diff options
897 files changed, 39759 insertions, 17896 deletions
diff --git a/ChangeLog b/ChangeLog index ff4adb19b15..f49f04ec398 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,22 @@ +2008-04-14 Ben Elliston <bje@au.ibm.com> + + * config.sub, config.guess: Update from upstream sources. + +2008-04-12 Hans-Peter Nilsson <hp@axis.com> + + * Makefile.tpl <gcc>: Error early unless at least GNU make 3.80. + * Makefile.in: Regenerate. + +2008-04-11 Eric B. Weddington <eweddington@cso.atmel.com> + + * configure.ac: Do not build libssp for the AVR. + * configure: Regenerate. + +2008-04-07 Ian Lance Taylor <iant@google.com> + + * Makefile.def: check-gold depends upon all-binutils. + * Makefile.in: Regenerate. + 2008-04-04 Andy Hutchinson <hutchinsonandy@aim.com> * MAINTAINERS (Write After Approval): Add myself. diff --git a/ChangeLog.melt b/ChangeLog.melt index 2dabb936a2c..d7182955daa 100644 --- a/ChangeLog.melt +++ b/ChangeLog.melt @@ -1,4 +1,10 @@ +2008-04-14 Basile Starynkevitch <basile@starynkevitch.net> + MELT branch merged with trunk r134275 + + stilly buggy for libgcc muldi3: internal compiler error: in + execute_ipa_pass_list, at passes.c:1235 + 2008-04-05 Basile Starynkevitch <basile@starynkevitch.net> MELT branch merged with trunk r133937 diff --git a/Makefile.def b/Makefile.def index 0791ed85c08..203dd1d4631 100644 --- a/Makefile.def +++ b/Makefile.def @@ -382,6 +382,7 @@ dependencies = { module=all-gold; on=all-intl; }; dependencies = { module=all-gold; on=all-bfd; }; dependencies = { module=all-gold; on=all-build-bison; }; dependencies = { module=all-gold; on=all-build-byacc; }; +dependencies = { module=check-gold; on=all-binutils; }; dependencies = { module=configure-opcodes; on=configure-intl; }; dependencies = { module=all-opcodes; on=all-bfd; }; diff --git a/Makefile.in b/Makefile.in index ff3e9072136..dc3b0c5569a 100644 --- a/Makefile.in +++ b/Makefile.in @@ -20,6 +20,14 @@ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # +# First, test for a proper version of make, but only where one is required. + +@if gcc +ifeq (,$(.VARIABLES)) # The variable .VARIABLES, new with 3.80, is never empty. +$(error GNU make version 3.80 or newer is required.) +endif +@endif gcc + # ------------------------------- # Standard Autoconf-set variables # ------------------------------- @@ -53351,6 +53359,16 @@ all-stageb3g2-gold: maybe-all-build-byacc all-stage4-gold: maybe-all-build-byacc all-stageprofile-gold: maybe-all-build-byacc all-stagefeedback-gold: maybe-all-build-byacc +check-gold: maybe-all-binutils + +check-stage1-gold: maybe-all-stage1-binutils +check-stage2-gold: maybe-all-stage2-binutils +check-stageb2g0-gold: maybe-all-stageb2g0-binutils +check-stage3-gold: maybe-all-stage3-binutils +check-stageb3g2-gold: maybe-all-stageb3g2-binutils +check-stage4-gold: maybe-all-stage4-binutils +check-stageprofile-gold: maybe-all-stageprofile-binutils +check-stagefeedback-gold: maybe-all-stagefeedback-binutils configure-opcodes: maybe-configure-intl configure-stage1-opcodes: maybe-configure-stage1-intl diff --git a/Makefile.tpl b/Makefile.tpl index 95441f5bc43..e9629e2da2c 100644 --- a/Makefile.tpl +++ b/Makefile.tpl @@ -23,6 +23,14 @@ in # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # +# First, test for a proper version of make, but only where one is required. + +@if gcc +ifeq (,$(.VARIABLES)) # The variable .VARIABLES, new with 3.80, is never empty. +$(error GNU make version 3.80 or newer is required.) +endif +@endif gcc + # ------------------------------- # Standard Autoconf-set variables # ------------------------------- diff --git a/config.guess b/config.guess index 6603908c211..c7607c74f1b 100755 --- a/config.guess +++ b/config.guess @@ -4,7 +4,7 @@ # 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 # Free Software Foundation, Inc. -timestamp='2008-03-12' +timestamp='2008-04-14' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by @@ -985,9 +985,6 @@ EOF a.out-i386-linux) echo "${UNAME_MACHINE}-pc-linux-gnuaout" exit ;; - coff-i386) - echo "${UNAME_MACHINE}-pc-linux-gnucoff" - exit ;; "") # Either a pre-BFD a.out linker (linux-gnuoldld) or # one that does not give us useful --help. diff --git a/config.sub b/config.sub index 0f295d963d8..63bfff03070 100755 --- a/config.sub +++ b/config.sub @@ -4,7 +4,7 @@ # 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 # Free Software Foundation, Inc. -timestamp='2008-03-08' +timestamp='2008-04-14' # This file is (in principle) common to ALL GNU software. # The presence of a machine in this file suggests that SOME GNU software @@ -250,7 +250,7 @@ case $basic_machine in | i370 | i860 | i960 | ia64 \ | ip2k | iq2000 \ | m32c | m32r | m32rle | m68000 | m68k | m88k \ - | maxq | mb | microblaze | mcore | mep \ + | maxq | mb | microblaze | mcore | mep | metag \ | mips | mipsbe | mipseb | mipsel | mipsle \ | mips16 \ | mips64 | mips64el \ @@ -333,7 +333,7 @@ case $basic_machine in | ip2k-* | iq2000-* \ | m32c-* | m32r-* | m32rle-* \ | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ - | m88110-* | m88k-* | maxq-* | mcore-* \ + | m88110-* | m88k-* | maxq-* | mcore-* | metag-* \ | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ | mips16-* \ | mips64-* | mips64el-* \ @@ -530,6 +530,10 @@ case $basic_machine in basic_machine=m88k-motorola os=-sysv3 ;; + dicos) + basic_machine=i686-pc + os=-dicos + ;; djgpp) basic_machine=i586-pc os=-msdosdjgpp @@ -1392,6 +1396,9 @@ case $os in -zvmoe) os=-zvmoe ;; + -dicos*) + os=-dicos + ;; -none) ;; *) diff --git a/configure b/configure index f164ab891ed..028444c431b 100755 --- a/configure +++ b/configure @@ -2790,7 +2790,7 @@ case "${target}" in noconfigdirs="$noconfigdirs ld target-libgloss ${libgcj}" ;; avr-*-*) - noconfigdirs="$noconfigdirs target-libiberty target-libstdc++-v3 ${libgcj}" + noconfigdirs="$noconfigdirs target-libiberty target-libstdc++-v3 ${libgcj} target-libssp" ;; bfin-*-*) noconfigdirs="$noconfigdirs gdb" diff --git a/configure.ac b/configure.ac index 1a18c61ece9..f47be29cb8c 100644 --- a/configure.ac +++ b/configure.ac @@ -588,7 +588,7 @@ case "${target}" in noconfigdirs="$noconfigdirs ld target-libgloss ${libgcj}" ;; avr-*-*) - noconfigdirs="$noconfigdirs target-libiberty target-libstdc++-v3 ${libgcj}" + noconfigdirs="$noconfigdirs target-libiberty target-libstdc++-v3 ${libgcj} target-libssp" ;; bfin-*-*) noconfigdirs="$noconfigdirs gdb" diff --git a/gcc/ChangeLog b/gcc/ChangeLog index de51e84e604..b15e712aea4 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,522 @@ +2008-04-13 Jan Hubicka <jh@suse.cz> + + * m32.c (m32c_pushm_popm): Use crtl->retrun_rtx. + +2008-04-12 Andrew Pinski <pinskia@gmail.com> + + * config/rs6000/rs6000.c (compute_save_world_info): Set lr_save_p if + we are going to "save the world". + +2008-04-13 Hans-Peter Nilsson <hp@axis.com> + + * config/cris/cris.md ("*andhi_lowpart_non_v32", "*andhi_lowpart_v32") + ("*andqi_lowpart_non_v32", "*andqi_lowpart_v32"): Use "+" for the + operand 0 constraint, not "=". + +2008-04-11 James E. Wilson <wilson@tuliptree.org> + + * system.h: Change ASSERT_CHECKING to ENABLE_ASSERT_CHECKING. + +2008-04-11 H.J. Lu <hongjiu.lu@intel.com> + + * dse.c (record_store): Use HOST_BITS_PER_WIDE_INT instead + of size of positions_needed * CHAR_BIT. + +2008-04-11 H.J. Lu <hongjiu.lu@intel.com> + + PR middle-end/35897 + * dse.c (store_info): Change positions_needed to unsigned + HOST_WIDE_INT. + (lowpart_bitmask): New. + (record_store): Cast to unsigned HOST_WIDE_INT for + positions_needed. Assert width <= size of positions_needed * + CHAR_BIT. Call lowpart_bitmask to initialize positions_needed. + (check_mem_read_rtx): Use unsigned HOST_WIDE_INT on mask. Call + lowpart_bitmask to set mask. + +2008-04-11 Bernd Schmidt <bernd.schmidt@analog.com> + + * config/bfin/constraints.md: New file. + * config/bfin/bfin.md: Include it. + (adddi3): Use satisfies_constraint functions instead of the old macros. + * config/bfin/bfin.h (REG_CLASS_FROM_LETTER, CONSTRAINT_LEN, + CONST_18UBIT_IMM_P, CONST_16BIT_IMM_P, CONST_16UBIT_IMM_P, + CONST_7BIT_IMM_P, CONST_7NBIT_IMM_P, CONST_5UBIT_IMM_P, + CONST_4BIT_IMM_P, CONST_4UBIT_IMM_P, CONST_3BIT_IMM_P, + CONST_3UBIT_IMM_P, CONST_OK_FOR_K, CONST_OK_FOR_P, CONST_OK_FOR_M, + CONST_OK_FOR_CONSTRAINT_P, CONST_DOUBLE_OK_FOR_LETTER, + EXTRA_CONSTRAINT): Delete. + * config/bfin/predicates.md (highbits_operand, reg_or_7bit_operand, + reg_or_neg7bit_operand): Use satisfies_constraint functions instead + of the old macros. + * config/bfin/bfin.c: Include "tm-constrs.h". + (bfin_secondary_reload, split_load_immediate, bfin_rtx_costs): + Use satisfies_constraint functions instead of the old macros. + * doc/md.texi (Blackfin Constraints): Update file name reference. + +2008-04-11 Richard Guenther <rguenther@suse.de> + + PR tree-optimization/35869 + * tree-vrp.c (execute_vrp): Move switch statement update after + jump threading. Schedule another cfg cleanup run. + +2008-04-11 Volker Reichelt <v.reichelt@netcologne.de> + + PR c/35744 + * attribs.c (decl_attributes): Return early on errorneous node. + +2008-04-10 Oleg Ryjkov <olegr@google.com> + + * tree.h (struct tree_base): Added a new flag default_def_flag. + (SSA_NAME_IS_DEFAULT_DEF): Changed to use the new flag. + +2008-04-11 Kaz Kojima <kkojima@gcc.gnu.org> + + * config.gcc (need_64bit_hwint): Need 64bit hwint for sh-*-*. + +2008-04-10 John David Anglin <dave.anglin@nrc-cnrc.gc.ca> + + PR target/35768 + * pa.md: Define mode iterator P. Define mode attribute dwc. + (dcacheflush): Update pattern to use iterator P and attribute dwc. + (icacheflush): Likewise. + * pa.h (INITIALIZE_TRAMPOLINE): Use dcacheflushsi/icacheflushsi if + !TARGET_64BIT, and dcacheflushdi/icacheflushdi if TARGET_64BIT. + +2008-04-11 Ben Elliston <bje@au.ibm.com> + + * config/spu/spu.c (spu_init_builtins): Mark builtins as nothrow. + +2008-04-10 Rafael Espindola <espindola@google.com> + + * gcc/tree-vrp.c (extract_range_from_binary_expr): Don't handle + TRUTH_ANDIF_EXPR or TRUTH_ORIF_EXPR. + (extract_range_from_expr): The same. + +2008-04-10 Adam Nemet <anemet@caviumnetworks.com> + + * config/mips/mips.md (GPR2): New mode iterator. + (seq): Add comment. + (*seq_<mode>, *seq_<mode>_mips16, *sne_<mode>, *sgt<u>_<mode>, + *sgt<u>_<mode>_mips16, *sge<u>_<mode>, *slt<u>_<mode>, + *slt<u>_<mode>_mips16 *sle<u>_<mode>, *sle<u>_<mode>_mips16): + Rewrite these to take two modes, the mode of comparison and the + mode of the destination. + * config/mips/mips.c (mips_expand_scc): Instead of having + paradoxical subreg as destination, expand "narrowing" scc if mode + of comparison is SI and target is requested in DI mode. + (mips_emit_int_order_test): Update comment. Make mode of + comparison match CMP0 rather than TARGET. When creating inverse + target use mode of TARGET. + +2008-04-10 Adam Nemet <anemet@caviumnetworks.com> + + * gcov-dump.c (tag_summary): Only print summaries for the first + GCOV_COUNTERS_SUMMABLE counters. + +2008-04-10 Uros Bizjak <ubizjak@gmail.com> + + * config/i386/i386.md (absneg): New code iterator. + (absnegprefix): New code attribute. + (<code><mode>2): Macroize expander from abs<mode>2 and neg<mode>2 + patterns using absneg code iterator. + (<code>tf2): Macroize expander from abstf2 and negtf2 patterns + using absneg code iterator. + (*<code><mode>2_1): Macroize insn pattern from *abs<mode>2_1 and + *neg<mode>2 patterns using absneg code iterator. + (*<code>extendsfdf2): Macroize insn pattern from *absextendsfdf2 and + *negextendsfdf2 patterns using absneg code iterator. + (*<code>extendsfxf2): Macroize insn pattern from *absextendsfxf2 and + *negextendsfxf2 patterns using absneg code iterator. + (*<code>extendsfdf2): Macroize insn pattern from *absextendsfdf2 and + *negextendsfdf2 patterns using absneg code iterator. + * config/i386/sse.md (<code><mode>2): Macroize expander from + abs<mode>2 and neg<mode>2 patterns using absneg code iterator. + +2008-04-10 Andreas Krebbel <krebbel1@de.ibm.com> + + * config/s390/s390.h: Remove the remains of the recent search + & replace action of current_function_outgoing_args_size. + +2008-04-10 Ira Rosen <irar@il.ibm.com> + + PR tree-optimization/35821 + * tree-vect-transform.c (vect_create_data_ref_ptr): Add check that + NEW_STMT_LIST is not NULL. + +2008-04-09 David Edelsohn <edelsohn@gnu.org> + + PR libstdc++/35597 + * toplev.c (process_options): Remove -ffunction-sections debugging + warning. + +2008-04-09 Peter Bergner <bergner@vnet.ibm.com> + + PR middle-end/PR28690 + * explow.c (break_out_memory_refs): Use simplify_gen_binary rather + than gen_rtx_fmt_ee to perform more canonicalizations. + +2008-04-08 John David Anglin <dave.anglin@nrc-cnrc.gc.ca> + + PR driver/35665 + * collect2.c (write_c_file): Don't wrap in "#ifdef __cplusplus". + +2008-04-09 Richard Guenther <rguenther@suse.de> + + * tree-cfg.c (verify_stmt): Print complete bogus stmt. + (dump_function_to_file): Dump function arguments with types. + +2008-04-08 Richard Guenther <rguenther@suse.de> + + * fold-const.c (fold_widened_comparison): Do not allow + sign-changes that change the result. + +2008-04-08 Janis Johnson <janis187@us.ibm.com> + + PR target/35839 + * config/rs6000/rs6000.c (rs6000_check_sdmode): Handle additional + kinds of indirect references. + +2008-04-08 David Edelsohn <edelsohn@gnu.org> + + * config/rs6000/rs6000.c (rs6000_output_function_epilogue): Update + GNU Fortran language string. + +2008-04-08 Rafael Espindola <espindola@google.com> + + * fold-canst.c (tree_call_nonnegative_warnv_p): New. + (tree_invalid_nonnegative_warnv_p): Use tree_call_nonnegative_warnv_p. + * tree.h (tree_call_nonnegative_warnv_p): New. + +2008-04-08 Jan Hubicka <jh@suse.cz> + + * function.c (free_after_compilation): Clear out regno_reg_rtx + pointer. + +2008-04-08 Peter Bergner <bergner@vnet.ibm.com> + + Revert + 2008-04-07 Peter Bergner <bergner@vnet.ibm.com> + + PR middle-end/PR28690 + * rtlanal.c: (commutative_operand_precedence): Give SYMBOL_REF's the + same precedence as REG_POINTER and MEM_POINTER operands. + +2008-04-08 Richard Guenther <rguenther@suse.de> + + PR middle-end/35834 + * tree-ssa-address.c (create_mem_ref): Use POINTER_PLUS_EXPR + for adding index to base. + +2008-04-08 Kai Tietz <kai.tietz@onevision.com> + + * config/i386/mingw32.h (ENABLE_EXECUTE_STACK): New. + (MINGW_ENABLE_EXECUTE_STACK): New. + (IN_LIBGCC2): For libgcc include windows.h file for + function declarations. + +2008-04-08 Hans-Peter Nilsson <hp@axis.com> + + * config/cris/cris.c (cris_address_cost): For a PLUS, swap tem1 + and tem2 if tem1 is not a REG or MULT. + +2008-04-08 Jan Hubicka <jh@suse.cz> + + * function.h (incomming_args): Break out of struct function. + (function_subsections): Break out of struct function. + (rtl_data): Add args, subsections fields. Break out outgoing_args_size, + return_rtx and hard_reg_initial_vals from struct function. + Kill inl_max_label_num. + (current_function_pops_args, current_function_args_info, + current_function_args_size, current_function_args_size, + current_function_pretend_args_size, + current_function_outgoing_args_size, + current_function_internal_arg_pointer, current_function_return_rtx): + Kill compatibility accestor macros. + * builtins.c (expand_builtin_apply_args_1): Update. + (expand_builtin_next_arg): Update. + * df-scan.c (df_get_call_refs): Update. + * dbxout.c (dbxout_function_end): Update. + * dwarf2out.c (dwarf2out_switch_text_section): Update. + (output_line_info): Update. + (secname_for_decl): Update. + (dwarf2out_var_location): Update. + * function.c (free_after_compilation): Update. + (assign_parm_find_stack_rtl): Update. + (assign_parms): Update. + (expand_dummy_function_end): Update. + (expand_function_end): Update. + * calls.c (mem_overlaps_already_clobbered_arg_p): Update. + (expand_call): Update. + (emit_library_call_value_1): Update. + (store_one_arg): Update. + * varasm.c (initialize_cold_section_name): Update. + (unlikely_text_section): Update. + (unlikely_text_section_p): Update. + (assemble_start_function): Update. + (assemble_end_function): Update. + (default_section_type_flags): Update. + (switch_to_section): Update. + * integrate.c (set_decl_abstract_flags): Update. + (get_hard_reg_initial_val): Update. + (has_hard_reg_initial_val): Update. + (allocate_initial_values): Update. + * resource.c (init_resource_info): Update. + * config/alpha/alpha.c (NUM_ARGS): Update. + (direct_return): Update. + (alpha_va_start): Update. + (alpha_sa_size): Update. + (alpha_initial_elimination_offset): Update. + (alpha_expand_prologue): Update. + (alpha_start_function): Update. + (alpha_expand_epilogue): Update. + (unicosmk_initial_elimination_offset): + * config/alpha/alpha.md (call expander): Update. + * config/s390/s390.c (s390_register_info): Update. + (s390_register_info): Update. + (s390_frame_info): Update. + (s390_initial_elimination_offset): Update. + (s390_build_builtin_va_list): Update. + (s390_va_start): Update. + * config/spu/spu.c (direct_return): Update. + (spu_expand_prologue): Update. + (spu_initial_elimination_offset): Update. + (spu_build_builtin_va_list): Update. + (spu_va_start): Update. + * config/sparc/sparc.c (sparc_init_modes): Update. + (sparc_compute_frame_size): Update. + (function_value): Update. + * config/m32r/m32r.c (m32r_compute_frame_size): Update. + * config/i386/i386.md (return expander): Update. + * config/i386/i386.c (ix86_va_start): Update. + (ix86_can_use_return_insn_p): Update. + (ix86_compute_frame_layout): Update. + (ix86_expand_epilogue): Update. + * config/sh/sh.c (output_stack_adjust): Update. + (calc_live_regs): Update. + (sh_expand_prologue): Update. + (sh_builtin_saveregs): Update. + (sh_va_start): Update. + (initial_elimination_offset): Update. + (sh_allocate_initial_value): Update. + (sh_function_ok_for_sibcall): Update. + (sh_get_pr_initial_val): Update. + * config/sh/sh.md (return expander): Update. + * config/avr/avr.c (frame_pointer_required_p): UPdate. + * config/crx/crx.c (crx_compute_frame): UPdate. + (crx_initial_elimination_offset): UPdate. + * config/xtensa/xtensa.c (compute_frame_size): Update + (xtensa_builtin_saveregs): Update. + (xtensa_va_start): Update. + (order_regs_for_local_alloc): Update. + * config/stormy16/stormy16.c (xstormy16_compute_stack_layout): Update. + (xstormy16_expand_builtin_va_start): Update. + * config/fr30/fr30.c (fr30_compute_frame_size): Update. + * config/m68hc11/m68hc11.md (return expanders): Update. + * config/m68hc11/m68hc11.c (expand_prologue): Update. + (expand_epilogue): Update. + * config/cris/cris.c (cris_initial_frame_pointer_offset): Update. + (cris_simple_epilogue): Update. + (cris_expand_prologue): Update. + (cris_expand_epilogue): Update. + * config/iq2000/iq2000.c (iq2000_va_start): Update. + (compute_frame_size): Update. + * config/mt/mt.c (mt_compute_frame_size): Update. + * config/mn10300/mn10300.c (expand_prologue): Update. + (expand_epilogue): Update. + (initial_offset): Update. + (mn10300_builtin_saveregs): + * config/mn10300/mn10300.md (return expander): Update. + * config/ia64/ia64.c (ia64_compute_frame_size): Update. + (ia64_initial_elimination_offset): Update. + (ia64_initial_elimination_offset): Update. + (ia64_expand_prologue): Update. + * config/m68k/m68k.md (return expander): Update. + * config/rs6000/rs6000.c (rs6000_va_start): Update. + (rs6000_stack_info): Update. + * config/mcore/mcore.c (layout_mcore_frame): Update. + (mcore_expand_prolog): Update. + * config/arc/arc.c (arc_compute_frame_size): Update. + * config/score/score3.c (score3_compute_frame_size): Update. + * config/score/score7.c (score7_compute_frame_size): Update. + * config/arm/arm.c (use_return_insn): Update. + (thumb_find_work_register): Update. + (arm_compute_save_reg_mask): Update. + (arm_output_function_prologue): Update. + (arm_output_epilogue): Update. + (arm_size_return_regs): Update. + (arm_get_frame_offsets): Update. + (arm_expand_prologue): Update. + (thumb_exit): Update. + (thumb_unexpanded_epilogue): Update. + (thumb1_output_function_prologue): Update. + * config/pa/pa.md (return expander): Update. + * config/pa/pa.c (compute_frame_size): Update. + (hppa_builtin_saveregs): Update. + * config/mips/mips.c (mips_va_start): Update. + (mips16_build_function_stub): Update. + (mips_compute_frame_info): Update. + (mips_restore_gp): Update. + (mips_output_function_prologue): Update. + (mips_expand_prologue): Update. + * config/v850/v850.c (compute_frame_size): Update. + (expand_prologue): * config/mmix/mmix.c (along): update. + (mmix_initial_elimination_offset): update. + (mmix_reorg): update. + (mmix_use_simple_return): update. + (mmix_expand_prologue): update. + (mmix_expand_epilogue): Update. + * config/bfin/bfin.c (bfin_initial_elimination_offset): Update. + (emit_link_insn): Update. + +2008-04-08 Anatoly Sokolov <aesok@post.ru> + + * config/avr/avr.h (TARGET_CPU_CPP_BUILTINS): Define + __AVR_HAVE_EIJMP_EICALL__ macro if device have EIJMP and EICALL + instructions. + * config/avr/avr.c (avr_mcu_types): Set AVR31 architecture for + atmega103 device. + +2008-04-07 Jan Hubicka <jh@suse.cz> + + * function.h (rtl): Rename to x_rtl. + (crtl): New define. + (return_label, naked_return_label, stack_slot_list, parm_birth_insn, + frame_offset, stack_check_probe_note, arg_pointer_save_area, + used_temp_slots avail_temp_slots, temp_slot_level, + nonlocal_goto_handler_labels): Update accesstors. + (rtl): New global variable. + (struct function): Move some fileds to rtl_data. + (get_arg_pointer_save_area): Update prototype. + * builtins.c (expand_builtin_setjmp_receiver): Update call of + get_arg_pointer_save_area. + * expr.c (init_expr): Update + * function.c (get_frame_size): Update + (assign_stack_local): Update + (expand_function_end): Update. + (get_art_pointer_save_area): Update + * function.h + * emit-rtl.c (rtl): Declare. + (regno_reg_rtx): Declare. + (first_insn, last_insn, cur_insn_uid, last_location, first_label_num): + Update. + (gen_reg_rtx): Update. + * varasm.c (n_deferred_constatns): Update accestor. + (init_varasm_status): Do not allocate varasm_status. + (force_const_mem, get_pool_size, output_constant_pool): Update. + * stmt.c (force_label_rtx): Do not use x_ prefixes. + (expand_nl_goto_receiver): Update get_arg_pointer_save_area. + * m32c/m32.c (m32c_leaf_function_p, m32c_function_needs_enter): Update. + * sparc/sparc.h (INIT_EXPANDERS): Update. + * ia64/ia64.h (INIT_EXPANDERS): Update. + +2008-04-07 James E. Wilson <wilson@tuliptree.org> + + * reload.c (push_secondary_reload): Add missing break to for loop. + +2008-04-07 Peter Bergner <bergner@vnet.ibm.com> + + PR middle-end/PR28690 + * rtlanal.c: Update copyright years. + (commutative_operand_precedence): Give SYMBOL_REF's the same precedence + as REG_POINTER and MEM_POINTER operands. + * emit-rtl.c (gen_reg_rtx_and_attrs): New function. + (set_reg_attrs_from_value): Call mark_reg_pointer as appropriate. + * rtl.h (gen_reg_rtx_and_attrs): Add prototype for new function. + * gcse.c: Update copyright years. + (pre_delete): Call gen_reg_rtx_and_attrs. + (hoist_code): Likewise. + (build_store_vectors): Likewise. + (delete_store): Likewise. + * loop-invariant.c (move_invariant_reg): Likewise. + Update copyright years. + +2008-04-07 Uros Bizjak <ubizjak@gmail.com> + + * config/i386/i386.md ("*sse_prologue_save_insn"): Use braced output + control string instead of quoted. + +2008-04-07 Kenneth Zadeck <zadeck@naturalbridge.com> + + * doc/rtl.texi: Rewrite of subreg section. + +2008-04-07 Kai Tietz <kai.tietz@onevision.com> + + PR/35842 + * config/i386/i386.c (legitimize_pic_address): Add treating + of dllimport SYM_REF's. + (legitimize_dllimport_symbol): Add prototype. + +2008-04-07 Eric Botcazou <ebotcazou@adacore.com> + + * fold-const.c (fold) <ARRAY_REF>: New case. Try to fold constant + reference in constructor with non self-referential type. + +2008-04-07 Eric Botcazou <ebotcazou@adacore.com> + + Removal of Return with Depressed Stack Pointer support + * tree.h (TYPE_RETURNS_STACK_DEPRESSED): Delete. + (ECF_SP_DEPRESSED): Likewise. + (ECF_LIBCALL_BLOCK, ECF_NOVOPS): Adjust. + * calls.c (emit_call_1): Do not test ECF_SP_DEPRESSED. + (flags_from_decl_or_type): Do not test TYPE_RETURNS_STACK_DEPRESSED. + (expand_call): Do not test ECF_SP_DEPRESSED. + * dse.c (dse_step0): Do not test TYPE_RETURNS_STACK_DEPRESSED. + * function.c (keep_stack_depressed): Delete. + (handle_epilogue_set): Likewise. + (update_epilogue_consts): Likewise. + (emit_equiv_load): Likewise. + (thread_prologue_and_epilogue_insns): Remove support for Return with + Depressed Stack Pointer. + * print-tree.c (print_node): Do not test TYPE_RETURNS_STACK_DEPRESSED. + +2008-04-06 Richard Guenther <rguenther@suse.de> + + PR tree-optimization/35400 + * tree-vrp.c (vrp_evaluate_conditional): Only query value-range + information from SSA_NAMEs. + +2008-04-06 Anatoly Sokolov <aesok@post.ru> + + * config/avr/avr.h (avr_mega_p): Remove declaration. + (AVR_MEGA): Remove macro. + * config/avr/avr.c (avr_mega_p): Remove variable. + (avr_override_options): Remove inicializion of avr_mega_p. + Use AVR_HAVE_JMP_CALL instead of AVR_MEGA. + (print_operand): Use AVR_HAVE_JMP_CALL instead of AVR_MEGA. + (avr_jump_mode): (Ditto.). + (avr_output_progmem_section_asm_op): (Ditto.). + (avr_asm_init_sections): (Ditto.). + (avr_asm_init_sections): (Ditto.). + (avr_rtx_costs): (Ditto.). + * config/avr/avr.md: (Ditto.). + * config/avr/avr.h: Use '__AVR_HAVE_JMP_CALL__' instead of + '__AVR_MEGA__'. + +2008-04-06 Richard Guenther <rguenther@suse.de> + + PR tree-optimization/35842 + * tree-ssa-address.c (fixed_address_object_p): Adjust to match + is_gimple_invariant_address. + +2008-04-06 Francois-Xavier Coudert <fxcoudert@gcc.gnu.org> + + * gcc.c (default_compilers): Sync Fortran extensions list with + that in fortran/lang-specs.h. + * doc/invoke.texi: Likewise. + * dbxout.c (get_lang_number): Use "GNU Fortran" in "GNU F95". + * dwarf2out.c (gen_compile_unit_die): Likewise. + +2008-04-06 Tom G. Christensen <tgc@jupiterrise.com> + + * gthr-posix95.h (__gthread_cond_wait_recursive): Add missing &. + +2008-04-05 Uros Bizjak <ubizjak@gmail.com> + + PR target/12329 + * config/i386/i386.c (ix86_function_regparm): Error if regparm(3) + attribute is used for nested functions. + 2008-04-05 Jan Hubicka <jh@suse.cz> * emit-rtl.c (init_emit): xcalloc regno_pointer_align. @@ -13,8 +532,8 @@ it out based on pass type. (register_dump_files_1): Likewise. (init_optimization_passes): Update register_one_dump_file calls. - (execute_one_pass): Sanity check that IPA passes are called at IPA level - and RTL passes at RTL level. + (execute_one_pass): Sanity check that IPA passes are called at IPA + level and RTL passes at RTL level. (execute_pass_list): IPA pass can not be after or subpass of GIMPLE/RTL pass. (execute_ipa_pass_list): Handle IPA subpasses of IPA subpasses and @@ -197,12 +716,10 @@ * config/mips/mips.md (any_gt, any_ge, any_lt, any_le): New code iterators. - (u): Add attribute values for gt, gtu, ge, geu, lt, ltu, le and - leu. + (u): Add attribute values for gt, gtu, ge, geu, lt, ltu, le and leu. (sgt<u>): Merge sgt and sgtu into new expander. (sgt, sgtu): Remove expanders. - (*sgt<u>_<mode>): Merge *sgt_<mode> and *sgtu_<mode> into new - pattern. + (*sgt<u>_<mode>): Merge *sgt_<mode> and *sgtu_<mode> into new pattern. (*sgt_<mode>, *sgtu_<mode>): Remove patterns. (*sgt<u>_<mode>_mips16): Merge *sgt_<mode>_mips16 and *sgtu_<mode>_mips16 into new pattern. @@ -214,16 +731,14 @@ (*sge_<mode>, second *sge_<mode>): Remove patterns. (slt<u>): Merge slt and sltu into new expander. (slt, sltu): Remove expanders. - (*slt<u>_<mode>): Merge *slt_<mode> and *sltu_<mode> into new - pattern. + (*slt<u>_<mode>): Merge *slt_<mode> and *sltu_<mode> into new pattern. (*slt_<mode>, *sltu_<mode>): Remove patterns. (*slt<u>_<mode>_mips16): Merge *slt_<mode>_mips16 and *sltu_<mode>_mips16 into new pattern. (*slt_<mode>_mips16, *sltu_<mode>_mips16): Remove patterns. (sle<u>): Merge sle and sleu into new expander. (sle, sleu): Remove expanders. - (*sle<u>_<mode>): Merge *sle_<mode> and *sleu_<mode> into new - pattern. + (*sle<u>_<mode>): Merge *sle_<mode> and *sleu_<mode> into new pattern. (*sle_<mode>, *sleu_<mode>): Remove patterns. (*sle<u>_<mode>_mips16): Merge *sle_<mode>_mips16 and *sleu_<mode>_mips16 into new pattern. diff --git a/gcc/ChangeLog.melt b/gcc/ChangeLog.melt index f52b4cf702d..4bef619eed8 100644 --- a/gcc/ChangeLog.melt +++ b/gcc/ChangeLog.melt @@ -1,5 +1,11 @@ 2008-04-14 Basile Starynkevitch <basile@starynkevitch.net> + MELT branch merged with trunk r134275 + + stilly buggy for libgcc muldi3: internal compiler error: in + execute_ipa_pass_list, at passes.c:1235 + +2008-04-14 Basile Starynkevitch <basile@starynkevitch.net> * melt/warm-basilys.bysl: adding pamater passing capacity to constant cstrings in ctype_cstring. This requires a change in contrib/cold-basilys.lisp which is not yet implemented. diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 6f3af28280b..9ce44af4554 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20080405 +20080414 diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 57c55e21868..199fe294a83 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,7 +1,1775 @@ +2008-04-14 Robert Dewar <dewar@adacore.com> + + * sem_util.ads, sem_util.adb (In_Subprogram): Remove. + * sem_attr.adb (Anayze_Attribute): Check for Current_Subprogram + directly. + +2008-04-14 Samuel Tardieu <sam@rfc1149.net> + + PR ada/18680 + * sem_prag.adb (Analyze_Pragma, Linker_Section case): Refuse to + apply pragma Linker_Section on type. + +2008-04-14 Samuel Tardieu <sam@rfc1149.net> + + PR ada/16098 + * sem_prag.adb (Error_Pragma_Ref): New. + (Process_Convention): Specialized message for non-local + subprogram renaming. Detect the problem in homonyms as well. + +2008-04-14 Samuel Tardieu <sam@rfc1149.net> + + PR ada/15915 + * sem_util.ads, sem_util.adb (Denotes_Variable): New function. + * sem_ch12.adb (Instantiate_Object): Use it. + * sem_ch13.adb (Analyze_Attribute_Definition_Clause): Ensure that + storage pool denotes a variable as per RM 13.11(15). + +2008-04-14 Samuel Tardieu <sam@rfc1149.net> + + * sem_util.ads, sem_util.adb (In_Subprogram): New function. + * sem_attr.adb (Analyze_Attribute, Attribute_Old case): Use it. + +2008-04-14 Rolf Ebert <rolf.ebert.gcc@gmx.de> + + PR ada/20822 + * xgnatugn.adb (Put_Line): New procedure, ensuring Unix + line endings even on non-Unix platforms. + +2008-04-14 Samuel Tardieu <sam@rfc1149.net> + + PR ada/35050 + * xref_lib.adb (Parse_Identifier_Info): Correctly parse and ignore the + renaming information. + +2008-04-13 Samuel Tardieu <sam@rfc1149.net> + + PR ada/17985 + * sem_aggr.adb (Valid_Ancestor_Type): A type is not an ancestor of + itself. + +2008-04-13 Ralf Wildenhues <Ralf.Wildenhues@gmx.de> + + * sfn_scan.adb, sfn_scan.ads, sinfo.ads, + sinput-d.ads, sinput-l.adb, sinput-l.ads, sinput.ads, + snames.ads, sprint.adb, stand.ads, stringt.ads, + styleg.adb, styleg.ads, stylesw.adb, stylesw.ads, + switch.ads, sysdep.c, table.adb, table.ads, + targparm.ads, tb-gcc.c, tbuild.ads, tracebak.c, + trans.c, tree_io.adb, treepr.adb, types.adb, types.ads, + uintp.adb, uintp.ads, utils.c, utils2.c, validsw.ads, + vms_conv.adb, vms_conv.ads, vms_data.ads, widechar.adb, + widechar.ads, xeinfo.adb, xgnatugn.adb, xr_tabls.adb, + xr_tabls.ads, xref_lib.adb, xref_lib.ads, xsinfo.adb: + Fix comment typos. + + * sem_ch10.adb, sem_ch10.ads, + sem_ch12.adb, sem_ch12.ads, sem_ch13.adb, sem_ch13.ads, + sem_ch3.adb, sem_ch4.adb, sem_ch5.adb, sem_ch6.adb, + sem_ch6.ads, sem_ch8.adb, sem_ch8.ads, sem_ch9.adb, + sem_elab.adb, sem_elab.ads, sem_elim.ads, sem_eval.adb, + sem_eval.ads, sem_intr.adb, sem_mech.adb, sem_mech.ads, + sem_prag.adb, sem_prag.ads, sem_res.adb, sem_res.ads, + sem_type.adb, sem_util.adb, sem_util.ads, sem_warn.adb, + sem_warn.ads: Fix comment typos. + + * s-secsta.adb, s-sequio.ads, s-shasto.ads, + s-soflin.ads, s-stalib.ads, s-stausa.adb, + s-stausa.ads, s-strxdr.adb, s-taenca.adb, s-taenca.ads, + s-taprob.adb, s-taprop-hpux-dce.adb, s-taprop-irix.adb, + s-taprop-linux.adb, s-taprop-mingw.adb, s-taprop-posix.adb, + s-taprop-solaris.adb, s-taprop-tru64.adb, s-taprop-vms.adb, + s-taprop-vxworks.adb, s-taprop.ads, s-tarest.adb, + s-tarest.ads, s-tasini.adb, s-tasini.ads, s-taskin.ads, + s-tasque.ads, s-tassta.adb, s-tassta.ads, s-tasuti.ads, + s-tpoben.adb, s-tpoben.ads, s-tpobop.adb, + s-tpopsp-posix.adb, s-tpopsp-rtems.adb, s-tposen.adb, + s-tposen.ads, s-traceb-hpux.adb, s-traces.ads, + s-trafor-default.ads, s-unstyp.ads, s-utf_32.ads, + s-vaflop.adb, s-vaflop.ads, s-valrea.adb, s-valuti.adb, + s-wchstw.ads, s-wchwts.adb, s-wchwts.ads, scans.ads, + scn.adb, scng.adb, seh_init.c, sem.ads, sem_aggr.adb, + sem_attr.adb, sem_attr.ads, sem_case.adb, sem_case.ads, + sem_cat.adb, sem_cat.ads: Fix comment typos. + +2008-04-12 Joel Sherrill <joel@oarcorp.com> + + PR ada/35825 + * g-soccon-rtems.ads: Add IP_PKTINFO as unsupported. + +2008-04-12 Arnaud Charlet <charlet@adacore.com> + + * s-linux-hppa.ads: Fix syntax errors. + +2008-04-10 Ralf Wildenhues <Ralf.Wildenhues@gmx.de> + + * gnat_ugn.texi: Fix typos. + * raise-gcc.c, repinfo.adb, repinfo.ads, restrict.adb, + restrict.ads, rtsfind.adb, rtsfind.ads, s-arit64.ads, + s-asthan-vms-alpha.adb, s-auxdec.ads, s-casuti.ads, + s-fatflt.ads, s-fatgen.adb, s-fatlfl.ads, + s-fatllf.ads, s-fatsfl.ads, s-filofl.ads, + s-finimp.adb, s-finroo.ads, s-fishfl.ads, + s-fvadfl.ads, s-fvaffl.ads, s-fvagfl.ads, + s-hibaen.ads, s-htable.ads, s-imgcha.adb, + s-imgenu.ads, s-imgint.adb, s-imgrea.adb, + s-inmaop-dummy.adb, s-inmaop.ads, s-interr-vms.adb, + s-interr-vxworks.adb, s-interr.adb, s-interr.ads, + s-intman-vxworks.ads, s-intman.ads, s-mastop-irix.adb, + s-os_lib.adb, s-os_lib.ads, s-osinte-aix.ads, + s-osinte-darwin.ads, s-osinte-freebsd.ads, + s-osinte-hpux.ads, s-osinte-lynxos-3.adb, + s-osinte-lynxos-3.ads, s-osinte-lynxos.ads, + s-osinte-rtems.ads, s-osinte-solaris-posix.ads, + s-osprim-mingw.adb, s-osprim-vms.adb, s-parame-ae653.ads, + s-parame-hpux.ads, s-parame-vms-alpha.ads, + s-parame-vms-ia64.ads, s-parame-vms-restrict.ads, + s-parame-vxworks.ads, s-parame.ads, s-parint.adb, + s-parint.ads, s-poosiz.adb, s-proinf-irix-athread.ads, + s-proinf.ads, s-regexp.adb, s-regpat.adb, s-regpat.ads, + s-rident.ads: Fix comment typos. + +2008-04-09 Samuel Tardieu <sam@rfc1149.net> + + PR ada/28305 + * sem_ch6.adb (Build_Body_To_Inline): Do not save and restore + environment if generic instance is a top-level one. + +2008-04-09 Doug Rupp <rupp@adacore.com> + + * decl.c (validate_size): Set minimum size for fat pointers same as + access types. Code clean ups. + + * gmem.c (xstrdup32): New macro for 32bit dup on VMS, noop otherwise + (__gnat_gmem_a2l_initialize): Dup exename into 32 bit memory on VMS + + * s-auxdec-vms_64.ads, s-auxdec.ads (Short_Address_Size): New constant + + * s-crtl.ads (malloc32) New function, alias for malloc + (realloc32) New function, alias for realloc + + * socket.c (__gnat_new_socket_set): Malloc fd_set in 32 bits on VMS + + * utils2.c (build_call_alloc_dealloc): Return call to short malloc if + allocator size is 32 and default pointer size is 64. + (find_common_type): Document assumption on t1/t2 vs lhs/rhs. Force use of + lhs type if smaller, whatever the modes. + + * gigi.h (malloc32_decl): New macro definition + + * utils.c (init_gigi_decls): New malloc32_decl + Various code clean ups. + + * s-asthan-vms-alpha.adb (Process_AST.To_Address): Unchecked convert to + Task_Address vice System.Address. + + * s-taspri-vms.ads: Import System.Aux_DEC + (Task_Address): New subtype of System.Aux_DEC.Short_Address + (Task_Address_Size): New constant size of System.Aux_DEC.Short_Address + + * s-asthan-vms-alpha.adb (Process_AST.To_Address): Unchecked convert to + Task_Address vice System.Address. + + * s-inmaop-vms.adb: Import System.Task_Primitives + (To_Address): Unchecked convert to Task_Address vice System.Address + + * s-taprop-vms.adb (Timed_Delay): Always set the timer even if delay + expires now. + (To_Task_ID) Unchecked convert from Task_Adddress vice System.Address + (To_Address) Unchecked convert to Task_Address vice System.Address + + * s-tpopde-vms.adb: Remove unnecessary warning pragmas + + * g-socthi-vms.ads: Add 32bit size clauses on socket access types. + +2008-04-08 Eric Botcazou <ebotcazou@adacore.com> + + * gigi.h (standard_datatypes): Add ADT_fdesc_type and ADT_null_fdesc. + (fdesc_type_node): Define. + (null_fdesc_node): Likewise. + * decl.c (gnat_to_gnu_entity) <E_Access_Subprogram_Type>: If the target + uses descriptors for vtables and the type comes from a dispatch table, + return the descriptor type. + * trans.c (Attribute_to_gnu) <Attr_Unrestricted_Access>: If the target + uses descriptors for vtables and the type comes from a dispatch table, + build a descriptor in the static case and copy the existing one in the + non-static case. + (gnat_to_gnu) <N_Null>: If the target uses descriptors for vtables and + the type is a pointer-to-subprogram coming from a dispatch table, + return the null descriptor. + <N_Unchecked_Type_Conversion>: If the target uses descriptors for + vtables, the source type is the descriptor type and the target type + is a pointer type, first build the pointer. + * utils.c (init_gigi_decls): If the target uses descriptors for vtables + build the descriptor type and the null descriptor. + +2008-04-08 Eric Botcazou <ebotcazou@adacore.com> + + * decl.c (prepend_attributes): Fix typo. + * trans.c (Pragma_to_gnu): Likewise. + * utils.c (gnat_genericize): Likewise. + +2008-04-08 Eric Botcazou <ebotcazou@adacore.com> + Richard Kenner <kenner@adacore.com> + + * ada-tree.h (TYPE_PACKED_ARRAY_TYPE_P): Only set it when bit-packed. + * decl.c (gnat_to_gnu_entity): Adjust for above change. + <E_Record_Type>: Try to get a better form of the component for + packing, even if it has an integral mode. + <E_Record_Subtype>: Likewise. + * trans.c (gnat_to_gnu): Do not require BLKmode for the special + exception suppressing the final conversion between record types. + +2008-04-08 Eric Botcazou <ebotcazou@adacore.com> + + * decl.c (gnat_to_gnu_entity) <object>: If -gnatd.a and not optimizing + alignment for space, promote the alignment of non-scalar variables with + no size and alignment. + * gigi.h (gnat_types_compatible_p): Declare. + * misc.c (LANG_HOOKS_TYPES_COMPATIBLE_P): Set to above predicate. + * trans.c (gnat_to_gnu): Revert revision 129339 change. Minor cleanup. + * utils.c (gnat_types_compatible_p) : New predicate. + (convert): Use it throughout to test for cases where a mere view + conversion is sufficient. + * utils2.c (build_binary_op): Minor tweaks. + (build_unary_op): Likewise. + +2008-04-08 Eric Botcazou <ebotcazou@adacore.com> + + * decl.c (adjust_packed): Expand comment. + +2008-04-08 Arnaud Charlet <charlet@adacore.com> + + * s-tasuti.ads: Use Task_Address instead of System.Address. + + * makeutl.adb (Path_Or_File_Name): New function + + * nlists.ads, itypes.ads: Update comments. + + * s-crtl.ads (malloc32, realloc32): New functions. + + * s-auxdec.ads (Short_Address_Size): New constant. + + * a-taside.adb, s-tasdeb.adb: Use Task_Address. + + * s-ststop.ads, s-ststop.adb: New file. + + * exp_tss.ads, s-taprop-lynxos.adb: Update comments. + Minor reformatting. + +2008-04-08 Pascal Obry <obry@adacore.com> + + * g-sercom.ads, g-sercom.adb (Data_Rate): Add B115200. + (Stop_Bits_Number): New type. + (Parity_Check): Likewise. + (Set): Add parameter to set the number of stop bits and + the parity. Parameter timeout is now a duration instead + of a plain integer. + + * g-sercom-linux.adb: + Implement the stop bits and parity support for GNU/Linux. + Fix handling of timeout, it must be given in tenth of seconds. + + * g-sercom-mingw.adb: + Implement the stop bits and parity support for Windows. + Use new s-win32.ads unit instead of declaring Win32 services + directly into this body. + Update handling of timeout as now a duration. + + * s-win32.ads, s-winext.ads: New files. + +2008-04-08 Eric Botcazou <ebotcazou@adacore.com> + Arnaud Charlet <charlet@adacore.com> + + * s-osinte-linux-alpha.ads, s-osinte-linux-hppa.ads: Removed. + + s-taspri-posix-noaltstack.ads, s-linux.ads, s-linux-alpha.ads, + s-linux-hppa.ads: New files. Disable alternate stack on ia64-hpux. + + * s-osinte-lynxos-3.ads, + (Alternate_Stack): Remove when not needed. Simplify declaration + otherwise. + (Alternate_Stack_Size): New constant. + + s-osinte-mingw.ads, s-taprop-mingw.adb: Code clean up: avoid use of + 'Unrestricted_Access. + + * s-osinte-hpux.ads, s-osinte-solaris-posix.ads, s-osinte-aix.ads, + s-osinte-lynxos.ads, s-osinte-freebsd.ads s-osinte-darwin.ads, + s-osinte-tru64.ads, s-osinte-irix.ads, s-osinte-linux.ads, + s-osinte-solaris.ads, s-osinte-vms.ads + (SA_ONSTACK): New constant. + (stack_t): New record type. + (sigaltstack): New imported function. + (Alternate_Stack): New imported variable. + (Alternate_Stack_Size): New constant. + + * system-linux-x86_64.ads: (Stack_Check_Probes): Set to True. + + * s-taspri-lynxos.ads, s-taspri-solaris.ads, s-taspri-tru64.ads, + s-taspri-hpux-dce.ads, s-taspri-dummy.ads, s-taspri-posix.ads, + s-taspri-vms.ads (Task_Address): New subtype of System.Address + (Task_Address_Size): New constant size of System.Address + (Alternate_Stack_Size): New constant. + + * s-taprop-posix.adb, s-taprop-linux.adb (Get_Stack_Attributes): Delete. + (Enter_Task): Do not notify stack to System.Stack_Checking.Operations. + Establish the alternate stack if the platform makes use of n alternate + signal stack for stack overflows. + (Create_Task): Take into account the alternate stack in the stack size. + (Initialize): Save the address of the alternate stack into the ATCB for + the environment task. + (Create_Task): Fix assertions for NPTL library (vs old LinuxThreads). + + * s-parame.adb (Minimum_Stack_Size): Increase value to 16K + + * system-linux-x86.ads: (Stack_Check_Probes): Set to True. + + * s-intman-posix.adb: + (Initialize): Set SA_ONSTACK for SIGSEGV if the platform makes use of an + alternate signal stack for stack overflows. + + * init.c (__gnat_adjust_context_for_raise, Linux version): On i386 and + x86-64, adjust the saved value of the stack pointer if the signal was + raised by a stack checking probe. + (HP-UX section): Use global __gnat_alternate_stack as signal handler + stack and only for SIGSEGV. + (Linux section): Likewise on x86 and x86-64. + [VxWorks section] + (__gnat_map_signal): Now static. + (__gnat_error_handler): Not static any more. + (__gnat_adjust_context_for_raise): New function. Signal context + adjustment for PPC && !VTHREADS && !RTP, as required by the zcx + propagation circuitry. + (__gnat_error_handler): Second argument of a sigaction handler is a + pointer, not an int, and is unused. + Adjust signal context before mapping to exception. + Install signal handlers for LynxOS case. + + * s-taskin.ads (Common_ATCB): New field Task_Alternate_Stack. + (Task_Id): Set size to Task_Address_Size + (To_Task_id): Unchecked convert from Task_Address vice System.Address + (To_Address): Unchecked convert to Task_Address vice System.Address + + * s-tassta.adb (Task_Wrapper): Define the alternate stack and save its + address into the ATCB if the platform makes use of an alternate signal + stack for stack overflows. + (Free_Task): Add call to Finalize_Attributes_Link. + Add argument Relative_Deadline to pass the value specified for + the task. This is not yet used for any target. + + * s-tassta.ads (Create_Task): Add argument Relative_Deadline to pass + the value specified for the task. + +2008-04-08 Arnaud Charlet <charlet@adacore.com> + + (s-osinte-vxworks6.ads): Removed, merged with s-osinte-vxworks.ads/.adb + (s-vxwext.ads, s-vxwext-kernel.ads, s-vxwext-rtp.ads, + s-vxwext-rtp.adb): New files. + + * s-taprop-vxworks.adb, s-osinte-vxworks.ads, s-osinte-vxworks.adb: + Minor updates to accomodate changes above. + +2008-04-08 Pascal Obry <obry@adacore.com> + + * a-exetim-mingw.adb, s-gloloc-mingw.adb, s-taprop-mingw.adb, + s-tasinf-mingw.ad{s,b}, s-taspri-mingw.ads: + Use new s-win32.ads unit instead of declaration + from s-osinte-mingw.ads. + + * s-osinte-mingw.ads: + Move all non tasking based interface to s-win32.ads. + + * s-osprim-mingw.adb: + Remove duplicated declarations and use s-win32.ads + unit instead. + +2008-04-08 Vincent Celier <celier@adacore.com> + Arnaud Charlet <charlet@adacore.com> + + * mlib-tgt-aix.adb, mlib-tgt-darwin.adb, mlib-tgt-hpux.adb, + mlib-tgt-irix.adb, mlib-tgt-linux.adb, mlib-tgt-lynxos.adb, + mlib-tgt-solaris.adb, mlib-tgt-tru64.adb, mlib-tgt-vms.adb, + mlib-tgt-vms.ads, mlib-tgt-vms-alpha.adb, mlib-tgt-vms-ia64.adb, + mlib-tgt-vxworks.adb, mlib-tgt-mingw.adb: Renamed into... + + * mlib-tgt-specific-aix.adb, mlib-tgt-specific-darwin.adb, + mlib-tgt-specific-hpux.adb, mlib-tgt-specific-irix.adb, + mlib-tgt-specific-linux.adb, mlib-tgt-specific-lynxos.adb, + mlib-tgt-specific-solaris.adb, mlib-tgt-specific-tru64.adb, + mlib-tgt-vms_common.adb, mlib-tgt-vms_common.ads, + mlib-tgt-specific-vms-alpha.adb, mlib-tgt-specific-vms-ia64.adb, + mlib-tgt-specific-vxworks.adb, mlib-tgt-specific-xi.adb, + mlib-tgt-specific-mingw.adb: New names. + + * Makefile.in: + On VxWorks platforms use s-stchop-limit.ads for s-stchop.ads + Get rid of gnatbl. + (EXTRA_GNATRTL_NONTASKING_OBJS): Add s-win32.o + Files mlib-tgt-*.adb have been renamed mlib-tgt-specific-*.adb + Minor updates for VMS + + * gnatbl.c: Removed. + +2008-04-08 Thomas Quinot <quinot@adacore.com> + + * g-expect-vms.adb, a-textio.adb, a-witeio.adb, exp_dbug.adb, + g-expect.adb, g-locfil.adb, gnatchop.adb, gnatdll.adb, gnatlbr.adb, + gnatmem.adb, g-regist.adb, i-vxwork.ads, mlib-utl.adb, i-vxwork-x86.ads, + a-ztexio.adb, g-enblsp-vms-alpha.adb, g-enblsp-vms-ia64.adb, + s-os_lib.adb, s-regpat.adb, s-regpat.ads: Fix incorrect casing of + ASCII.NUL throughout. + +2008-04-08 Arnaud Charlet <charlet@adacore.com> + Matthew Heaney <heaney@adacore.com> + + * a-cgcaso.adb, a-convec.adb: (Swap, Sift): Avoid use of complex + renaming. + + * a-cgaaso.ads, a-secain.ads, a-slcain.ads, a-shcain.ads, + a-crdlli.ads, a-coormu.ads, a-ciormu.ads: modified header to conform + to convention for non-RM specs. + Add descriptive header, and documented each operation + document each operation + +2008-04-08 Robert Dewar <dewar@adacore.com> + Bob Duff <duff@adacore.com> + Gary Dismukes <dismukes@adacore.com> + Ed Schonberg <schonberg@adacore.com> + + * alloc.ads: Add entries for Obsolescent_Warnings table + + * einfo.ads, einfo.adb: Minor reformatting. + (Is_Discriminal): New subprogram. + (Is_Prival): New subprogram. + (Is_Protected_Component): New subprogram. + (Is_Protected_Private): Removed. + (Object_Ref, Set_Object_Ref): Removed. + (Prival, Set_Prival): Change assertion. + (Privals_Chain, Set_Privals_Chain): Removed. + (Prival_Link, Set_Prival_Link): New subprogram. + (Protected_Operation, Set_Protected_Operation): Removed. + (Protection_Object, Set_Protection_Object): New subprogram. + (Write_Field17_Name): Remove case for Object_Ref. + (Write_Field20_Name): Add case for Prival_Link. + (Write_Field22_Name): Remove case for Protected_Operation, + Privals_Chain. + Add case for Protection_Object. + (Can_Use_Internal_Rep): Make this into a [base type only] attribute, + so clients + (Overlays_Constant): New flag + (Is_Constant_Object): New predicate + (Is_Standard_Character_Type): New predicate + (Optimize_Alignment_Space): New flag + (Optimize_Alignment_Time): New flag + (Has_Postconditions): New flag + (Obsolescent_Warrning): Field removed + (Spec_PPC_List): New field + (Relative_Deadline_Variable, Set_Relative_Deadline_Variable): Add + subprograms to get and set the relative deadline associated to a task. + + * exp_attr.adb (May_Be_External_Call): Account for the case where the + Access attribute is part of a named parameter association. + (Expand_Access_To_Protected_Op): Test for the attribute occurring + within an init proc and use that directly as the scope rather than + traversing up to the protected operation's enclosing scope. Only apply + assertion on Is_Open_Scopes in the case the scope traversal is done. + For the init proc case use the address of the first formal (_init) as + the protected object reference. + Implement Invalid_Value attribute + (Expand_N_Attribute_Reference): Case Attribute_Unrestricted_Access. + contents of the dispatch table there is no need to duplicate the + itypes associated with record types (i.e. the implicit full view + of private types). + Implement Enum_Val attribute + (Expand_N_Attribute_Reference, case Old): Properly handle appearence + within _Postconditions procedure + (Expand_N_Attribute_Reference, case Result): Implement new attribute + + * exp_ch5.adb (Expand_N_Simple_Return_Statement): Handle case in which + a return statement calls a function that is not available in + configurable runtime. + (Analyze_If_Statement): don't optimize simple True/False cases in -O0 + (Expand_Non_Function_Return): Generate call to _Postconditions proc + (Expand_Simple_Function_Return): Ditto + + * frontend.adb: Add call to Sem_Aux.Initialize + + * sem_aux.ads, sem_aux.adb: New file. + + * par-prag.adb: Add entries for pragmas Precondition/Postcondition + Add new Pragma_Relative_Deadline. + Add support for pragmas Check and Check_Policy + + * sem_attr.ads, sem_attr.adb (Check_Not_CPP_Type): New subprogram. + (Check_Stream_Attribute): Add missing check (not allowed in CPP types) + (Analyze_Attribute): In case of attributes 'Alignment and 'size add + missing check because they are not allowed in CPP tagged types. + Add Sure parameter to Note_Possible_Modification calls + Add implementation of Invalid_Value attribute + Implement new attribute Has_Tagged_Values + Implement Enum_Val attribute + (Analyze_Attribute, case Range): Set Name_Req True for prefix of + generated attributes. + (Analyze_Attribute, case Result): If prefix of the attribute is + overloaded, it always resolves to the enclosing function. + (Analyze_Attribute, case Result): Properly deal with analysis when + Postconditions are not active. + (Resolve_Attribute, case Result): Properly deal with appearence during + preanalysis in spec. + Add processing for attribute Result + + * sem_ch6.ads, sem_ch6.adb (Check_Overriding_Indicator): Code cleanup + for operators. + (Analyze_Subprogram_Body): Install private_with_clauses when the body + acts as a spec. + (Check_Inline_Pragma): recognize an inline pragma that appears within + the subprogram body to which it applies. + (Analyze_Function_Return): Check that type of the expression of a return + statement in a function with a class-wide result is not declared at a + deeper level than the function. + (Process_PPCs): Deal with enabling/disabling, using PPC_Enabled flag + (Verify_Overriding_Indicator): Handle properly subprogram bodies for + user- defined operators. + (Install_Formals): Moved to spec to allow use from Sem_Prag for + analysis of precondition/postcondition pragmas. + (Analyze_Subprogram_Body.Last_Real_Spec_Entity): New name for + Last_Formal, along with lots of comments on what this is about + (Analyze_Subprogram_Body): Fix case where we move entities from the + spec to the body when there are no body entities (now possible with + precondition and postcondition pragmas). + (Process_PPCs): New procedure + (Analyze_Subprogram_Body): Add call to Process_PPCs + + * sem_ch8.adb (Use_One_Type): refine warning on a redundant use_type + clause. + (Pop_Scope): Restore Check_Policy_List on scope exit + (Push_Scope): Save Check_Policy_List on scope entry + Change name In_Default_Expression => In_Spec_Expression + Change name Analyze_Per_Use_Expression => Preanalyze_Spec_Expression + Change name Pre_Analyze_And_Resolve => Preanalyze_And_Resolve + (Analyze_Object_Renaming): Allow 'Reference as object + (Analyze_Pragma, case Restriction_Warnings): Call GNAT_Pragma + (Process_Restrictions_Or_Restriction_Warnings): Check for bad spelling + of restriction identifier. + Add Sure parameter to Note_Possible_Modication calls + + * sem_prag.ads, sem_prag.adb (Analyze_Pragma, case Stream_Convert): + Don't check for primitive operations when calling Rep_Item_Too_Late. + (Process_Import_Or_Interface): Do not place flag on formal + subprograms. + (Analyze_Pragma, case Export): If the entity is a deferred constant, + propagate information to full view, which is the one elaborated by the + back-end. + (Make_Inline): the pragma is effective if it applies to an internally + generated subprogram declaration for a body that carries the pragma. + (Analyze_Pragma, case Optimize_Alignment): Set new flag + Optimize_Alignment_Local. + (Analyze_PPC_In_Decl_Part): New procedure + (Get_Pragma_Arg): Moved to outer level + (Check_Precondition_Postcondition): Change to allow new visibility + rules for package spec + (Analyze_Pragma, case Check_Policy): Change placement rules to be + same as pragma Suppress/Unsuppress. + Change name In_Default_Expression => In_Spec_Expression + Change name Analyze_Per_Use_Expression => Preanalyze_Spec_Expression + Change name Pre_Analyze_And_Resolve => Preanalyze_And_Resolve + (Check_Precondition_Postcondition): Do proper visibility preanalysis + for the case of these pragmas appearing in the spec. + (Check_Enabled): New function + (Initialize): New procedure + (Tree_Read): New procedure + (Tree_Write): New procedure + (Check_Precondition_Postcondition): New procedure + Implement pragmas Check and Check_Policy + Merge Assert processing with Check + + * sem_warn.adb (Warn_On_Known_Condition): Handle pragma Check + New warning flag -gnatw.e + + * sinfo.ads, sinfo.adb (Has_Relative_Deadline_Pragma): New function + returning whether a task (or main procedure) has a pragma + Relative_Deadline. + (Set_Has_Relative_Deadline_Pragma): Procedure to indicate that a task + (or main procedure) has a pragma Relative_Deadline. + Add Next_Pragma field to N_Pragma node + (PPC_Enabled): New flag + (Next_Pragma): Now used for Pre/Postcondition processing + + * snames.h, snames.ads, snames.adb: New standard name + Inherit_Source_Path + Add entry for 'Invalid_Value attribute + Add entry for new attribute Has_Tagged_Values + Add entry for Enum_Val attribute + Add new standard names Aggregate, Configuration and Library. + Add _Postconditions + Add _Result + Add Pragma_Precondition + Add Pragma_Postcondition + Add Attribute_Result + New standard name Archive_Builder_Append_Option + (Preset_Names): Add _relative_deadline and relative_deadline definitions + There was also a missing non_preemptive_within_priorities. + (Get_Pragma_Id, Is_Pragma_Name): Add support for pragma + Relative_Deadline. + Add support for pragmas Check and Check_Policy + + * tree_gen.adb: Call Sem_Aux.Tree_Write + + * tree_in.adb: Call Sem_Aux.Tree_Read + + * exp_ch11.adb (Expand_N_Raise_Statement): New Build_Location calling + sequence + + * exp_intr.adb (Expand_Source_Info): New Build_Location calling + sequence + + * exp_prag.adb (Expand_Pragma_Relative_Deadline): New procedure. + (Expand_N_Pragma): Call the appropriate procedure for expanding pragma + Relative_Deadline. + (Expand_Pragma_Check): New procedure + + * sinput.ads, sinput.adb (Build_Location_String): Now appends to name + buffer. + + * sinfo.adb (PPC_Enabled): New flag + +2008-04-08 Robert Dewar <dewar@adacore.com> + Gary Dismukes <dismukes@adacore.com> + Javier Miranda <miranda@adacore.com> + Ed Schonberg <schonberg@adacore.com> + + * fe.h: Remove global Optimize_Alignment flag, no longer used + + * layout.adb: Test Optimize_Alignment flags rather than global switch + + * lib.ads, lib.adb: New OA_Setting field in library record + + * lib-load.adb: New OA_Setting field in library record + + * lib-writ.ads, lib-writ.adb (Collect_Withs, Write_With_Lines): Place + units mentioned in limited_with_ clauses in the ali file, with an + 'Y' marker. + New Ox fields in U line + + * opt.adb: New flag Optimize_Alignment_Local + (Check_Policy_List[_Config]): New flags + + * opt.ads (Invalid_Value_Used): New flag + New switch Optimize_Alignment_Local + (Warn_On_Parameter_Order): New flag + (Check_Policy_List[_Config]): New flags + + * ali.ads, ali.adb: Add indicator 'Y' to mark mark the presence of + limited_with clauses. + New data structures for Optimize_Alignment + + * bcheck.adb (Check_Consistent_Restriction_No_Default_Initialization): + New procedure + (Check_Consistent_Optimize_Alignment): Rework for new structure + (Check_Consistent_Restrictions): Fix incorrect error message + + sem_ch10.adb (Decorate_Tagged_Type): Set the Parent field of a newly + created class-wide type (to the Parent field of the specific type). + (Install_Siblings): Handle properly private_with_clauses on subprogram + bodies and on generic units. + (Analyze_With_Clause, Install_Limited_Withed_Unit): Guard against an + illegal limited_with_clause that names a non-existent package. + (Check_Body_Required): Determine whether a unit named a limited_with + clause needs a body. + (Analyze_Context): A limited_with_clause is illegal on a unit_renaming. + Capture Optimize_Alignment settings to set new OA_Setting field in + library record. + (Build_Limited_Views): Include task and protected type declarations. + + * sem_ch3.ads, sem_ch3.adb (Analyze_Object_Declaration): Handle the + case of a possible constant redeclaration where the current object is + an entry index constant. + (Analyze_Object_Declaration): Generate an error in case of CPP + class-wide object initialization. + (Analyze_Object_Declaration): Add extra information on warnings for + declaration of unconstrained objects. + (Access_Type_Declaration): Set Associated_Final_Chain to Empty, to avoid + conflicts with the setting of Stored_Constraint in the case where the + access type entity has already been created as an E_Incomplete_Type due + to a limited with clause. + Use new Is_Standard_Character_Type predicate + (Analyze_Object_Declaration): Apply access_constant check only after + expression has been resolved, given that it may be overloaded with + several access types. + (Constant_Redeclaration): Additional legality checks for deferred + constant declarations tha involve anonymous access types and/or null + exclusion indicators. + (Analyze_Type_Declaration): Set Optimize_Alignment flags + (Analyze_Subtype_Declaration): Ditto + (Analyze_Object_Declaration): Ditto + (Analyze_Object_Declaration): Don't count tasks in generics + Change name In_Default_Expression => In_Spec_Expression + Change name Analyze_Per_Use_Expression => Preanalyze_Spec_Expression + Change name Pre_Analyze_And_Resolve => Preanalyze_And_Resolve + (Process_Discriminants): Additional check for illegal use of default + expressions in access discriminant specifications in a type that is not + explicitly limited. + (Check_Abstract_Overriding): If an inherited function dispaches on an + access result, it must be overridden, even if the type is a null + extension. + (Derive_Subprogram): The formals of the derived subprogram have the + names and defaults of the parent subprogram, even if the type is + obtained from the actual subprogram. + (Derive_Subprogram): In the presence of interfaces, a formal of an + inherited operation has the derived type not only if it descends from + the type of the formal of the parent operation, but also if it + implements it. This is relevant for the renamings created for the + primitive operations of the actual for a formal derived type. + (Is_Progenitor): New predicate, to determine whether the type of a + formal in the parent operation must be replaced by the derived type. + + * sem_util.ads, sem_util.adb (Has_Overriding_Initialize): Make + predicate recursive to handle components that have a user-defined + Initialize procedure. Handle controlled derived types whose ancestor + has a user-defined Initialize procedured. + (Note_Possible_Modification): Add Sure parameter, generate warning if + sure modification of constant + Use new Is_Standard_Character_Type predicate + (Find_Parameter_Type): when determining whether a protected operation + implements an interface operation, retrieve the type of the formal from + the entity when the formal is an access parameter or an + anonymous-access-to-subprogram. + Move Copy_Parameter_List to sem_util, for use when building stubbed + subprogram bodies. + (Has_Access_Values): Tagged types now return False + (Within_HSS_Or_If): New procedure + (Set_Optimize_Alignment_Flags): New procedure + Change name In_Default_Expression => In_Spec_Expression + Change name Analyze_Per_Use_Expression => Preanalyze_Spec_Expression + Change name Pre_Analyze_And_Resolve => Preanalyze_And_Resolve + +2008-04-08 Tristan Gingold <gingold@adacore.com> + + * s-fileio.adb: Name_Error shouldn't be raised for a tempory file. + +2008-04-08 Tristan Gingold <gingold@adacore.com> + +PR ada/10768 + + * cuintp.c: Fix 16 bits issue for AVR. + On AVR, integer is 16 bits, so it can't be used to do math with + Base (=32768). + So use long_integer instead. + +2008-04-08 Hristian Kirtchev <kirtchev@adacore.com> + + * a-calend-vms.ads, a-calend-vms.adb: Add with and use clause for + System.OS_Primitives. + Change type of various constants, parameters and local variables from + Time to representation type OS_Time. + (To_Ada_Time, To_Unix_Time): Correct sign of origin shift. + Remove the declaration of constant Mili_F from several routines. New + body for internal package Conversions_Operations. + (Time_Of): Add default parameters for several formals. + + * a-caldel.adb: Minor reformatting + + * a-calend.ads, a-calend.adb: New body for internal package + Conversions_Operations. + (Time_Of): Add default parameters for several formals. + + * Makefile.rtl: Add a-ststop + Add Ada.Calendar.Conversions to the list of runtime files. + Add g-timsta + + * a-calcon.adb, a-calcon.ads: New files. + +2008-04-08 Jose Ruiz <ruiz@adacore.com> + Tristan Gingold <gingold@adacore.com> + + * s-interr-dummy.adb, s-interr-vms.adb, s-interr-sigaction.adb + (Install_Restricted_Handlers): New procedure + which is a simplified version of Install_Handlers that does not store + previously installed. + + * s-interr-vxworks.adb: Fix ACATS cxc3001 + On VxWorks interrupts can't be detached. + (Install_Restricted_Handlers): New procedure. + + * s-interr.ads, s-interr.adb (Install_Restricted_Handlers): New + procedure. + +2008-04-08 Olivier Hainque <hainque@adacore.com> + + * s-intman-vxworks.ads, s-intman-vxworks.adb + (Map_And_Raise_Exception): Remove. Was an import of only part of the + required services already implemented elsewhere. + (Notify_Exception): Delete body, import __gnat_error_handler instead. + (Initialize): Add SA_SIGINFO to the sa_flags, to get the sigcontext + argument passed to the handler, which we need for ZCX propagation + purposes. + +2008-04-08 Hristian Kirtchev <kirtchev@adacore.com> + + * adaint.h, adaint.c (__gnat_current_time_string): New routine. + + * g-timsta.adb, g-timsta.ads: New files. + +2008-04-08 Robert Dewar <dewar@adacore.com> + + * a-except-2005.ads, a-except-2005.adb, a-except.ads, a-except.adb + (Raise_Exception): In accordance with AI-446, raise CE for Null_Id + (Raise_Exception_Always): Fix documentation accordingly + +2008-04-08 Robert Dewar <dewar@adacore.com> + + * a-strbou.ads, a-strbou.adb (From_String): New procedure (for use by + Stream_Convert) + + * sem_ch13.ads (Rep_Item_Too_Late): Document that Stream_Convert sets + FOnly + +2008-04-08 Javier Miranda <miranda@adacore.com> + Robert Dewar <dewar@adacore.com> + Ed Schonberg <schonberg@adacore.com> + + * a-tags.adb (Register_Interface_Offset): New subprogram. + (Set_Dynamic_Offset_To_Top): New subprogram (see previous comment). + (To_Predef_Prims_Table_Ptr): Removed. + (Acc_Size): Removed. + (To_Acc_Size): Removed. + (Parent_Size): Modified to the call the subprogram returning the size of + the parent by means of the new TSD component Size_Func. + + * a-tags.ads (Offset_To_Top_Ptr): New access type declaration. + (DT_Offset_To_Top_Offset): New constant value that is used to generate + code referencing the Offset_To_Top component of the dispatch table's + prologue. + (Prim_Ptr): New declaration of access to procedure. Used to avoid the + use of 'address to initialize dispatch table slots. + (Size_Func): New component of the TSD. Used by the run-time to call the + size primitive of the tagged type. + + * checks.adb (Apply_Access_Check): Avoid check when accessing the + Offset_To_Top component of a dispatch table. + (Null_Exclusion_Static_Checks): If the non-null access type appears in a + deferred constant declaration. do not add a null expression, to prevent + spurious errors when full declaration is analyzed. + (Apply_Discriminant_Check): If both discriminant constraints share a + node which is not static but has no side effects, do not generate a + check for that discriminant. + (Generate_Index_Checks): Set Name_Req to true in call to duplicate + subexpr, since the prefix of an attribute is a name. + + * checks.ads: Fix nit in comment. + + * exp_ch3.ads, exp_ch3.adb (Freeze_Record_Type): Do not add the spec + and body of predefined primitives in case of CPP tagged type + derivations. + (Freeze_Type): Deal properly with no storage pool case + (Make_Predefined_Primitive_Specs): Generate specification of abstract + primitive Deep_Adjust if a nonlimited interface is derived from a + limited interface. + (Build_Dcheck_Functions): Create discriminant-checking functions only + for variants that have some component(s). + (Build_Slice_Assignment): In expanded code for slice assignment, handle + properly the case where the slice bounds extend to the last value of the + underlying representation. + (Get_Simple_Init_Val): New calling sequence, accomodate Invalid_Value + (Is_Variable_Size_Record): An array component has a static size if + index bounds are enumeration literals. + + * exp_disp.adb (Make_DT): Use the first subtype to determine whether + an external tag has been specified for the type. + (Building_Static_DT): Add missing support for private types. + (Make_DT): Add declaration of Parent_Typ to ensure consistent access + to the entity associated with the parent of Typ. This is done to + avoid wrong access when the parent is a private type. + (Expand_Interface_Conversion): Improve error message when the + configurable runtime has no support for dynamic interface conversion. + (Expand_Interface_Thunk): Add missing support to interface types in + configurable runtime. + (Expand_Dispatching_Call): remove obsolete code. + (Make_DT): Replace occurrences of RE_Address by RE_Prim_Ptr, and + ensure that all subtypes and aggregates associated with dispatch + tables have the attribute Is_Dispatch_Table_Entity set to true. + (Register_Primitive): Rename one variable to improve code reading. + Replace occurrences of RE_Addres by RE_Prim_Ptr. Register copy o + of the pointer to the 'size primitive in the TSD. + + * rtsfind.ads (RE_DT_Offset_To_Top_Offset): New entity. + (RE_Offset_To_Top_Ptr): New entity. + (RE_Register_Interface_Offset): New entity. + (RE_Set_Dynamic_Offset_To_Top): New entity. + (RE_Set_Offset_To_Top): Removed entity. + (RE_Prim_Ptr): New entity + (RE_Size_Func): New entity + (RE_Size_Ptr): New entity + (RTU_Id): Add Ada_Dispatching and Ada_Dispatching_EDF. + (Ada_Dispatching_Child): Define this new subrange. + (RE_Id): Add new required run-time calls (RE_Set_Deadline, RE_Clock, + RE_Time_Span, and RE_Time_Span_Zero). + (RE_Unit_Table): Add new required run-time calls + + * rtsfind.adb (Get_Unit_Name): Add processing for Ada.Dispatching + children. + + * exp_atag.ads, exp_atag.adb (Build_Offset_To_Top): New subprogram. + (Build_Set_Static_Offset_To_Top): New subprogram. Generates code that + initializes the Offset_To_Top component of a dispatch table. + (Build_Predef_Prims): Removed. + (Build_Get_Predefined_Prim_Op_Address): Replace call to Predef_Prims by + its actual code. + (Build_Set_Size_Function): New subprogram. + + * exp_ch13.adb: Do not generate storage variable for storage_size zero + (Expand): Handle setting/restoring flag Inside_Freezing_Actions + +2008-04-08 Robert Dewar <dewar@adacore.com> + + * a-ztdeau.adb, a-tideau.adb, a-wtdeau.adb (Puts_Dec): Fix error in + computing Fore when Exp > 0 + +2008-04-08 Robert Dewar <dewar@adacore.com> + + * back_end.adb: Remove Big_String_Ptr declarations (now in Types) + + * errout.adb: Remove Big_String_Ptr declarations (now in Types) + Change name Is_Style_Msg to Is_Style_Or_Info_Msg + + * fmap.adb: Remove Big_String declarations (now in Types) + (No_Mapping_File): New Boolean global variable + (Initialize): When mapping file cannot be read, set No_Mapping_File to + False. + (Update_Mapping_File): Do nothing if No_Mapping_File is True. If the + tables were empty before adding entries, open the mapping file + with Truncate = True, instead of delete/re-create. + + * fname-sf.adb: Remove Big_String declarations (now in Types) + + * s-strcom.adb, g-dyntab.ads, g-table.ads, s-carsi8.adb, + s-stalib.ads, s-carun8.adb: Add zero size Storage_Size clauses for + big pointer types + + * table.ads: Add for Table_Ptr'Storage_Size use 0 + + * types.ads: Add Big_String declarations + Add Size_Clause of zero for big pointer types + +2008-04-08 Vincent Celier <celier@adacore.com> + + * clean.adb (Parse_Cmd_Line): Recognize switch --subdirs= + (Usage): Add line for switch --subdirs= + Add new switch -eL, to follow symbolic links when processing project + files. + + * gnatcmd.adb: Process switches -eL and --subdirs= + (Non_VMS_Usage): Output "gnaampcmd" instead of "gnat", and call + Program_Name to get proper tool names when AAMP_On_Target is set. + (Gnatcmd): Call Add_Default_Search_Dirs and Get_Target_Parameters to get + AAMP_On_Target set properly for use of GNAAMP tools (this is needed by + Osint.Program_Name). + + * gnatname.adb: (Scan_Args): Recognize switches -eL and --subdirs= + (Usage): Add lines for switches -eL and --subdirs= + + * makeusg.adb: Add line for switch --subdirs= + + * prj.ads: + (Source_Data): New Boolean component Compiled, defaulted to True + (Empty_File_Name: New global variable in private part, initialized in + procedure Initialize. + (Subdirs_Option): New constant string + (Subdirs): New String_Ptr global variable + (Language_Config): New component Include_Compatible_Languages + (Project_Qualifier): New type for project qualifiers + (Project_Data): New component Qualifier + (Project_Configuration): New component Archive_Builder_Append_Option + + * prj-nmsc.adb (Get_Unit_Exceptions): When a unit is already in + another imported project indicate the name of this imported project. + (Check_File): When a unit is in two project files, indicate the project + names and the paths of the source files for each project. + (Add_Source): Set Compiled to False if compiler driver is empty. Only + set object, dependency and switches file names if Compiled is True. + (Process_Compiler): Allow the empty string for value of attribute Driver + (Get_Directories): When Subdirs is not null and Object_Dir is not + specified, locate and create if necessary the actual object dir. + (Locate_Directory): When Subdirs is not empty and Create is not the + empty string, locate and create if necessary the actual directory + as a subdirectory of directory Name. + (Check_Library_Attributes.Check_Library): Allow a project where the only + "sources" are header files of file based languages to be imported by + library projects, in multi-language mode (gprbuild). + (Check_Library_Attributes.Check_Library): In multi-language mode + (gprbuild), allow a library project to import a project with no + sources, even when this is not declared explicitly. + (Check_If_Externally_Built): A virtual project extending an externally + built project is also externally built. + (Check_Library_Attributes): For a virtual project extending a library + project, inherit the library directory. + (Process_Project_Level_Array_Attributes): Process new attribute + Inherit_Source_Path. + For projects with specified qualifiers "standard", "library" or + "abstract", check that the project conforms to the qualifier. + (Process_Project_Level_Simple_Attributes): Process new attribute + Archive_Builder_Append_Option. + + * switch-m.adb: (Scan_Make_Switches): Process switch --subdirs= + (Normalize_Compiler_Switches): Only keep compiler switches that are + passed to gnat1 by the gcc driver and that are stored in the ALI file + by gnat1. + Do not take into account switc -save-temps + + * makegpr.adb (Compile_Link_With_Gnatmake): Transmit switch -eL if + gprmake is called with -eL. + (Scan_Arg): Recognize switch -eL + (Usage): Add line for switch -eL + + * prj.adb (Initialize): Initialize Empty_File_Name + (Project_Empty): New component Qualifier + + * prj-attr.ads, prj-attr.adb: New project level attribute + Inherit_Source_Path. + New project level attribute Archive_Builder_Append_Option + + * prj-dect.adb: Replace System.Strings by GNAT.Strings. + + * prj-ext.adb (Initialize_Project_Path): In Multi_Language mode, add + <prefix>/lib/gnat in the project path, after <prefix>/share/gpr, for + upward compatibility. + + * prj-part.adb (Project_Path_Name_Of.Try_Path): In high verbosity, put + each Trying ..." on different lines. + (Parse_Single_Project): Recognize project qualifiers. Fail in qualifier + is "configuration" when not in configuration. Fail when in configuration + when a specified qualifier is other than "configuration". + + * prj-proc.adb (Process_Declarative_Items): Link new elements of copied + full associative array together. + (Recursive_Process): Put the project qualifier in the project data + + * prj-tree.ads, prj-tree.adb: (Project_Qualifier_Of): New function + (Set_Project_Qualifier_Of): New procedure + +2008-04-08 Robert Dewar <dewar@adacore.com> + + * errout.ads: Update comments for new handling of info: messages + + * erroutc.adb (Matches): New procedure + (Warning_Specifically_Suppressed): Modified to handle multiple * chars + (Is_Style_Or_Info_Msg): New name for Is_Style_Msg, now set for + info messages as well as style messages. + + * erroutc.ads: Remove unneeded fields from Specific_Warning_Entry + + * sem_elab.adb (Supply_Bodies): Create actual bodies for stubbed + subprograms. + (Check_A_Call): Special "info: " warnings now have ? in the text + (Elab_Warning): Use info message in static case + +2008-04-08 Ed Schonberg <schonberg@adacore.com> + + * exp_aggr.adb (Static_Array_Aggregate): Use Max_Aggr_Size to determine + whether an array aggregate with static bounds and scalar components + should be expanded into a static constant. + +2008-04-08 Gary Dismukes <dismukes@adacore.com> + Ed Schonberg <schonberg@adacore.com> + Robert Dewar <dewar@adacore.com> + + * sem_cat.adb (Validate_RCI_Subprogram_Declaration): Add tests of + Has_Stream_Attribute_ Definition when checking for available stream + attributes on parameters of a limited type in Ada 2005. Necessary for + proper recognition of visible stream attribute clauses. + (Has_Stream_Attribute_Definition): If the type is derived from a + private type, then use the derived type's underlying type for checking + whether it has stream attributes. + (Validate_Object_Declaration): The check for a user-defined Initialize + procedure applies also to types with controlled components or a + controlled ancestor. + Reject an object declaration in a preelaborated unit if the type is a + controlled type with an overriding Initialize procedure. + (Validate_Remote_Access_To_Class_Wide_Type): Return without further + checking when the parent of a dereference is a selected component and + the name has not been analyzed. + + * sem_ch4.adb (Analyze_Selected_Component): Add checking for selected + prefixes that are invalid explicit dereferences of remote + access-to-class-wide values, first checking whether the selected + component is a prefixed form of call to a tagged operation. + (Analyze_Call): Remove code that issues an error for limited function + calls in illegal contexts, as we now support all of the contexts that + were forbidden here. + Allow a function call that returns a task.and appears as the + prefix of a selected component. + (Analyze_Reference): Give error message if we try to make a 'Reference + for an object that is atomic/aliased without its type having the + corresponding attribute. + (Analyze_Call): Remove condition checking for attributes to allow + calls to functions with inherently limited results as prefixes of + attributes. Remove related comment about Class attributes. + (Analyze_Selected_Component): If the prefix is a remote type, check + whether this is a prefixed call before reporting an error. + (Complete_Object_Operation): If the controlling formal is an access to + variable reject an actual that is a constant or an access to one. + (Try_Object_Operation): If prefix is a tagged protected object,retrieve + primitive operations from base type. + + * exp_ch4.adb (Expand_N_Indexed_Component): Test for prefix that is a + build-in-place + function call and call Make_Build_In_Place_Call_In_Anonymous_Context. + (Expand_N_Selected_Component): Test for prefix that is a build-in-place + function call and call Make_Build_In_Place_Call_In_Anonymous_Context. + (Expand_N_Slice): Test for prefix that is a build-in-place function call + and call Make_Build_In_Place_Call_In_Anonymous_Context. + (Analyze_Call): Remove code that issues an error for limited function + calls in illegal contexts, as we now support all of the contexts that + were forbidden here. + New calling sequence for Get_Simple_Init_Val + (Expand_Boolean_Operator): Add call to Silly_Boolean_Array_Xor_Test + (Expand_N_Op_Not): Add call to Silly_Boolan_Array_Not_Test + +2008-04-08 Hristian Kirtchev <kirtchev@adacore.com> + Ed Schonberg <schonberg@adacore.com> + Robert Dewar <dewar@adacore.com> + + * exp_ch2.adb: Minor reformatting. + (Expand_Entry_Index_Parameter): Set the type of the identifier. + (Expand_Entry_Reference): Add call to Expand_Protected_Component. + (Expand_Protected_Component): New routine. + (Expand_Protected_Private): Removed. + Add Sure parameter to Note_Possible_Modification calls + + * sem_ch12.ads, sem_ch12.adb (Analyze_Subprogram_Instantiation): The + generated subprogram declaration must inherit the overriding indicator + from the instantiation node. + (Validate_Access_Type_Instance): If the designated type of the actual is + a limited view, use the available view in all cases, not only if the + type is an incomplete type. + (Instantiate_Object): Actual is illegal if the formal is null-excluding + and the actual subtype does not exclude null. + (Process_Default): Handle properly abstract formal subprograms. + (Check_Formal_Package_Instance): Handle properly defaulted formal + subprograms in a partially parameterized formal package. + Add Sure parameter to Note_Possible_Modification calls + (Validate_Derived_Type_Instance): if the formal is non-limited, the + actual cannot be limited. + (Collect_Previous_Instances): Generate instance bodies for subprograms + as well. + + * sem_ch13.adb (Analyze_Attribute_Definition_Clause, case Small): Don't + try to set RM_Size. + Add Sure parameter to Note_Possible_Modification calls + (Analyze_At_Clause): Preserve Comes_From_Source on Rewrite call + (Analyze_Attribute_Definition_Clause, case Attribute_Address): Check for + constant overlaid by variable and issue warning. + Use new Is_Standard_Character_Type predicate + (Analyze_Record_Representation_Clause): Check that the specified + Last_Bit is not less than First_Bit - 1. + (Analyze_Attribute_Definition_Clause, case Address): Check for + self-referential address clause + + * sem_ch5.ads, sem_ch5.adb (Diagnose_Non_Variable_Lhs): Rewrite the + detection mechanism when the lhs is a prival. + (Analyze_Assignment): Call Check_Unprotected_Access to detect + assignment of a pointer to protected data, to an object declared + outside of the protected object. + (Analyze_Loop_Statement): Check for unreachable code after loop + Add Sure parameter to Note_Possible_Modication calls + Protect analysis from previous syntax error such as a scope mismatch + or a missing begin. + (Analyze_Assignment_Statement): The assignment is illegal if the + left-hand is an interface. + + * sem_res.ads, sem_res.adb (Resolve_Arithmetic_Op): For mod/rem check + violation of restriction No_Implicit_Conditionals + Add Sure parameter to Note_Possible_Modication calls + Use new Is_Standard_Character_Type predicate + (Make_Call_Into_Operator): Preserve Comes_From_Source when rewriting + call as operator. Fixes problems (e.g. validity checking) which + come from the result looking as though it does not come from source). + (Resolve_Call): Check case of name in named parameter if style checks + are enabled. + (Resolve_Call): Exclude calls to Current_Task as entry formal defaults + from the checking that such calls should not occur from an entry body. + (Resolve_Call): If the return type of an Inline_Always function + requires the secondary stack, create a transient scope for the call + if the body of the function is not available for inlining. + (Resolve_Actuals): Apply Ada2005 checks to view conversions of arrays + that are actuals for in-out formals. + (Try_Object_Operation): If prefix is a tagged protected object,retrieve + primitive operations from base type. + (Analyze_Selected_Component): If the context is a call to a protected + operation the parent may be an indexed component prior to expansion. + (Resolve_Actuals): If an actual is of a protected subtype, use its + base type to determine whether a conversion to the corresponding record + is needed. + (Resolve_Short_Circuit): Handle pragma Check + + * sem_eval.adb: Minor code reorganization (usea Is_Constant_Object) + Use new Is_Standard_Character_Type predicate + (Eval_Relational_Op): Catch more cases of string comparison + +2008-04-08 Robert Dewar <dewar@adacore.com> + Gary Dismukes <dismukes@adacore.com> + + * s-rident.ads: Add No_Default_Initialization restriction + + * exp_tss.adb: + (Has_Non_Null_Base_Init_Proc): Handle No_Default_Initialization case + (Set_TSS): Handle No_Default_Initialization case + + * exp_ch6.adb (Expand_N_Subprogram_Body): Handle restriction + No_Default_Initialization + (Expand_N_Subprogram_Body): Remove redundant initialization of out + parameters when Normalize_Scalars is active. + (Add_Final_List_Actual_To_Build_In_Place_Call): Add formal Sel_Comp + Fix casing error in formal parameter name in call + (Register_Predefined_DT_Entry): Replace occurrences of RE_Address by + (Expand_Call, Propagate_Tag): Call Kill_Current_Values when processing a + dispatching call on VM targets. + +2008-04-08 Gary Dismukes <dismukes@adacore.com> + Thomas Quinot <quinot@adacore.com> + + * exp_ch7.adb (Find_Final_List): Change the test for generating a + selected component from an access type's Associated_Final_Chain to + check for the presence of that field, rather than assuming it exists + for all named access types. + (Make_Clean): New formal Chained_Cleanup_Action allowing to specify a + procedure to call at the end of the generated cleanup procedure. + (Expand_Cleanup_Actions): When a new cleanup procedure is generated, and + and an At_End_Proc already exists in the handled sequence of statements + for which cleanup actions are being expanded, the original cleanup + action must be preserved. + +2008-04-08 Hristian Kirtchev <kirtchev@adacore.com> + Ed Schonberg <schonberg@adacore.com> + Robert Dewar <dewar@adacore.com> + Gary Dismukes <dismukes@adacore.com> + + * exp_ch9.ads, exp_ch9.adb (Build_Protected_Entry, + Build_Unprotected_Subprogram_Body): Generate debug info for + declarations related to the handling of private data in task and + protected types. + (Debug_Private_Data_Declarations): New subprogram. + (Install_Private_Data_Declarations): Remove all debug info flagging. + This is now done by Debug_Private_Data_Declarations at the correct + stage of expansion. + (Build_Simple_Entry_Call): If the task name is a function call, expand + the prefix into an object declaration, and make the surrounding block a + task master. + (Build_Master_Entity): An internal block is a master if it wraps a call. + Code reformatting, update comments. Code clean up. + (Make_Task_Create_Call): Use 'Unrestricted_Access instead of 'Address. + (Replicate_Entry_Formals): If the formal is an access parameter or + anonymous access to subprogram, copy the original tree to create new + entities for the formals of the subprogram. + (Expand_N_Task_Type_Declaration): Create a Relative_Deadline variable + for tasks to store the value passed using pragma Relative_Deadline. + (Make_Task_Create_Call): Add the Relative_Deadline argument to the + run-time call to create a task. + (Build_Wrapper_Spec): If the controlling argument of the interface + operation is an access parameter with a non-null indicator, use the + non-null indicator on the wrapper. + + * sem_ch9.adb (Analyze_Protected_Type): Only retrieve the full view when + present, which it may not be in the case where the type entity is an + incomplete view brought in by a limited with. + (Analyze_Task_Type): Only retrieve the full view when present, which it + may not be in the case where the type entity is an incomplete view brought + in by a limited with. + (Analyze_Protected_Definition): Set Is_Frozen on all itypes generated for + private components of a protected type, to prevent the generation of freeze + nodes for which there is no proper scope of elaboration. + + * exp_util.ads, exp_util.adb + (Remove_Side_Effects): If the expression is a function call that returns a + task, expand into a declaration to invoke the build_in_place machinery. + (Find_Protection_Object): New routine. + (Remove_Side_Effects): Also make a copy of the value + for attributes whose result is of an elementary type. + (Silly_Boolean_Array_Not_Test): New procedure + (Silly_Boolean_Array_Xor_Test): New procedure + (Is_Volatile_Reference): New function + (Remove_Side_Effects): Use Is_Volatile_Reference + (Possible_Bit_Aligned_Component): Handle slice case properly + + * exp_pakd.adb (Expand_Packed_Not): Move silly true/true or false/false + case test to Exp_Util + (Expand_Packed_Xor): Move silly true/true case test to Exp_Util + +2008-04-08 Thomas Quinot <quinot@adacore.com> + + * exp_dist.ads, exp_dist.adb: Fix casing error in formal parameter name + in call + (Add_RACW_Features): When processing an RACW in another unit than the + main unit, set Body_Decls to No_List to indicate that the bodies of + the type's TSS must not be generated. + (GARLIC_Support.Add_RACW_Read_Attribute, + GARLIC_Support.Add_RACW_Write_Attribute): Do not generate bodies if + Body_Decls is No_List. + (PolyORB_Support.Add_RACW_Read_Attribute, + PolyORB_Support.Add_RACW_Write_Attribute, + PolyORB_Support.Add_RACW_From_Any, + PolyORB_Support.Add_RACW_To_Any, + PolyORB_Support.Add_RACW_TypeCode): Same. + (Transmit_As_Unconstrained): New function. + (Build_Ordered_Parameters_List): Use the above to order parameters. + (GARLIC_Support.Build_General_Calling_Stubs): + Use the above to determine which parameters to unmarshall using 'Input + at the point where their temporary is declared (as opposed to later on + with a 'Read call). + (PolyORB_Support.Build_General_Calling_Stubs): + Use the above to determine which parameters to unmarshall using From_Any + at the point where their temporary is declared (as opposed to later on + with an assignment). + +2008-04-08 Ed Schonberg <schonberg@adacore.com> + + * exp_strm.adb (Build_Record_Or_Elementary_Input_Function): If this is + an Input function for an access type, do not perform default + initialization on the local variable that receives the value, to + prevent spurious warnings when the type is null-excluding. + +2008-04-08 Robert Dewar <dewar@adacore.com> + Ed Schonberg <schonberg@adacore.com> + + * freeze.adb (Freeze_Entity): Improve warnings on access types in pure + units. + (Size_Known): Generic formal scalar types have known at compile + time size, so remove check. + Fix casing error in formal parameter name in call + (Freeze_Subprogram): If the subprogram is a user-defined operator, + recheck its overriding indication. + +2008-04-08 Vincent Celier <celier@adacore.com> + + * gnat1drv.adb: Send all messages indicating an error to standard error + +2008-04-08 Robert Dewar <dewar@adacore.com> + + * gnatbind.adb (Restriction_Could_Be_Set): New procedure + (List_Applicable_Restrictions): Do not list existing restrictions + +2008-04-08 Thomas Quinot <quinot@adacore.com> + + * g-socket.ads, g-socket.adb: Improve documentation of GNAT.Sockets: + add a pointer to generic sockets literature + do not mention that the given example is "typical" usage. + Remove obsolete comment about multicast not being supported on Windows. + (Connect_Socket): Make Server mode IN rather than IN OUT + since this formal is never modified. + +2008-04-08 Robert Dewar <dewar@adacore.com> + + * sprint.adb (Write_Itype): Handle Itypes whose Parent field points to + the declaration for some different entity. + (Sprint_Node_Actual, case N_Derived_Type_Definition): When an interface + list is precent (following the parent subtype indication), display + appropriate "and" keyword. + + * itypes.adb: Remove unnecessary calls to Init_Size_Align and Init_Esize + Remove unnecessary calls to Init_Size_Align and Init_Esize. + Add notes on use of Parent field of an Itype + +2008-04-08 Ed Schonberg <schonberg@adacore.com> + Robert Dewar <dewar@adacore.com> + Gary Dismukes <dismukes@adacore.com> + + * lib-xref.adb (Is_On_LHS): Remove dead code + (Output_Overriden_Op): If the overridden operation is itself inherited, + list the ancestor operation, which is the one whose body or absstract + specification is actually being overridden. For source navigation + purposes. + + * sem_ch7.adb (Is_Primitive_Of): use base type to determine whether + operation is primitive for the type. + (Declare_Inherited_Private_Subprograms): If the new operation overrides + an inherited private subprogram, set properly the Overridden_Operation + attribute, for better cross-reference information. + (Analyze_Package_Specification): Do late analysis of spec PPCs + (Install_Private_Declaration, Uninstall_Declarations): Save/restore + properly the full view and underlying full views of a private type in a + child unit, whose full view is derived from a private type in a parent + unit, and whose own full view becomes visible in the child body. + + * sem_disp.adb (Check_Dispatching_Operation): When a body declares a + primitive operation after the type has been frozen, add an explicit + reference to the type and the operation, because other primitive + references have been emitted already. + (Expand_Call, Propagate_Tag): Call Kill_Current_Values when processing a + dispatching call on VM targets. + +2008-04-08 Vincent Celier <celier@adacore.com> + Thomas Quinot <quinot@adacore.com> + + * make.adb: (Gnatmake_Called): Remove, no longer necessary + (Compile_Surces): Call Delete_Temp_Config_Files only if Gnatmake_Called + is True and Debug_Flag_N is False. Debug_Flag_N means "keep temp files". + (Insert_Project_Sources): Take into account index in multi-unit source + files. + After building a library project, delete all temporary files. + (Initialize): Reset current output after parsing project file. + (Collect_Arguments_And_Compile): Never insert in the queue the sources + of library projects that are externally built. + Put file name in error and inform messages if -df is used + (Display): If invoked with -d7, do not display path names, but only + file names. + + * makeutl.ads (Path_Or_File_Name): New function + (Path_Or_File_Name): New function + +2008-04-08 Arnaud Charlet <charlet@adacore.com> + + * Make-lang.in: Disable warnings during first stage of bootstrap + Get rid of gnatbl. + Update dependencies. + +2008-04-08 Vincent Celier <celier@adacore.com> + + * mlib-prj.adb (Build_Library): Compare with ALI file name in canonical + case to decide if ALI object file is included in library. + (Build_Library): Never attempt to build a library if the project is + externally built. + +2008-04-08 Thomas Quinot <quinot@adacore.com> + + * nlists.adb (Is_Non_Empty_List): Remove redundant test. First + (No_List) is defined to return Empty. + +2008-04-08 Jose Ruiz <ruiz@adacore.com> + + * osint.ads, osint.adb (Get_Libraries_From_Registry): Improve + documentation. + Update comments. + (Read_Default_Search_Dirs): Do not consider spaces as path separators + because spaces may be part of legal paths. + +2008-04-08 Robert Dewar <dewar@adacore.com> + + * par-ch11.adb (P_Exception_Handler): Check indentation level for + handler + +2008-04-08 Ed Schonberg <schonberg@adacore.com> + + * par-ch3.adb (P_Type_Declaration) Reject the keyword "synchronized" + in a type declaration, if this is not an interface declaration or + private type extension. + +2008-04-08 Vincent Celier <celier@adacore.com> + + * prj-util.adb (Executable_Of): New String parameter Language. When + Ada_Main is False and Language is not empty, attempt to remove the body + suffix or the spec suffix of the language to get the base of the + executable file name. + (Put): New Boolean parameter Lower_Case, defauilted to False. When + Lower_Case is True, put the value in lower case in the name list. + (Executable_Of): If there is no executable suffix in the configuration, + then do not modify Executable_Extension_On_Target. + + * prj-util.ads (Executable_Of): New String parameter Language, + defaulted to the empty string. + (Put): New Boolean parameter Lower_Case, defauilted to False + +2008-04-08 Robert Dewar <dewar@adacore.com> + + * scng.adb (Scan_Identifier): Handle case of identifier starting with + wide character using UTF-8 encoding. + +2008-04-08 Javier Miranda <miranda@adacore.com> + + * sem.adb (Analyze): Consider case in which we analyze an empty node + that was generated by a call to a runtime function that is not + available under the configurable runtime. + + * sem.ads (Inside_Freezing_Actions): New flag. + (Save_Check_Policy_List): New field in scope stack entry + +2008-04-08 Ed Schonberg <schonberg@adacore.com> + Robert Dewar <dewar@adacore.com> + + * sem_aggr.adb (Analyze_N_Extension_Aggregate): Add legality checks for + the ancestor part of an extension aggregate for a limited type. + (Resolve_Array_Aggregate): Issue warning for sliding of aggregate with + enumeration index bounds. + (Resolve_Array_Aggregate): Add circuit for diagnosing missing choices + when array is too short. + (Check_Expr_OK_In_Limited_Aggregate): Move function + Check_Non_Limited_Type from Resolve_Record_Aggregate to top level (and + change name). + (Resolve_Array_Aggregate.Resolve_Aggr_Expr): + Check_Expr_OK_In_Limited_Aggregates called to check for illegal limited + component associations. + (Check_Non_Limited_Type): Moved to outer level and renamed. + (Resolve_Record_Aggregate): In an extension aggregate, an association + with a box initialization can only designate a component of the + extension, not a component inherited from the given ancestor + + * sem_case.adb: Use new Is_Standard_Character_Type predicate + +2008-04-08 Robert Dewar <dewar@adacore.com> + + * s-imgdec.adb (Set_Decimal_Digits): Fix error when input is zero with + negative scale + (Set_Decimal_Digits): Properly handle Aft=0 (equivalent to Aft=1) + Properly handle case where Aft > Scale and input number is less than + one. + +2008-04-08 Hristian Kirtchev <kirtchev@adacore.com> + + * s-stoele.ads, s-soflin.ads: Move the location of + Dummy_Communication_Block from System.Storage_Elements to + System.Soft_Links. + + * s-tpobop.ads: Add comment on usage of Dummy_Communication_Block to + emulate Communication_Block in certain scenarios. + +2008-04-08 Hristian Kirtchev <kirtchev@adacore.com> + + * s-strxdr.adb, s-stratt.ads, s-stratt.adb (Block_IO_OK): New + subprogram. + Add new subtype S_WWC, unchecked conversion routines From_WWC and + To_WWC. + (I_WWC, O_WWC): New routines for input and output of + Wide_Wide_Character. + +2008-04-08 Robert Dewar <dewar@adacore.com> + + * stringt.adb (Write_String_Table_Entry): Handle wide characters + properly + +2008-04-08 Robert Dewar <dewar@adacore.com> + + * styleg.adb (Check_Comment): Allow special char after -- in + non-end-of-line case + +2008-04-08 Robert Dewar <dewar@adacore.com> + + * stylesw.adb: Implement -gnaty + - y options + (Set_GNAT_Style_Check_Options): Includ I in style check string + + * stylesw.ads: Add comments for new style switch options + +2008-04-08 Sergey Rybin <rybin@adacore.com> + + * tree_io.ads: Increase ASIS_Version_Number because of adding Sem_Aux + to the set of the GNAT components needed by ASIS. + +2008-04-08 Bob Duff <duff@adacore.com> + + * types.h: Change CE_Null_Exception_Id to the correct value (8, was 9). + +2008-04-08 Tristan Gingold <gingold@adacore.com> + + * vxaddr2line.adb: Use Unsigned_32 instead of Integer for address type. + Improve error message generation. + +2008-04-08 Vincent Celier <celier@adacore.com> + + * a-direct.adb (Start_Search): Check for Name_Error before checking for + Use_Error, as specified in the RM. Check if directory is open and raise + Use_Error if it is not. + +2008-04-08 Vincent Celier <celier@adacore.com> + Robert Dewar <dewar@adacore.com> + + * vms_conv.adb (Output_Version): Print "GNAAMP" instead of "GNAT when + AAMP_On_Target is set. + + * vms_data.ads: Add NOxxx to style check switch list + Add entry COMPONENTS for -gnatVe + Add VMS qualifiers for -eL (/FOLLOW_LINKS_FOR_FILES) and --subdirs= + (/SUBDIRS=). + (GCC_Switches): Add /ALL_BACK_END_WARNINGS. + Add qualifiers for gnatmetric coupling options + Add note that -gnata enables all checks + Add entries [NO]PARAMETER_ORDER for -gnatw.p[P] + Fix inconsistency for VMS qualifier for the gnatpp '-rnb' option + New warning flag -gnatw.e + + * usage.adb: Add entries for -gnaty+ -gnaty- -gnatyy + Add entry for -gnatyN (forgotten before) + Line for new warning switch -gnatw.p + New warning flag -gnatw.e + + * gnat_ugn.texi: Add documentation fpr project file switch -aP + Document -gnaty - + y + Replace occurences of "package specification" with "package spec" + Define preprocessing symbols in documentation of gnatprep + Clarify reason for distinguishing overflow checking + Add documentation for project-aware tool switches -eL and --subdirs= + Complete list of configuration pragmas + Specify that, even when gnatmake switch -x is used, mains on the command + line need to be sources of project files. + Editing of gnatcheck/gnatmetric doc. + Add documentation for -gnatw.p/-gnatw.P + Add missing documentation for -fno-inline-functions. + Add documentation for -gnatw.e + + * gnat_rm.texi: Add documentation for No_Default_Initialization + Replace occurences of "package specification" with "package spec" + Document use of * in Warnings Off string + Update documentation of alignment/component clauses. + Add documentation for Invalid_Value + Document new consistency rule for Optimize_Alignment + Add documentation for Precondition and Postcondition pragmas + Add documentation for Check and Check_Policy pragmas + Document new Enum_Val attribute + Remove requirement for static string in pragma Assert + Add documentation on GNAT.Time_Stamp + + * ug_words: add entry for -gnatVe + Add entries for -gnat.p[P] /WARNINGS=[NO]PARAMETER_ORDER + Add entry for -gnatw.e + + * debug.adb: Add missing documentation for d.a flag + Document new -gnatd.a switch. + Add documentation for new gnatmake debug switch -df + +2008-04-08 Thomas Quinot <quinot@adacore.com> + + * gen-soccon.c: Bump year in copyright notices. + + * g-soccon-vxworks.ads: Add new constant IP_PKTINFO + +2008-04-08 Eric Botcazou <ebotcazou@adacore.com> + + * ctrl_c.c: Improve handling of ctrl-c on LynxOS and Windows. + Minor reformatting. + +2008-04-08 Robert Dewar <dewar@adacore.com> + Bob Duff <duff@adacore.com> + + * impunit.adb: Add Interfaces.Java.JNI, System.Strings.Stream_Ops, + Ada.Calendar.Conversions, Ada.Dispatching.EDF, GNAT.Time_Stamp + + * s-intman-mingw.adb: Minor comment fix -- spell 'explicitly' correctly + + * g-trasym.adb: Minor comment fix -- spell 'explicitly' correctly + + * g-trasym.ads: Minor comment improvements + + * s-stalib.adb: Minor comment fix -- spell 'explicitly' correctly + + * a-sequio.ads, a-direio.ads: improve message for tagged type + + * a-strunb.ads: Minor reformatting + + * a-tifiio.adb: Minor reformatting + + * atree.adb (Fix_Parents): Use clearer names for formals + Cleanup and simplify code + Use named notation in calls + + * exp_fixd.adb (Do_Multiply_Fixed_Universal): Use named notation in + confusing calls + + * uintp.adb: Used named notation for some confusing calls + + * bindusg.adb: Minor change in one line of output + + * cstand.adb: Minor reformatting of src representation of Standard + + * a-assert.ads: Add comment. + + * g-decstr.adb: Fix bad indentation + + * expander.ads, expander.adb: Code clean up. + + * sem_dist.ads: Minor comment improvement + + * sem_type.adb, g-dirope.ads, g-exctra.ads, s-valwch.adb, + s-wchstw.adb, targparm.ads, widechar.adb: Minor reformatting + + * i-cstrin.adb: Fix casing error in formal parameter name in call + +2008-04-08 Ed Schonberg <schonberg@adacore.com> + + * binde.adb (Gather_All_Links, Gather_Dependencies): units that are + mentioned in limited_with_clauses to do create semantic dependencies + even though they appear in the ali file. + +2008-04-08 Emmanuel Briot <briot@adacore.com> + + * g-comlin.ads, g-comlin.adb (Expansion): Remove unreachable return + statement. + (Get_Configuration): New subprogram. + + * prj-pp.ads, prj-pp.adb (Pretty_Print): new parameters Id and Id_Tree + These optional parameters help preserve the casing of the project's name + when pretty-printing. + +2008-04-08 Jerome Lambourg <lambourg@adacore.com> + Arnaud Charlet <charlet@adacore.com> + + * bindgen.adb (Gen_Adainit_Ada): If the main program is a CIL function, + then use __gnat_set_exit_status to report the returned status code. + + * comperr.adb (Compiler_Abort): Convert most bug boxes into clean error + messages on .NET, since some constructs of the language are not + properly supported. + + * gnatlink.adb (Gnatlink): In case the command line is too long for the + .NET linker, gnatlink now concatenate all .il files and pass this to + ilasm. + +2008-04-07 Aurelien Jarno <aurelien@aurel32.net> + Xavier Grave <grave@ipno.in2p3.fr> + + * Makefile.in: Add make ifeq define for mips/mipsel support. + * g-soccon-linux-mips.ads, system-linux-mipsel.ads, + system-linux-mips.ads: New files. + +2008-04-07 Aurelien Jarno <aurelien@aurel32.net> + + * sysdep.c: add __GLIBC__ to the #ifdef preprocessor macros to + detect systems using GNU libc. + * gsocket.h: ditto. + * socket.c: ditto. + * adaint.c: ditto. + * link.c: ditto. + +2008-04-07 Aurelien Jarno <aurelien@aurel32.net> + + * s-osinte-linux-kfreebsd.ads (SC_NPROCESSORS_ONLN): New + constant constant for sysconf call. + (bit_field): New packed boolean type used by cpu_set_t. + (cpu_set_t): New type corresponding to the C type with + the same name. Note that on the Ada side we use a bit + field array for the affinity mask. There is not need + for the C macro for setting individual bit. + (pthread_setaffinity_np): New imported routine. + * Makefile.in: Use s-tasinf-linux.ads and s-tasinf-linux.adb + on GNU/kFreeBSD. + +2008-04-07 Eric Botcazou <ebotcazou@adacore.com> + + * utils2.c (build_binary_op): Fold ARRAY_REF and ARRAY_RANGE_REF too. + +2008-04-07 Eric Botcazou <ebotcazou@adacore.com> + + * gigi.h (create_subprog_type): Remove returns_with_dsp parameter. + * decl.c (gnat_to_gnu_entity): Adjust for above new prototype. + * utils.c (create_subprog_type): Remove returns_with_dsp parameter. + * trans.c (gnat_to_gnu) <N_Return_Statement>: Remove code dealing with + Return by Depressed Stack Pointer. + +2008-04-06 Eric Botcazou <ebotcazou@adacore.com> + + * decl.c (is_variable_size): Do not unconditionally return false + on non-strict alignment platforms. + +2008-04-06 Eric Botcazou <ebotcazou@adacore.com> + + * decl.c (rest_of_type_decl_compilation_no_defer): New local function + used to process all the variants of the specified type. + (gnat_to_gnu_entity): Invoke rest_of_type_decl_compilation for enumeral + types too. Call rest_of_type_decl_compilation_no_defer if undeferring. + (rest_of_type_decl_compilation): Likewise. + * utils.c (gnat_pushdecl): Propagate the name to all variants of type. + 2008-04-03 Paolo Bonzini <bonzini@gnu.org> - * gigi.h (insert_block): Kill. - * utils.c (insert_block): Kill. + * gigi.h (insert_block): Kill. + * utils.c (insert_block): Kill. 2008-04-02 Eric Botcazou <ebotcazou@adacore.com> @@ -823,8 +2591,8 @@ 2008-03-18 Paolo Bonzini <bonzini@gnu.org> - * misc.c (LANG_HOOKS_REDUCE_BIT_FIELD_OPERATIONS): Delete. - + * misc.c (LANG_HOOKS_REDUCE_BIT_FIELD_OPERATIONS): Delete. + 2008-03-15 Ralf Wildenhues <Ralf.Wildenhues@gmx.de> * gnat_rm.texi (Implementation Defined Characteristics) diff --git a/gcc/ada/Make-lang.in b/gcc/ada/Make-lang.in index 83ad1aa2b8f..94c293f5d5b 100644 --- a/gcc/ada/Make-lang.in +++ b/gcc/ada/Make-lang.in @@ -44,8 +44,17 @@ RMDIR = rm -rf # Extra flags to pass to recursive makes. -BOOT_ADAFLAGS= $(ADAFLAGS) -ADAFLAGS= -gnatpg -gnata +COMMON_ADAFLAGS= -gnatpg -gnata +BOOT_ADAFLAGS= $(COMMON_ADAFLAGS) + +ifeq ($(CROSS),) +# If not in cross context we are probably doing a bootstrap +# so disable warnings during stage1 +ADAFLAGS= $(COMMON_ADAFLAGS) -gnatws +else +ADAFLAGS= $(COMMON_ADAFLAGS) +endif + ALL_ADAFLAGS = $(CFLAGS) $(ALL_ADA_CFLAGS) $(X_ADAFLAGS) $(T_ADAFLAGS) \ $(ADAFLAGS) FORCE_DEBUG_ADAFLAGS = -g @@ -143,7 +152,8 @@ GNAT_ADA_OBJS = ada/ada.o ada/a-charac.o ada/a-chlat1.o ada/a-except.o \ ada/s-secsta.o ada/s-strops.o ada/s-sopco3.o ada/s-sopco4.o ada/s-sopco5.o \ ada/s-traent.o ada/s-wchcnv.o ada/s-wchcon.o ada/s-wchjis.o \ ada/s-unstyp.o ada/scans.o ada/scng.o ada/scn.o ada/sdefault.o ada/sem.o \ - ada/sem_aggr.o ada/sem_attr.o ada/sem_cat.o ada/sem_ch10.o ada/sem_ch11.o \ + ada/sem_aggr.o ada/sem_attr.o ada/sem_aux.o \ + ada/sem_cat.o ada/sem_ch10.o ada/sem_ch11.o \ ada/sem_ch12.o ada/sem_ch13.o ada/sem_ch2.o ada/sem_ch3.o ada/sem_ch4.o \ ada/sem_ch5.o ada/sem_ch6.o ada/sem_ch7.o ada/sem_ch8.o ada/sem_ch9.o \ ada/sem_case.o ada/sem_disp.o ada/sem_dist.o ada/sem_elab.o ada/sem_elim.o \ @@ -153,7 +163,8 @@ GNAT_ADA_OBJS = ada/ada.o ada/a-charac.o ada/a-chlat1.o ada/a-except.o \ ada/sinput-l.o ada/snames.o ada/sprint.o ada/stand.o ada/stringt.o \ ada/style.o ada/styleg.o ada/styleg-c.o ada/switch.o ada/switch-c.o \ ada/stylesw.o ada/validsw.o ada/system.o ada/table.o ada/targparm.o \ - ada/tbuild.o ada/tree_gen.o ada/tree_io.o ada/treepr.o ada/treeprs.o \ + ada/tbuild.o ada/tree_gen.o ada/tree_in.o \ + ada/tree_io.o ada/treepr.o ada/treeprs.o \ ada/ttypef.o ada/ttypes.o ada/types.o ada/uintp.o ada/uname.o ada/urealp.o \ ada/usage.o ada/widechar.o ada/s-crtl.o ada/seh_init.o ada/targext.o \ ada/s-restri.o @@ -319,10 +330,6 @@ ada.all.cross: then \ $(MV) gnatbind$(exeext) gnatbind-cross$(exeext); \ fi - -if [ -f gnatbl$(exeext) ] ; \ - then \ - $(MV) gnatbl$(exeext) gnatbl-cross$(exeext); \ - fi -if [ -f gnatchop$(exeext) ] ; \ then \ $(MV) gnatchop$(exeext) gnatchop-cross$(exeext); \ @@ -489,7 +496,7 @@ doc/gnat-style.pdf: ada/gnat-style.texi $(gcc_docdir)/include/fdl.texi # Install the binder program as $(target_noncanonical)-gnatbind # and also as either gnatbind (if native) or $(tooldir)/bin/gnatbind # likewise for gnatf, gnatchop, and gnatlink, gnatkr, gnatmake, gnat, -# gnatprep, gnatbl, gnatls, gnatxref, gnatfind, gnatname, gnatclean, +# gnatprep, gnatls, gnatxref, gnatfind, gnatname, gnatclean, # gnatsym, gprmake ada.install-common: $(MKDIR) $(DESTDIR)$(bindir) @@ -510,21 +517,6 @@ ada.install-common: fi -if [ -f gnat1$(exeext) ] ; \ then \ - if [ -f gnatbl-cross$(exeext) ] ; \ - then \ - $(RM) $(DESTDIR)$(bindir)/$(target_noncanonical)-gnatbl$(exeext); \ - $(INSTALL_PROGRAM) gnatbl-cross$(exeext) $(DESTDIR)$(bindir)/$(target_noncanonical)-gnatbl$(exeext); \ - if [ -d $(DESTDIR)$(tooldir)/bin/. ] ; then \ - rm -f $(DESTDIR)$(tooldir)/bin/gnatbl$(exeext); \ - $(INSTALL_PROGRAM) gnatbl-cross$(exeext) $(DESTDIR)$(tooldir)/bin/gnatbl$(exeext); \ - fi; \ - else \ - $(RM) $(DESTDIR)$(bindir)/gnatbl$(exeext); \ - $(INSTALL_PROGRAM) gnatbl$(exeext) $(DESTDIR)$(bindir)/gnatbl$(exeext); \ - fi ; \ - fi - -if [ -f gnat1$(exeext) ] ; \ - then \ if [ -f gnatchop-cross$(exeext) ] ; \ then \ $(RM) $(DESTDIR)$(bindir)/$(target_noncanonical)-gnatchop$(exeext); \ @@ -744,7 +736,6 @@ ada.install-man: ada.uninstall: -$(RM) $(DESTDIR)$(bindir)/gnatbind$(exeext) - -$(RM) $(DESTDIR)$(bindir)/gnatbl$(exeext) -$(RM) $(DESTDIR)$(bindir)/gnatchop$(exeext) -$(RM) $(DESTDIR)$(bindir)/gnat$(exeext) -$(RM) $(DESTDIR)$(bindir)/gnatfind$(exeext) @@ -760,7 +751,6 @@ ada.uninstall: -$(RM) $(DESTDIR)$(bindir)/gnatclean$(exeext) -$(RM) $(DESTDIR)$(bindir)/gnatsym$(exeext) -$(RM) $(DESTDIR)$(bindir)/$(target_noncanonical)-gnatbind$(exeext) - -$(RM) $(DESTDIR)$(bindir)/$(target_noncanonical)-gnatbl$(exeext) -$(RM) $(DESTDIR)$(bindir)/$(target_noncanonical)-gnatchop$(exeext) -$(RM) $(DESTDIR)$(bindir)/$(target_noncanonical)-gnat$(exeext) -$(RM) $(DESTDIR)$(bindir)/$(target_noncanonical)-gnatfind$(exeext) @@ -776,7 +766,6 @@ ada.uninstall: -$(RM) $(DESTDIR)$(bindir)/$(target_noncanonical)-gnatclean$(exeext) -$(RM) $(DESTDIR)$(bindir)/$(target_noncanonical)-gnatsym$(exeext) -$(RM) $(DESTDIR)$(tooldir)/bin/gnatbind$(exeext) - -$(RM) $(DESTDIR)$(tooldir)/bin/gnatbl$(exeext) -$(RM) $(DESTDIR)$(tooldir)/bin/gnatchop$(exeext) -$(RM) $(DESTDIR)$(tooldir)/bin/gnat$(exeext) -$(RM) $(DESTDIR)$(tooldir)/bin/gnatfind$(exeext) @@ -806,7 +795,6 @@ ada.mostlyclean: ada.clean: ada.distclean: -$(RM) ada/Makefile - -$(RM) gnatbl$(exeext) -$(RM) gnatchop$(exeext) -$(RM) gnat$(exeext) -$(RM) gnatdll$(exeext) @@ -1382,17 +1370,18 @@ ada/comperr.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \ ada/g-hesorg.ads ada/g-htable.ads ada/gnatvsn.ads ada/hostparm.ads \ ada/lib.ads ada/lib.adb ada/lib-list.adb ada/lib-sort.adb ada/namet.ads \ ada/nlists.ads ada/nlists.adb ada/opt.ads ada/osint.ads ada/output.ads \ - ada/output.adb ada/sdefault.ads ada/sinfo.ads ada/sinfo.adb \ - ada/sinput.ads ada/sinput.adb ada/snames.ads ada/sprint.ads \ - ada/stand.ads ada/stringt.ads ada/system.ads ada/s-exctab.ads \ - ada/s-htable.ads ada/s-imenne.ads ada/s-memory.ads ada/s-os_lib.ads \ - ada/s-parame.ads ada/s-secsta.ads ada/s-soflin.ads ada/s-stache.ads \ - ada/s-stalib.ads ada/s-stoele.ads ada/s-stoele.adb ada/s-strops.ads \ - ada/s-sopco3.ads ada/s-sopco4.ads ada/s-sopco5.ads ada/s-string.ads \ - ada/s-traent.ads ada/s-unstyp.ads ada/s-wchcon.ads ada/table.ads \ - ada/table.adb ada/tree_io.ads ada/treepr.ads ada/types.ads \ - ada/uintp.ads ada/uintp.adb ada/uname.ads ada/unchconv.ads \ - ada/unchdeal.ads ada/urealp.ads ada/widechar.ads + ada/output.adb ada/rident.ads ada/sdefault.ads ada/sinfo.ads \ + ada/sinfo.adb ada/sinput.ads ada/sinput.adb ada/snames.ads \ + ada/sprint.ads ada/stand.ads ada/stringt.ads ada/system.ads \ + ada/s-exctab.ads ada/s-htable.ads ada/s-imenne.ads ada/s-memory.ads \ + ada/s-os_lib.ads ada/s-parame.ads ada/s-rident.ads ada/s-secsta.ads \ + ada/s-soflin.ads ada/s-stache.ads ada/s-stalib.ads ada/s-stoele.ads \ + ada/s-stoele.adb ada/s-strops.ads ada/s-sopco3.ads ada/s-sopco4.ads \ + ada/s-sopco5.ads ada/s-string.ads ada/s-traent.ads ada/s-unstyp.ads \ + ada/s-wchcon.ads ada/table.ads ada/table.adb ada/targparm.ads \ + ada/tree_io.ads ada/treepr.ads ada/types.ads ada/uintp.ads \ + ada/uintp.adb ada/uname.ads ada/unchconv.ads ada/unchdeal.ads \ + ada/urealp.ads ada/widechar.ads ada/csets.o : ada/ada.ads ada/a-unccon.ads ada/a-uncdea.ads ada/csets.ads \ ada/csets.adb ada/debug.ads ada/hostparm.ads ada/opt.ads ada/system.ads \ @@ -1591,32 +1580,34 @@ ada/exp_attr.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \ ada/casing.ads ada/checks.ads ada/csets.ads ada/debug.ads ada/einfo.ads \ ada/einfo.adb ada/elists.ads ada/elists.adb ada/err_vars.ads \ ada/errout.ads ada/erroutc.ads ada/exp_aggr.ads ada/exp_atag.ads \ - ada/exp_attr.ads ada/exp_attr.adb ada/exp_ch2.ads ada/exp_ch6.ads \ - ada/exp_ch7.ads ada/exp_ch9.ads ada/exp_imgv.ads ada/exp_pakd.ads \ - ada/exp_strm.ads ada/exp_tss.ads ada/exp_util.ads ada/exp_util.adb \ - ada/exp_vfpt.ads ada/fname.ads ada/fname-uf.ads ada/freeze.ads \ - ada/get_targ.ads ada/gnat.ads ada/g-htable.ads ada/gnatvsn.ads \ - ada/hostparm.ads ada/inline.ads ada/interfac.ads ada/itypes.ads \ - ada/lib.ads ada/lib-xref.ads ada/namet.ads ada/namet.adb ada/nlists.ads \ - ada/nlists.adb ada/nmake.ads ada/nmake.adb ada/opt.ads ada/output.ads \ - ada/restrict.ads ada/restrict.adb ada/rident.ads ada/rtsfind.ads \ - ada/scans.ads ada/scn.ads ada/scng.ads ada/scng.adb ada/sem.ads \ - ada/sem_attr.ads ada/sem_ch6.ads ada/sem_ch7.ads ada/sem_ch8.ads \ - ada/sem_eval.ads ada/sem_res.ads ada/sem_type.ads ada/sem_util.ads \ - ada/sem_util.adb ada/sinfo.ads ada/sinfo.adb ada/sinput.ads \ - ada/snames.ads ada/stand.ads ada/stringt.ads ada/stringt.adb \ - ada/style.ads ada/styleg.ads ada/styleg.adb ada/styleg-c.ads \ - ada/stylesw.ads ada/system.ads ada/s-carun8.ads ada/s-crc32.ads \ - ada/s-exctab.ads ada/s-htable.ads ada/s-imenne.ads ada/s-memory.ads \ - ada/s-os_lib.ads ada/s-parame.ads ada/s-rident.ads ada/s-secsta.ads \ - ada/s-soflin.ads ada/s-stache.ads ada/s-stalib.ads ada/s-stoele.ads \ - ada/s-stoele.adb ada/s-strops.ads ada/s-sopco3.ads ada/s-sopco4.ads \ - ada/s-sopco5.ads ada/s-string.ads ada/s-traent.ads ada/s-unstyp.ads \ - ada/s-utf_32.ads ada/s-wchcon.ads ada/table.ads ada/table.adb \ - ada/targparm.ads ada/tbuild.ads ada/tbuild.adb ada/tree_io.ads \ - ada/ttypes.ads ada/types.ads ada/types.adb ada/uintp.ads ada/uintp.adb \ - ada/uname.ads ada/unchconv.ads ada/unchdeal.ads ada/urealp.ads \ - ada/validsw.ads ada/widechar.ads + ada/exp_attr.ads ada/exp_attr.adb ada/exp_ch2.ads ada/exp_ch3.ads \ + ada/exp_ch6.ads ada/exp_ch7.ads ada/exp_ch9.ads ada/exp_imgv.ads \ + ada/exp_pakd.ads ada/exp_strm.ads ada/exp_tss.ads ada/exp_util.ads \ + ada/exp_util.adb ada/exp_vfpt.ads ada/fname.ads ada/fname-uf.ads \ + ada/freeze.ads ada/get_targ.ads ada/gnat.ads ada/g-hesorg.ads \ + ada/g-htable.ads ada/gnatvsn.ads ada/hostparm.ads ada/inline.ads \ + ada/interfac.ads ada/itypes.ads ada/lib.ads ada/lib.adb \ + ada/lib-list.adb ada/lib-sort.adb ada/lib-xref.ads ada/namet.ads \ + ada/namet.adb ada/nlists.ads ada/nlists.adb ada/nmake.ads ada/nmake.adb \ + ada/opt.ads ada/output.ads ada/restrict.ads ada/restrict.adb \ + ada/rident.ads ada/rtsfind.ads ada/scans.ads ada/scn.ads ada/scng.ads \ + ada/scng.adb ada/sem.ads ada/sem_attr.ads ada/sem_ch6.ads \ + ada/sem_ch7.ads ada/sem_ch8.ads ada/sem_eval.ads ada/sem_res.ads \ + ada/sem_type.ads ada/sem_util.ads ada/sem_util.adb ada/sinfo.ads \ + ada/sinfo.adb ada/sinput.ads ada/snames.ads ada/stand.ads \ + ada/stringt.ads ada/stringt.adb ada/style.ads ada/styleg.ads \ + ada/styleg.adb ada/styleg-c.ads ada/stylesw.ads ada/system.ads \ + ada/s-carun8.ads ada/s-crc32.ads ada/s-exctab.ads ada/s-htable.ads \ + ada/s-imenne.ads ada/s-memory.ads ada/s-os_lib.ads ada/s-parame.ads \ + ada/s-rident.ads ada/s-secsta.ads ada/s-soflin.ads ada/s-stache.ads \ + ada/s-stalib.ads ada/s-stoele.ads ada/s-stoele.adb ada/s-strops.ads \ + ada/s-sopco3.ads ada/s-sopco4.ads ada/s-sopco5.ads ada/s-string.ads \ + ada/s-traent.ads ada/s-unstyp.ads ada/s-utf_32.ads ada/s-wchcon.ads \ + ada/table.ads ada/table.adb ada/targparm.ads ada/tbuild.ads \ + ada/tbuild.adb ada/tree_io.ads ada/ttypes.ads ada/types.ads \ + ada/types.adb ada/uintp.ads ada/uintp.adb ada/uname.ads \ + ada/unchconv.ads ada/unchdeal.ads ada/urealp.ads ada/validsw.ads \ + ada/widechar.ads ada/exp_ch11.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \ ada/a-uncdea.ads ada/alloc.ads ada/atree.ads ada/atree.adb \ @@ -2116,8 +2107,8 @@ ada/exp_prag.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \ ada/lib.ads ada/namet.ads ada/nlists.ads ada/nlists.adb ada/nmake.ads \ ada/nmake.adb ada/opt.ads ada/output.ads ada/restrict.ads \ ada/restrict.adb ada/rident.ads ada/rtsfind.ads ada/sem.ads \ - ada/sem_eval.ads ada/sem_res.ads ada/sem_util.ads ada/sinfo.ads \ - ada/sinfo.adb ada/sinput.ads ada/snames.ads ada/snames.adb \ + ada/sem_res.ads ada/sem_util.ads ada/sinfo.ads ada/sinfo.adb \ + ada/sinput.ads ada/sinput.adb ada/snames.ads ada/snames.adb \ ada/stand.ads ada/stringt.ads ada/stringt.adb ada/system.ads \ ada/s-exctab.ads ada/s-htable.ads ada/s-imenne.ads ada/s-memory.ads \ ada/s-os_lib.ads ada/s-parame.ads ada/s-rident.ads ada/s-soflin.ads \ @@ -2343,19 +2334,19 @@ ada/frontend.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \ ada/nmake.adb ada/opt.ads ada/osint.ads ada/output.ads ada/par.ads \ ada/prepcomp.ads ada/restrict.ads ada/rident.ads ada/rtsfind.ads \ ada/scans.ads ada/scn.ads ada/scng.ads ada/scng.adb ada/sem.ads \ - ada/sem_ch8.ads ada/sem_elab.ads ada/sem_prag.ads ada/sem_warn.ads \ - ada/sinfo.ads ada/sinfo.adb ada/sinput.ads ada/sinput.adb \ - ada/sinput-l.ads ada/snames.ads ada/sprint.ads ada/stand.ads \ - ada/stringt.ads ada/style.ads ada/styleg.ads ada/styleg.adb \ - ada/styleg-c.ads ada/stylesw.ads ada/system.ads ada/s-crc32.ads \ - ada/s-crc32.adb ada/s-exctab.ads ada/s-htable.ads ada/s-imenne.ads \ - ada/s-memory.ads ada/s-os_lib.ads ada/s-parame.ads ada/s-rident.ads \ - ada/s-soflin.ads ada/s-stache.ads ada/s-stalib.ads ada/s-stoele.ads \ - ada/s-stoele.adb ada/s-strops.ads ada/s-sopco3.ads ada/s-sopco4.ads \ - ada/s-sopco5.ads ada/s-string.ads ada/s-traent.ads ada/s-unstyp.ads \ - ada/s-utf_32.ads ada/s-wchcon.ads ada/table.ads ada/table.adb \ - ada/targparm.ads ada/tbuild.ads ada/tbuild.adb ada/tree_io.ads \ - ada/types.ads ada/uintp.ads ada/uintp.adb ada/uname.ads \ + ada/sem_aux.ads ada/sem_ch8.ads ada/sem_elab.ads ada/sem_prag.ads \ + ada/sem_warn.ads ada/sinfo.ads ada/sinfo.adb ada/sinput.ads \ + ada/sinput.adb ada/sinput-l.ads ada/snames.ads ada/sprint.ads \ + ada/stand.ads ada/stringt.ads ada/style.ads ada/styleg.ads \ + ada/styleg.adb ada/styleg-c.ads ada/stylesw.ads ada/system.ads \ + ada/s-crc32.ads ada/s-crc32.adb ada/s-exctab.ads ada/s-htable.ads \ + ada/s-imenne.ads ada/s-memory.ads ada/s-os_lib.ads ada/s-parame.ads \ + ada/s-rident.ads ada/s-soflin.ads ada/s-stache.ads ada/s-stalib.ads \ + ada/s-stoele.ads ada/s-stoele.adb ada/s-strops.ads ada/s-sopco3.ads \ + ada/s-sopco4.ads ada/s-sopco5.ads ada/s-string.ads ada/s-traent.ads \ + ada/s-unstyp.ads ada/s-utf_32.ads ada/s-wchcon.ads ada/table.ads \ + ada/table.adb ada/targparm.ads ada/tbuild.ads ada/tbuild.adb \ + ada/tree_io.ads ada/types.ads ada/uintp.ads ada/uintp.adb ada/uname.ads \ ada/unchconv.ads ada/unchdeal.ads ada/urealp.ads ada/widechar.ads ada/g-byorma.o : ada/gnat.ads ada/g-byorma.ads ada/g-byorma.adb \ @@ -3140,6 +3131,15 @@ ada/sem_attr.o : ada/ada.ads ada/a-charac.ads ada/a-chlat1.ads \ ada/uintp.adb ada/unchconv.ads ada/unchdeal.ads ada/urealp.ads \ ada/urealp.adb ada/validsw.ads ada/widechar.ads +ada/sem_aux.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \ + ada/a-uncdea.ads ada/alloc.ads ada/debug.ads ada/hostparm.ads \ + ada/opt.ads ada/output.ads ada/sem_aux.ads ada/sem_aux.adb \ + ada/system.ads ada/s-exctab.ads ada/s-memory.ads ada/s-os_lib.ads \ + ada/s-parame.ads ada/s-stalib.ads ada/s-strops.ads ada/s-sopco3.ads \ + ada/s-sopco4.ads ada/s-sopco5.ads ada/s-string.ads ada/s-traent.ads \ + ada/s-unstyp.ads ada/s-wchcon.ads ada/table.ads ada/table.adb \ + ada/tree_io.ads ada/types.ads ada/unchconv.ads ada/unchdeal.ads + ada/sem_case.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \ ada/a-uncdea.ads ada/alloc.ads ada/atree.ads ada/atree.adb \ ada/casing.ads ada/debug.ads ada/einfo.ads ada/einfo.adb ada/elists.ads \ @@ -3159,30 +3159,39 @@ ada/sem_case.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \ ada/sem_cat.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \ ada/a-uncdea.ads ada/alloc.ads ada/atree.ads ada/atree.adb \ - ada/casing.ads ada/debug.ads ada/einfo.ads ada/einfo.adb ada/elists.ads \ - ada/elists.adb ada/err_vars.ads ada/errout.ads ada/erroutc.ads \ - ada/exp_tss.ads ada/fname.ads ada/gnat.ads ada/g-hesorg.ads \ - ada/g-htable.ads ada/hostparm.ads ada/lib.ads ada/lib.adb \ - ada/lib-list.adb ada/lib-sort.adb ada/namet.ads ada/nlists.ads \ - ada/nlists.adb ada/nmake.ads ada/opt.ads ada/output.ads ada/sem.ads \ - ada/sem_cat.ads ada/sem_cat.adb ada/sem_eval.ads ada/sem_util.ads \ - ada/sinfo.ads ada/sinfo.adb ada/sinput.ads ada/snames.ads ada/stand.ads \ - ada/stringt.ads ada/system.ads ada/s-exctab.ads ada/s-htable.ads \ - ada/s-imenne.ads ada/s-memory.ads ada/s-os_lib.ads ada/s-parame.ads \ - ada/s-stalib.ads ada/s-strops.ads ada/s-sopco3.ads ada/s-sopco4.ads \ + ada/casing.ads ada/checks.ads ada/csets.ads ada/debug.ads ada/einfo.ads \ + ada/einfo.adb ada/elists.ads ada/elists.adb ada/err_vars.ads \ + ada/errout.ads ada/erroutc.ads ada/exp_tss.ads ada/exp_util.ads \ + ada/fname.ads ada/freeze.ads ada/get_targ.ads ada/gnat.ads \ + ada/g-hesorg.ads ada/g-htable.ads ada/hostparm.ads ada/interfac.ads \ + ada/lib.ads ada/lib.adb ada/lib-list.adb ada/lib-sort.adb \ + ada/lib-xref.ads ada/namet.ads ada/namet.adb ada/nlists.ads \ + ada/nlists.adb ada/nmake.ads ada/opt.ads ada/output.ads ada/rident.ads \ + ada/rtsfind.ads ada/scans.ads ada/scn.ads ada/scng.ads ada/scng.adb \ + ada/sem.ads ada/sem_attr.ads ada/sem_cat.ads ada/sem_cat.adb \ + ada/sem_ch6.ads ada/sem_ch8.ads ada/sem_eval.ads ada/sem_res.ads \ + ada/sem_type.ads ada/sem_util.ads ada/sem_util.adb ada/sinfo.ads \ + ada/sinfo.adb ada/sinput.ads ada/snames.ads ada/stand.ads \ + ada/stringt.ads ada/style.ads ada/styleg.ads ada/styleg.adb \ + ada/styleg-c.ads ada/stylesw.ads ada/system.ads ada/s-crc32.ads \ + ada/s-exctab.ads ada/s-htable.ads ada/s-imenne.ads ada/s-memory.ads \ + ada/s-os_lib.ads ada/s-parame.ads ada/s-rident.ads ada/s-secsta.ads \ + ada/s-soflin.ads ada/s-stache.ads ada/s-stalib.ads ada/s-stoele.ads \ + ada/s-stoele.adb ada/s-strops.ads ada/s-sopco3.ads ada/s-sopco4.ads \ ada/s-sopco5.ads ada/s-string.ads ada/s-traent.ads ada/s-unstyp.ads \ - ada/s-wchcon.ads ada/table.ads ada/table.adb ada/tree_io.ads \ + ada/s-utf_32.ads ada/s-wchcon.ads ada/table.ads ada/table.adb \ + ada/targparm.ads ada/tbuild.ads ada/tree_io.ads ada/ttypes.ads \ ada/types.ads ada/uintp.ads ada/uintp.adb ada/uname.ads \ - ada/unchconv.ads ada/unchdeal.ads ada/urealp.ads + ada/unchconv.ads ada/unchdeal.ads ada/urealp.ads ada/widechar.ads ada/sem_ch10.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \ ada/a-uncdea.ads ada/alloc.ads ada/atree.ads ada/atree.adb \ ada/casing.ads ada/checks.ads ada/csets.ads ada/debug.ads ada/einfo.ads \ - ada/einfo.adb ada/elists.ads ada/err_vars.ads ada/errout.ads \ - ada/erroutc.ads ada/exp_tss.ads ada/exp_util.ads ada/fname.ads \ - ada/fname-uf.ads ada/freeze.ads ada/get_targ.ads ada/gnat.ads \ - ada/g-hesorg.ads ada/g-htable.ads ada/hostparm.ads ada/impunit.ads \ - ada/inline.ads ada/interfac.ads ada/lib.ads ada/lib.adb \ + ada/einfo.adb ada/elists.ads ada/elists.adb ada/err_vars.ads \ + ada/errout.ads ada/erroutc.ads ada/exp_tss.ads ada/exp_util.ads \ + ada/fname.ads ada/fname-uf.ads ada/freeze.ads ada/get_targ.ads \ + ada/gnat.ads ada/g-hesorg.ads ada/g-htable.ads ada/hostparm.ads \ + ada/impunit.ads ada/inline.ads ada/interfac.ads ada/lib.ads ada/lib.adb \ ada/lib-list.adb ada/lib-load.ads ada/lib-sort.adb ada/lib-xref.ads \ ada/namet.ads ada/namet.adb ada/nlists.ads ada/nlists.adb ada/nmake.ads \ ada/nmake.adb ada/opt.ads ada/output.ads ada/restrict.ads \ @@ -3213,18 +3222,18 @@ ada/sem_ch11.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \ ada/hostparm.ads ada/lib.ads ada/lib-xref.ads ada/namet.ads \ ada/nlists.ads ada/nlists.adb ada/nmake.ads ada/nmake.adb ada/opt.ads \ ada/output.ads ada/restrict.ads ada/rident.ads ada/rtsfind.ads \ - ada/sem.ads ada/sem_ch11.ads ada/sem_ch11.adb ada/sem_ch5.ads \ - ada/sem_ch8.ads ada/sem_eval.ads ada/sem_res.ads ada/sem_util.ads \ - ada/sem_warn.ads ada/sem_warn.adb ada/sinfo.ads ada/sinfo.adb \ - ada/sinput.ads ada/snames.ads ada/stand.ads ada/stringt.ads \ - ada/system.ads ada/s-exctab.ads ada/s-htable.ads ada/s-imenne.ads \ - ada/s-memory.ads ada/s-os_lib.ads ada/s-parame.ads ada/s-rident.ads \ - ada/s-soflin.ads ada/s-stache.ads ada/s-stalib.ads ada/s-stoele.ads \ - ada/s-stoele.adb ada/s-strops.ads ada/s-sopco3.ads ada/s-sopco4.ads \ - ada/s-sopco5.ads ada/s-string.ads ada/s-traent.ads ada/s-unstyp.ads \ - ada/s-wchcon.ads ada/table.ads ada/table.adb ada/tree_io.ads \ - ada/types.ads ada/uintp.ads ada/uintp.adb ada/unchconv.ads \ - ada/unchdeal.ads ada/urealp.ads + ada/sem.ads ada/sem_aux.ads ada/sem_ch11.ads ada/sem_ch11.adb \ + ada/sem_ch5.ads ada/sem_ch8.ads ada/sem_eval.ads ada/sem_res.ads \ + ada/sem_util.ads ada/sem_warn.ads ada/sem_warn.adb ada/sinfo.ads \ + ada/sinfo.adb ada/sinput.ads ada/snames.ads ada/stand.ads \ + ada/stringt.ads ada/system.ads ada/s-exctab.ads ada/s-htable.ads \ + ada/s-imenne.ads ada/s-memory.ads ada/s-os_lib.ads ada/s-parame.ads \ + ada/s-rident.ads ada/s-soflin.ads ada/s-stache.ads ada/s-stalib.ads \ + ada/s-stoele.ads ada/s-stoele.adb ada/s-strops.ads ada/s-sopco3.ads \ + ada/s-sopco4.ads ada/s-sopco5.ads ada/s-string.ads ada/s-traent.ads \ + ada/s-unstyp.ads ada/s-wchcon.ads ada/table.ads ada/table.adb \ + ada/tree_io.ads ada/types.ads ada/uintp.ads ada/uintp.adb \ + ada/unchconv.ads ada/unchdeal.ads ada/urealp.ads ada/sem_ch12.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \ ada/a-uncdea.ads ada/alloc.ads ada/atree.ads ada/atree.adb \ @@ -3266,14 +3275,14 @@ ada/sem_ch13.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \ ada/erroutc.ads ada/exp_dist.ads ada/exp_tss.ads ada/exp_util.ads \ ada/fname.ads ada/fname-uf.ads ada/get_targ.ads ada/gnat.ads \ ada/g-hesorg.ads ada/g-hesorg.adb ada/g-htable.ads ada/hostparm.ads \ - ada/layout.ads ada/lib.ads ada/lib.adb ada/lib-list.adb \ - ada/lib-load.ads ada/lib-sort.adb ada/lib-xref.ads ada/namet.ads \ - ada/nlists.ads ada/nlists.adb ada/nmake.ads ada/nmake.adb ada/opt.ads \ - ada/output.ads ada/restrict.ads ada/rident.ads ada/rtsfind.ads \ - ada/rtsfind.adb ada/sem.ads ada/sem_ch13.ads ada/sem_ch13.adb \ - ada/sem_ch7.ads ada/sem_ch8.ads ada/sem_dist.ads ada/sem_eval.ads \ - ada/sem_res.ads ada/sem_type.ads ada/sem_util.ads ada/sem_warn.ads \ - ada/sinfo.ads ada/sinfo.adb ada/sinput.ads ada/snames.ads ada/stand.ads \ + ada/lib.ads ada/lib.adb ada/lib-list.adb ada/lib-load.ads \ + ada/lib-sort.adb ada/lib-xref.ads ada/namet.ads ada/nlists.ads \ + ada/nlists.adb ada/nmake.ads ada/nmake.adb ada/opt.ads ada/output.ads \ + ada/restrict.ads ada/rident.ads ada/rtsfind.ads ada/rtsfind.adb \ + ada/sem.ads ada/sem_ch13.ads ada/sem_ch13.adb ada/sem_ch7.ads \ + ada/sem_ch8.ads ada/sem_dist.ads ada/sem_eval.ads ada/sem_res.ads \ + ada/sem_type.ads ada/sem_util.ads ada/sem_warn.ads ada/sinfo.ads \ + ada/sinfo.adb ada/sinput.ads ada/snames.ads ada/stand.ads \ ada/stringt.ads ada/system.ads ada/s-exctab.ads ada/s-htable.ads \ ada/s-imenne.ads ada/s-memory.ads ada/s-os_lib.ads ada/s-parame.ads \ ada/s-rident.ads ada/s-soflin.ads ada/s-stache.ads ada/s-stalib.ads \ @@ -3382,25 +3391,25 @@ ada/sem_ch5.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \ ada/nlists.adb ada/nmake.ads ada/nmake.adb ada/opt.ads ada/output.ads \ ada/restrict.ads ada/rident.ads ada/rtsfind.ads ada/scans.ads \ ada/scn.ads ada/scng.ads ada/scng.adb ada/sem.ads ada/sem_aggr.ads \ - ada/sem_attr.ads ada/sem_case.ads ada/sem_case.adb ada/sem_cat.ads \ - ada/sem_ch3.ads ada/sem_ch4.ads ada/sem_ch5.ads ada/sem_ch5.adb \ - ada/sem_ch6.ads ada/sem_ch8.ads ada/sem_disp.ads ada/sem_dist.ads \ - ada/sem_elab.ads ada/sem_eval.ads ada/sem_eval.adb ada/sem_intr.ads \ - ada/sem_res.ads ada/sem_res.adb ada/sem_type.ads ada/sem_util.ads \ - ada/sem_util.adb ada/sem_warn.ads ada/sem_warn.adb ada/sinfo.ads \ - ada/sinfo.adb ada/sinput.ads ada/snames.ads ada/sprint.ads \ - ada/stand.ads ada/stringt.ads ada/stringt.adb ada/style.ads \ - ada/styleg.ads ada/styleg.adb ada/styleg-c.ads ada/stylesw.ads \ - ada/system.ads ada/s-crc32.ads ada/s-exctab.ads ada/s-htable.ads \ - ada/s-imenne.ads ada/s-memory.ads ada/s-os_lib.ads ada/s-parame.ads \ - ada/s-rident.ads ada/s-secsta.ads ada/s-soflin.ads ada/s-stache.ads \ - ada/s-stalib.ads ada/s-stoele.ads ada/s-stoele.adb ada/s-strops.ads \ - ada/s-sopco3.ads ada/s-sopco4.ads ada/s-sopco5.ads ada/s-string.ads \ - ada/s-traent.ads ada/s-unstyp.ads ada/s-utf_32.ads ada/s-wchcon.ads \ - ada/table.ads ada/table.adb ada/targparm.ads ada/tbuild.ads \ - ada/tree_io.ads ada/ttypes.ads ada/types.ads ada/uintp.ads \ - ada/uintp.adb ada/uname.ads ada/unchconv.ads ada/unchdeal.ads \ - ada/urealp.ads ada/validsw.ads ada/widechar.ads + ada/sem_attr.ads ada/sem_aux.ads ada/sem_case.ads ada/sem_case.adb \ + ada/sem_cat.ads ada/sem_ch3.ads ada/sem_ch4.ads ada/sem_ch5.ads \ + ada/sem_ch5.adb ada/sem_ch6.ads ada/sem_ch8.ads ada/sem_disp.ads \ + ada/sem_dist.ads ada/sem_elab.ads ada/sem_eval.ads ada/sem_eval.adb \ + ada/sem_intr.ads ada/sem_res.ads ada/sem_res.adb ada/sem_type.ads \ + ada/sem_util.ads ada/sem_util.adb ada/sem_warn.ads ada/sem_warn.adb \ + ada/sinfo.ads ada/sinfo.adb ada/sinput.ads ada/snames.ads \ + ada/sprint.ads ada/stand.ads ada/stringt.ads ada/stringt.adb \ + ada/style.ads ada/styleg.ads ada/styleg.adb ada/styleg-c.ads \ + ada/stylesw.ads ada/system.ads ada/s-crc32.ads ada/s-exctab.ads \ + ada/s-htable.ads ada/s-imenne.ads ada/s-memory.ads ada/s-os_lib.ads \ + ada/s-parame.ads ada/s-rident.ads ada/s-secsta.ads ada/s-soflin.ads \ + ada/s-stache.ads ada/s-stalib.ads ada/s-stoele.ads ada/s-stoele.adb \ + ada/s-strops.ads ada/s-sopco3.ads ada/s-sopco4.ads ada/s-sopco5.ads \ + ada/s-string.ads ada/s-traent.ads ada/s-unstyp.ads ada/s-utf_32.ads \ + ada/s-wchcon.ads ada/table.ads ada/table.adb ada/targparm.ads \ + ada/tbuild.ads ada/tree_io.ads ada/ttypes.ads ada/types.ads \ + ada/uintp.ads ada/uintp.adb ada/uname.ads ada/unchconv.ads \ + ada/unchdeal.ads ada/urealp.ads ada/validsw.ads ada/widechar.ads ada/sem_ch6.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \ ada/a-uncdea.ads ada/alloc.ads ada/atree.ads ada/atree.adb \ @@ -3451,20 +3460,21 @@ ada/sem_ch7.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \ ada/scng.adb ada/sem.ads ada/sem_attr.ads ada/sem_cat.ads \ ada/sem_ch10.ads ada/sem_ch12.ads ada/sem_ch3.ads ada/sem_ch6.ads \ ada/sem_ch7.ads ada/sem_ch7.adb ada/sem_ch8.ads ada/sem_disp.ads \ - ada/sem_eval.ads ada/sem_res.ads ada/sem_type.ads ada/sem_util.ads \ - ada/sem_util.adb ada/sem_warn.ads ada/sinfo.ads ada/sinfo.adb \ - ada/sinput.ads ada/sinput.adb ada/snames.ads ada/snames.adb \ - ada/stand.ads ada/stringt.ads ada/style.ads ada/styleg.ads \ - ada/styleg.adb ada/styleg-c.ads ada/stylesw.ads ada/system.ads \ - ada/s-crc32.ads ada/s-exctab.ads ada/s-htable.ads ada/s-imenne.ads \ - ada/s-memory.ads ada/s-os_lib.ads ada/s-parame.ads ada/s-rident.ads \ - ada/s-secsta.ads ada/s-soflin.ads ada/s-stache.ads ada/s-stalib.ads \ - ada/s-stoele.ads ada/s-stoele.adb ada/s-strops.ads ada/s-sopco3.ads \ - ada/s-sopco4.ads ada/s-sopco5.ads ada/s-string.ads ada/s-traent.ads \ - ada/s-unstyp.ads ada/s-utf_32.ads ada/s-wchcon.ads ada/table.ads \ - ada/table.adb ada/targparm.ads ada/tbuild.ads ada/tree_io.ads \ - ada/ttypes.ads ada/types.ads ada/uintp.ads ada/uintp.adb ada/uname.ads \ - ada/unchconv.ads ada/unchdeal.ads ada/urealp.ads ada/widechar.ads + ada/sem_eval.ads ada/sem_prag.ads ada/sem_res.ads ada/sem_type.ads \ + ada/sem_util.ads ada/sem_util.adb ada/sem_warn.ads ada/sinfo.ads \ + ada/sinfo.adb ada/sinput.ads ada/sinput.adb ada/snames.ads \ + ada/snames.adb ada/stand.ads ada/stringt.ads ada/style.ads \ + ada/styleg.ads ada/styleg.adb ada/styleg-c.ads ada/stylesw.ads \ + ada/system.ads ada/s-crc32.ads ada/s-exctab.ads ada/s-htable.ads \ + ada/s-imenne.ads ada/s-memory.ads ada/s-os_lib.ads ada/s-parame.ads \ + ada/s-rident.ads ada/s-secsta.ads ada/s-soflin.ads ada/s-stache.ads \ + ada/s-stalib.ads ada/s-stoele.ads ada/s-stoele.adb ada/s-strops.ads \ + ada/s-sopco3.ads ada/s-sopco4.ads ada/s-sopco5.ads ada/s-string.ads \ + ada/s-traent.ads ada/s-unstyp.ads ada/s-utf_32.ads ada/s-wchcon.ads \ + ada/table.ads ada/table.adb ada/targparm.ads ada/tbuild.ads \ + ada/tree_io.ads ada/ttypes.ads ada/types.ads ada/uintp.ads \ + ada/uintp.adb ada/uname.ads ada/unchconv.ads ada/unchdeal.ads \ + ada/urealp.ads ada/widechar.ads ada/sem_ch8.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \ ada/a-uncdea.ads ada/alloc.ads ada/atree.ads ada/atree.adb \ @@ -3723,27 +3733,27 @@ ada/sem_prag.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \ ada/nmake.ads ada/nmake.adb ada/opt.ads ada/output.ads ada/restrict.ads \ ada/restrict.adb ada/rident.ads ada/rtsfind.ads ada/scans.ads \ ada/scn.ads ada/scng.ads ada/scng.adb ada/sem.ads ada/sem_aggr.ads \ - ada/sem_attr.ads ada/sem_cat.ads ada/sem_ch13.ads ada/sem_ch3.ads \ - ada/sem_ch4.ads ada/sem_ch6.ads ada/sem_ch8.ads ada/sem_disp.ads \ - ada/sem_dist.ads ada/sem_elab.ads ada/sem_elim.ads ada/sem_eval.ads \ - ada/sem_eval.adb ada/sem_intr.ads ada/sem_mech.ads ada/sem_prag.ads \ - ada/sem_prag.adb ada/sem_res.ads ada/sem_res.adb ada/sem_type.ads \ - ada/sem_util.ads ada/sem_util.adb ada/sem_vfpt.ads ada/sem_warn.ads \ - ada/sinfo.ads ada/sinfo.adb ada/sinfo-cn.ads ada/sinput.ads \ - ada/sinput.adb ada/snames.ads ada/snames.adb ada/stand.ads \ - ada/stringt.ads ada/stringt.adb ada/style.ads ada/styleg.ads \ - ada/styleg.adb ada/styleg-c.ads ada/stylesw.ads ada/system.ads \ - ada/s-carun8.ads ada/s-crc32.ads ada/s-exctab.ads ada/s-exctab.adb \ - ada/s-htable.ads ada/s-imenne.ads ada/s-memory.ads ada/s-os_lib.ads \ - ada/s-parame.ads ada/s-rident.ads ada/s-secsta.ads ada/s-soflin.ads \ - ada/s-stache.ads ada/s-stalib.ads ada/s-stoele.ads ada/s-stoele.adb \ - ada/s-strops.ads ada/s-sopco3.ads ada/s-sopco4.ads ada/s-sopco5.ads \ - ada/s-string.ads ada/s-traent.ads ada/s-unstyp.ads ada/s-utf_32.ads \ - ada/s-wchcon.ads ada/table.ads ada/table.adb ada/targparm.ads \ - ada/tbuild.ads ada/tbuild.adb ada/tree_io.ads ada/ttypes.ads \ - ada/types.ads ada/types.adb ada/uintp.ads ada/uintp.adb ada/uname.ads \ - ada/unchconv.ads ada/unchdeal.ads ada/urealp.ads ada/urealp.adb \ - ada/validsw.ads ada/widechar.ads + ada/sem_attr.ads ada/sem_aux.ads ada/sem_cat.ads ada/sem_ch13.ads \ + ada/sem_ch3.ads ada/sem_ch4.ads ada/sem_ch6.ads ada/sem_ch8.ads \ + ada/sem_disp.ads ada/sem_dist.ads ada/sem_elab.ads ada/sem_elim.ads \ + ada/sem_eval.ads ada/sem_eval.adb ada/sem_intr.ads ada/sem_mech.ads \ + ada/sem_prag.ads ada/sem_prag.adb ada/sem_res.ads ada/sem_res.adb \ + ada/sem_type.ads ada/sem_util.ads ada/sem_util.adb ada/sem_vfpt.ads \ + ada/sem_warn.ads ada/sinfo.ads ada/sinfo.adb ada/sinfo-cn.ads \ + ada/sinput.ads ada/sinput.adb ada/snames.ads ada/snames.adb \ + ada/stand.ads ada/stringt.ads ada/stringt.adb ada/style.ads \ + ada/styleg.ads ada/styleg.adb ada/styleg-c.ads ada/stylesw.ads \ + ada/system.ads ada/s-carun8.ads ada/s-crc32.ads ada/s-exctab.ads \ + ada/s-exctab.adb ada/s-htable.ads ada/s-imenne.ads ada/s-memory.ads \ + ada/s-os_lib.ads ada/s-parame.ads ada/s-rident.ads ada/s-secsta.ads \ + ada/s-soflin.ads ada/s-stache.ads ada/s-stalib.ads ada/s-stoele.ads \ + ada/s-stoele.adb ada/s-strops.ads ada/s-sopco3.ads ada/s-sopco4.ads \ + ada/s-sopco5.ads ada/s-string.ads ada/s-traent.ads ada/s-unstyp.ads \ + ada/s-utf_32.ads ada/s-wchcon.ads ada/table.ads ada/table.adb \ + ada/targparm.ads ada/tbuild.ads ada/tbuild.adb ada/tree_io.ads \ + ada/ttypes.ads ada/types.ads ada/types.adb ada/uintp.ads ada/uintp.adb \ + ada/uname.ads ada/unchconv.ads ada/unchdeal.ads ada/urealp.ads \ + ada/urealp.adb ada/validsw.ads ada/widechar.ads ada/sem_res.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \ ada/a-uncdea.ads ada/alloc.ads ada/atree.ads ada/atree.adb \ @@ -3767,20 +3777,21 @@ ada/sem_res.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \ ada/sem_disp.ads ada/sem_dist.ads ada/sem_elab.ads ada/sem_eval.ads \ ada/sem_eval.adb ada/sem_intr.ads ada/sem_res.ads ada/sem_res.adb \ ada/sem_type.ads ada/sem_util.ads ada/sem_util.adb ada/sem_warn.ads \ - ada/sinfo.ads ada/sinfo.adb ada/sinput.ads ada/snames.ads \ - ada/sprint.ads ada/stand.ads ada/stringt.ads ada/stringt.adb \ - ada/style.ads ada/styleg.ads ada/styleg.adb ada/styleg-c.ads \ - ada/stylesw.ads ada/system.ads ada/s-carun8.ads ada/s-crc32.ads \ - ada/s-exctab.ads ada/s-htable.ads ada/s-imenne.ads ada/s-memory.ads \ - ada/s-os_lib.ads ada/s-parame.ads ada/s-rident.ads ada/s-secsta.ads \ - ada/s-soflin.ads ada/s-stache.ads ada/s-stalib.ads ada/s-stoele.ads \ - ada/s-stoele.adb ada/s-strops.ads ada/s-sopco3.ads ada/s-sopco4.ads \ - ada/s-sopco5.ads ada/s-string.ads ada/s-traent.ads ada/s-unstyp.ads \ - ada/s-utf_32.ads ada/s-wchcon.ads ada/table.ads ada/table.adb \ - ada/targparm.ads ada/tbuild.ads ada/tbuild.adb ada/tree_io.ads \ - ada/ttypes.ads ada/types.ads ada/types.adb ada/uintp.ads ada/uintp.adb \ - ada/uname.ads ada/unchconv.ads ada/unchdeal.ads ada/urealp.ads \ - ada/urealp.adb ada/validsw.ads ada/widechar.ads + ada/sinfo.ads ada/sinfo.adb ada/sinput.ads ada/sinput.adb \ + ada/snames.ads ada/sprint.ads ada/stand.ads ada/stringt.ads \ + ada/stringt.adb ada/style.ads ada/styleg.ads ada/styleg.adb \ + ada/styleg-c.ads ada/stylesw.ads ada/system.ads ada/s-carun8.ads \ + ada/s-crc32.ads ada/s-exctab.ads ada/s-htable.ads ada/s-imenne.ads \ + ada/s-memory.ads ada/s-os_lib.ads ada/s-parame.ads ada/s-rident.ads \ + ada/s-secsta.ads ada/s-soflin.ads ada/s-stache.ads ada/s-stalib.ads \ + ada/s-stoele.ads ada/s-stoele.adb ada/s-strops.ads ada/s-sopco3.ads \ + ada/s-sopco4.ads ada/s-sopco5.ads ada/s-string.ads ada/s-traent.ads \ + ada/s-unstyp.ads ada/s-utf_32.ads ada/s-wchcon.ads ada/table.ads \ + ada/table.adb ada/targparm.ads ada/tbuild.ads ada/tbuild.adb \ + ada/tree_io.ads ada/ttypes.ads ada/types.ads ada/types.adb \ + ada/uintp.ads ada/uintp.adb ada/uname.ads ada/unchconv.ads \ + ada/unchdeal.ads ada/urealp.ads ada/urealp.adb ada/validsw.ads \ + ada/widechar.ads ada/sem_smem.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \ ada/a-uncdea.ads ada/alloc.ads ada/atree.ads ada/atree.adb \ @@ -3881,22 +3892,22 @@ ada/sem_warn.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \ ada/lib-xref.ads ada/namet.ads ada/namet.adb ada/nlists.ads \ ada/nlists.adb ada/nmake.ads ada/opt.ads ada/output.ads ada/rident.ads \ ada/rtsfind.ads ada/scans.ads ada/scn.ads ada/scng.ads ada/scng.adb \ - ada/sem.ads ada/sem_attr.ads ada/sem_ch6.ads ada/sem_ch8.ads \ - ada/sem_eval.ads ada/sem_res.ads ada/sem_type.ads ada/sem_util.ads \ - ada/sem_util.adb ada/sem_warn.ads ada/sem_warn.adb ada/sinfo.ads \ - ada/sinfo.adb ada/sinput.ads ada/sinput.adb ada/snames.ads \ - ada/stand.ads ada/stringt.ads ada/stringt.adb ada/style.ads \ + ada/sem.ads ada/sem_attr.ads ada/sem_aux.ads ada/sem_ch6.ads \ + ada/sem_ch8.ads ada/sem_eval.ads ada/sem_res.ads ada/sem_type.ads \ + ada/sem_util.ads ada/sem_util.adb ada/sem_warn.ads ada/sem_warn.adb \ + ada/sinfo.ads ada/sinfo.adb ada/sinput.ads ada/sinput.adb \ + ada/snames.ads ada/stand.ads ada/stringt.ads ada/style.ads \ ada/styleg.ads ada/styleg.adb ada/styleg-c.ads ada/stylesw.ads \ - ada/system.ads ada/s-carun8.ads ada/s-crc32.ads ada/s-exctab.ads \ - ada/s-htable.ads ada/s-imenne.ads ada/s-memory.ads ada/s-os_lib.ads \ - ada/s-parame.ads ada/s-rident.ads ada/s-secsta.ads ada/s-soflin.ads \ - ada/s-stache.ads ada/s-stalib.ads ada/s-stoele.ads ada/s-stoele.adb \ - ada/s-strops.ads ada/s-sopco3.ads ada/s-sopco4.ads ada/s-sopco5.ads \ - ada/s-string.ads ada/s-traent.ads ada/s-unstyp.ads ada/s-utf_32.ads \ - ada/s-wchcon.ads ada/table.ads ada/table.adb ada/targparm.ads \ - ada/tbuild.ads ada/tree_io.ads ada/ttypes.ads ada/types.ads \ - ada/types.adb ada/uintp.ads ada/uintp.adb ada/uname.ads \ - ada/unchconv.ads ada/unchdeal.ads ada/urealp.ads ada/widechar.ads + ada/system.ads ada/s-crc32.ads ada/s-exctab.ads ada/s-htable.ads \ + ada/s-imenne.ads ada/s-memory.ads ada/s-os_lib.ads ada/s-parame.ads \ + ada/s-rident.ads ada/s-secsta.ads ada/s-soflin.ads ada/s-stache.ads \ + ada/s-stalib.ads ada/s-stoele.ads ada/s-stoele.adb ada/s-strops.ads \ + ada/s-sopco3.ads ada/s-sopco4.ads ada/s-sopco5.ads ada/s-string.ads \ + ada/s-traent.ads ada/s-unstyp.ads ada/s-utf_32.ads ada/s-wchcon.ads \ + ada/table.ads ada/table.adb ada/targparm.ads ada/tbuild.ads \ + ada/tree_io.ads ada/ttypes.ads ada/types.ads ada/uintp.ads \ + ada/uintp.adb ada/uname.ads ada/unchconv.ads ada/unchdeal.ads \ + ada/urealp.ads ada/widechar.ads ada/sinfo-cn.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \ ada/a-uncdea.ads ada/alloc.ads ada/atree.ads ada/atree.adb \ @@ -3994,18 +4005,19 @@ ada/sprint.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \ ada/elists.ads ada/fname.ads ada/gnat.ads ada/g-hesorg.ads \ ada/g-htable.ads ada/hostparm.ads ada/interfac.ads ada/lib.ads \ ada/lib.adb ada/lib-list.adb ada/lib-sort.adb ada/namet.ads \ - ada/namet.adb ada/nlists.ads ada/nlists.adb ada/opt.ads ada/output.ads \ - ada/output.adb ada/rtsfind.ads ada/sinfo.ads ada/sinfo.adb \ - ada/sinput.ads ada/sinput.adb ada/sinput-d.ads ada/snames.ads \ - ada/sprint.ads ada/sprint.adb ada/stand.ads ada/stringt.ads \ - ada/stringt.adb ada/system.ads ada/s-exctab.ads ada/s-htable.ads \ - ada/s-imenne.ads ada/s-memory.ads ada/s-os_lib.ads ada/s-parame.ads \ - ada/s-secsta.ads ada/s-stalib.ads ada/s-stoele.ads ada/s-stoele.adb \ - ada/s-strops.ads ada/s-sopco3.ads ada/s-sopco4.ads ada/s-sopco5.ads \ - ada/s-string.ads ada/s-traent.ads ada/s-unstyp.ads ada/s-wchcon.ads \ - ada/table.ads ada/table.adb ada/tree_io.ads ada/types.ads ada/uintp.ads \ - ada/uintp.adb ada/uname.ads ada/unchconv.ads ada/unchdeal.ads \ - ada/urealp.ads ada/urealp.adb ada/widechar.ads + ada/namet.adb ada/nlists.ads ada/nlists.adb ada/nmake.ads ada/opt.ads \ + ada/output.ads ada/output.adb ada/rtsfind.ads ada/sem_util.ads \ + ada/sinfo.ads ada/sinfo.adb ada/sinput.ads ada/sinput.adb \ + ada/sinput-d.ads ada/snames.ads ada/sprint.ads ada/sprint.adb \ + ada/stand.ads ada/stringt.ads ada/stringt.adb ada/system.ads \ + ada/s-exctab.ads ada/s-htable.ads ada/s-imenne.ads ada/s-memory.ads \ + ada/s-os_lib.ads ada/s-parame.ads ada/s-secsta.ads ada/s-stalib.ads \ + ada/s-stoele.ads ada/s-stoele.adb ada/s-strops.ads ada/s-sopco3.ads \ + ada/s-sopco4.ads ada/s-sopco5.ads ada/s-string.ads ada/s-traent.ads \ + ada/s-unstyp.ads ada/s-wchcon.ads ada/table.ads ada/table.adb \ + ada/tree_io.ads ada/types.ads ada/uintp.ads ada/uintp.adb ada/uname.ads \ + ada/unchconv.ads ada/unchdeal.ads ada/urealp.ads ada/urealp.adb \ + ada/widechar.ads ada/stand.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \ ada/a-uncdea.ads ada/alloc.ads ada/debug.ads ada/hostparm.ads \ @@ -4157,14 +4169,27 @@ ada/tree_gen.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \ ada/debug.ads ada/einfo.ads ada/elists.ads ada/fname.ads \ ada/hostparm.ads ada/lib.ads ada/namet.ads ada/nlists.ads ada/opt.ads \ ada/osint.ads ada/osint-c.ads ada/output.ads ada/repinfo.ads \ - ada/sinfo.ads ada/sinput.ads ada/snames.ads ada/stand.ads \ - ada/stringt.ads ada/system.ads ada/s-exctab.ads ada/s-memory.ads \ - ada/s-os_lib.ads ada/s-parame.ads ada/s-stalib.ads ada/s-strops.ads \ - ada/s-sopco3.ads ada/s-sopco4.ads ada/s-sopco5.ads ada/s-string.ads \ - ada/s-traent.ads ada/s-unstyp.ads ada/s-wchcon.ads ada/table.ads \ - ada/table.adb ada/tree_gen.ads ada/tree_gen.adb ada/tree_io.ads \ - ada/types.ads ada/uintp.ads ada/unchconv.ads ada/unchdeal.ads \ - ada/urealp.ads + ada/sem_aux.ads ada/sinfo.ads ada/sinput.ads ada/snames.ads \ + ada/stand.ads ada/stringt.ads ada/system.ads ada/s-exctab.ads \ + ada/s-memory.ads ada/s-os_lib.ads ada/s-parame.ads ada/s-stalib.ads \ + ada/s-strops.ads ada/s-sopco3.ads ada/s-sopco4.ads ada/s-sopco5.ads \ + ada/s-string.ads ada/s-traent.ads ada/s-unstyp.ads ada/s-wchcon.ads \ + ada/table.ads ada/table.adb ada/tree_gen.ads ada/tree_gen.adb \ + ada/tree_in.ads ada/tree_io.ads ada/types.ads ada/uintp.ads \ + ada/unchconv.ads ada/unchdeal.ads ada/urealp.ads + +ada/tree_in.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \ + ada/a-uncdea.ads ada/alloc.ads ada/atree.ads ada/casing.ads \ + ada/csets.ads ada/debug.ads ada/einfo.ads ada/elists.ads ada/fname.ads \ + ada/hostparm.ads ada/lib.ads ada/namet.ads ada/nlists.ads ada/opt.ads \ + ada/output.ads ada/repinfo.ads ada/sem_aux.ads ada/sinfo.ads \ + ada/sinput.ads ada/snames.ads ada/stand.ads ada/stringt.ads \ + ada/system.ads ada/s-exctab.ads ada/s-memory.ads ada/s-os_lib.ads \ + ada/s-parame.ads ada/s-stalib.ads ada/s-strops.ads ada/s-sopco3.ads \ + ada/s-sopco4.ads ada/s-sopco5.ads ada/s-string.ads ada/s-traent.ads \ + ada/s-unstyp.ads ada/s-wchcon.ads ada/table.ads ada/table.adb \ + ada/tree_in.ads ada/tree_in.adb ada/tree_io.ads ada/types.ads \ + ada/uintp.ads ada/unchconv.ads ada/unchdeal.ads ada/urealp.ads ada/tree_io.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \ ada/a-uncdea.ads ada/debug.ads ada/hostparm.ads ada/output.ads \ diff --git a/gcc/ada/Makefile.in b/gcc/ada/Makefile.in index c27e7e216a1..f03776d5681 100644 --- a/gcc/ada/Makefile.in +++ b/gcc/ada/Makefile.in @@ -400,6 +400,7 @@ ifeq ($(strip $(filter-out m68k% wrs vx%,$(targ))),) s-osprim.adb<s-osprim-vxworks.adb \ s-parame.ads<s-parame-vxworks.ads \ s-parame.adb<s-parame-vxworks.adb \ + s-stchop.ads<s-stchop-limit.ads \ s-stchop.adb<s-stchop-vxworks.adb \ s-taprop.adb<s-taprop-vxworks.adb \ s-taspri.ads<s-taspri-vxworks.ads \ @@ -413,7 +414,7 @@ ifeq ($(strip $(filter-out m68k% wrs vx%,$(targ))),) g-sttsne.ads<g-sttsne-locking.ads \ system.ads<system-vxworks-m68k.ads - TOOLS_TARGET_PAIRS=mlib-tgt-specific.adb<mlib-tgt-vxworks.adb + TOOLS_TARGET_PAIRS=mlib-tgt-specific.adb<mlib-tgt-specific-vxworks.adb EXTRA_GNATRTL_NONTASKING_OBJS=i-vxwork.o i-vxwoio.o EXTRA_GNATRTL_TASKING_OBJS=s-vxwork.o @@ -441,6 +442,7 @@ ifeq ($(strip $(filter-out powerpc% wrs vxworks,$(targ))),) s-osprim.adb<s-osprim-vxworks.adb \ s-parame.ads<s-parame-vxworks.ads \ s-parame.adb<s-parame-vxworks.adb \ + s-stchop.ads<s-stchop-limit.ads \ s-stchop.adb<s-stchop-vxworks.adb \ s-taprop.adb<s-taprop-vxworks.adb \ s-taspri.ads<s-taspri-vxworks.ads \ @@ -452,7 +454,7 @@ ifeq ($(strip $(filter-out powerpc% wrs vxworks,$(targ))),) g-sttsne.adb<g-sttsne-vxworks.adb \ g-sttsne.ads<g-sttsne-locking.ads - TOOLS_TARGET_PAIRS=mlib-tgt-specific.adb<mlib-tgt-vxworks.adb + TOOLS_TARGET_PAIRS=mlib-tgt-specific.adb<mlib-tgt-specific-vxworks.adb ifeq ($(strip $(filter-out yes,$(TRACE))),) LIBGNAT_TARGET_PAIRS += \ @@ -526,7 +528,7 @@ ifeq ($(strip $(filter-out powerpc% wrs vxworksae,$(targ))),) g-sttsne.ads<g-sttsne-locking.ads \ system.ads<system-vxworks-ppc-vthread.ads - TOOLS_TARGET_PAIRS=mlib-tgt-specific.adb<mlib-tgt-vxworks.adb + TOOLS_TARGET_PAIRS=mlib-tgt-specific.adb<mlib-tgt-specific-vxworks.adb EXTRA_GNATRTL_NONTASKING_OBJS=i-vxwork.o i-vxwoio.o s-vxwexc.o EXTRA_GNATRTL_TASKING_OBJS=s-vxwork.o @@ -561,6 +563,7 @@ ifeq ($(strip $(filter-out sparc% wrs vx%,$(targ))),) s-osprim.adb<s-osprim-vxworks.adb \ s-parame.ads<s-parame-vxworks.ads \ s-parame.adb<s-parame-vxworks.adb \ + s-stchop.ads<s-stchop-limit.ads \ s-stchop.adb<s-stchop-vxworks.adb \ s-taprop.adb<s-taprop-vxworks.adb \ s-taspri.ads<s-taspri-vxworks.ads \ @@ -574,7 +577,7 @@ ifeq ($(strip $(filter-out sparc% wrs vx%,$(targ))),) g-sttsne.ads<g-sttsne-locking.ads \ system.ads<system-vxworks-sparcv9.ads \ - TOOLS_TARGET_PAIRS=mlib-tgt-specific.adb<mlib-tgt-vxworks.adb + TOOLS_TARGET_PAIRS=mlib-tgt-specific.adb<mlib-tgt-specific-vxworks.adb EXTRA_GNATRTL_NONTASKING_OBJS=i-vxwork.o i-vxwoio.o EXTRA_GNATRTL_TASKING_OBJS=s-vxwork.o @@ -595,6 +598,7 @@ ifeq ($(strip $(filter-out %86 wrs vxworks,$(targ))),) s-osprim.adb<s-osprim-vxworks.adb \ s-parame.ads<s-parame-vxworks.ads \ s-parame.adb<s-parame-vxworks.adb \ + s-stchop.ads<s-stchop-limit.ads \ s-stchop.adb<s-stchop-vxworks.adb \ s-taprop.adb<s-taprop-vxworks.adb \ s-taspri.ads<s-taspri-vxworks.ads \ @@ -607,7 +611,7 @@ ifeq ($(strip $(filter-out %86 wrs vxworks,$(targ))),) g-sttsne.adb<g-sttsne-vxworks.adb \ g-sttsne.ads<g-sttsne-locking.ads - TOOLS_TARGET_PAIRS=mlib-tgt-specific.adb<mlib-tgt-vxworks.adb + TOOLS_TARGET_PAIRS=mlib-tgt-specific.adb<mlib-tgt-specific-vxworks.adb ifeq ($(strip $(filter-out yes,$(TRACE))),) LIBGNAT_TARGET_PAIRS += \ @@ -664,6 +668,7 @@ ifeq ($(strip $(filter-out arm% coff wrs vx%,$(targ))),) s-osprim.adb<s-osprim-vxworks.adb \ s-parame.ads<s-parame-vxworks.ads \ s-parame.adb<s-parame-vxworks.adb \ + s-stchop.ads<s-stchop-limit.ads \ s-stchop.adb<s-stchop-vxworks.adb \ s-taprop.adb<s-taprop-vxworks.adb \ s-taspri.ads<s-taspri-vxworks.ads \ @@ -677,7 +682,7 @@ ifeq ($(strip $(filter-out arm% coff wrs vx%,$(targ))),) g-sttsne.ads<g-sttsne-locking.ads \ system.ads<system-vxworks-arm.ads - TOOLS_TARGET_PAIRS=mlib-tgt-specific.adb<mlib-tgt-vxworks.adb + TOOLS_TARGET_PAIRS=mlib-tgt-specific.adb<mlib-tgt-specific-vxworks.adb EXTRA_GNATRTL_NONTASKING_OBJS=i-vxwork.o i-vxwoio.o EXTRA_GNATRTL_TASKING_OBJS=s-vxwork.o @@ -699,6 +704,7 @@ ifeq ($(strip $(filter-out mips% wrs vx%,$(targ))),) s-osprim.adb<s-osprim-vxworks.adb \ s-parame.ads<s-parame-vxworks.ads \ s-parame.adb<s-parame-vxworks.adb \ + s-stchop.ads<s-stchop-limit.ads \ s-stchop.adb<s-stchop-vxworks.adb \ s-taprop.adb<s-taprop-vxworks.adb \ s-taspri.ads<s-taspri-vxworks.ads \ @@ -712,7 +718,7 @@ ifeq ($(strip $(filter-out mips% wrs vx%,$(targ))),) g-sttsne.ads<g-sttsne-locking.ads \ system.ads<system-vxworks-mips.ads - TOOLS_TARGET_PAIRS=mlib-tgt-specific.adb<mlib-tgt-vxworks.adb + TOOLS_TARGET_PAIRS=mlib-tgt-specific.adb<mlib-tgt-specific-vxworks.adb EXTRA_GNATRTL_NONTASKING_OBJS=i-vxwork.o i-vxwoio.o EXTRA_GNATRTL_TASKING_OBJS=s-vxwork.o @@ -760,7 +766,7 @@ ifeq ($(strip $(filter-out sparc% sun solaris%,$(targ))),) LIBGNAT_TARGET_PAIRS = $(LIBGNAT_TARGET_PAIRS_64) endif - TOOLS_TARGET_PAIRS=mlib-tgt-specific.adb<mlib-tgt-solaris.adb + TOOLS_TARGET_PAIRS=mlib-tgt-specific.adb<mlib-tgt-specific-solaris.adb EH_MECHANISM=-gcc THREADSLIB = -lposix4 -lthread @@ -814,7 +820,7 @@ ifeq ($(strip $(filter-out %86 solaris2%,$(arch) $(osys))),) g-soliop.ads<g-soliop-solaris.ads \ system.ads<system-solaris-x86.ads - TOOLS_TARGET_PAIRS=mlib-tgt-specific.adb<mlib-tgt-solaris.adb + TOOLS_TARGET_PAIRS=mlib-tgt-specific.adb<mlib-tgt-specific-solaris.adb EH_MECHANISM=-gcc THREADSLIB = -lposix4 -lthread @@ -860,6 +866,7 @@ ifeq ($(strip $(filter-out %86 linux%,$(arch) $(osys))),) else LIBGNAT_TARGET_PAIRS += \ g-soccon.ads<g-soccon-linux-x86.ads \ + s-linux.ads<s-linux.ads \ s-osinte.adb<s-osinte-posix.adb \ s-osinte.ads<s-osinte-linux.ads \ s-tasinf.ads<s-tasinf-linux.ads \ @@ -868,10 +875,11 @@ ifeq ($(strip $(filter-out %86 linux%,$(arch) $(osys))),) EH_MECHANISM=-gcc THREADSLIB = -lpthread + EXTRA_GNATRTL_TASKING_OBJS=s-linux.o endif TOOLS_TARGET_PAIRS = \ - mlib-tgt-specific.adb<mlib-tgt-linux.adb \ + mlib-tgt-specific.adb<mlib-tgt-specific-linux.adb \ indepsw.adb<indepsw-gnu.adb GNATLIB_SHARED = gnatlib-shared-dual @@ -892,6 +900,8 @@ ifeq ($(strip $(filter-out %86 kfreebsd%,$(arch) $(osys))),) s-osinte.ads<s-osinte-kfreebsd-gnu.ads \ s-osprim.adb<s-osprim-posix.adb \ s-taprop.adb<s-taprop-linux.adb \ + s-tasinf.ads<s-tasinf-linux.ads \ + s-tasinf.adb<s-tasinf-linux.adb \ s-taspri.ads<s-taspri-posix.ads \ s-tpopsp.adb<s-tpopsp-posix-foreign.adb \ system.ads<system-freebsd-x86.ads @@ -926,7 +936,7 @@ ifeq ($(strip $(filter-out %86 freebsd%,$(arch) $(osys))),) system.ads<system-freebsd-x86.ads TOOLS_TARGET_PAIRS = \ - mlib-tgt-specific.adb<mlib-tgt-linux.adb + mlib-tgt-specific.adb<mlib-tgt-specific-linux.adb GNATLIB_SHARED = gnatlib-shared-dual EH_MECHANISM=-gcc @@ -942,13 +952,14 @@ ifeq ($(strip $(filter-out s390% linux%,$(arch) $(osys))),) a-intnam.ads<a-intnam-linux.ads \ s-inmaop.adb<s-inmaop-posix.adb \ s-intman.adb<s-intman-posix.adb \ + s-linux.ads<s-linux.ads \ s-osinte.adb<s-osinte-posix.adb \ s-osinte.ads<s-osinte-linux.ads \ s-osprim.adb<s-osprim-posix.adb \ s-taprop.adb<s-taprop-linux.adb \ s-tasinf.ads<s-tasinf-linux.ads \ s-tasinf.adb<s-tasinf-linux.adb \ - s-taspri.ads<s-taspri-posix.ads \ + s-taspri.ads<s-taspri-posix-noaltstack.ads \ s-tpopsp.adb<s-tpopsp-posix-foreign.adb \ system.ads<system-linux-s390x.ads else @@ -956,20 +967,22 @@ ifeq ($(strip $(filter-out s390% linux%,$(arch) $(osys))),) a-intnam.ads<a-intnam-linux.ads \ s-inmaop.adb<s-inmaop-posix.adb \ s-intman.adb<s-intman-posix.adb \ + s-linux.ads<s-linux.ads \ s-osinte.adb<s-osinte-posix.adb \ s-osinte.ads<s-osinte-linux.ads \ s-osprim.adb<s-osprim-posix.adb \ s-taprop.adb<s-taprop-linux.adb \ s-tasinf.ads<s-tasinf-linux.ads \ s-tasinf.adb<s-tasinf-linux.adb \ - s-taspri.ads<s-taspri-posix.ads \ + s-taspri.ads<s-taspri-posix-noaltstack.ads \ s-tpopsp.adb<s-tpopsp-posix-foreign.adb \ system.ads<system-linux-s390.ads endif TOOLS_TARGET_PAIRS = \ - mlib-tgt-specific.adb<mlib-tgt-linux.adb + mlib-tgt-specific.adb<mlib-tgt-specific-linux.adb + EXTRA_GNATRTL_TASKING_OBJS=s-linux.o EH_MECHANISM=-gcc THREADSLIB = -lpthread GNATLIB_SHARED = gnatlib-shared-dual @@ -1010,7 +1023,7 @@ ifeq ($(strip $(filter-out mips sgi irix%,$(targ))),) endif EH_MECHANISM=-gcc - TOOLS_TARGET_PAIRS = mlib-tgt-specific.adb<mlib-tgt-irix.adb + TOOLS_TARGET_PAIRS = mlib-tgt-specific.adb<mlib-tgt-specific-irix.adb TGT_LIB = -lexc MISCLIB = -lexc PREFIX_OBJS = $(PREFIX_REAL_OBJS) @@ -1055,7 +1068,7 @@ ifeq ($(strip $(filter-out hppa% hp hpux11%,$(targ))),) g-soccon.ads<g-soccon-hpux.ads \ system.ads<system-hpux.ads - TOOLS_TARGET_PAIRS = mlib-tgt-specific.adb<mlib-tgt-hpux.adb + TOOLS_TARGET_PAIRS = mlib-tgt-specific.adb<mlib-tgt-specific-hpux.adb EH_MECHANISM=-gcc TGT_LIB = /usr/lib/libcl.a THREADSLIB = -lpthread @@ -1085,7 +1098,7 @@ ifeq ($(strip $(filter-out ibm aix%,$(manu) $(osys))),) PREFIX_OBJS=$(PREFIX_REAL_OBJS) TOOLS_TARGET_PAIRS = \ - mlib-tgt-specific.adb<mlib-tgt-aix.adb \ + mlib-tgt-specific.adb<mlib-tgt-specific-aix.adb \ indepsw.adb<indepsw-aix.adb GMEM_LIB = gmemlib @@ -1093,7 +1106,7 @@ endif ifeq ($(strip $(filter-out lynxos,$(osys))),) TOOLS_TARGET_PAIRS = \ - mlib-tgt-specific.adb<mlib-tgt-lynxos.adb \ + mlib-tgt-specific.adb<mlib-tgt-specific-lynxos.adb \ indepsw.adb<indepsw-gnu.adb ifeq ($(strip $(filter-out %86 lynxos,$(arch) $(osys))),) @@ -1169,7 +1182,7 @@ ifeq ($(strip $(filter-out alpha% dec osf%,$(targ))),) g-soccon.ads<g-soccon-tru64.ads \ system.ads<system-tru64.ads - TOOLS_TARGET_PAIRS=mlib-tgt-specific.adb<mlib-tgt-tru64.adb + TOOLS_TARGET_PAIRS=mlib-tgt-specific.adb<mlib-tgt-specific-tru64.adb EH_MECHANISM=-gcc GMEM_LIB=gmemlib @@ -1197,7 +1210,7 @@ ifeq ($(strip $(filter-out ia64 hp vms% openvms%,$(targ))),) LIBGNAT_TARGET_PAIRS_AUX1 = \ g-enblsp.adb<g-enblsp-vms-ia64.adb \ g-trasym.adb<g-trasym-vms-ia64.adb \ - s-auxdec.ads<s-auxdec-vms_64.ads \ + s-asthan.adb<s-asthan-vms-ia64.adb \ s-osinte.adb<s-osinte-vms-ia64.adb \ s-osinte.ads<s-osinte-vms-ia64.ads \ s-vaflop.adb<s-vaflop-vms-ia64.adb \ @@ -1210,8 +1223,9 @@ ifeq ($(strip $(filter-out alpha64 dec vms% openvms% alphavms%,$(targ))),) LIBGNAT_TARGET_PAIRS_AUX1 = \ g-enblsp.adb<g-enblsp-vms-alpha.adb \ g-trasym.adb<g-trasym-vms-alpha.adb \ + s-traent.adb<s-traent-vms.adb \ + s-traent.ads<s-traent-vms.ads \ s-asthan.adb<s-asthan-vms-alpha.adb \ - s-auxdec.ads<s-auxdec-vms_64.ads \ s-osinte.adb<s-osinte-vms.adb \ s-osinte.ads<s-osinte-vms.ads \ s-vaflop.adb<s-vaflop-vms-alpha.adb \ @@ -1248,10 +1262,15 @@ endif i-cpoint.ads<i-cpoint-vms_64.ads \ i-cpoint.adb<i-cpoint-vms_64.adb \ i-cstrea.adb<i-cstrea-vms.adb \ + memtrack.adb<memtrack-vms_64.adb \ + s-auxdec.ads<s-auxdec-vms_64.ads \ + s-crtl.ads<s-crtl-vms_64.ads \ s-inmaop.adb<s-inmaop-vms.adb \ s-interr.adb<s-interr-vms.adb \ s-intman.adb<s-intman-vms.adb \ s-intman.ads<s-intman-vms.ads \ + s-memory.adb<s-memory-vms_64.adb \ + s-memory.ads<s-memory-vms_64.ads \ s-osprim.adb<s-osprim-vms.adb \ s-osprim.ads<s-osprim-vms.ads \ s-taprop.adb<s-taprop-vms.adb \ @@ -1259,25 +1278,25 @@ endif s-tpopsp.adb<s-tpopsp-posix-foreign.adb \ s-tpopde.adb<s-tpopde-vms.adb \ s-tpopde.ads<s-tpopde-vms.ads \ - s-traent.adb<s-traent-vms.adb \ - s-traent.ads<s-traent-vms.ads \ $(LIBGNAT_TARGET_PAIRS_AUX1) \ $(LIBGNAT_TARGET_PAIRS_AUX2) ifeq ($(strip $(filter-out ia64 hp vms% openvms%,$(targ))),) TOOLS_TARGET_PAIRS= \ - mlib-tgt-specific.adb<mlib-tgt-vms-ia64.adb \ + mlib-tgt-specific.adb<mlib-tgt-specific-vms-ia64.adb \ symbols.adb<symbols-vms.adb \ symbols-processing.adb<symbols-processing-vms-ia64.adb else TOOLS_TARGET_PAIRS= \ - mlib-tgt-specific.adb<mlib-tgt-vms-alpha.adb \ + mlib-tgt-specific.adb<mlib-tgt-specific-vms-alpha.adb \ symbols.adb<symbols-vms.adb \ symbols-processing.adb<symbols-processing-vms-alpha.adb endif +adamsg.o: adamsg.msg + -$(DECC) --cc=message adamsg.msg -o adamsg.o - EXTRA_GNATMAKE_OBJS = mlib-tgt-vms.o + EXTRA_GNATMAKE_OBJS = mlib-tgt-vms_common.o GMEM_LIB = gmemlib EH_MECHANISM=-gcc @@ -1286,6 +1305,8 @@ ifeq ($(strip $(filter-out alpha64 dec vms% openvms% alphavms%,$(targ))),) EXTRA_LIBGNAT_SRCS=vmshandler.asm EXTRA_LIBGNAT_OBJS=vmshandler.o endif + EXTRA_LIBGNAT_SRCS+=adamsg.msg + EXTRA_LIBGNAT_OBJS+=adamsg.o EXTRA_GNATRTL_TASKING_OBJS=s-tpopde.o EXTRA_GNATTOOLS = \ ../../gnatlbr$(exeext) \ @@ -1293,7 +1314,7 @@ endif ../../vms_help$(exeext) \ ../../gnat.hlp # This command transforms (YYYYMMDD) into YY,MMDD - GSMATCH_VERSION := $(shell grep "^ *Gnat_Static_Version_String" $(fsrcpfx)gnatvsn.ads | sed -e 's/.*(\(.*\)).*/\1/' -e 's/\(..\)\(..\)\(....\)/\2,\3/') + GSMATCH_VERSION := $(shell grep "^ *Gnat_Static_Version_String" $(fsrcpfx)gnatvsn.ads | sed -e 's/.*(\(.*\)).*/\1/' -e 's/\(..\)\(..\)\(....\).*/\2,\3/') TOOLS_LIBS_LO := --for-linker=sys\\$$\$$library:trace.exe LIBRARY_VERSION := $(subst .,_,$(LIB_VERSION)) endif @@ -1315,8 +1336,7 @@ ifeq ($(strip $(filter-out cygwin32% mingw32% pe,$(osys))),) g-socthi.adb<g-socthi-mingw.adb \ g-stsifd.adb<g-stsifd-sockets.adb \ g-soccon.ads<g-soccon-mingw.ads \ - g-soliop.ads<g-soliop-mingw.ads \ - g-sercom.adb<g-sercom-mingw.adb + g-soliop.ads<g-soliop-mingw.ads ifeq ($(strip $(filter-out rtx_w32 rtx_rtss,$(THREAD_KIND))),) LIBGNAT_TARGET_PAIRS += \ @@ -1326,6 +1346,8 @@ ifeq ($(strip $(filter-out cygwin32% mingw32% pe,$(osys))),) s-taprop.adb<s-taprop-rtx.adb \ system.ads<system-rtx.ads + EXTRA_GNATRTL_NONTASKING_OBJS = s-win32.o + MISCLIB = -lwsock32 -lrtapi_w32 THREADSLIB=-lrtapi_w32 else @@ -1333,6 +1355,7 @@ ifeq ($(strip $(filter-out cygwin32% mingw32% pe,$(osys))),) a-exetim.adb<a-exetim-mingw.adb \ a-exetim.ads<a-exetim-mingw.ads \ a-intnam.ads<a-intnam-mingw.ads \ + g-sercom.adb<g-sercom-mingw.adb \ s-interr.adb<s-interr-sigaction.adb \ s-intman.adb<s-intman-mingw.adb \ s-osinte.ads<s-osinte-mingw.ads \ @@ -1340,8 +1363,8 @@ ifeq ($(strip $(filter-out cygwin32% mingw32% pe,$(osys))),) s-taprop.adb<s-taprop-mingw.adb \ system.ads<system-mingw.ads - EXTRA_GNATRTL_NONTASKING_OBJS = g-regist.o - EXTRA_GNATRTL_TASKING_OBJS=a-exetim.o + EXTRA_GNATRTL_NONTASKING_OBJS = s-win32.o s-win32.o g-regist.o + EXTRA_GNATRTL_TASKING_OBJS = a-exetim.o MISCLIB = -lwsock32 @@ -1351,7 +1374,7 @@ ifeq ($(strip $(filter-out cygwin32% mingw32% pe,$(osys))),) endif TOOLS_TARGET_PAIRS= \ - mlib-tgt-specific.adb<mlib-tgt-mingw.adb \ + mlib-tgt-specific.adb<mlib-tgt-specific-mingw.adb \ indepsw.adb<indepsw-mingw.adb EH_MECHANISM=-gcc @@ -1363,27 +1386,79 @@ ifeq ($(strip $(filter-out cygwin32% mingw32% pe,$(osys))),) LIBRARY_VERSION := $(LIB_VERSION) endif +ifeq ($(strip $(filter-out mips linux%,$(arch) $(osys))),) + LIBGNAT_TARGET_PAIRS = \ + a-intnam.ads<a-intnam-linux.ads \ + g-soccon.ads<g-soccon-linux-mips.ads \ + s-inmaop.adb<s-inmaop-posix.adb \ + s-intman.adb<s-intman-posix.adb \ + s-linux.ads<s-linux.ads \ + s-osinte.adb<s-osinte-posix.adb \ + s-osinte.ads<s-osinte-linux.ads \ + s-osprim.adb<s-osprim-posix.adb \ + s-taprop.adb<s-taprop-linux.adb \ + s-tasinf.ads<s-tasinf-linux.ads \ + s-tasinf.adb<s-tasinf-linux.adb \ + s-taspri.ads<s-taspri-posix.ads \ + s-tpopsp.adb<s-tpopsp-posix-foreign.adb \ + system.ads<system-linux-mips.ads + + EH_MECHANISM=-gcc + THREADSLIB = -lpthread + GNATLIB_SHARED = gnatlib-shared-dual + GMEM_LIB = gmemlib + PREFIX_OBJS = $(PREFIX_REAL_OBJS) + LIBRARY_VERSION := $(LIB_VERSION) +endif + +ifeq ($(strip $(filter-out mipsel linux%,$(arch) $(osys))),) + LIBGNAT_TARGET_PAIRS = \ + a-intnam.ads<a-intnam-linux.ads \ + g-soccon.ads<g-soccon-linux-mips.ads \ + s-inmaop.adb<s-inmaop-posix.adb \ + s-intman.adb<s-intman-posix.adb \ + s-linux.ads<s-linux.ads \ + s-osinte.adb<s-osinte-posix.adb \ + s-osinte.ads<s-osinte-linux.ads \ + s-osprim.adb<s-osprim-posix.adb \ + s-taprop.adb<s-taprop-linux.adb \ + s-tasinf.ads<s-tasinf-linux.ads \ + s-tasinf.adb<s-tasinf-linux.adb \ + s-taspri.ads<s-taspri-posix.ads \ + s-tpopsp.adb<s-tpopsp-posix-foreign.adb \ + system.ads<system-linux-mipsel.ads + + EH_MECHANISM=-gcc + THREADSLIB = -lpthread + GNATLIB_SHARED = gnatlib-shared-dual + GMEM_LIB = gmemlib + PREFIX_OBJS = $(PREFIX_REAL_OBJS) + LIBRARY_VERSION := $(LIB_VERSION) +endif + ifeq ($(strip $(filter-out powerpc% linux%,$(arch) $(osys))),) LIBGNAT_TARGET_PAIRS = \ a-intnam.ads<a-intnam-linux.ads \ g-soccon.ads<g-soccon-linux-ppc.ads \ s-inmaop.adb<s-inmaop-posix.adb \ s-intman.adb<s-intman-posix.adb \ + s-linux.ads<s-linux.ads \ s-osinte.adb<s-osinte-posix.adb \ s-osinte.ads<s-osinte-linux.ads \ s-osprim.adb<s-osprim-posix.adb \ s-taprop.adb<s-taprop-linux.adb \ s-tasinf.ads<s-tasinf-linux.ads \ s-tasinf.adb<s-tasinf-linux.adb \ - s-taspri.ads<s-taspri-posix.ads \ + s-taspri.ads<s-taspri-posix-noaltstack.ads \ s-tpopsp.adb<s-tpopsp-posix-foreign.adb \ g-sercom.adb<g-sercom-linux.adb \ system.ads<system-linux-ppc.ads TOOLS_TARGET_PAIRS = \ - mlib-tgt-specific.adb<mlib-tgt-linux.adb \ + mlib-tgt-specific.adb<mlib-tgt-specific-linux.adb \ indepsw.adb<indepsw-gnu.adb + EXTRA_GNATRTL_TASKING_OBJS=s-linux.o EH_MECHANISM=-gcc THREADSLIB = -lpthread GNATLIB_SHARED = gnatlib-shared-dual @@ -1397,20 +1472,22 @@ ifeq ($(strip $(filter-out sparc% linux%,$(arch) $(osys))),) a-intnam.ads<a-intnam-linux.ads \ s-inmaop.adb<s-inmaop-posix.adb \ s-intman.adb<s-intman-posix.adb \ + s-linux.ads<s-linux.ads \ s-osinte.adb<s-osinte-posix.adb \ s-osinte.ads<s-osinte-linux.ads \ s-osprim.adb<s-osprim-posix.adb \ s-taprop.adb<s-taprop-linux.adb \ s-tasinf.ads<s-tasinf-linux.ads \ s-tasinf.adb<s-tasinf-linux.adb \ - s-taspri.ads<s-taspri-posix.ads \ + s-taspri.ads<s-taspri-posix-noaltstack.ads \ s-tpopsp.adb<s-tpopsp-posix-foreign.adb \ system.ads<system-linux-sparc.ads TOOLS_TARGET_PAIRS = \ - mlib-tgt-specific.adb<mlib-tgt-linux.adb \ + mlib-tgt-specific.adb<mlib-tgt-specific-linux.adb \ indepsw.adb<indepsw-gnu.adb + EXTRA_GNATRTL_TASKING_OBJS=s-linux.o EH_MECHANISM=-gcc THREADSLIB = -lpthread GNATLIB_SHARED = gnatlib-shared-dual @@ -1424,20 +1501,22 @@ ifeq ($(strip $(filter-out hppa% linux%,$(arch) $(osys))),) a-intnam.ads<a-intnam-linux.ads \ s-inmaop.adb<s-inmaop-posix.adb \ s-intman.adb<s-intman-posix.adb \ + s-linux.ads<s-linux-hppa.ads \ s-osinte.adb<s-osinte-posix.adb \ - s-osinte.ads<s-osinte-linux-hppa.ads \ + s-osinte.ads<s-osinte-linux.ads \ s-osprim.adb<s-osprim-posix.adb \ s-taprop.adb<s-taprop-linux.adb \ s-tasinf.ads<s-tasinf-linux.ads \ s-tasinf.adb<s-tasinf-linux.adb \ - s-taspri.ads<s-taspri-posix.ads \ + s-taspri.ads<s-taspri-posix-noaltstack.ads \ s-tpopsp.adb<s-tpopsp-posix-foreign.adb \ system.ads<system-linux-hppa.ads TOOLS_TARGET_PAIRS = \ - mlib-tgt-specific.adb<mlib-tgt-linux.adb \ + mlib-tgt-specific.adb<mlib-tgt-specific-linux.adb \ indepsw.adb<indepsw-gnu.adb + EXTRA_GNATRTL_TASKING_OBJS=s-linux.o EH_MECHANISM=-gcc THREADSLIB = -lpthread GNATLIB_SHARED = gnatlib-shared-dual @@ -1481,6 +1560,7 @@ ifeq ($(strip $(filter-out %ia64 linux%,$(arch) $(osys))),) g-soccon.ads<g-soccon-linux-64.ads \ s-inmaop.adb<s-inmaop-posix.adb \ s-intman.adb<s-intman-posix.adb \ + s-linux.ads<s-linux.ads \ s-osinte.ads<s-osinte-linux.ads \ s-osinte.adb<s-osinte-posix.adb \ s-osprim.adb<s-osprim-posix.adb \ @@ -1488,14 +1568,15 @@ ifeq ($(strip $(filter-out %ia64 linux%,$(arch) $(osys))),) s-tasinf.ads<s-tasinf-linux.ads \ s-tasinf.adb<s-tasinf-linux.adb \ s-tpopsp.adb<s-tpopsp-posix-foreign.adb \ - s-taspri.ads<s-taspri-posix.ads \ + s-taspri.ads<s-taspri-posix-noaltstack.ads \ g-sercom.adb<g-sercom-linux.adb \ system.ads<system-linux-ia64.ads TOOLS_TARGET_PAIRS = \ - mlib-tgt-specific.adb<mlib-tgt-linux.adb \ + mlib-tgt-specific.adb<mlib-tgt-specific-linux.adb \ indepsw.adb<indepsw-gnu.adb + EXTRA_GNATRTL_TASKING_OBJS=s-linux.o EH_MECHANISM=-gcc MISCLIB= THREADSLIB=-lpthread @@ -1510,20 +1591,22 @@ ifeq ($(strip $(filter-out alpha% linux%,$(arch) $(osys))),) a-intnam.ads<a-intnam-linux.ads \ s-inmaop.adb<s-inmaop-posix.adb \ s-intman.adb<s-intman-posix.adb \ - s-osinte.ads<s-osinte-linux-alpha.ads \ + s-linux.ads<s-linux-alpha.ads \ + s-osinte.ads<s-osinte-linux.ads \ s-osinte.adb<s-osinte-posix.adb \ s-osprim.adb<s-osprim-posix.adb \ s-taprop.adb<s-taprop-linux.adb \ s-tasinf.ads<s-tasinf-linux.ads \ s-tasinf.adb<s-tasinf-linux.adb \ s-tpopsp.adb<s-tpopsp-posix-foreign.adb \ - s-taspri.ads<s-taspri-posix.ads \ + s-taspri.ads<s-taspri-posix-noaltstack.ads \ system.ads<system-linux-alpha.ads TOOLS_TARGET_PAIRS = \ - mlib-tgt-specific.adb<mlib-tgt-linux.adb \ + mlib-tgt-specific.adb<mlib-tgt-specific-linux.adb \ indepsw.adb<indepsw-gnu.adb + EXTRA_GNATRTL_TASKING_OBJS=s-linux.o EH_MECHANISM=-gcc MISCLIB= THREADSLIB=-lpthread @@ -1540,6 +1623,7 @@ ifeq ($(strip $(filter-out %x86_64 linux%,$(arch) $(osys))),) g-soccon.ads<g-soccon-linux-64.ads \ s-inmaop.adb<s-inmaop-posix.adb \ s-intman.adb<s-intman-posix.adb \ + s-linux.ads<s-linux.ads \ s-osinte.ads<s-osinte-linux.ads \ s-osinte.adb<s-osinte-posix.adb \ s-osprim.adb<s-osprim-posix.adb \ @@ -1552,9 +1636,10 @@ ifeq ($(strip $(filter-out %x86_64 linux%,$(arch) $(osys))),) system.ads<system-linux-x86_64.ads TOOLS_TARGET_PAIRS = \ - mlib-tgt-specific.adb<mlib-tgt-linux.adb \ + mlib-tgt-specific.adb<mlib-tgt-specific-linux.adb \ indepsw.adb<indepsw-gnu.adb + EXTRA_GNATRTL_TASKING_OBJS=s-linux.o EH_MECHANISM=-gcc THREADSLIB=-lpthread GNATLIB_SHARED=gnatlib-shared-dual @@ -1597,7 +1682,7 @@ ifeq ($(strip $(filter-out darwin%,$(osys))),) endif TOOLS_TARGET_PAIRS = \ - mlib-tgt-specific.adb<mlib-tgt-darwin.adb + mlib-tgt-specific.adb<mlib-tgt-specific-darwin.adb EH_MECHANISM=-gcc GNATLIB_SHARED = gnatlib-shared-darwin @@ -1787,12 +1872,6 @@ gnatlink-re: link.o targext.o $(GCC_LINK) $(ALL_CFLAGS) $(LDFLAGS) -o $@ b_gnatl.o $(GNATLINK_OBJS) \ $(TOOLS_LIBS) -../../gnatbl$(exeext): gnatbl.o - $(GCC_LINK) -o $@ $(ALL_CFLAGS) $(LDFLAGS) gnatbl.o $(TOOLS_LIBS) - -gnatbl.o: gnatbl.c adaint.h - $(CC) $(ALL_CFLAGS) $(INCLUDES) -c $< $(OUTPUT_OPTION) - ../stamp-gnatlib: @if [ ! -f stamp-gnatlib ] ; \ then \ @@ -2039,20 +2118,18 @@ gnatlib-shared-vms: THREAD_KIND="$(THREAD_KIND)" \ gnatlib $(RM) rts/libgna*$(soext) - cd rts && echo "case_sensitive=yes" > SYMVEC_$$$$.opt && \ - objdump --syms $(LIBGNAT_OBJS) $(GNATRTL_NONTASKING_OBJS) | \ - $(SHLIB_SYMVEC) >> SYMVEC_$$$$.opt && \ - echo "case_sensitive=NO" >> SYMVEC_$$$$.opt && \ + cd rts && \ + ../../gnatsym -s SYMVEC_$$$$.opt \ + $(LIBGNAT_OBJS) $(GNATRTL_NONTASKING_OBJS) && \ ../../xgcc -g -B../../ -shared -shared-libgcc \ -o libgnat$(hyphen)$(LIBRARY_VERSION)$(soext) libgnat.a \ sys\$$library:trace.exe \ --for-linker=/noinform \ --for-linker=SYMVEC_$$$$.opt \ --for-linker=gsmatch=equal,$(GSMATCH_VERSION) - cd rts && echo "case_sensitive=yes" > SYMVEC_$$$$.opt && \ - objdump --syms $(GNATRTL_TASKING_OBJS) | \ - $(SHLIB_SYMVEC) >> SYMVEC_$$$$.opt && \ - echo "case_sensitive=NO" >> SYMVEC_$$$$.opt && \ + cd rts && \ + ../../gnatsym -s SYMVEC_$$$$.opt \ + $(GNATRTL_TASKING_OBJS) && \ ../../xgcc -g -B../../ -shared -shared-libgcc \ -o libgnarl$(hyphen)$(LIBRARY_VERSION)$(soext) \ libgnarl.a libgnat$(hyphen)$(LIBRARY_VERSION)$(soext) \ diff --git a/gcc/ada/Makefile.rtl b/gcc/ada/Makefile.rtl index 9eaa7070d1b..755fa31da85 100644 --- a/gcc/ada/Makefile.rtl +++ b/gcc/ada/Makefile.rtl @@ -79,6 +79,7 @@ GNATRTL_NONTASKING_OBJS= \ a-calari$(objext) \ a-caldel$(objext) \ a-calend$(objext) \ + a-calcon$(objext) \ a-calfor$(objext) \ a-catizo$(objext) \ a-cdlili$(objext) \ @@ -380,6 +381,7 @@ GNATRTL_NONTASKING_OBJS= \ g-sttsne$(objext) \ g-table$(objext) \ g-tasloc$(objext) \ + g-timsta$(objext) \ g-traceb$(objext) \ g-utf_32$(objext) \ g-u3spch$(objext) \ @@ -558,6 +560,7 @@ GNATRTL_NONTASKING_OBJS= \ s-stopoo$(objext) \ s-stratt$(objext) \ s-strops$(objext) \ + s-ststop$(objext) \ s-soflin$(objext) \ s-memory$(objext) \ s-memcop$(objext) \ diff --git a/gcc/ada/a-assert.ads b/gcc/ada/a-assert.ads index 614421b7e4e..bfc2229beda 100755 --- a/gcc/ada/a-assert.ads +++ b/gcc/ada/a-assert.ads @@ -25,6 +25,9 @@ package Ada.Assertions is pragma Pure (Assertions); Assertion_Error : exception renames System.Assertions.Assert_Failure; + -- This is the renaming that is allowed by 11.4.2(24). Note that the + -- Exception_Name will refer to the one in System.Assertions (see + -- AARM-11.4.1(12.b)). procedure Assert (Check : Boolean); diff --git a/gcc/ada/a-calcon.adb b/gcc/ada/a-calcon.adb new file mode 100644 index 00000000000..e946c5ea793 --- /dev/null +++ b/gcc/ada/a-calcon.adb @@ -0,0 +1,150 @@ +------------------------------------------------------------------------------ +-- -- +-- GNAT RUN-TIME COMPONENTS -- +-- -- +-- A D A . C A L E N D A R . C O N V E R S I O N S -- +-- -- +-- B o d y -- +-- -- +-- Copyright (C) 2008, Free Software Foundation, Inc. -- +-- -- +-- GNAT is free software; you can redistribute it and/or modify it under -- +-- terms of the GNU General Public License as published by the Free Soft- -- +-- ware Foundation; either version 2, or (at your option) any later ver- -- +-- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- +-- OUT 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 distributed with GNAT; see file COPYING. If not, write -- +-- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, -- +-- Boston, MA 02110-1301, USA. -- +-- -- +-- As a special exception, if other files instantiate generics from this -- +-- unit, or you link this unit with other files to produce an executable, -- +-- this unit does not by itself cause the resulting executable to be -- +-- covered by the GNU General Public License. This exception does not -- +-- however invalidate any other reasons why the executable file might be -- +-- covered by the GNU Public License. -- +-- -- +-- GNAT was originally developed by the GNAT team at New York University. -- +-- Extensive contributions were provided by Ada Core Technologies Inc. -- +-- -- +------------------------------------------------------------------------------ + +with Interfaces.C; use Interfaces.C; + +package body Ada.Calendar.Conversions is + + ----------------- + -- To_Ada_Time -- + ----------------- + + function To_Ada_Time (Unix_Time : long) return Time is + Val : constant Long_Integer := Long_Integer (Unix_Time); + begin + return Conversion_Operations.To_Ada_Time (Val); + end To_Ada_Time; + + ----------------- + -- To_Ada_Time -- + ----------------- + + function To_Ada_Time + (tm_year : int; + tm_mon : int; + tm_day : int; + tm_hour : int; + tm_min : int; + tm_sec : int; + tm_isdst : int) return Time + is + Year : constant Integer := Integer (tm_year); + Month : constant Integer := Integer (tm_mon); + Day : constant Integer := Integer (tm_day); + Hour : constant Integer := Integer (tm_hour); + Minute : constant Integer := Integer (tm_min); + Second : constant Integer := Integer (tm_sec); + DST : constant Integer := Integer (tm_isdst); + begin + return + Conversion_Operations.To_Ada_Time + (Year, Month, Day, Hour, Minute, Second, DST); + end To_Ada_Time; + + ----------------- + -- To_Duration -- + ----------------- + + function To_Duration + (tv_sec : long; + tv_nsec : long) return Duration + is + Secs : constant Long_Integer := Long_Integer (tv_sec); + Nano_Secs : constant Long_Integer := Long_Integer (tv_nsec); + begin + return Conversion_Operations.To_Duration (Secs, Nano_Secs); + end To_Duration; + + ------------------------ + -- To_Struct_Timespec -- + ------------------------ + + procedure To_Struct_Timespec + (D : Duration; + tv_sec : out long; + tv_nsec : out long) + is + Secs : Long_Integer; + Nano_Secs : Long_Integer; + + begin + Conversion_Operations.To_Struct_Timespec (D, Secs, Nano_Secs); + + tv_sec := long (Secs); + tv_nsec := long (Nano_Secs); + end To_Struct_Timespec; + + ------------------ + -- To_Struct_Tm -- + ------------------ + + procedure To_Struct_Tm + (T : Time; + tm_year : out int; + tm_mon : out int; + tm_day : out int; + tm_hour : out int; + tm_min : out int; + tm_sec : out int) + is + Year : Integer; + Month : Integer; + Day : Integer; + Hour : Integer; + Minute : Integer; + Second : Integer; + + begin + Conversion_Operations.To_Struct_Tm + (T, Year, Month, Day, Hour, Minute, Second); + + tm_year := int (Year); + tm_mon := int (Month); + tm_day := int (Day); + tm_hour := int (Hour); + tm_min := int (Minute); + tm_sec := int (Second); + end To_Struct_Tm; + + ------------------ + -- To_Unix_Time -- + ------------------ + + function To_Unix_Time (Ada_Time : Time) return long is + Val : constant Long_Integer := + Conversion_Operations.To_Unix_Time (Ada_Time); + begin + return long (Val); + end To_Unix_Time; + +end Ada.Calendar.Conversions; diff --git a/gcc/ada/a-calcon.ads b/gcc/ada/a-calcon.ads new file mode 100644 index 00000000000..d2dd3fbcc10 --- /dev/null +++ b/gcc/ada/a-calcon.ads @@ -0,0 +1,116 @@ +------------------------------------------------------------------------------ +-- -- +-- GNAT RUN-TIME COMPONENTS -- +-- -- +-- A D A . C A L E N D A R . C O N V E R S I O N S -- +-- -- +-- S p e c -- +-- -- +-- Copyright (C) 2008, Free Software Foundation, Inc. -- +-- -- +-- GNAT is free software; you can redistribute it and/or modify it under -- +-- terms of the GNU General Public License as published by the Free Soft- -- +-- ware Foundation; either version 2, or (at your option) any later ver- -- +-- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- +-- OUT 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 distributed with GNAT; see file COPYING. If not, write -- +-- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, -- +-- Boston, MA 02110-1301, USA. -- +-- -- +-- As a special exception, if other files instantiate generics from this -- +-- unit, or you link this unit with other files to produce an executable, -- +-- this unit does not by itself cause the resulting executable to be -- +-- covered by the GNU General Public License. This exception does not -- +-- however invalidate any other reasons why the executable file might be -- +-- covered by the GNU Public License. -- +-- -- +-- GNAT was originally developed by the GNAT team at New York University. -- +-- Extensive contributions were provided by Ada Core Technologies Inc. -- +-- -- +------------------------------------------------------------------------------ + +-- This package provides various routines for conversion between Ada and Unix +-- time models - Time, Duration, struct tm and struct timespec. + +with Interfaces.C; + +package Ada.Calendar.Conversions is + + function To_Ada_Time (Unix_Time : Interfaces.C.long) return Time; + -- Convert a time value represented as number of seconds since the Unix + -- Epoch to a time value relative to an Ada implementation-defined Epoch. + -- The units of the result are 100 nanoseconds on VMS and nanoseconds on + -- all other targets. Raises Time_Error if the result cannot fit into a + -- Time value. + + function To_Ada_Time + (tm_year : Interfaces.C.int; + tm_mon : Interfaces.C.int; + tm_day : Interfaces.C.int; + tm_hour : Interfaces.C.int; + tm_min : Interfaces.C.int; + tm_sec : Interfaces.C.int; + tm_isdst : Interfaces.C.int) return Time; + -- Convert a time value expressed in Unix-like fields of struct tm into + -- a Time value relative to the Ada Epoch. The ranges of the formals are + -- as follows: + + -- tm_year -- years since 1900 + -- tm_mon -- months since January [0 .. 11] + -- tm_day -- day of the month [1 .. 31] + -- tm_hour -- hours since midnight [0 .. 24] + -- tm_min -- minutes after the hour [0 .. 59] + -- tm_sec -- seconds after the minute [0 .. 60] + -- tm_isdst -- Daylight Savings Time flag [-1 .. 1] + + -- The returned value is in UTC and may or may not contain leap seconds + -- depending on whether binder flag "-y" was used. Raises Time_Error if + -- the input values are out of the defined ranges or if tm_sec equals 60 + -- and the instance in time is not a leap second occurence. + + function To_Duration + (tv_sec : Interfaces.C.long; + tv_nsec : Interfaces.C.long) return Duration; + -- Convert an elapsed time value expressed in Unix-like fields of struct + -- timespec into a Duration value. The expected ranges are: + + -- tv_sec - seconds + -- tv_nsec - nanoseconds + + procedure To_Struct_Timespec + (D : Duration; + tv_sec : out Interfaces.C.long; + tv_nsec : out Interfaces.C.long); + -- Convert a Duration value into the constituents of struct timespec. + -- Formal tv_sec denotes seconds and tv_nsecs denotes nanoseconds. + + procedure To_Struct_Tm + (T : Time; + tm_year : out Interfaces.C.int; + tm_mon : out Interfaces.C.int; + tm_day : out Interfaces.C.int; + tm_hour : out Interfaces.C.int; + tm_min : out Interfaces.C.int; + tm_sec : out Interfaces.C.int); + -- Convert a Time value set in the Ada Epoch into the constituents of + -- struct tm. The ranges of the out formals are as follows: + + -- tm_year -- years since 1900 + -- tm_mon -- months since January [0 .. 11] + -- tm_day -- day of the month [1 .. 31] + -- tm_hour -- hours since midnight [0 .. 24] + -- tm_min -- minutes after the hour [0 .. 59] + -- tm_sec -- seconds after the minute [0 .. 60] + -- tm_isdst -- Daylight Savings Time flag [-1 .. 1] + + -- The input date is considered to be in UTC + + function To_Unix_Time (Ada_Time : Time) return Interfaces.C.long; + -- Convert a time value represented as number of time units since the Ada + -- implementation-defined Epoch to a value relative to the Unix Epoch. The + -- units of the result are seconds. Raises Time_Error if the result cannot + -- fit into a Time value. + +end Ada.Calendar.Conversions; diff --git a/gcc/ada/a-caldel.adb b/gcc/ada/a-caldel.adb index 3410b6135fe..17b39977714 100644 --- a/gcc/ada/a-caldel.adb +++ b/gcc/ada/a-caldel.adb @@ -116,15 +116,13 @@ package body Ada.Calendar.Delays is -- target independent operation in Ada.Calendar is used to perform -- this conversion. - return Delays_Operations.To_Duration (T); + return Delay_Operations.To_Duration (T); end To_Duration; begin -- Set up the Timed_Delay soft link to the non tasking version if it has - -- not been already set. - - -- If tasking is present, Timed_Delay has already set this soft link, or - -- this will be overridden during the elaboration of + -- not been already set. If tasking is present, Timed_Delay has already set + -- this soft link, or this will be overridden during the elaboration of -- System.Tasking.Initialization if SSL.Timed_Delay = null then diff --git a/gcc/ada/a-calend-vms.adb b/gcc/ada/a-calend-vms.adb index 89cda37c8f3..86e77cb66a6 100644 --- a/gcc/ada/a-calend-vms.adb +++ b/gcc/ada/a-calend-vms.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 1992-2007, Free Software Foundation, Inc. -- +-- Copyright (C) 1992-2008, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -33,10 +33,11 @@ -- This is the Alpha/VMS version -with System.Aux_DEC; use System.Aux_DEC; - with Ada.Unchecked_Conversion; +with System.Aux_DEC; use System.Aux_DEC; +with System.OS_Primitives; use System.OS_Primitives; + package body Ada.Calendar is -------------------------- @@ -77,15 +78,15 @@ package body Ada.Calendar is -- Local Subprograms -- ----------------------- - procedure Check_Within_Time_Bounds (T : Time); + procedure Check_Within_Time_Bounds (T : OS_Time); -- Ensure that a time representation value falls withing the bounds of Ada -- time. Leap seconds support is taken into account. procedure Cumulative_Leap_Seconds - (Start_Date : Time; - End_Date : Time; + (Start_Date : OS_Time; + End_Date : OS_Time; Elapsed_Leaps : out Natural; - Next_Leap_Sec : out Time); + Next_Leap_Sec : out OS_Time); -- Elapsed_Leaps is the sum of the leap seconds that have occurred on or -- after Start_Date and before (strictly before) End_Date. Next_Leap_Sec -- represents the next leap second occurrence on or after End_Date. If @@ -135,26 +136,26 @@ package body Ada.Calendar is -- The range of Ada time expressed as milis since the VMS Epoch - Ada_Low : constant Time := (10 * 366 + 32 * 365 + 45) * Milis_In_Day; - Ada_High : constant Time := (131 * 366 + 410 * 365 + 45) * Milis_In_Day; + Ada_Low : constant OS_Time := (10 * 366 + 32 * 365 + 45) * Milis_In_Day; + Ada_High : constant OS_Time := (131 * 366 + 410 * 365 + 45) * Milis_In_Day; -- Even though the upper bound of time is 2399-12-31 23:59:59.9999999 -- UTC, it must be increased to include all leap seconds. - Ada_High_And_Leaps : constant Time := - Ada_High + Time (Leap_Seconds_Count) * Mili; + Ada_High_And_Leaps : constant OS_Time := + Ada_High + OS_Time (Leap_Seconds_Count) * Mili; -- Two constants used in the calculations of elapsed leap seconds. -- End_Of_Time is later than Ada_High in time zone -28. Start_Of_Time -- is earlier than Ada_Low in time zone +28. - End_Of_Time : constant Time := Ada_High + Time (3) * Milis_In_Day; - Start_Of_Time : constant Time := Ada_Low - Time (3) * Milis_In_Day; + End_Of_Time : constant OS_Time := Ada_High + OS_Time (3) * Milis_In_Day; + Start_Of_Time : constant OS_Time := Ada_Low - OS_Time (3) * Milis_In_Day; -- The following table contains the hard time values of all existing leap -- seconds. The values are produced by the utility program xleaps.adb. - Leap_Second_Times : constant array (1 .. Leap_Seconds_Count) of Time := + Leap_Second_Times : constant array (1 .. Leap_Seconds_Count) of OS_Time := (35855136000000000, 36014112010000000, 36329472020000000, @@ -219,13 +220,15 @@ package body Ada.Calendar is -- The bound of type Duration expressed as time - Dur_High : constant Time := To_Relative_Time (Duration'Last); - Dur_Low : constant Time := To_Relative_Time (Duration'First); + Dur_High : constant OS_Time := + OS_Time (To_Relative_Time (Duration'Last)); + Dur_Low : constant OS_Time := + OS_Time (To_Relative_Time (Duration'First)); - Res_M : Time; + Res_M : OS_Time; begin - Res_M := Left - Right; + Res_M := OS_Time (Left) - OS_Time (Right); -- Due to the extended range of Ada time, "-" is capable of producing -- results which may exceed the range of Duration. In order to prevent @@ -240,7 +243,7 @@ package body Ada.Calendar is -- Normal case, result fits else - return To_Duration (Res_M); + return To_Duration (Time (Res_M)); end if; exception @@ -254,7 +257,7 @@ package body Ada.Calendar is function "<" (Left, Right : Time) return Boolean is begin - return Long_Integer (Left) < Long_Integer (Right); + return OS_Time (Left) < OS_Time (Right); end "<"; ---------- @@ -263,7 +266,7 @@ package body Ada.Calendar is function "<=" (Left, Right : Time) return Boolean is begin - return Long_Integer (Left) <= Long_Integer (Right); + return OS_Time (Left) <= OS_Time (Right); end "<="; --------- @@ -272,7 +275,7 @@ package body Ada.Calendar is function ">" (Left, Right : Time) return Boolean is begin - return Long_Integer (Left) > Long_Integer (Right); + return OS_Time (Left) > OS_Time (Right); end ">"; ---------- @@ -281,14 +284,14 @@ package body Ada.Calendar is function ">=" (Left, Right : Time) return Boolean is begin - return Long_Integer (Left) >= Long_Integer (Right); + return OS_Time (Left) >= OS_Time (Right); end ">="; ------------------------------ -- Check_Within_Time_Bounds -- ------------------------------ - procedure Check_Within_Time_Bounds (T : Time) is + procedure Check_Within_Time_Bounds (T : OS_Time) is begin if Leap_Support then if T < Ada_Low or else T > Ada_High_And_Leaps then @@ -307,8 +310,8 @@ package body Ada.Calendar is function Clock return Time is Elapsed_Leaps : Natural; - Next_Leap_M : Time; - Res_M : constant Time := Time (OSP.OS_Clock); + Next_Leap_M : OS_Time; + Res_M : constant OS_Time := OS_Clock; begin -- Note that on other targets a soft-link is used to get a different @@ -335,7 +338,7 @@ package body Ada.Calendar is Elapsed_Leaps := 0; end if; - return Res_M + Time (Elapsed_Leaps) * Mili; + return Time (Res_M + OS_Time (Elapsed_Leaps) * Mili); end Clock; ----------------------------- @@ -343,15 +346,15 @@ package body Ada.Calendar is ----------------------------- procedure Cumulative_Leap_Seconds - (Start_Date : Time; - End_Date : Time; + (Start_Date : OS_Time; + End_Date : OS_Time; Elapsed_Leaps : out Natural; - Next_Leap_Sec : out Time) + Next_Leap_Sec : out OS_Time) is End_Index : Positive; - End_T : Time := End_Date; + End_T : OS_Time := End_Date; Start_Index : Positive; - Start_T : Time := Start_Date; + Start_T : OS_Time := Start_Date; begin pragma Assert (Leap_Support and then End_Date >= Start_Date); @@ -641,8 +644,9 @@ package body Ada.Calendar is function Add (Date : Time; Days : Long_Integer) return Time is pragma Unsuppress (Overflow_Check); + Date_M : constant OS_Time := OS_Time (Date); begin - return Date + Time (Days) * Milis_In_Day; + return Time (Date_M + OS_Time (Days) * Milis_In_Day); exception when Constraint_Error => raise Time_Error; @@ -659,15 +663,13 @@ package body Ada.Calendar is Seconds : out Duration; Leap_Seconds : out Integer) is - Mili_F : constant Duration := 10_000_000.0; - - Diff_M : Time; - Diff_S : Time; - Earlier : Time; + Diff_M : OS_Time; + Diff_S : OS_Time; + Earlier : OS_Time; Elapsed_Leaps : Natural; - Later : Time; + Later : OS_Time; Negate : Boolean := False; - Next_Leap : Time; + Next_Leap : OS_Time; Sub_Seconds : Duration; begin @@ -675,11 +677,11 @@ package body Ada.Calendar is -- being raised by the arithmetic operators in Ada.Calendar. if Left >= Right then - Later := Left; - Earlier := Right; + Later := OS_Time (Left); + Earlier := OS_Time (Right); else - Later := Right; - Earlier := Left; + Later := OS_Time (Right); + Earlier := OS_Time (Left); Negate := True; end if; @@ -699,7 +701,7 @@ package body Ada.Calendar is Elapsed_Leaps := 0; end if; - Diff_M := Later - Earlier - Time (Elapsed_Leaps) * Mili; + Diff_M := Later - Earlier - OS_Time (Elapsed_Leaps) * Mili; -- Sub second processing @@ -730,8 +732,9 @@ package body Ada.Calendar is function Subtract (Date : Time; Days : Long_Integer) return Time is pragma Unsuppress (Overflow_Check); + Date_M : constant OS_Time := OS_Time (Date); begin - return Date - Time (Days) * Milis_In_Day; + return Time (Date_M - OS_Time (Days) * Milis_In_Day); exception when Constraint_Error => raise Time_Error; @@ -739,6 +742,209 @@ package body Ada.Calendar is end Arithmetic_Operations; --------------------------- + -- Conversion_Operations -- + --------------------------- + + package body Conversion_Operations is + + Epoch_Offset : constant OS_Time := 35067168000000000; + -- The difference between 1970-1-1 UTC and 1858-11-17 UTC expressed in + -- 100 nanoseconds. + + ----------------- + -- To_Ada_Time -- + ----------------- + + function To_Ada_Time (Unix_Time : Long_Integer) return Time is + pragma Unsuppress (Overflow_Check); + Unix_Rep : constant OS_Time := OS_Time (Unix_Time) * Mili; + begin + return Time (Unix_Rep + Epoch_Offset); + exception + when Constraint_Error => + raise Time_Error; + end To_Ada_Time; + + ----------------- + -- To_Ada_Time -- + ----------------- + + function To_Ada_Time + (tm_year : Integer; + tm_mon : Integer; + tm_day : Integer; + tm_hour : Integer; + tm_min : Integer; + tm_sec : Integer; + tm_isdst : Integer) return Time + is + pragma Unsuppress (Overflow_Check); + + Year_Shift : constant Integer := 1900; + Month_Shift : constant Integer := 1; + + Year : Year_Number; + Month : Month_Number; + Day : Day_Number; + Second : Integer; + Leap : Boolean; + Result : OS_Time; + + begin + -- Input processing + + Year := Year_Number (Year_Shift + tm_year); + Month := Month_Number (Month_Shift + tm_mon); + Day := Day_Number (tm_day); + + -- Step 1: Validity checks of input values + + if not Year'Valid + or else not Month'Valid + or else not Day'Valid + or else tm_hour not in 0 .. 24 + or else tm_min not in 0 .. 59 + or else tm_sec not in 0 .. 60 + or else tm_isdst not in -1 .. 1 + then + raise Time_Error; + end if; + + -- Step 2: Potential leap second + + if tm_sec = 60 then + Leap := True; + Second := 59; + else + Leap := False; + Second := tm_sec; + end if; + + -- Step 3: Calculate the time value + + Result := + OS_Time + (Formatting_Operations.Time_Of + (Year => Year, + Month => Month, + Day => Day, + Day_Secs => 0.0, -- Time is given in h:m:s + Hour => tm_hour, + Minute => tm_min, + Second => Second, + Sub_Sec => 0.0, -- No precise sub second given + Leap_Sec => Leap, + Use_Day_Secs => False, -- Time is given in h:m:s + Is_Ada_05 => True, -- Force usage of explicit time zone + Time_Zone => 0)); -- Place the value in UTC + -- Step 4: Daylight Savings Time + + if tm_isdst = 1 then + Result := Result + OS_Time (3_600) * Mili; + end if; + + return Time (Result); + exception + when Constraint_Error => + raise Time_Error; + end To_Ada_Time; + + ----------------- + -- To_Duration -- + ----------------- + + function To_Duration + (tv_sec : Long_Integer; + tv_nsec : Long_Integer) return Duration + is + pragma Unsuppress (Overflow_Check); + begin + return Duration (tv_sec) + Duration (tv_nsec) / Mili_F; + end To_Duration; + + ------------------------ + -- To_Struct_Timespec -- + ------------------------ + + procedure To_Struct_Timespec + (D : Duration; + tv_sec : out Long_Integer; + tv_nsec : out Long_Integer) + is + pragma Unsuppress (Overflow_Check); + Secs : Duration; + Nano_Secs : Duration; + + begin + -- Seconds extraction, avoid potential rounding errors + + Secs := D - 0.5; + tv_sec := Long_Integer (Secs); + + -- 100 Nanoseconds extraction + + Nano_Secs := D - Duration (tv_sec); + tv_nsec := Long_Integer (Nano_Secs * Mili); + end To_Struct_Timespec; + + ------------------ + -- To_Struct_Tm -- + ------------------ + + procedure To_Struct_Tm + (T : Time; + tm_year : out Integer; + tm_mon : out Integer; + tm_day : out Integer; + tm_hour : out Integer; + tm_min : out Integer; + tm_sec : out Integer) + is + pragma Unsuppress (Overflow_Check); + Year : Year_Number; + Month : Month_Number; + Second : Integer; + Day_Secs : Day_Duration; + Sub_Sec : Duration; + Leap_Sec : Boolean; + + begin + -- Step 1: Split the input time + + Formatting_Operations.Split + (T, Year, Month, tm_day, Day_Secs, + tm_hour, tm_min, Second, Sub_Sec, Leap_Sec, True, 0); + + -- Step 2: Correct the year and month + + tm_year := Year - 1900; + tm_mon := Month - 1; + + -- Step 3: Handle leap second occurences + + if Leap_Sec then + tm_sec := 60; + else + tm_sec := Second; + end if; + end To_Struct_Tm; + + ------------------ + -- To_Unix_Time -- + ------------------ + + function To_Unix_Time (Ada_Time : Time) return Long_Integer is + pragma Unsuppress (Overflow_Check); + Ada_OS_Time : constant OS_Time := OS_Time (Ada_Time); + begin + return Long_Integer ((Ada_OS_Time - Epoch_Offset) / Mili); + exception + when Constraint_Error => + raise Time_Error; + end To_Unix_Time; + end Conversion_Operations; + + --------------------------- -- Formatting_Operations -- --------------------------- @@ -812,20 +1018,19 @@ package body Ada.Calendar is Ada_Min_Year : constant := 1901; Ada_Max_Year : constant := 2399; - Mili_F : constant Duration := 10_000_000.0; - Date_M : Time; + Date_M : OS_Time; Elapsed_Leaps : Natural; - Next_Leap_M : Time; + Next_Leap_M : OS_Time; begin - Date_M := Date; + Date_M := OS_Time (Date); -- Step 1: Leap seconds processing if Leap_Support then Cumulative_Leap_Seconds - (Start_Of_Time, Date, Elapsed_Leaps, Next_Leap_M); + (Start_Of_Time, Date_M, Elapsed_Leaps, Next_Leap_M); Leap_Sec := Date_M >= Next_Leap_M; @@ -840,12 +1045,12 @@ package body Ada.Calendar is Leap_Sec := False; end if; - Date_M := Date_M - Time (Elapsed_Leaps) * Mili; + Date_M := Date_M - OS_Time (Elapsed_Leaps) * Mili; -- Step 2: Time zone processing if Time_Zone /= 0 then - Date_M := Date_M + Time (Time_Zone) * 60 * Mili; + Date_M := Date_M + OS_Time (Time_Zone) * 60 * Mili; end if; -- After the leap seconds and time zone have been accounted for, @@ -867,7 +1072,7 @@ package body Ada.Calendar is -- Step 4: VMS system call - Numtim (Status, Timbuf, Date_M); + Numtim (Status, Timbuf, Time (Date_M)); if Status mod 2 /= 1 or else Timbuf (1) not in Ada_Min_Year .. Ada_Max_Year @@ -903,10 +1108,10 @@ package body Ada.Calendar is Minute : Integer; Second : Integer; Sub_Sec : Duration; - Leap_Sec : Boolean; - Use_Day_Secs : Boolean; - Is_Ada_05 : Boolean; - Time_Zone : Long_Integer) return Time + Leap_Sec : Boolean := False; + Use_Day_Secs : Boolean := False; + Is_Ada_05 : Boolean := False; + Time_Zone : Long_Integer := 0) return Time is procedure Cvt_Vectim (Status : out Unsigned_Longword; @@ -923,8 +1128,6 @@ package body Ada.Calendar is Status : Unsigned_Longword; Timbuf : Unsigned_Word_Array (1 .. 7); - Mili_F : constant := 10_000_000.0; - Y : Year_Number := Year; Mo : Month_Number := Month; D : Day_Number := Day; @@ -935,9 +1138,10 @@ package body Ada.Calendar is Elapsed_Leaps : Natural; Int_Day_Secs : Integer; - Next_Leap_M : Time; - Res_M : Time; - Rounded_Res_M : Time; + Next_Leap_M : OS_Time; + Res : Time; + Res_M : OS_Time; + Rounded_Res_M : OS_Time; begin -- No validity checks are performed on the input values since it is @@ -1015,7 +1219,7 @@ package body Ada.Calendar is Timbuf (6) := Unsigned_Word (Se); Timbuf (7) := 0; - Cvt_Vectim (Status, Timbuf, Res_M); + Cvt_Vectim (Status, Timbuf, Res); if Status mod 2 /= 1 then raise Time_Error; @@ -1023,7 +1227,7 @@ package body Ada.Calendar is -- Step 3: Sub second adjustment - Res_M := Res_M + Time (Su * Mili_F); + Res_M := OS_Time (Res) + OS_Time (Su * Mili_F); -- Step 4: Bounds check @@ -1032,7 +1236,7 @@ package body Ada.Calendar is -- Step 5: Time zone processing if Time_Zone /= 0 then - Res_M := Res_M - Time (Time_Zone) * 60 * Mili; + Res_M := Res_M - OS_Time (Time_Zone) * 60 * Mili; end if; -- Step 6: Leap seconds processing @@ -1041,7 +1245,7 @@ package body Ada.Calendar is Cumulative_Leap_Seconds (Start_Of_Time, Res_M, Elapsed_Leaps, Next_Leap_M); - Res_M := Res_M + Time (Elapsed_Leaps) * Mili; + Res_M := Res_M + OS_Time (Elapsed_Leaps) * Mili; -- An Ada 2005 caller requesting an explicit leap second or an -- Ada 95 caller accounting for an invisible leap second. @@ -1049,7 +1253,7 @@ package body Ada.Calendar is if Leap_Sec or else Res_M >= Next_Leap_M then - Res_M := Res_M + Time (1) * Mili; + Res_M := Res_M + OS_Time (1) * Mili; end if; -- Leap second validity check @@ -1064,7 +1268,7 @@ package body Ada.Calendar is end if; end if; - return Res_M; + return Time (Res_M); end Time_Of; end Formatting_Operations; diff --git a/gcc/ada/a-calend-vms.ads b/gcc/ada/a-calend-vms.ads index 108bd868179..c11093df238 100644 --- a/gcc/ada/a-calend-vms.ads +++ b/gcc/ada/a-calend-vms.ads @@ -6,7 +6,7 @@ -- -- -- S p e c -- -- -- --- Copyright (C) 1992-2007, Free Software Foundation, Inc. -- +-- Copyright (C) 1992-2008, Free Software Foundation, Inc. -- -- -- -- This specification is derived from the Ada Reference Manual for use with -- -- GNAT. The copyright notice above, and the license provisions that follow -- @@ -107,6 +107,7 @@ private -- readability, this unit will be called "mili". Mili : constant := 10_000_000; + Mili_F : constant := 10_000_000.0; Milis_In_Day : constant := 864_000_000_000; Secs_In_Day : constant := 86_400; @@ -139,7 +140,12 @@ private -- NOTE: Delays does not need a target independent interface because -- VMS already has a target specific file for that package. + --------------------------- + -- Arithmetic_Operations -- + --------------------------- + package Arithmetic_Operations is + function Add (Date : Time; Days : Long_Integer) return Time; -- Add a certain number of days to a time value @@ -156,9 +162,59 @@ private function Subtract (Date : Time; Days : Long_Integer) return Time; -- Subtract a certain number of days from a time value + end Arithmetic_Operations; + --------------------------- + -- Conversion_Operations -- + --------------------------- + + package Conversion_Operations is + function To_Ada_Time (Unix_Time : Long_Integer) return Time; + -- Unix to Ada Epoch conversion + + function To_Ada_Time + (tm_year : Integer; + tm_mon : Integer; + tm_day : Integer; + tm_hour : Integer; + tm_min : Integer; + tm_sec : Integer; + tm_isdst : Integer) return Time; + -- Struct tm to Ada Epoch conversion + + function To_Duration + (tv_sec : Long_Integer; + tv_nsec : Long_Integer) return Duration; + -- Struct timespec to Duration conversion + + procedure To_Struct_Timespec + (D : Duration; + tv_sec : out Long_Integer; + tv_nsec : out Long_Integer); + -- Duration to struct timespec conversion + + procedure To_Struct_Tm + (T : Time; + tm_year : out Integer; + tm_mon : out Integer; + tm_day : out Integer; + tm_hour : out Integer; + tm_min : out Integer; + tm_sec : out Integer); + -- Time to struct tm conversion + + function To_Unix_Time (Ada_Time : Time) return Long_Integer; + -- Ada to Unix Epoch conversion + + end Conversion_Operations; + + --------------------------- + -- Formatting_Operations -- + --------------------------- + package Formatting_Operations is + function Day_Of_Week (Date : Time) return Integer; -- Determine which day of week Date falls on. The returned values are -- within the range of 0 .. 6 (Monday .. Sunday). @@ -189,21 +245,28 @@ private Minute : Integer; Second : Integer; Sub_Sec : Duration; - Leap_Sec : Boolean; - Use_Day_Secs : Boolean; - Is_Ada_05 : Boolean; - Time_Zone : Long_Integer) return Time; + Leap_Sec : Boolean := False; + Use_Day_Secs : Boolean := False; + Is_Ada_05 : Boolean := False; + Time_Zone : Long_Integer := 0) return Time; -- Given all the components of a date, return the corresponding time -- value. Set Use_Day_Secs to use the value in Day_Secs, otherwise the -- day duration will be calculated from Hour, Minute, Second and Sub_ -- Sec. Set Is_Ada_05 to use the local time zone (the value in formal -- Time_Zone is ignored) when building a time value and to verify the -- validity of a requested leap second. + end Formatting_Operations; + --------------------------- + -- Time_Zones_Operations -- + --------------------------- + package Time_Zones_Operations is + function UTC_Time_Offset (Date : Time) return Long_Integer; -- Return the offset in seconds from UTC + end Time_Zones_Operations; end Ada.Calendar; diff --git a/gcc/ada/a-calend.adb b/gcc/ada/a-calend.adb index 1fe977d68a4..2e7c61a9d7f 100644 --- a/gcc/ada/a-calend.adb +++ b/gcc/ada/a-calend.adb @@ -758,13 +758,216 @@ package body Ada.Calendar is when Constraint_Error => raise Time_Error; end Subtract; + end Arithmetic_Operations; + --------------------------- + -- Conversion_Operations -- + --------------------------- + + package body Conversion_Operations is + + Epoch_Offset : constant Time_Rep := + (136 * 365 + 44 * 366) * Nanos_In_Day; + -- The difference between 2150-1-1 UTC and 1970-1-1 UTC expressed in + -- nanoseconds. Note that year 2100 is non-leap. + + ----------------- + -- To_Ada_Time -- + ----------------- + + function To_Ada_Time (Unix_Time : Long_Integer) return Time is + pragma Unsuppress (Overflow_Check); + Unix_Rep : constant Time_Rep := Time_Rep (Unix_Time) * Nano; + begin + return Time (Unix_Rep - Epoch_Offset); + exception + when Constraint_Error => + raise Time_Error; + end To_Ada_Time; + + ----------------- + -- To_Ada_Time -- + ----------------- + + function To_Ada_Time + (tm_year : Integer; + tm_mon : Integer; + tm_day : Integer; + tm_hour : Integer; + tm_min : Integer; + tm_sec : Integer; + tm_isdst : Integer) return Time + is + pragma Unsuppress (Overflow_Check); + Year : Year_Number; + Month : Month_Number; + Day : Day_Number; + Second : Integer; + Leap : Boolean; + Result : Time_Rep; + + begin + -- Input processing + + Year := Year_Number (1900 + tm_year); + Month := Month_Number (1 + tm_mon); + Day := Day_Number (tm_day); + + -- Step 1: Validity checks of input values + + if not Year'Valid + or else not Month'Valid + or else not Day'Valid + or else tm_hour not in 0 .. 24 + or else tm_min not in 0 .. 59 + or else tm_sec not in 0 .. 60 + or else tm_isdst not in -1 .. 1 + then + raise Time_Error; + end if; + + -- Step 2: Potential leap second + + if tm_sec = 60 then + Leap := True; + Second := 59; + else + Leap := False; + Second := tm_sec; + end if; + + -- Step 3: Calculate the time value + + Result := + Time_Rep + (Formatting_Operations.Time_Of + (Year => Year, + Month => Month, + Day => Day, + Day_Secs => 0.0, -- Time is given in h:m:s + Hour => tm_hour, + Minute => tm_min, + Second => Second, + Sub_Sec => 0.0, -- No precise sub second given + Leap_Sec => Leap, + Use_Day_Secs => False, -- Time is given in h:m:s + Is_Ada_05 => True, -- Force usage of explicit time zone + Time_Zone => 0)); -- Place the value in UTC + + -- Step 4: Daylight Savings Time + + if tm_isdst = 1 then + Result := Result + Time_Rep (3_600) * Nano; + end if; + + return Time (Result); + + exception + when Constraint_Error => + raise Time_Error; + end To_Ada_Time; + + ----------------- + -- To_Duration -- + ----------------- + + function To_Duration + (tv_sec : Long_Integer; + tv_nsec : Long_Integer) return Duration + is + pragma Unsuppress (Overflow_Check); + begin + return Duration (tv_sec) + Duration (tv_nsec) / Nano_F; + end To_Duration; + + ------------------------ + -- To_Struct_Timespec -- + ------------------------ + + procedure To_Struct_Timespec + (D : Duration; + tv_sec : out Long_Integer; + tv_nsec : out Long_Integer) + is + pragma Unsuppress (Overflow_Check); + Secs : Duration; + Nano_Secs : Duration; + + begin + -- Seconds extraction, avoid potential rounding errors + + Secs := D - 0.5; + tv_sec := Long_Integer (Secs); + + -- Nanoseconds extraction + + Nano_Secs := D - Duration (tv_sec); + tv_nsec := Long_Integer (Nano_Secs * Nano); + end To_Struct_Timespec; + + ------------------ + -- To_Struct_Tm -- + ------------------ + + procedure To_Struct_Tm + (T : Time; + tm_year : out Integer; + tm_mon : out Integer; + tm_day : out Integer; + tm_hour : out Integer; + tm_min : out Integer; + tm_sec : out Integer) + is + pragma Unsuppress (Overflow_Check); + Year : Year_Number; + Month : Month_Number; + Second : Integer; + Day_Secs : Day_Duration; + Sub_Sec : Duration; + Leap_Sec : Boolean; + + begin + -- Step 1: Split the input time + + Formatting_Operations.Split + (T, Year, Month, tm_day, Day_Secs, + tm_hour, tm_min, Second, Sub_Sec, Leap_Sec, True, 0); + + -- Step 2: Correct the year and month + + tm_year := Year - 1900; + tm_mon := Month - 1; + + -- Step 3: Handle leap second occurences + + if Leap_Sec then + tm_sec := 60; + else + tm_sec := Second; + end if; + end To_Struct_Tm; + + ------------------ + -- To_Unix_Time -- + ------------------ + + function To_Unix_Time (Ada_Time : Time) return Long_Integer is + pragma Unsuppress (Overflow_Check); + Ada_Rep : constant Time_Rep := Time_Rep (Ada_Time); + begin + return Long_Integer ((Ada_Rep + Epoch_Offset) / Nano); + exception + when Constraint_Error => + raise Time_Error; + end To_Unix_Time; + end Conversion_Operations; + ---------------------- -- Delay_Operations -- ---------------------- - package body Delays_Operations is + package body Delay_Operations is ----------------- -- To_Duration -- @@ -804,7 +1007,8 @@ package body Ada.Calendar is return Time (Res_N) - Time (Unix_Min); end To_Duration; - end Delays_Operations; + + end Delay_Operations; --------------------------- -- Formatting_Operations -- @@ -1071,10 +1275,10 @@ package body Ada.Calendar is Minute : Integer; Second : Integer; Sub_Sec : Duration; - Leap_Sec : Boolean; - Use_Day_Secs : Boolean; - Is_Ada_05 : Boolean; - Time_Zone : Long_Integer) return Time + Leap_Sec : Boolean := False; + Use_Day_Secs : Boolean := False; + Is_Ada_05 : Boolean := False; + Time_Zone : Long_Integer := 0) return Time is Count : Integer; Elapsed_Leaps : Natural; @@ -1217,6 +1421,7 @@ package body Ada.Calendar is return Time (Res_N); end Time_Of; + end Formatting_Operations; --------------------------- @@ -1352,6 +1557,7 @@ package body Ada.Calendar is return Offset; end UTC_Time_Offset; + end Time_Zones_Operations; -- Start of elaboration code for Ada.Calendar diff --git a/gcc/ada/a-calend.ads b/gcc/ada/a-calend.ads index 2bacb9ba823..77b466a87c4 100644 --- a/gcc/ada/a-calend.ads +++ b/gcc/ada/a-calend.ads @@ -6,7 +6,7 @@ -- -- -- S p e c -- -- -- --- Copyright (C) 1992-2007, Free Software Foundation, Inc. -- +-- Copyright (C) 1992-2008, Free Software Foundation, Inc. -- -- -- -- This specification is derived from the Ada Reference Manual for use with -- -- GNAT. The copyright notice above, and the license provisions that follow -- @@ -212,9 +212,15 @@ private -- Determine whether a given year is leap -- The following packages provide a target independent interface to the - -- children of Calendar - Arithmetic, Delays, Formatting and Time_Zones. + -- children of Calendar - Arithmetic, Conversions, Delays, Formatting and + -- Time_Zones. + + --------------------------- + -- Arithmetic_Operations -- + --------------------------- package Arithmetic_Operations is + function Add (Date : Time; Days : Long_Integer) return Time; -- Add a certain number of days to a time value @@ -231,15 +237,72 @@ private function Subtract (Date : Time; Days : Long_Integer) return Time; -- Subtract a certain number of days from a time value + end Arithmetic_Operations; - package Delays_Operations is + --------------------------- + -- Conversion_Operations -- + --------------------------- + + package Conversion_Operations is + + function To_Ada_Time (Unix_Time : Long_Integer) return Time; + -- Unix to Ada Epoch conversion + + function To_Ada_Time + (tm_year : Integer; + tm_mon : Integer; + tm_day : Integer; + tm_hour : Integer; + tm_min : Integer; + tm_sec : Integer; + tm_isdst : Integer) return Time; + -- Struct tm to Ada Epoch conversion + + function To_Duration + (tv_sec : Long_Integer; + tv_nsec : Long_Integer) return Duration; + -- Struct timespec to Duration conversion + + procedure To_Struct_Timespec + (D : Duration; + tv_sec : out Long_Integer; + tv_nsec : out Long_Integer); + -- Duration to struct timespec conversion + + procedure To_Struct_Tm + (T : Time; + tm_year : out Integer; + tm_mon : out Integer; + tm_day : out Integer; + tm_hour : out Integer; + tm_min : out Integer; + tm_sec : out Integer); + -- Time to struct tm conversion + + function To_Unix_Time (Ada_Time : Time) return Long_Integer; + -- Ada to Unix Epoch conversion + + end Conversion_Operations; + + ---------------------- + -- Delay_Operations -- + ---------------------- + + package Delay_Operations is + function To_Duration (Date : Time) return Duration; -- Given a time value in nanoseconds since 1901, convert it into a -- duration value giving the number of nanoseconds since the Unix Epoch. - end Delays_Operations; + + end Delay_Operations; + + --------------------------- + -- Formatting_Operations -- + --------------------------- package Formatting_Operations is + function Day_Of_Week (Date : Time) return Integer; -- Determine which day of week Date falls on. The returned values are -- within the range of 0 .. 6 (Monday .. Sunday). @@ -270,21 +333,28 @@ private Minute : Integer; Second : Integer; Sub_Sec : Duration; - Leap_Sec : Boolean; - Use_Day_Secs : Boolean; - Is_Ada_05 : Boolean; - Time_Zone : Long_Integer) return Time; + Leap_Sec : Boolean := False; + Use_Day_Secs : Boolean := False; + Is_Ada_05 : Boolean := False; + Time_Zone : Long_Integer := 0) return Time; -- Given all the components of a date, return the corresponding time -- value. Set Use_Day_Secs to use the value in Day_Secs, otherwise the -- day duration will be calculated from Hour, Minute, Second and Sub_ -- Sec. Set Is_Ada_05 to use the local time zone (the value in formal -- Time_Zone is ignored) when building a time value and to verify the -- validity of a requested leap second. + end Formatting_Operations; + --------------------------- + -- Time_Zones_Operations -- + --------------------------- + package Time_Zones_Operations is + function UTC_Time_Offset (Date : Time) return Long_Integer; -- Return the offset in seconds from UTC + end Time_Zones_Operations; end Ada.Calendar; diff --git a/gcc/ada/a-cgaaso.ads b/gcc/ada/a-cgaaso.ads index fe2e9226adb..e189ccc572f 100644 --- a/gcc/ada/a-cgaaso.ads +++ b/gcc/ada/a-cgaaso.ads @@ -6,11 +6,7 @@ -- -- -- S p e c -- -- -- --- Copyright (C) 2004-2007, Free Software Foundation, Inc. -- --- -- --- This specification is derived from the Ada Reference Manual for use with -- --- GNAT. The copyright notice above, and the license provisions that follow -- --- apply solely to the contents of the part following the private keyword. -- +-- Copyright (C) 2004-2008, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -33,7 +29,9 @@ -- This unit was originally developed by Matthew J Heaney. -- ------------------------------------------------------------------------------ --- Documentation of this unit is needed ??? +-- Allows an anonymous array (or array-like container) to be sorted. Generic +-- formal Less returns the result of comparing the elements designated by the +-- indices, and generic formal Swap exchanges the designated elements. generic type Index_Type is (<>); @@ -42,5 +40,4 @@ generic procedure Ada.Containers.Generic_Anonymous_Array_Sort (First, Last : Index_Type'Base); - pragma Pure (Ada.Containers.Generic_Anonymous_Array_Sort); diff --git a/gcc/ada/a-cgcaso.adb b/gcc/ada/a-cgcaso.adb index ff7cdba1723..747c2a99ebf 100644 --- a/gcc/ada/a-cgcaso.adb +++ b/gcc/ada/a-cgcaso.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 2004-2007, Free Software Foundation, Inc. -- +-- Copyright (C) 2004-2008, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -91,14 +91,11 @@ is while C /= S loop declare - Father : constant T := C / 2; - Father_Elem : Element_Type renames A (To_Index (Father)); - + Father : constant T := C / 2; begin - if Father_Elem < Temp then -- Lt (Father, 0) - A (To_Index (C)) := Father_Elem; -- Move (Father, C) + if A (To_Index (Father)) < Temp then -- Lt (Father, 0) + A (To_Index (C)) := A (To_Index (Father)); -- Move (Father, C) C := Father; - else exit; end if; @@ -117,12 +114,8 @@ begin end loop; while Max > 1 loop - declare - Max_Elem : Element_Type renames A (To_Index (Max)); - begin - Temp := Max_Elem; -- Move (Max, 0); - Max_Elem := A (A'First); -- Move (1, Max); - end; + Temp := A (To_Index (Max)); -- Move (Max, 0); + A (To_Index (Max)) := A (A'First); -- Move (1, Max); Max := Max - 1; Sift (1); diff --git a/gcc/ada/a-ciormu.ads b/gcc/ada/a-ciormu.ads index e18e44fca90..0b3719b5aa2 100644 --- a/gcc/ada/a-ciormu.ads +++ b/gcc/ada/a-ciormu.ads @@ -8,10 +8,6 @@ -- -- -- Copyright (C) 2004-2008, Free Software Foundation, Inc. -- -- -- --- This specification is derived from the Ada Reference Manual for use with -- --- GNAT. The copyright notice above, and the license provisions that follow -- --- apply solely to the contents of the part following the private keyword. -- --- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 2, or (at your option) any later ver- -- @@ -33,7 +29,10 @@ -- This unit was originally developed by Matthew J Heaney. -- ------------------------------------------------------------------------------ --- Documentation of this unit is needed ??? +-- The indefinite ordered multiset container is similar to the indefinite +-- ordered set, but with the difference that multiple equivalent elements are +-- allowed. It also provides additional operations, to iterate over items that +-- are equivalent. private with Ada.Containers.Red_Black_Trees; private with Ada.Finalization; @@ -50,6 +49,8 @@ package Ada.Containers.Indefinite_Ordered_Multisets is pragma Remote_Types; function Equivalent_Elements (Left, Right : Element_Type) return Boolean; + -- Returns False if Left is less than Right, or Right is less than Left; + -- otherwise, it returns True. type Set is tagged private; pragma Preelaborable_Initialization (Set); @@ -58,40 +59,91 @@ package Ada.Containers.Indefinite_Ordered_Multisets is pragma Preelaborable_Initialization (Cursor); Empty_Set : constant Set; + -- The default value for set objects declared without an explicit + -- initialization expression. No_Element : constant Cursor; + -- The default value for cursor objects declared without an explicit + -- initialization expression. function "=" (Left, Right : Set) return Boolean; + -- If Left denotes the same set object as Right, then equality returns + -- True. If the length of Left is different from the length of Right, then + -- it returns False. Otherwise, set equality iterates over Left and Right, + -- comparing the element of Left to the element of Right using the equality + -- operator for elements. If the elements compare False, then the iteration + -- terminates and set equality returns False. Otherwise, if all elements + -- compare True, then set equality returns True. function Equivalent_Sets (Left, Right : Set) return Boolean; + -- Similar to set equality, but with the difference that elements are + -- compared for equivalence instead of equality. function To_Set (New_Item : Element_Type) return Set; + -- Constructs a set object with New_Item as its single element function Length (Container : Set) return Count_Type; + -- Returns the total number of elements in Container function Is_Empty (Container : Set) return Boolean; + -- Returns True if Container.Length is 0 procedure Clear (Container : in out Set); + -- Deletes all elements from Container function Element (Position : Cursor) return Element_Type; + -- If Position equals No_Element, then Constraint_Error is raised. + -- Otherwise, function Element returns the element designed by Position. procedure Replace_Element (Container : in out Set; Position : Cursor; New_Item : Element_Type); + -- If Position equals No_Element, then Constraint_Error is raised. If + -- Position is associated with a set different from Container, then + -- Program_Error is raised. If New_Item is equivalent to the element + -- designated by Position, then if Container is locked (element tampering + -- has been attempted), Program_Error is raised; otherwise, the element + -- designated by Position is assigned the value of New_Item. If New_Item is + -- not equivalent to the element designated by Position, then if the + -- container is busy (cursor tampering has been attempted), Program_Error + -- is raised; otherwise, the element designed by Position is assigned the + -- value of New_Item, and the node is moved to its new position (in + -- canonical insertion order). procedure Query_Element (Position : Cursor; Process : not null access procedure (Element : Element_Type)); + -- If Position equals No_Element, then Constraint_Error is + -- raised. Otherwise, it calls Process with the element designated by + -- Position as the parameter. This call locks the container, so attempts to + -- change the value of the element while Process is executing (to "tamper + -- with elements") will raise Program_Error. procedure Move (Target : in out Set; Source : in out Set); + -- If Target denotes the same object as Source, the operation does + -- nothing. If either Target or Source is busy (cursor tampering is + -- attempted), then it raises Program_Error. Otherwise, Target is cleared, + -- and the nodes from Source are moved (not copied) to Target (so Source + -- becomes empty). procedure Insert (Container : in out Set; New_Item : Element_Type; Position : out Cursor); + -- Insert adds New_Item to Container, and returns cursor Position + -- designating the newly inserted node. The node is inserted after any + -- existing elements less than or equivalent to New_Item (and before any + -- elements greater than New_Item). Note that the issue of where the new + -- node is inserted relative to equivalent elements does not arise for + -- unique-key containers, since in that case the insertion would simply + -- fail. For a multiple-key container (the case here), insertion always + -- succeeds, and is defined such that the new item is positioned after any + -- equivalent elements already in the container. procedure Insert (Container : in out Set; New_Item : Element_Type); + -- Inserts New_Item in Container, but does not return a cursor designating + -- the newly-inserted node. -- TODO: include Replace too??? -- @@ -100,98 +152,184 @@ package Ada.Containers.Indefinite_Ordered_Multisets is -- New_Item : Element_Type); procedure Exclude (Container : in out Set; Item : Element_Type); + -- Deletes from Container all of the elements equivalent to Item procedure Delete (Container : in out Set; Item : Element_Type); + -- Deletes from Container all of the elements equivalent to Item. If there + -- are no elements equivalent to Item, then it raises Constraint_Error. procedure Delete (Container : in out Set; Position : in out Cursor); + -- If Position equals No_Element, then Constraint_Error is raised. If + -- Position is associated with a set different from Container, then + -- Program_Error is raised. Otherwise, the node designated by Position is + -- removed from Container, and Position is set to No_Element. procedure Delete_First (Container : in out Set); + -- Removes the first node from Container procedure Delete_Last (Container : in out Set); + -- Removes the last node from Container procedure Union (Target : in out Set; Source : Set); + -- If Target is busy (cursor tampering is attempted), then Program_Error is + -- raised. Otherwise, it inserts each element of Source into Target. + -- Elements are inserted in the canonical order for multisets, such that + -- the elements from Source are inserted after equivalent elements already + -- in Target. function Union (Left, Right : Set) return Set; + -- Returns a set comprising the all elements from Left and all of the + -- elements from Right. The elements from Right follow the equivalent + -- elements from Left. function "or" (Left, Right : Set) return Set renames Union; procedure Intersection (Target : in out Set; Source : Set); + -- If Target denotes the same object as Source, the operation does + -- nothing. If Target is busy (cursor tampering is attempted), + -- Program_Error is raised. Otherwise, the elements in Target having no + -- equivalent element in Source are deleted from Target. function Intersection (Left, Right : Set) return Set; + -- If Left denotes the same object as Right, then the function returns a + -- copy of Left. Otherwise, it returns a set comprising the equivalent + -- elements from both Left and Right. Items are inserted in the result set + -- in canonical order, such that the elements from Left precede the + -- equivalent elements from Right. function "and" (Left, Right : Set) return Set renames Intersection; procedure Difference (Target : in out Set; Source : Set); + -- If Target is busy (cursor tampering is attempted), then Program_Error is + -- raised. Otherwise, the elements in Target that are equivalent to + -- elements in Source are deleted from Target. function Difference (Left, Right : Set) return Set; + -- Returns a set comprising the elements from Left that have no equivalent + -- element in Right. function "-" (Left, Right : Set) return Set renames Difference; procedure Symmetric_Difference (Target : in out Set; Source : Set); + -- If Target is busy, then Program_Error is raised. Otherwise, the elements + -- in Target equivalent to elements in Source are deleted from Target, and + -- the elements in Source not equivalent to elements in Target are inserted + -- into Target. function Symmetric_Difference (Left, Right : Set) return Set; + -- Returns a set comprising the union of the elements from Target having no + -- equivalent in Source, and the elements of Source having no equivalent in + -- Target. function "xor" (Left, Right : Set) return Set renames Symmetric_Difference; function Overlap (Left, Right : Set) return Boolean; + -- Returns True if Left contains an element equivalent to an element of + -- Right. function Is_Subset (Subset : Set; Of_Set : Set) return Boolean; + -- Returns True if every element in Subset has an equivalent element in + -- Of_Set. function First (Container : Set) return Cursor; + -- If Container is empty, the function returns No_Element. Otherwise, it + -- returns a cursor designating the smallest element. function First_Element (Container : Set) return Element_Type; + -- Equivalent to Element (First (Container)) function Last (Container : Set) return Cursor; + -- If Container is empty, the function returns No_Element. Otherwise, it + -- returns a cursor designating the largest element. function Last_Element (Container : Set) return Element_Type; + -- Equivalent to Element (Last (Container)) function Next (Position : Cursor) return Cursor; + -- If Position equals No_Element or Last (Container), the function returns + -- No_Element. Otherwise, it returns a cursor designating the node that + -- immediately follows (as per the insertion order) the node designated by + -- Position. procedure Next (Position : in out Cursor); + -- Equivalent to Position := Next (Position) function Previous (Position : Cursor) return Cursor; + -- If Position equals No_Element or First (Container), the function returns + -- No_Element. Otherwise, it returns a cursor designating the node that + -- immediately precedes (as per the insertion order) the node designated by + -- Position. procedure Previous (Position : in out Cursor); + -- Equivalent to Position := Previous (Position) function Find (Container : Set; Item : Element_Type) return Cursor; + -- Returns a cursor designating the first element in Container equivalent + -- to Item. If there is no equivalent element, it returns No_Element. function Floor (Container : Set; Item : Element_Type) return Cursor; + -- If Container is empty, the function returns No_Element. If Item is + -- equivalent to elements in Container, it returns a cursor designating the + -- first equivalent element. Otherwise, it returns a cursor designating the + -- largest element less than Item, or No_Element if all elements are + -- greater than Item. function Ceiling (Container : Set; Item : Element_Type) return Cursor; + -- If Container is empty, the function returns No_Element. If Item is + -- equivalent to elements of Container, it returns a cursor designating the + -- last equivalent element. Otherwise, it returns a cursor designating the + -- smallest element greater than Item, or No_Element if all elements are + -- less than Item. function Contains (Container : Set; Item : Element_Type) return Boolean; + -- Equivalent to Container.Find (Item) /= No_Element function Has_Element (Position : Cursor) return Boolean; + -- Equivalent to Position /= No_Element function "<" (Left, Right : Cursor) return Boolean; + -- Equivalent to Element (Left) < Element (Right) function ">" (Left, Right : Cursor) return Boolean; + -- Equivalent to Element (Right) < Element (Left) function "<" (Left : Cursor; Right : Element_Type) return Boolean; + -- Equivalent to Element (Left) < Right function ">" (Left : Cursor; Right : Element_Type) return Boolean; + -- Equivalent to Right < Element (Left) function "<" (Left : Element_Type; Right : Cursor) return Boolean; + -- Equivalent to Left < Element (Right) function ">" (Left : Element_Type; Right : Cursor) return Boolean; + -- Equivalent to Element (Right) < Left procedure Iterate (Container : Set; Process : not null access procedure (Position : Cursor)); + -- Calls Process with a cursor designating each element of Container, in + -- order from Container.First to Container.Last. procedure Reverse_Iterate (Container : Set; Process : not null access procedure (Position : Cursor)); + -- Calls Process with a cursor designating each element of Container, in + -- order from Container.Last to Container.First. procedure Iterate (Container : Set; Item : Element_Type; Process : not null access procedure (Position : Cursor)); + -- Call Process with a cursor designating each element equivalent to Item, + -- in order from Container.Floor (Item) to Container.Ceiling (Item). procedure Reverse_Iterate (Container : Set; Item : Element_Type; Process : not null access procedure (Position : Cursor)); + -- Call Process with a cursor designating each element equivalent to Item, + -- in order from Container.Ceiling (Item) to Container.Floor (Item). generic type Key_Type (<>) is private; @@ -203,38 +341,75 @@ package Ada.Containers.Indefinite_Ordered_Multisets is package Generic_Keys is function Equivalent_Keys (Left, Right : Key_Type) return Boolean; + -- Returns False if Left is less than Right, or Right is less than Left; + -- otherwise, it returns True. function Key (Position : Cursor) return Key_Type; + -- Equivalent to Key (Element (Position)) function Element (Container : Set; Key : Key_Type) return Element_Type; + -- Equivalent to Element (Find (Container, Key)) procedure Exclude (Container : in out Set; Key : Key_Type); + -- Deletes from Container any elements whose key is equivalent to Key procedure Delete (Container : in out Set; Key : Key_Type); + -- Deletes from Container any elements whose key is equivalent to + -- Key. If there are no such elements, then it raises Constraint_Error. function Find (Container : Set; Key : Key_Type) return Cursor; + -- Returns a cursor designating the first element in Container whose key + -- is equivalent to Key. If there is no equivalent element, it returns + -- No_Element. function Floor (Container : Set; Key : Key_Type) return Cursor; + -- If Container is empty, the function returns No_Element. If Item is + -- equivalent to the keys of elements in Container, it returns a cursor + -- designating the first such element. Otherwise, it returns a cursor + -- designating the largest element whose key is less than Item, or + -- No_Element if all keys are greater than Item. function Ceiling (Container : Set; Key : Key_Type) return Cursor; + -- If Container is empty, the function returns No_Element. If Item is + -- equivalent to the keys of elements of Container, it returns a cursor + -- designating the last such element. Otherwise, it returns a cursor + -- designating the smallest element whose key is greater than Item, or + -- No_Element if all keys are less than Item. function Contains (Container : Set; Key : Key_Type) return Boolean; + -- Equivalent to Find (Container, Key) /= No_Element - procedure Update_Element + procedure Update_Element -- Update_Element_Preserving_Key ??? (Container : in out Set; Position : Cursor; Process : not null access procedure (Element : in out Element_Type)); + -- If Position equals No_Element, then Constraint_Error is raised. If + -- Position is associated with a set object different from Container, + -- then Program_Error is raised. Otherwise, it makes a copy of the key + -- of the element designated by Position, and then calls Process with + -- the element as the parameter. Update_Element then compares the key + -- value obtained before calling Process to the key value obtained from + -- the element after calling Process. If the keys are equivalent then + -- the operation terminates. If Container is busy (cursor tampering has + -- been attempted), then Program_Error is raised. Otherwise, the node + -- is moved to its new position (in canonical order). procedure Iterate (Container : Set; Key : Key_Type; Process : not null access procedure (Position : Cursor)); + -- Call Process with a cursor designating each element equivalent to + -- Key, in order from Floor (Container, Key) to + -- Ceiling (Container, Key). procedure Reverse_Iterate (Container : Set; Key : Key_Type; Process : not null access procedure (Position : Cursor)); + -- Call Process with a cursor designating each element equivalent to + -- Key, in order from Ceiling (Container, Key) to + -- Floor (Container, Key). end Generic_Keys; diff --git a/gcc/ada/a-convec.adb b/gcc/ada/a-convec.adb index 5cbfa0915af..6175c2f3daa 100644 --- a/gcc/ada/a-convec.adb +++ b/gcc/ada/a-convec.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 2004-2007, Free Software Foundation, Inc. -- +-- Copyright (C) 2004-2008, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -2077,14 +2077,10 @@ package body Ada.Containers.Vectors is end if; declare - EI : Element_Type renames Container.Elements.EA (I); - EJ : Element_Type renames Container.Elements.EA (J); - - EI_Copy : constant Element_Type := EI; - + EI_Copy : constant Element_Type := Container.Elements.EA (I); begin - EI := EJ; - EJ := EI_Copy; + Container.Elements.EA (I) := Container.Elements.EA (J); + Container.Elements.EA (J) := EI_Copy; end; end Swap; diff --git a/gcc/ada/a-coormu.ads b/gcc/ada/a-coormu.ads index 05d71df4b0e..b1a6d1a3f8b 100644 --- a/gcc/ada/a-coormu.ads +++ b/gcc/ada/a-coormu.ads @@ -8,10 +8,6 @@ -- -- -- Copyright (C) 2004-2008, Free Software Foundation, Inc. -- -- -- --- This specification is derived from the Ada Reference Manual for use with -- --- GNAT. The copyright notice above, and the license provisions that follow -- --- apply solely to the contents of the part following the private keyword. -- --- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 2, or (at your option) any later ver- -- @@ -33,7 +29,9 @@ -- This unit was originally developed by Matthew J Heaney. -- ------------------------------------------------------------------------------ --- Documentation is needed for this unit ??? +-- The ordered multiset container is similar to the ordered set, but with the +-- difference that multiple equivalent elements are allowed. It also provides +-- additional operations, to iterate over items that are equivalent. private with Ada.Containers.Red_Black_Trees; private with Ada.Finalization; @@ -50,6 +48,8 @@ package Ada.Containers.Ordered_Multisets is pragma Remote_Types; function Equivalent_Elements (Left, Right : Element_Type) return Boolean; + -- Returns False if Left is less than Right, or Right is less than Left; + -- otherwise, it returns True. type Set is tagged private; pragma Preelaborable_Initialization (Set); @@ -58,42 +58,93 @@ package Ada.Containers.Ordered_Multisets is pragma Preelaborable_Initialization (Cursor); Empty_Set : constant Set; + -- The default value for set objects declared without an explicit + -- initialization expression. No_Element : constant Cursor; + -- The default value for cursor objects declared without an explicit + -- initialization expression. function "=" (Left, Right : Set) return Boolean; + -- If Left denotes the same set object as Right, then equality returns + -- True. If the length of Left is different from the length of Right, then + -- it returns False. Otherwise, set equality iterates over Left and Right, + -- comparing the element of Left to the element of Right using the equality + -- operator for elements. If the elements compare False, then the iteration + -- terminates and set equality returns False. Otherwise, if all elements + -- compare True, then set equality returns True. function Equivalent_Sets (Left, Right : Set) return Boolean; + -- Similar to set equality, but with the difference that elements are + -- compared for equivalence instead of equality. function To_Set (New_Item : Element_Type) return Set; + -- Constructs a set object with New_Item as its single element function Length (Container : Set) return Count_Type; + -- Returns the total number of elements in Container function Is_Empty (Container : Set) return Boolean; + -- Returns True if Container.Length is 0 procedure Clear (Container : in out Set); + -- Deletes all elements from Container function Element (Position : Cursor) return Element_Type; + -- If Position equals No_Element, then Constraint_Error is raised. + -- Otherwise, function Element returns the element designed by Position. procedure Replace_Element (Container : in out Set; Position : Cursor; New_Item : Element_Type); + -- If Position equals No_Element, then Constraint_Error is raised. If + -- Position is associated with a set different from Container, then + -- Program_Error is raised. If New_Item is equivalent to the element + -- designated by Position, then if Container is locked (element tampering + -- has been attempted), Program_Error is raised; otherwise, the element + -- designated by Position is assigned the value of New_Item. If New_Item is + -- not equivalent to the element designated by Position, then if the + -- container is busy (cursor tampering has been attempted), Program_Error + -- is raised; otherwise, the element designed by Position is assigned the + -- value of New_Item, and the node is moved to its new position (in + -- canonical insertion order). procedure Query_Element (Position : Cursor; Process : not null access procedure (Element : Element_Type)); + -- If Position equals No_Element, then Constraint_Error is + -- raised. Otherwise, it calls Process with the element designated by + -- Position as the parameter. This call locks the container, so attempts to + -- change the value of the element while Process is executing (to "tamper + -- with elements") will raise Program_Error. procedure Move (Target : in out Set; Source : in out Set); + -- If Target denotes the same object as Source, the operation does + -- nothing. If either Target or Source is busy (cursor tampering is + -- attempted), then it raises Program_Error. Otherwise, Target is cleared, + -- and the nodes from Source are moved (not copied) to Target (so Source + -- becomes empty). procedure Insert (Container : in out Set; New_Item : Element_Type; Position : out Cursor); + -- Insert adds New_Item to Container, and returns cursor Position + -- designating the newly inserted node. The node is inserted after any + -- existing elements less than or equivalent to New_Item (and before any + -- elements greater than New_Item). Note that the issue of where the new + -- node is inserted relative to equivalent elements does not arise for + -- unique-key containers, since in that case the insertion would simply + -- fail. For a multiple-key container (the case here), insertion always + -- succeeds, and is defined such that the new item is positioned after any + -- equivalent elements already in the container. procedure Insert (Container : in out Set; New_Item : Element_Type); + -- Inserts New_Item in Container, but does not return a cursor designating + -- the newly-inserted node. -- TODO: include Replace too??? -- @@ -104,102 +155,188 @@ package Ada.Containers.Ordered_Multisets is procedure Exclude (Container : in out Set; Item : Element_Type); + -- Deletes from Container all of the elements equivalent to Item procedure Delete (Container : in out Set; Item : Element_Type); + -- Deletes from Container all of the elements equivalent to Item. If there + -- are no elements equivalent to Item, then it raises Constraint_Error. procedure Delete (Container : in out Set; Position : in out Cursor); + -- If Position equals No_Element, then Constraint_Error is raised. If + -- Position is associated with a set different from Container, then + -- Program_Error is raised. Otherwise, the node designated by Position is + -- removed from Container, and Position is set to No_Element. procedure Delete_First (Container : in out Set); + -- Removes the first node from Container procedure Delete_Last (Container : in out Set); + -- Removes the last node from Container procedure Union (Target : in out Set; Source : Set); + -- If Target is busy (cursor tampering is attempted), the Program_Error is + -- raised. Otherwise, it inserts each element of Source into + -- Target. Elements are inserted in the canonical order for multisets, such + -- that the elements from Source are inserted after equivalent elements + -- already in Target. function Union (Left, Right : Set) return Set; + -- Returns a set comprising the all elements from Left and all of the + -- elements from Right. The elements from Right follow the equivalent + -- elements from Left. function "or" (Left, Right : Set) return Set renames Union; procedure Intersection (Target : in out Set; Source : Set); + -- If Target denotes the same object as Source, the operation does + -- nothing. If Target is busy (cursor tampering is attempted), + -- Program_Error is raised. Otherwise, the elements in Target having no + -- equivalent element in Source are deleted from Target. function Intersection (Left, Right : Set) return Set; + -- If Left denotes the same object as Right, then the function returns a + -- copy of Left. Otherwise, it returns a set comprising the equivalent + -- elements from both Left and Right. Items are inserted in the result set + -- in canonical order, such that the elements from Left precede the + -- equivalent elements from Right. function "and" (Left, Right : Set) return Set renames Intersection; procedure Difference (Target : in out Set; Source : Set); + -- If Target is busy (cursor tampering is attempted), then Program_Error is + -- raised. Otherwise, the elements in Target that are equivalent to + -- elements in Source are deleted from Target. function Difference (Left, Right : Set) return Set; + -- Returns a set comprising the elements from Left that have no equivalent + -- element in Right. function "-" (Left, Right : Set) return Set renames Difference; procedure Symmetric_Difference (Target : in out Set; Source : Set); + -- If Target is busy, then Program_Error is raised. Otherwise, the elements + -- in Target equivalent to elements in Source are deleted from Target, and + -- the elements in Source not equivalent to elements in Target are inserted + -- into Target. function Symmetric_Difference (Left, Right : Set) return Set; + -- Returns a set comprising the union of the elements from Target having no + -- equivalent in Source, and the elements of Source having no equivalent in + -- Target. function "xor" (Left, Right : Set) return Set renames Symmetric_Difference; function Overlap (Left, Right : Set) return Boolean; + -- Returns True if Left contains an element equivalent to an element of + -- Right. function Is_Subset (Subset : Set; Of_Set : Set) return Boolean; + -- Returns True if every element in Subset has an equivalent element in + -- Of_Set. function First (Container : Set) return Cursor; + -- If Container is empty, the function returns No_Element. Otherwise, it + -- returns a cursor designating the smallest element. function First_Element (Container : Set) return Element_Type; + -- Equivalent to Element (First (Container)) function Last (Container : Set) return Cursor; + -- If Container is empty, the function returns No_Element. Otherwise, it + -- returns a cursor designating the largest element. function Last_Element (Container : Set) return Element_Type; + -- Equivalent to Element (Last (Container)) function Next (Position : Cursor) return Cursor; + -- If Position equals No_Element or Last (Container), the function returns + -- No_Element. Otherwise, it returns a cursor designating the node that + -- immediately follows (as per the insertion order) the node designated by + -- Position. procedure Next (Position : in out Cursor); + -- Equivalent to Position := Next (Position) function Previous (Position : Cursor) return Cursor; + -- If Position equals No_Element or First (Container), the function returns + -- No_Element. Otherwise, it returns a cursor designating the node that + -- immediately precedes (as per the insertion order) the node designated by + -- Position. procedure Previous (Position : in out Cursor); + -- Equivalent to Position := Previous (Position) function Find (Container : Set; Item : Element_Type) return Cursor; + -- Returns a cursor designating the first element in Container equivalent + -- to Item. If there is no equivalent element, it returns No_Element. function Floor (Container : Set; Item : Element_Type) return Cursor; + -- If Container is empty, the function returns No_Element. If Item is + -- equivalent to elements in Container, it returns a cursor designating the + -- first equivalent element. Otherwise, it returns a cursor designating the + -- largest element less than Item, or No_Element if all elements are + -- greater than Item. function Ceiling (Container : Set; Item : Element_Type) return Cursor; + -- If Container is empty, the function returns No_Element. If Item is + -- equivalent to elements of Container, it returns a cursor designating the + -- last equivalent element. Otherwise, it returns a cursor designating the + -- smallest element greater than Item, or No_Element if all elements are + -- less than Item. function Contains (Container : Set; Item : Element_Type) return Boolean; + -- Equivalent to Container.Find (Item) /= No_Element function Has_Element (Position : Cursor) return Boolean; + -- Equivalent to Position /= No_Element function "<" (Left, Right : Cursor) return Boolean; + -- Equivalent to Element (Left) < Element (Right) function ">" (Left, Right : Cursor) return Boolean; + -- Equivalent to Element (Right) < Element (Left) function "<" (Left : Cursor; Right : Element_Type) return Boolean; + -- Equivalent to Element (Left) < Right function ">" (Left : Cursor; Right : Element_Type) return Boolean; + -- Equivalent to Right < Element (Left) function "<" (Left : Element_Type; Right : Cursor) return Boolean; + -- Equivalent to Left < Element (Right) function ">" (Left : Element_Type; Right : Cursor) return Boolean; + -- Equivalent to Element (Right) < Left procedure Iterate (Container : Set; Process : not null access procedure (Position : Cursor)); + -- Calls Process with a cursor designating each element of Container, in + -- order from Container.First to Container.Last. procedure Reverse_Iterate (Container : Set; Process : not null access procedure (Position : Cursor)); + -- Calls Process with a cursor designating each element of Container, in + -- order from Container.Last to Container.First. procedure Iterate (Container : Set; Item : Element_Type; Process : not null access procedure (Position : Cursor)); + -- Call Process with a cursor designating each element equivalent to Item, + -- in order from Container.Floor (Item) to Container.Ceiling (Item). procedure Reverse_Iterate (Container : Set; Item : Element_Type; Process : not null access procedure (Position : Cursor)); + -- Call Process with a cursor designating each element equivalent to Item, + -- in order from Container.Ceiling (Item) to Container.Floor (Item). generic type Key_Type (<>) is private; @@ -211,38 +348,75 @@ package Ada.Containers.Ordered_Multisets is package Generic_Keys is function Equivalent_Keys (Left, Right : Key_Type) return Boolean; + -- Returns False if Left is less than Right, or Right is less than Left; + -- otherwise, it returns True. function Key (Position : Cursor) return Key_Type; + -- Equivalent to Key (Element (Position)) function Element (Container : Set; Key : Key_Type) return Element_Type; + -- Equivalent to Element (Find (Container, Key)) procedure Exclude (Container : in out Set; Key : Key_Type); + -- Deletes from Container any elements whose key is equivalent to Key procedure Delete (Container : in out Set; Key : Key_Type); + -- Deletes from Container any elements whose key is equivalent to + -- Key. If there are no such elements, then it raises Constraint_Error. function Find (Container : Set; Key : Key_Type) return Cursor; + -- Returns a cursor designating the first element in Container whose key + -- is equivalent to Key. If there is no equivalent element, it returns + -- No_Element. function Floor (Container : Set; Key : Key_Type) return Cursor; + -- If Container is empty, the function returns No_Element. If Item is + -- equivalent to the keys of elements in Container, it returns a cursor + -- designating the first such element. Otherwise, it returns a cursor + -- designating the largest element whose key is less than Item, or + -- No_Element if all keys are greater than Item. function Ceiling (Container : Set; Key : Key_Type) return Cursor; + -- If Container is empty, the function returns No_Element. If Item is + -- equivalent to the keys of elements of Container, it returns a cursor + -- designating the last such element. Otherwise, it returns a cursor + -- designating the smallest element whose key is greater than Item, or + -- No_Element if all keys are less than Item. function Contains (Container : Set; Key : Key_Type) return Boolean; + -- Equivalent to Find (Container, Key) /= No_Element - procedure Update_Element + procedure Update_Element -- Update_Element_Preserving_Key ??? (Container : in out Set; Position : Cursor; Process : not null access procedure (Element : in out Element_Type)); + -- If Position equals No_Element, then Constraint_Error is raised. If + -- Position is associated with a set object different from Container, + -- then Program_Error is raised. Otherwise, it makes a copy of the key + -- of the element designated by Position, and then calls Process with + -- the element as the parameter. Update_Element then compares the key + -- value obtained before calling Process to the key value obtained from + -- the element after calling Process. If the keys are equivalent then + -- the operation terminates. If Container is busy (cursor tampering has + -- been attempted), then Program_Error is raised. Otherwise, the node + -- is moved to its new position (in canonical order). procedure Iterate (Container : Set; Key : Key_Type; Process : not null access procedure (Position : Cursor)); + -- Call Process with a cursor designating each element equivalent to + -- Key, in order from Floor (Container, Key) to + -- Ceiling (Container, Key). procedure Reverse_Iterate (Container : Set; Key : Key_Type; Process : not null access procedure (Position : Cursor)); + -- Call Process with a cursor designating each element equivalent to + -- Key, in order from Ceiling (Container, Key) to + -- Floor (Container, Key). end Generic_Keys; diff --git a/gcc/ada/a-crdlli.ads b/gcc/ada/a-crdlli.ads index 00f17eb6890..a97f354d43e 100644 --- a/gcc/ada/a-crdlli.ads +++ b/gcc/ada/a-crdlli.ads @@ -6,11 +6,7 @@ -- -- -- S p e c -- -- -- --- Copyright (C) 2004-2007, Free Software Foundation, Inc. -- --- -- --- This specification is derived from the Ada Reference Manual for use with -- --- GNAT. The copyright notice above, and the license provisions that follow -- --- apply solely to the contents of the part following the private keyword. -- +-- Copyright (C) 2004-2008, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -33,7 +29,15 @@ -- This unit was originally developed by Matthew J Heaney. -- ------------------------------------------------------------------------------ --- Documentation required for this unit ??? +-- The doubly-linked list container provides constant-time insertion and +-- deletion at all positions, and allows iteration in both the forward and +-- reverse directions. This list form allocates storage for all nodes +-- statically (there is no dynamic allocation), and a discriminant is used to +-- specify the capacity. This container is also "restricted", meaning that +-- even though it does raise exceptions (as described below), it does not use +-- internal exception handlers. No state changes are made that would need to +-- be reverted (in the event of an exception), and so as a consequence, this +-- container cannot detect tampering (of cursors or elements). generic type Element_Type is private; @@ -51,40 +55,81 @@ package Ada.Containers.Restricted_Doubly_Linked_Lists is pragma Preelaborable_Initialization (Cursor); Empty_List : constant List; + -- The default value for list objects declared without an explicit + -- initialization expression. No_Element : constant Cursor; + -- The default value for cursor objects declared without an explicit + -- initialization expression. function "=" (Left, Right : List) return Boolean; + -- If Left denotes the same list object as Right, then equality returns + -- True. If the length of Left is different from the length of Right, then + -- it returns False. Otherwise, list equality iterates over Left and Right, + -- comparing the element of Left to the corresponding element of Right + -- using the generic actual equality operator for elements. If the elements + -- compare False, then the iteration terminates and list equality returns + -- False. Otherwise, if all elements return True, then list equality + -- returns True. procedure Assign (Target : in out List; Source : List); + -- If Target denotes the same list object as Source, the operation does + -- nothing. If Target.Capacity is less than Source.Length, then it raises + -- Constraint_Error. Otherwise, it clears Target, and then inserts each + -- element of Source into Target. function Length (Container : List) return Count_Type; + -- Returns the total number of (active) elements in Container function Is_Empty (Container : List) return Boolean; + -- Returns True if Container.Length is 0 procedure Clear (Container : in out List); + -- Deletes all elements from Container. Note that this is a bounded + -- container and so the element is not "deallocated" in the same sense that + -- an unbounded form would deallocate the element. Rather, the node is + -- relinked off of the active part of the list and onto the inactive part + -- of the list (the storage from which new elements are "allocated"). function Element (Position : Cursor) return Element_Type; + -- If Position equals No_Element, then Constraint_Error is raised. + -- Otherwise, function Element returns the element designed by Position. procedure Replace_Element (Container : in out List; Position : Cursor; New_Item : Element_Type); + -- If Position equals No_Element, then Constraint_Error is raised. If + -- Position is associated with a list object different from Container, + -- Program_Error is raised. Otherwise, the element designated by Position + -- is assigned the value New_Item. procedure Query_Element (Position : Cursor; Process : not null access procedure (Element : Element_Type)); + -- If Position equals No_Element, then Constraint_Error is raised. + -- Otherwise, it calls Process with (a constant view of) the element + -- designated by Position as the parameter. procedure Update_Element (Container : in out List; Position : Cursor; Process : not null access procedure (Element : in out Element_Type)); + -- If Position equals No_Element, then Constraint_Error is raised. + -- Otherwise, it calls Process with (a variable view of) the element + -- designated by Position as the parameter. procedure Insert (Container : in out List; Before : Cursor; New_Item : Element_Type; Count : Count_Type := 1); + -- Inserts Count new elements, all with the value New_Item, into Container, + -- immediately prior to the position specified by Before. If Before has the + -- value No_Element, this is interpreted to mean that the elements are + -- appended to the list. If Before is associated with a list object + -- different from Container, then Program_Error is raised. If there are + -- fewer than Count nodes available, then Constraint_Error is raised. procedure Insert (Container : in out List; @@ -92,98 +137,171 @@ package Ada.Containers.Restricted_Doubly_Linked_Lists is New_Item : Element_Type; Position : out Cursor; Count : Count_Type := 1); + -- Inserts elements into Container as described above, but with the + -- difference that cursor Position is returned, which designates the first + -- of the new elements inserted. If Count is 0, Position returns the value + -- Before. procedure Insert (Container : in out List; Before : Cursor; Position : out Cursor; Count : Count_Type := 1); + -- Inserts elements in Container as described above, but with the + -- difference that the new elements are initialized to the default value + -- for objects of type Element_Type. procedure Prepend (Container : in out List; New_Item : Element_Type; Count : Count_Type := 1); + -- Inserts Count elements, all having the value New_Item, prior to the + -- first element of Container. procedure Append (Container : in out List; New_Item : Element_Type; Count : Count_Type := 1); + -- Inserts Count elements, all having the value New_Item, following the + -- last element of Container. procedure Delete (Container : in out List; Position : in out Cursor; Count : Count_Type := 1); + -- If Position equals No_Element, Constraint_Error is raised. If Position + -- is associated with a list object different from Container, then + -- Program_Error is raised. Otherwise, the Count nodes starting from + -- Position are removed from Container ("removed" meaning that the nodes + -- are unlinked from the active nodes of the list and relinked to inactive + -- storage). On return, Position is set to No_Element. procedure Delete_First (Container : in out List; Count : Count_Type := 1); + -- Removes the first Count nodes from Container procedure Delete_Last (Container : in out List; Count : Count_Type := 1); + -- Removes the last Count nodes from Container procedure Reverse_Elements (Container : in out List); + -- Relinks the nodes in reverse order procedure Swap (Container : in out List; I, J : Cursor); + -- If I or J equals No_Element, then Constraint_Error is raised. If I or J + -- is associated with a list object different from Container, then + -- Program_Error is raised. Otherwise, Swap exchanges (copies) the values + -- of the elements (on the nodes) designated by I and J. procedure Swap_Links (Container : in out List; I, J : Cursor); + -- If I or J equals No_Element, then Constraint_Error is raised. If I or J + -- is associated with a list object different from Container, then + -- Program_Error is raised. Otherwise, Swap exchanges (relinks) the nodes + -- designated by I and J. procedure Splice (Container : in out List; Before : Cursor; Position : in out Cursor); + -- If Before is associated with a list object different from Container, + -- then Program_Error is raised. If Position equals No_element, then + -- Constraint_Error is raised; if it associated with a list object + -- different from Container, then Program_Error is raised. Otherwise, the + -- node designated by Position is relinked immediately prior to Before. If + -- Before equals No_Element, this is interpreted to mean to move the node + -- designed by Position to the last end of the list. function First (Container : List) return Cursor; + -- If Container is empty, the function returns No_Element. Otherwise, it + -- returns a cursor designating the first element. function First_Element (Container : List) return Element_Type; + -- Equivalent to Element (First (Container)) function Last (Container : List) return Cursor; + -- If Container is empty, the function returns No_Element. Otherwise, it + -- returns a cursor designating the last element. function Last_Element (Container : List) return Element_Type; + -- Equivalent to Element (Last (Container)) function Next (Position : Cursor) return Cursor; + -- If Position equals No_Element or Last (Container), the function returns + -- No_Element. Otherwise, it returns a cursor designating the node that + -- immediately follows the node designated by Position. procedure Next (Position : in out Cursor); + -- Equivalent to Position := Next (Position) function Previous (Position : Cursor) return Cursor; + -- If Position equals No_Element or First (Container), the function returns + -- No_Element. Otherwise, it returns a cursor designating the node that + -- immediately precedes the node designated by Position. procedure Previous (Position : in out Cursor); + -- Equivalent to Position := Previous (Position) function Find (Container : List; Item : Element_Type; Position : Cursor := No_Element) return Cursor; + -- Searches for the node whose element is equal to Item, starting from + -- Position and continuing to the last end of the list. If Position equals + -- No_Element, the seach starts from the first node. If Position is + -- associated with a list object different from Container, then + -- Program_Error is raised. If no node is found having an element equal to + -- Item, then Find returns No_Element. function Reverse_Find (Container : List; Item : Element_Type; Position : Cursor := No_Element) return Cursor; + -- Searches in reverse for the node whose element is equal to Item, + -- starting from Position and continuing to the first end of the list. If + -- Position equals No_Element, the seach starts from the last node. If + -- Position is associated with a list object different from Container, then + -- Program_Error is raised. If no node is found having an element equal to + -- Item, then Reverse_Find returns No_Element. function Contains (Container : List; Item : Element_Type) return Boolean; + -- Equivalent to Container.Find (Item) /= No_Element function Has_Element (Position : Cursor) return Boolean; + -- Equivalent to Position /= No_Element procedure Iterate (Container : List; Process : not null access procedure (Position : Cursor)); + -- Calls Process with a cursor designating each element of Container, in + -- order from Container.First to Container.Last. procedure Reverse_Iterate (Container : List; Process : not null access procedure (Position : Cursor)); + -- Calls Process with a cursor designating each element of Container, in + -- order from Container.Last to Container.First. generic with function "<" (Left, Right : Element_Type) return Boolean is <>; package Generic_Sorting is function Is_Sorted (Container : List) return Boolean; + -- Returns False if there exists an element which is less than its + -- predecessor. procedure Sort (Container : in out List); + -- Sorts the elements of Container (by relinking nodes), according to + -- the order specified by the generic formal less-than operator, such + -- that smaller elements are first in the list. The sort is stable, + -- meaning that the relative order of elements is preserved. end Generic_Sorting; diff --git a/gcc/ada/a-direct.adb b/gcc/ada/a-direct.adb index 39a49c96090..cdb68764115 100644 --- a/gcc/ada/a-direct.adb +++ b/gcc/ada/a-direct.adb @@ -158,17 +158,20 @@ package body Ada.Directories is if Containing_Directory /= "" and then not Is_Valid_Path_Name (Containing_Directory) then - raise Name_Error; + raise Name_Error with + "invalid directory path name """ & Containing_Directory & '"'; elsif Extension'Length = 0 and then (not Is_Valid_Simple_Name (Name)) then - raise Name_Error; + raise Name_Error with + "invalid simple name """ & Name & '"'; elsif Extension'Length /= 0 and then not Is_Valid_Simple_Name (Name & '.' & Extension) then - raise Name_Error; + raise Name_Error with + "invalid file name """ & Name & '.' & Extension & '"'; -- This is not an invalid case so build the path name @@ -211,7 +214,7 @@ package body Ada.Directories is -- First, the invalid case if not Is_Valid_Path_Name (Name) then - raise Name_Error; + raise Name_Error with "invalid path name """ & Name & '"'; else declare @@ -242,7 +245,8 @@ package body Ada.Directories is and then (Norm (Norm'First) in 'a' .. 'z' or else Norm (Norm'First) in 'A' .. 'Z')))) then - raise Use_Error; + raise Use_Error with + "directory """ & Name & """ has no containing directory"; else declare @@ -309,14 +313,19 @@ package body Ada.Directories is begin -- First, the invalid cases - if not Is_Valid_Path_Name (Source_Name) - or else not Is_Valid_Path_Name (Target_Name) - or else not Is_Regular_File (Source_Name) - then - raise Name_Error; + if not Is_Valid_Path_Name (Source_Name) then + raise Name_Error with + "invalid source path name """ & Source_Name & '"'; + + elsif not Is_Valid_Path_Name (Target_Name) then + raise Name_Error with + "invalid target path name """ & Target_Name & '"'; + + elsif not Is_Regular_File (Source_Name) then + raise Name_Error with '"' & Source_Name & """ is not a file"; elsif Is_Directory (Target_Name) then - raise Use_Error; + raise Use_Error with "target """ & Target_Name & """ is a directory"; else -- The implementation uses System.OS_Lib.Copy_File, with parameters @@ -325,7 +334,7 @@ package body Ada.Directories is Copy_File (Source_Name, Target_Name, Success, Overwrite, None); if not Success then - raise Use_Error; + raise Use_Error with "copy of """ & Source_Name & """ failed"; end if; end if; end Copy_File; @@ -349,11 +358,13 @@ package body Ada.Directories is -- First, the invalid case if not Is_Valid_Path_Name (New_Directory) then - raise Name_Error; + raise Name_Error with + "invalid new directory path name """ & New_Directory & '"'; else if mkdir (C_Dir_Name) /= 0 then - raise Use_Error; + raise Use_Error with + "creation of new directory """ & New_Directory & """ failed"; end if; end if; end Create_Directory; @@ -375,7 +386,8 @@ package body Ada.Directories is -- First, the invalid case if not Is_Valid_Path_Name (New_Directory) then - raise Name_Error; + raise Name_Error with + "invalid new directory path name """ & New_Directory & '"'; else -- Build New_Dir with a directory separator at the end, so that the @@ -410,7 +422,8 @@ package body Ada.Directories is -- It is an error if a file with such a name already exists elsif Is_Regular_File (New_Dir (1 .. Last)) then - raise Use_Error; + raise Use_Error with + "file """ & New_Dir (1 .. Last) & """ already exists"; else Create_Directory (New_Directory => New_Dir (1 .. Last)); @@ -459,19 +472,22 @@ package body Ada.Directories is -- First, the invalid cases if not Is_Valid_Path_Name (Directory) then - raise Name_Error; + raise Name_Error with + "invalid directory path name """ & Directory & '"'; elsif not Is_Directory (Directory) then - raise Name_Error; + raise Name_Error with '"' & Directory & """ not a directory"; else declare C_Dir_Name : constant String := Directory & ASCII.NUL; + begin rmdir (C_Dir_Name); if System.OS_Lib.Is_Directory (Directory) then - raise Use_Error; + raise Use_Error with + "deletion of directory """ & Directory & """ failed"; end if; end; end if; @@ -488,10 +504,10 @@ package body Ada.Directories is -- First, the invalid cases if not Is_Valid_Path_Name (Name) then - raise Name_Error; + raise Name_Error with "invalid path name """ & Name & '"'; elsif not Is_Regular_File (Name) then - raise Name_Error; + raise Name_Error with "file """ & Name & """ does not exist"; else -- The implementation uses System.OS_Lib.Delete_File @@ -499,7 +515,7 @@ package body Ada.Directories is Delete_File (Name, Success); if not Success then - raise Use_Error; + raise Use_Error with "file """ & Name & """ could not be deleted"; end if; end if; end Delete_File; @@ -516,10 +532,11 @@ package body Ada.Directories is -- First, the invalid cases if not Is_Valid_Path_Name (Directory) then - raise Name_Error; + raise Name_Error with + "invalid directory path name """ & Directory & '"'; elsif not Is_Directory (Directory) then - raise Name_Error; + raise Name_Error with '"' & Directory & """ not a directory"; else Set_Directory (Directory); @@ -553,7 +570,9 @@ package body Ada.Directories is rmdir (C_Dir_Name); if System.OS_Lib.Is_Directory (Directory) then - raise Use_Error; + raise Use_Error with + "directory tree rooted at """ & + Directory & """ could not be deleted"; end if; end; end if; @@ -568,7 +587,7 @@ package body Ada.Directories is -- First, the invalid case if not Is_Valid_Path_Name (Name) then - raise Name_Error; + raise Name_Error with "invalid path name """ & Name & '"'; else -- The implementation is in File_Exists @@ -586,7 +605,7 @@ package body Ada.Directories is -- First, the invalid case if not Is_Valid_Path_Name (Name) then - raise Name_Error; + raise Name_Error with "invalid path name """ & Name & '"'; else -- Look for first dot that is not followed by a directory separator @@ -769,7 +788,7 @@ package body Ada.Directories is -- First, the invalid case if not Is_Valid_Path_Name (Name) then - raise Name_Error; + raise Name_Error with "invalid path name """ & Name & '"'; else -- Build the return value with lower bound 1 @@ -791,7 +810,7 @@ package body Ada.Directories is -- First, the invalid case if not Directory_Entry.Is_Valid then - raise Status_Error; + raise Status_Error with "invalid directory entry"; else -- The value to return has already been computed @@ -812,7 +831,7 @@ package body Ada.Directories is -- First, the invalid case if Search.Value = null or else not Search.Value.Is_Valid then - raise Status_Error; + raise Status_Error with "invalid search"; end if; -- Fetch the next entry, if needed @@ -824,7 +843,7 @@ package body Ada.Directories is -- It is an error if no valid entry is found if not Search.Value.Is_Valid then - raise Status_Error; + raise Status_Error with "no next entry"; else -- Reset Entry_Fetched and return the entry @@ -843,7 +862,7 @@ package body Ada.Directories is -- First, the invalid case if not File_Exists (Name) then - raise Name_Error; + raise Name_Error with "file """ & Name & """ does not exist"; elsif Is_Regular_File (Name) then return Ordinary_File; @@ -861,7 +880,7 @@ package body Ada.Directories is -- First, the invalid case if not Directory_Entry.Is_Valid then - raise Status_Error; + raise Status_Error with "invalid directory entry"; else -- The value to return has already be computed @@ -888,7 +907,7 @@ package body Ada.Directories is -- First, the invalid cases if not (Is_Regular_File (Name) or else Is_Directory (Name)) then - raise Name_Error; + raise Name_Error with '"' & Name & """ not a file or directory"; else Date := File_Time_Stamp (Name); @@ -928,7 +947,7 @@ package body Ada.Directories is -- First, the invalid case if not Directory_Entry.Is_Valid then - raise Status_Error; + raise Status_Error with "invalid directory entry"; else -- The value to return has already be computed @@ -968,15 +987,21 @@ package body Ada.Directories is begin -- First, the invalid cases - if not Is_Valid_Path_Name (Old_Name) - or else not Is_Valid_Path_Name (New_Name) - or else (not Is_Regular_File (Old_Name) - and then not Is_Directory (Old_Name)) + if not Is_Valid_Path_Name (Old_Name) then + raise Name_Error with "invalid old path name """ & Old_Name & '"'; + + elsif not Is_Valid_Path_Name (New_Name) then + raise Name_Error with "invalid new path name """ & New_Name & '"'; + + elsif not Is_Regular_File (Old_Name) + and then not Is_Directory (Old_Name) then - raise Name_Error; + raise Name_Error with "old file """ & Old_Name & """ does not exist"; elsif Is_Regular_File (New_Name) or Is_Directory (New_Name) then - raise Use_Error; + raise Use_Error with + "new name """ & New_Name + & """ designates a file that already exists"; else -- The implementation uses System.OS_Lib.Rename_File @@ -984,7 +1009,8 @@ package body Ada.Directories is Rename_File (Old_Name, New_Name, Success); if not Success then - raise Use_Error; + raise Use_Error with + "file """ & Old_Name & """ could not be renamed"; end if; end if; end Rename; @@ -1025,8 +1051,17 @@ package body Ada.Directories is pragma Import (C, chdir, "chdir"); begin - if chdir (C_Dir_Name) /= 0 then - raise Name_Error; + if not Is_Valid_Path_Name (Directory) then + raise Name_Error with + "invalid directory path name & """ & Directory & '"'; + + elsif not Is_Directory (Directory) then + raise Name_Error with + "directory """ & Directory & """ does not exist"; + + elsif chdir (C_Dir_Name) /= 0 then + raise Name_Error with + "could not set to designated directory """ & Directory & '"'; end if; end Set_Directory; @@ -1103,7 +1138,7 @@ package body Ada.Directories is -- First, the invalid case if not Is_Valid_Path_Name (Name) then - raise Name_Error; + raise Name_Error with "invalid path name """ & Name & '"'; else -- Build the value to return with lower bound 1 @@ -1135,7 +1170,7 @@ package body Ada.Directories is -- First, the invalid case if not Directory_Entry.Is_Valid then - raise Status_Error; + raise Status_Error with "invalid directory entry"; else -- The value to return has already be computed @@ -1158,7 +1193,7 @@ package body Ada.Directories is -- First, the invalid case if not Is_Regular_File (Name) then - raise Name_Error; + raise Name_Error with "file """ & Name & """ does not exist"; else C_Name (1 .. Name'Length) := Name; @@ -1172,7 +1207,7 @@ package body Ada.Directories is -- First, the invalid case if not Directory_Entry.Is_Valid then - raise Status_Error; + raise Status_Error with "invalid directory entry"; else -- The value to return has already be computed @@ -1195,17 +1230,32 @@ package body Ada.Directories is pragma Import (C, opendir, "__gnat_opendir"); C_File_Name : constant String := Directory & ASCII.NUL; + Pat : Regexp; + Dir : Dir_Type_Value; begin - -- First, the invalid cases + -- First, the invalid case Name_Error if not Is_Directory (Directory) then - raise Name_Error - with "unknown directory """ & Simple_Name (Directory) & '"'; + raise Name_Error with + "unknown directory """ & Simple_Name (Directory) & '"'; + end if; + + -- Check the pattern + + begin + Pat := Compile (Pattern, Glob => True); + exception + when Error_In_Regexp => + Free (Search.Value); + raise Name_Error with "invalid pattern """ & Pattern & '"'; + end; + + Dir := Dir_Type_Value (opendir (C_File_Name)); - elsif not Is_Readable_File (Directory) then - raise Use_Error - with "unreadable directory """ & Simple_Name (Directory) & '"'; + if Dir = No_Dir then + raise Use_Error with + "unreadable directory """ & Simple_Name (Directory) & '"'; end if; -- If needed, finalize Search @@ -1216,23 +1266,12 @@ package body Ada.Directories is Search.Value := new Search_Data; - begin - -- Check the pattern - - Search.Value.Pattern := Compile (Pattern, Glob => True); - - exception - when Error_In_Regexp => - Free (Search.Value); - raise Name_Error - with "invalid pattern """ & Pattern & '"'; - end; - -- Initialize some Search components - Search.Value.Filter := Filter; - Search.Value.Name := To_Unbounded_String (Full_Name (Directory)); - Search.Value.Dir := Dir_Type_Value (opendir (C_File_Name)); + Search.Value.Filter := Filter; + Search.Value.Name := To_Unbounded_String (Full_Name (Directory)); + Search.Value.Pattern := Pat; + Search.Value.Dir := Dir; Search.Value.Is_Valid := True; end Start_Search; diff --git a/gcc/ada/a-direio.ads b/gcc/ada/a-direio.ads index 24b2a0ba533..6ac1a8a95b6 100644 --- a/gcc/ada/a-direio.ads +++ b/gcc/ada/a-direio.ads @@ -6,7 +6,7 @@ -- -- -- S p e c -- -- -- --- Copyright (C) 1992-2006, Free Software Foundation, Inc. -- +-- Copyright (C) 1992-2008, Free Software Foundation, Inc. -- -- -- -- This specification is derived from the Ada Reference Manual for use with -- -- GNAT. The copyright notice above, and the license provisions that follow -- @@ -48,6 +48,10 @@ package Ada.Direct_IO is (Element_Type'Has_Access_Values, "Element_Type for Direct_IO instance has access values"); + pragma Compile_Time_Warning + (Element_Type'Has_Tagged_Values, + "Element_Type for Direct_IO instance has tagged values"); + type File_Type is limited private; type File_Mode is (In_File, Inout_File, Out_File); diff --git a/gcc/ada/a-except-2005.adb b/gcc/ada/a-except-2005.adb index 402a04cbe85..14624cb8178 100644 --- a/gcc/ada/a-except-2005.adb +++ b/gcc/ada/a-except-2005.adb @@ -420,11 +420,11 @@ package body Ada.Exceptions is -- Run-Time Check Routines -- ----------------------------- - -- These routines are called from the runtime to raise a specific - -- exception with a reason message attached. The parameters are - -- the file name and line number in each case. The names are keyed - -- to the codes defined in Types.ads and a-types.h (for example, - -- the name Rcheck_05 refers to the Reason whose Pos code is 5). + -- These routines raise a specific exception with a reason message + -- attached. The parameters are the file name and line number in each + -- case. The names are keyed to the codes defined in types.ads and + -- a-types.h (for example, the name Rcheck_05 refers to the Reason + -- RT_Exception_Code'Val (5)). procedure Rcheck_00 (File : System.Address; Line : Integer); procedure Rcheck_01 (File : System.Address; Line : Integer); @@ -838,20 +838,20 @@ package body Ada.Exceptions is (E : Exception_Id; Message : String := "") is + EF : Exception_Id := E; + begin - if E /= null then - Exception_Data.Set_Exception_Msg (E, Message); - Abort_Defer.all; - Raise_Current_Excep (E); + -- Raise CE if E = Null_ID (AI-446) + + if E = null then + EF := Constraint_Error'Identity; end if; - -- Note: if E is null, then we simply return, which is correct Ada 95 - -- semantics. If we are operating in Ada 2005 mode, then the expander - -- generates a raise Constraint_Error immediately following the call - -- to provide the required Ada 2005 semantics (see AI-329). We do it - -- this way to avoid having run time dependencies on the Ada version. + -- Go ahead and raise appropriate exception - return; + Exception_Data.Set_Exception_Msg (EF, Message); + Abort_Defer.all; + Raise_Current_Excep (EF); end Raise_Exception; ---------------------------- diff --git a/gcc/ada/a-except-2005.ads b/gcc/ada/a-except-2005.ads index 6dae91ff467..79e25123076 100644 --- a/gcc/ada/a-except-2005.ads +++ b/gcc/ada/a-except-2005.ads @@ -93,12 +93,8 @@ package Ada.Exceptions is pragma Ada_05 (Wide_Wide_Exception_Name); procedure Raise_Exception (E : Exception_Id; Message : String := ""); - -- Note: it would be really nice to give a pragma No_Return for this - -- procedure, but it would be wrong, since Raise_Exception does return - -- if given the null exception. However we do special case the name in - -- the test in the compiler for issuing a warning for a missing return - -- after this call. Program_Error seems reasonable enough in such a case. - -- See also the routine Raise_Exception_Always in the private part. + pragma No_Return (Raise_Exception); + -- Note: In accordance with AI-466, CE is raised if E = Null_Id function Exception_Message (X : Exception_Occurrence) return String; @@ -135,11 +131,10 @@ package Ada.Exceptions is (Source : Exception_Occurrence) return Exception_Occurrence_Access; - -- Ada 2005 (AI-438): The language revision introduces the - -- following subprograms and attribute definitions. We do not - -- provide them explicitly; instead, the corresponding stream - -- attributes are made available through a pragma Stream_Convert - -- in the private part of this package. + -- Ada 2005 (AI-438): The language revision introduces the following + -- subprograms and attribute definitions. We do not provide them + -- explicitly. instead, the corresponding stream attributes are made + -- available through a pragma Stream_Convert in the private part. -- procedure Read_Exception_Occurrence -- (Stream : not null access Ada.Streams.Root_Stream_Type'Class; @@ -209,10 +204,10 @@ private pragma No_Return (Raise_Exception_Always); pragma Export (Ada, Raise_Exception_Always, "__gnat_raise_exception"); -- This differs from Raise_Exception only in that the caller has determined - -- that for sure the parameter E is not null, and that therefore the call - -- to this procedure cannot return. The expander converts Raise_Exception - -- calls to Raise_Exception_Always if it can determine this is the case. - -- The Export allows this routine to be accessed from Pure units. + -- that for sure the parameter E is not null, and that therefore no check + -- for Null_Id is required. The expander converts Raise_Exception calls to + -- Raise_Exception_Always if it can determine this is the case. The Export + -- allows this routine to be accessed from Pure units. procedure Raise_From_Signal_Handler (E : Exception_Id; diff --git a/gcc/ada/a-except.adb b/gcc/ada/a-except.adb index a07bf294203..7168d48dbfd 100644 --- a/gcc/ada/a-except.adb +++ b/gcc/ada/a-except.adb @@ -377,11 +377,11 @@ package body Ada.Exceptions is -- Run-Time Check Routines -- ----------------------------- - -- These routines are called from the runtime to raise a specific - -- exception with a reason message attached. The parameters are - -- the file name and line number in each case. The names are keyed - -- to the codes defined in Types.ads and a-types.h (for example, - -- the name Rcheck_05 refers to the Reason whose Pos code is 5). + -- These routines raise a specific exception with a reason message + -- attached. The parameters are the file name and line number in each + -- case. The names are keyed to the codes defined in types.ads and + -- a-types.h (for example, the name Rcheck_05 refers to the Reason + -- RT_Exception_Code'Val (5)). procedure Rcheck_00 (File : System.Address; Line : Integer); procedure Rcheck_01 (File : System.Address; Line : Integer); @@ -807,16 +807,20 @@ package body Ada.Exceptions is (E : Exception_Id; Message : String := "") is + EF : Exception_Id := E; + begin - if E /= null then - Exception_Data.Set_Exception_Msg (E, Message); - Abort_Defer.all; - Raise_Current_Excep (E); + -- Raise CE if E = Null_ID (AI-446) + + if E = null then + EF := Constraint_Error'Identity; end if; - -- Note: if E is null then just return (Ada 95 semantics) + -- Go ahead and raise appropriate exception - return; + Exception_Data.Set_Exception_Msg (EF, Message); + Abort_Defer.all; + Raise_Current_Excep (EF); end Raise_Exception; ---------------------------- diff --git a/gcc/ada/a-except.ads b/gcc/ada/a-except.ads index a97ccb44032..e9f5ecd687e 100644 --- a/gcc/ada/a-except.ads +++ b/gcc/ada/a-except.ads @@ -84,12 +84,8 @@ package Ada.Exceptions is function Exception_Name (Id : Exception_Id) return String; procedure Raise_Exception (E : Exception_Id; Message : String := ""); - -- Note: it would be really nice to give a pragma No_Return for this - -- procedure, but it would be wrong, since Raise_Exception does return if - -- given the null exception in Ada 95 mode. However we do special case the - -- name in the test in the compiler for issuing a warning for a missing - -- return after this call. Program_Error seems reasonable enough in such a - -- case. See also the routine Raise_Exception_Always in the private part. + pragma No_Return (Raise_Exception); + -- Note: In accordance with AI-466, CE is raised if E = Null_Id function Exception_Message (X : Exception_Occurrence) return String; @@ -183,10 +179,10 @@ private pragma No_Return (Raise_Exception_Always); pragma Export (Ada, Raise_Exception_Always, "__gnat_raise_exception"); -- This differs from Raise_Exception only in that the caller has determined - -- that for sure the parameter E is not null, and that therefore the call - -- to this procedure cannot return. The expander converts Raise_Exception - -- calls to Raise_Exception_Always if it can determine this is the case. - -- The Export allows this routine to be accessed from Pure units. + -- that for sure the parameter E is not null, and that therefore no check + -- for Null_Id is required. The expander converts Raise_Exception calls to + -- Raise_Exception_Always if it can determine this is the case. The Export + -- allows this routine to be accessed from Pure units. procedure Raise_From_Signal_Handler (E : Exception_Id; diff --git a/gcc/ada/a-exetim-mingw.adb b/gcc/ada/a-exetim-mingw.adb index bf2f271c045..8ee288acb64 100755 --- a/gcc/ada/a-exetim-mingw.adb +++ b/gcc/ada/a-exetim-mingw.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 2007, Free Software Foundation, Inc. -- +-- Copyright (C) 2007-2008, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -39,6 +39,7 @@ with Ada.Unchecked_Conversion; with System.OS_Interface; use System.OS_Interface; with System.Task_Primitives.Operations; use System.Task_Primitives.Operations; with System.Tasking; use System.Tasking; +with System.Win32; use System.Win32; package body Ada.Execution_Time is @@ -118,7 +119,7 @@ package body Ada.Execution_Time is (HANDLE (Get_Thread_Id (To_Task_Id (T))), C_Time'Access, E_Time'Access, K_Time'Access, U_Time'Access); - if Res = False then + if Res = System.Win32.FALSE then raise Program_Error; end if; diff --git a/gcc/ada/a-secain.ads b/gcc/ada/a-secain.ads index 38f2ef04f57..9c2dfc3319f 100644 --- a/gcc/ada/a-secain.ads +++ b/gcc/ada/a-secain.ads @@ -6,14 +6,35 @@ -- -- -- S p e c -- -- -- --- This specification is derived from the Ada Reference Manual for use with -- --- GNAT. In accordance with the copyright of that document, you can freely -- --- copy and modify this specification, provided that if you redistribute a -- --- modified version, any changes that you have made are clearly indicated. -- +-- Copyright (C) 2004-2008, Free Software Foundation, Inc. -- -- -- +-- GNAT is free software; you can redistribute it and/or modify it under -- +-- terms of the GNU General Public License as published by the Free Soft- -- +-- ware Foundation; either version 2, or (at your option) any later ver- -- +-- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- +-- OUT 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 distributed with GNAT; see file COPYING. If not, write -- +-- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, -- +-- Boston, MA 02110-1301, USA. -- +-- -- +-- As a special exception, if other files instantiate generics from this -- +-- unit, or you link this unit with other files to produce an executable, -- +-- this unit does not by itself cause the resulting executable to be -- +-- covered by the GNU General Public License. This exception does not -- +-- however invalidate any other reasons why the executable file might be -- +-- covered by the GNU Public License. -- +-- -- +-- This unit was originally developed by Matthew J Heaney. -- ------------------------------------------------------------------------------ function Ada.Strings.Equal_Case_Insensitive (Left, Right : String) return Boolean; - pragma Pure (Ada.Strings.Equal_Case_Insensitive); +-- Performs a case-insensitive equality test of Left and Right. This is +-- useful as the generic actual equivalence operation (Equivalent_Keys) +-- when instantiating a hashed container package with type String as the +-- key. It is also useful as the generic actual equality operator when +-- instantiating a container package with type String as the element, +-- allowing case-insensitive container equality tests. diff --git a/gcc/ada/a-sequio.ads b/gcc/ada/a-sequio.ads index 6d3b7d2b2ac..ece3ee13ea6 100644 --- a/gcc/ada/a-sequio.ads +++ b/gcc/ada/a-sequio.ads @@ -6,7 +6,7 @@ -- -- -- S p e c -- -- -- --- Copyright (C) 1992-2006, Free Software Foundation, Inc. -- +-- Copyright (C) 1992-2008, Free Software Foundation, Inc. -- -- -- -- This specification is derived from the Ada Reference Manual for use with -- -- GNAT. The copyright notice above, and the license provisions that follow -- @@ -48,6 +48,10 @@ package Ada.Sequential_IO is (Element_Type'Has_Access_Values, "Element_Type for Sequential_IO instance has access values"); + pragma Compile_Time_Warning + (Element_Type'Has_Tagged_Values, + "Element_Type for Sequential_IO instance has tagged values"); + type File_Type is limited private; type File_Mode is (In_File, Out_File, Append_File); diff --git a/gcc/ada/a-shcain.ads b/gcc/ada/a-shcain.ads index c7263b602fe..45f4ab34069 100644 --- a/gcc/ada/a-shcain.ads +++ b/gcc/ada/a-shcain.ads @@ -6,16 +6,34 @@ -- -- -- S p e c -- -- -- --- This specification is derived from the Ada Reference Manual for use with -- --- GNAT. In accordance with the copyright of that document, you can freely -- --- copy and modify this specification, provided that if you redistribute a -- --- modified version, any changes that you have made are clearly indicated. -- +-- Copyright (C) 2004-2008, Free Software Foundation, Inc. -- -- -- +-- GNAT is free software; you can redistribute it and/or modify it under -- +-- terms of the GNU General Public License as published by the Free Soft- -- +-- ware Foundation; either version 2, or (at your option) any later ver- -- +-- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- +-- OUT 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 distributed with GNAT; see file COPYING. If not, write -- +-- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, -- +-- Boston, MA 02110-1301, USA. -- +-- -- +-- As a special exception, if other files instantiate generics from this -- +-- unit, or you link this unit with other files to produce an executable, -- +-- this unit does not by itself cause the resulting executable to be -- +-- covered by the GNU General Public License. This exception does not -- +-- however invalidate any other reasons why the executable file might be -- +-- covered by the GNU Public License. -- +-- -- +-- This unit was originally developed by Matthew J Heaney. -- ------------------------------------------------------------------------------ with Ada.Containers; function Ada.Strings.Hash_Case_Insensitive (Key : String) return Containers.Hash_Type; - pragma Pure (Ada.Strings.Hash_Case_Insensitive); +-- Computes a hash value for Key without regard for character case. This is +-- useful as the generic actual Hash function when instantiating a hashed +-- container package with type String as the key. diff --git a/gcc/ada/a-slcain.ads b/gcc/ada/a-slcain.ads index 2bb2d1ad4c7..848c1b7f021 100644 --- a/gcc/ada/a-slcain.ads +++ b/gcc/ada/a-slcain.ads @@ -6,14 +6,33 @@ -- -- -- S p e c -- -- -- --- This specification is derived from the Ada Reference Manual for use with -- --- GNAT. In accordance with the copyright of that document, you can freely -- --- copy and modify this specification, provided that if you redistribute a -- --- modified version, any changes that you have made are clearly indicated. -- +-- Copyright (C) 2004-2008, Free Software Foundation, Inc. -- -- -- +-- GNAT is free software; you can redistribute it and/or modify it under -- +-- terms of the GNU General Public License as published by the Free Soft- -- +-- ware Foundation; either version 2, or (at your option) any later ver- -- +-- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- +-- OUT 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 distributed with GNAT; see file COPYING. If not, write -- +-- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, -- +-- Boston, MA 02110-1301, USA. -- +-- -- +-- As a special exception, if other files instantiate generics from this -- +-- unit, or you link this unit with other files to produce an executable, -- +-- this unit does not by itself cause the resulting executable to be -- +-- covered by the GNU General Public License. This exception does not -- +-- however invalidate any other reasons why the executable file might be -- +-- covered by the GNU Public License. -- +-- -- +-- This unit was originally developed by Matthew J Heaney. -- ------------------------------------------------------------------------------ function Ada.Strings.Less_Case_Insensitive (Left, Right : String) return Boolean; - pragma Pure (Ada.Strings.Less_Case_Insensitive); +-- Performs a case-insensitive lexicographic comparison of Left and +-- Right. This is useful as the generic actual less-than operator when +-- instantiating an ordered container package with type String as the key, +-- allowing case-insensitive equivalence tests. diff --git a/gcc/ada/a-strbou.adb b/gcc/ada/a-strbou.adb index 015123a8faf..d7ddc5878e7 100644 --- a/gcc/ada/a-strbou.adb +++ b/gcc/ada/a-strbou.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 1992-2005, Free Software Foundation, Inc. -- +-- Copyright (C) 1992-2008, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -60,6 +60,15 @@ package body Ada.Strings.Bounded is return Times (Left, Right, Max_Length); end "*"; + ----------------- + -- From_String -- + ----------------- + + function From_String (Source : String) return Bounded_String is + begin + return To_Super_String (Source, Max_Length, Error); + end From_String; + --------------- -- Replicate -- --------------- diff --git a/gcc/ada/a-strbou.ads b/gcc/ada/a-strbou.ads index 13f51a4e81e..9961b638b76 100644 --- a/gcc/ada/a-strbou.ads +++ b/gcc/ada/a-strbou.ads @@ -6,7 +6,7 @@ -- -- -- S p e c -- -- -- --- Copyright (C) 1992-2006, Free Software Foundation, Inc. -- +-- Copyright (C) 1992-2008, Free Software Foundation, Inc. -- -- -- -- This specification is derived from the Ada Reference Manual for use with -- -- GNAT. The copyright notice above, and the license provisions that follow -- @@ -469,6 +469,12 @@ package Ada.Strings.Bounded is -- the generic instantiation is compatible with the Super_String -- type declared in the Superbounded package. + function From_String (Source : String) return Bounded_String; + -- Private routine used only by Stream_Convert + + pragma Stream_Convert (Bounded_String, From_String, To_String); + -- Provide stream routines without dragging in Ada.Streams + Null_Bounded_String : constant Bounded_String := (Max_Length => Max_Length, Current_Length => 0, diff --git a/gcc/ada/a-strunb.ads b/gcc/ada/a-strunb.ads index a213f0b37e2..1601f3fef74 100644 --- a/gcc/ada/a-strunb.ads +++ b/gcc/ada/a-strunb.ads @@ -6,7 +6,7 @@ -- -- -- S p e c -- -- -- --- Copyright (C) 1992-2006, Free Software Foundation, Inc. -- +-- Copyright (C) 1992-2008, Free Software Foundation, Inc. -- -- -- -- This specification is derived from the Ada Reference Manual for use with -- -- GNAT. The copyright notice above, and the license provisions that follow -- @@ -395,7 +395,6 @@ private Reference : String_Access := Null_String'Access; Last : Natural := 0; end record; - -- The Unbounded_String is using a buffered implementation to increase -- speed of the Append/Delete/Insert procedures. The Reference string -- pointer above contains the current string value and extra room at the @@ -404,6 +403,7 @@ private -- Reference (1 .. Last). pragma Stream_Convert (Unbounded_String, To_Unbounded, To_String); + -- Provide stream routines without dragging in Ada.Streams pragma Finalize_Storage_Only (Unbounded_String); -- Finalization is required only for freeing storage diff --git a/gcc/ada/a-tags.adb b/gcc/ada/a-tags.adb index 522a826fc06..3f841c622f4 100644 --- a/gcc/ada/a-tags.adb +++ b/gcc/ada/a-tags.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 1992-2007, Free Software Foundation, Inc. -- +-- Copyright (C) 1992-2008, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -105,25 +105,12 @@ package body Ada.Tags is function To_Object_Specific_Data_Ptr is new Ada.Unchecked_Conversion (System.Address, Object_Specific_Data_Ptr); - function To_Predef_Prims_Table_Ptr is - new Ada.Unchecked_Conversion (System.Address, Predef_Prims_Table_Ptr); - function To_Tag_Ptr is new Ada.Unchecked_Conversion (System.Address, Tag_Ptr); function To_Type_Specific_Data_Ptr is new Ada.Unchecked_Conversion (System.Address, Type_Specific_Data_Ptr); - ------------------------------------------------ - -- Unchecked Conversions for other components -- - ------------------------------------------------ - - type Acc_Size - is access function (A : System.Address) return Long_Long_Integer; - - function To_Acc_Size is new Unchecked_Conversion (System.Address, Acc_Size); - -- The profile of the implicitly defined _size primitive - ------------------------------- -- Inline_Always Subprograms -- ------------------------------- @@ -733,7 +720,7 @@ package body Ada.Tags is begin Len := 1; - while Str (Len) /= ASCII.Nul loop + while Str (Len) /= ASCII.NUL loop Len := Len + 1; end loop; @@ -778,35 +765,23 @@ package body Ada.Tags is -- The tag of the parent is always in the first slot of the table of -- ancestor tags. - Size_Slot : constant Positive := 1; - -- The pointer to the _size primitive is always in the first slot of - -- the dispatch table. - TSD_Ptr : constant Addr_Ptr := To_Addr_Ptr (To_Address (T) - DT_Typeinfo_Ptr_Size); TSD : constant Type_Specific_Data_Ptr := To_Type_Specific_Data_Ptr (TSD_Ptr.all); -- Pointer to the TSD - Parent_Tag : constant Tag := TSD.Tags_Table (Parent_Slot); - Parent_Predef_Prims_Ptr : constant Addr_Ptr := - To_Addr_Ptr (To_Address (Parent_Tag) - - DT_Predef_Prims_Offset); - Parent_Predef_Prims : constant Predef_Prims_Table_Ptr := - To_Predef_Prims_Table_Ptr - (Parent_Predef_Prims_Ptr.all); - - -- The tag of the parent type through the dispatch table and its - -- Predef_Prims field. - - F : constant Acc_Size := - To_Acc_Size (Parent_Predef_Prims (Size_Slot)); - -- Access to the _size primitive of the parent + Parent_Tag : constant Tag := TSD.Tags_Table (Parent_Slot); + Parent_TSD_Ptr : constant Addr_Ptr := + To_Addr_Ptr (To_Address (Parent_Tag) + - DT_Typeinfo_Ptr_Size); + Parent_TSD : constant Type_Specific_Data_Ptr := + To_Type_Specific_Data_Ptr (Parent_TSD_Ptr.all); begin -- Here we compute the size of the _parent field of the object - return SSE.Storage_Count (F.all (Obj)); + return SSE.Storage_Count (Parent_TSD.Size_Func.all (Obj)); end Parent_Size; ---------------- @@ -837,6 +812,56 @@ package body Ada.Tags is end if; end Parent_Tag; + ------------------------------- + -- Register_Interface_Offset -- + ------------------------------- + + procedure Register_Interface_Offset + (This : System.Address; + Interface_T : Tag; + Is_Static : Boolean; + Offset_Value : SSE.Storage_Offset; + Offset_Func : Offset_To_Top_Function_Ptr) + is + Prim_DT : Dispatch_Table_Ptr; + Iface_Table : Interface_Data_Ptr; + + begin + -- "This" points to the primary DT and we must save Offset_Value in + -- the Offset_To_Top field of the corresponding dispatch table. + + Prim_DT := DT (To_Tag_Ptr (This).all); + Iface_Table := To_Type_Specific_Data_Ptr (Prim_DT.TSD).Interfaces_Table; + + -- Save Offset_Value in the table of interfaces of the primary DT. + -- This data will be used by the subprogram "Displace" to give support + -- to backward abstract interface type conversions. + + -- Register the offset in the table of interfaces + + if Iface_Table /= null then + for Id in 1 .. Iface_Table.Nb_Ifaces loop + if Iface_Table.Ifaces_Table (Id).Iface_Tag = Interface_T then + if Is_Static or else Offset_Value = 0 then + Iface_Table.Ifaces_Table (Id).Static_Offset_To_Top := True; + Iface_Table.Ifaces_Table (Id).Offset_To_Top_Value := + Offset_Value; + else + Iface_Table.Ifaces_Table (Id).Static_Offset_To_Top := False; + Iface_Table.Ifaces_Table (Id).Offset_To_Top_Func := + Offset_Func; + end if; + + return; + end if; + end loop; + end if; + + -- If we arrive here there is some error in the run-time data structure + + raise Program_Error; + end Register_Interface_Offset; + ------------------ -- Register_Tag -- ------------------ @@ -892,68 +917,26 @@ package body Ada.Tags is -- Set_Offset_To_Top -- ----------------------- - procedure Set_Offset_To_Top + procedure Set_Dynamic_Offset_To_Top (This : System.Address; Interface_T : Tag; - Is_Static : Boolean; Offset_Value : SSE.Storage_Offset; Offset_Func : Offset_To_Top_Function_Ptr) is - Prim_DT : Dispatch_Table_Ptr; - Sec_Base : System.Address; - Sec_DT : Dispatch_Table_Ptr; - Iface_Table : Interface_Data_Ptr; - + Sec_Base : System.Address; + Sec_DT : Dispatch_Table_Ptr; begin -- Save the offset to top field in the secondary dispatch table if Offset_Value /= 0 then Sec_Base := This + Offset_Value; - Sec_DT := DT (To_Tag_Ptr (Sec_Base).all); - - if Is_Static then - Sec_DT.Offset_To_Top := Offset_Value; - else - Sec_DT.Offset_To_Top := SSE.Storage_Offset'Last; - end if; + Sec_DT := DT (To_Tag_Ptr (Sec_Base).all); + Sec_DT.Offset_To_Top := SSE.Storage_Offset'Last; end if; - -- "This" points to the primary DT and we must save Offset_Value in - -- the Offset_To_Top field of the corresponding secondary dispatch - -- table. - - Prim_DT := DT (To_Tag_Ptr (This).all); - Iface_Table := To_Type_Specific_Data_Ptr (Prim_DT.TSD).Interfaces_Table; - - -- Save Offset_Value in the table of interfaces of the primary DT. - -- This data will be used by the subprogram "Displace" to give support - -- to backward abstract interface type conversions. - - -- Register the offset in the table of interfaces - - if Iface_Table /= null then - for Id in 1 .. Iface_Table.Nb_Ifaces loop - if Iface_Table.Ifaces_Table (Id).Iface_Tag = Interface_T then - Iface_Table.Ifaces_Table (Id).Static_Offset_To_Top := - Is_Static; - - if Is_Static then - Iface_Table.Ifaces_Table (Id).Offset_To_Top_Value - := Offset_Value; - else - Iface_Table.Ifaces_Table (Id).Offset_To_Top_Func - := Offset_Func; - end if; - - return; - end if; - end loop; - end if; - - -- If we arrive here there is some error in the run-time data structure - - raise Program_Error; - end Set_Offset_To_Top; + Register_Interface_Offset + (This, Interface_T, False, Offset_Value, Offset_Func); + end Set_Dynamic_Offset_To_Top; ---------------------- -- Set_Prim_Op_Kind -- diff --git a/gcc/ada/a-tags.ads b/gcc/ada/a-tags.ads index 1fc31e8a233..5117eea9ad7 100644 --- a/gcc/ada/a-tags.ads +++ b/gcc/ada/a-tags.ads @@ -6,7 +6,7 @@ -- -- -- S p e c -- -- -- --- Copyright (C) 1992-2007, Free Software Foundation, Inc. -- +-- Copyright (C) 1992-2008, Free Software Foundation, Inc. -- -- -- -- This specification is derived from the Ada Reference Manual for use with -- -- GNAT. The copyright notice above, and the license provisions that follow -- @@ -222,7 +222,8 @@ private -- type. This construct is used in the handling of dispatching triggers -- in select statements. - type Address_Array is array (Positive range <>) of System.Address; + type Prim_Ptr is access procedure; + type Address_Array is array (Positive range <>) of Prim_Ptr; subtype Dispatch_Table is Address_Array (1 .. 1); -- Used by GDB to identify the _tags and traverse the run-time structure @@ -242,8 +243,14 @@ private type Tag_Ptr is access all Tag; pragma No_Strict_Aliasing (Tag_Ptr); + type Offset_To_Top_Ptr is access all SSE.Storage_Offset; + pragma No_Strict_Aliasing (Offset_To_Top_Ptr); + type Tag_Table is array (Natural range <>) of Tag; + type Size_Ptr is + access function (A : System.Address) return Long_Long_Integer; + type Type_Specific_Data (Idepth : Natural) is record -- The discriminant Idepth is the Inheritance Depth Level: Used to -- implement the membership test associated with single inheritance of @@ -279,6 +286,12 @@ private -- Controller Offset: Used to give support to tagged controlled objects -- (see Get_Deep_Controller at s-finimp) + Size_Func : Size_Ptr; + -- Pointer to the subprogram computing the _size of the object. Used by + -- the run-time whenever a call to the 'size primitive is required. We + -- cannot assume that the contents of dispatch tables are addresses + -- because in some architectures the ABI allows descriptors. + Interfaces_Table : Interface_Data_Ptr; -- Pointer to the table of interface tags. It is used to implement the -- membership test associated with interfaces and also for backward @@ -370,6 +383,10 @@ private use type System.Storage_Elements.Storage_Offset; + DT_Offset_To_Top_Offset : constant SSE.Storage_Count := + DT_Typeinfo_Ptr_Size + + DT_Offset_To_Top_Size; + DT_Predef_Prims_Offset : constant SSE.Storage_Count := DT_Typeinfo_Ptr_Size + DT_Offset_To_Top_Size @@ -474,28 +491,44 @@ private pragma Export (Ada, Parent_Size, "ada__tags__parent_size"); -- This procedure is used in s-finimp and is thus exported manually + procedure Register_Interface_Offset + (This : System.Address; + Interface_T : Tag; + Is_Static : Boolean; + Offset_Value : SSE.Storage_Offset; + Offset_Func : Offset_To_Top_Function_Ptr); + -- Register in the table of interfaces of the tagged type associated with + -- "This" object the offset of the record component associated with the + -- progenitor Interface_T (that is, the distance from "This" to the object + -- component containing the tag of the secondary dispatch table). In case + -- of constant offset, Is_Static is true and Offset_Value has such value. + -- In case of variable offset, Is_Static is false and Offset_Func is an + -- access to function that must be called to evaluate the offset. + procedure Register_Tag (T : Tag); -- Insert the Tag and its associated external_tag in a table for the -- sake of Internal_Tag - procedure Set_Entry_Index (T : Tag; Position : Positive; Value : Positive); - -- Ada 2005 (AI-345): Set the entry index of a primitive operation in T's - -- TSD table indexed by Position. - - procedure Set_Offset_To_Top + procedure Set_Dynamic_Offset_To_Top (This : System.Address; Interface_T : Tag; - Is_Static : Boolean; Offset_Value : SSE.Storage_Offset; Offset_Func : Offset_To_Top_Function_Ptr); - -- Ada 2005 (AI-251): Initialize the Offset_To_Top field in the prologue of - -- the dispatch table. In primary dispatch tables the value of "This" is - -- not required (and the compiler passes always the Null_Address value) and - -- the Offset_Value is always cero; in secondary dispatch tables "This" - -- points to the object, Interface_T is the interface for which the - -- secondary dispatch table is being initialized, and Offset_Value is the - -- distance from "This" to the object component containing the tag of the - -- secondary dispatch table. + -- Ada 2005 (AI-251): The compiler generates calls to this routine only + -- when initializing the Offset_To_Top field of dispatch tables associated + -- with tagged type whose parent has variable size components. "This" is + -- the object whose dispatch table is being initialized. Interface_T is the + -- interface for which the secondary dispatch table is being initialized, + -- and Offset_Value is the distance from "This" to the object component + -- containing the tag of the secondary dispatch table (a zero value means + -- that this interface shares the primary dispatch table). Offset_Func + -- references a function that must be called to evaluate the offset at + -- runtime. This routine also takes care of registering these values in + -- the table of interfaces of the type. + + procedure Set_Entry_Index (T : Tag; Position : Positive; Value : Positive); + -- Ada 2005 (AI-345): Set the entry index of a primitive operation in T's + -- TSD table indexed by Position. procedure Set_Prim_Op_Kind (T : Tag; @@ -532,5 +565,7 @@ private type Addr_Ptr is access System.Address; pragma No_Strict_Aliasing (Addr_Ptr); - -- Why is this needed ??? + -- This type is used by the frontend to generate the code that handles + -- dispatch table slots of types declared at the local level. + end Ada.Tags; diff --git a/gcc/ada/a-taside.adb b/gcc/ada/a-taside.adb index e9431d16499..600425c3996 100644 --- a/gcc/ada/a-taside.adb +++ b/gcc/ada/a-taside.adb @@ -34,6 +34,7 @@ with System.Address_Image; with System.Parameters; with System.Soft_Links; +with System.Task_Primitives; with System.Task_Primitives.Operations; with Ada.Unchecked_Conversion; @@ -113,7 +114,8 @@ package body Ada.Task_Identification is function Image (T : Task_Id) return String is function To_Address is new - Ada.Unchecked_Conversion (Task_Id, System.Address); + Ada.Unchecked_Conversion + (Task_Id, System.Task_Primitives.Task_Address); begin if T = Null_Task_Id then diff --git a/gcc/ada/a-textio.adb b/gcc/ada/a-textio.adb index 050e71d500c..9247ba7f7aa 100644 --- a/gcc/ada/a-textio.adb +++ b/gcc/ada/a-textio.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 1992-2007, Free Software Foundation, Inc. -- +-- Copyright (C) 1992-2008, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -858,8 +858,8 @@ package body Ada.Text_IO is Result := WC_In (C, File.WC_Method); if Wide_Character'Pos (Result) > 16#FF# then - raise Constraint_Error - with "invalid wide character in Text_'I'O input"; + raise Constraint_Error with + "invalid wide character in Text_'I'O input"; else return Character'Val (Wide_Character'Pos (Result)); end if; @@ -901,8 +901,8 @@ package body Ada.Text_IO is Result := WC_In (C, File.WC_Method); if Wide_Character'Pos (Result) > 16#FF# then - raise Constraint_Error - with "invalid wide character in Text_'I'O input"; + raise Constraint_Error with + "invalid wide character in Text_'I'O input"; else return Character'Val (Wide_Character'Pos (Result)); end if; @@ -2212,9 +2212,9 @@ package body Ada.Text_IO is -- null character in the runtime, here the null characters are added just -- to have a correct filename length. - Err_Name : aliased String := "*stderr" & ASCII.Nul; - In_Name : aliased String := "*stdin" & ASCII.Nul; - Out_Name : aliased String := "*stdout" & ASCII.Nul; + Err_Name : aliased String := "*stderr" & ASCII.NUL; + In_Name : aliased String := "*stdin" & ASCII.NUL; + Out_Name : aliased String := "*stdout" & ASCII.NUL; begin ------------------------------- diff --git a/gcc/ada/a-tideau.adb b/gcc/ada/a-tideau.adb index 06a41ee791d..b9e39dcb586 100644 --- a/gcc/ada/a-tideau.adb +++ b/gcc/ada/a-tideau.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 1992-2006, Free Software Foundation, Inc. -- +-- Copyright (C) 1992-2008, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -201,16 +201,24 @@ package body Ada.Text_IO.Decimal_Aux is Ptr : Natural := 0; begin - if Exp = 0 then - Fore := To'Length - 1 - Aft; - else - Fore := To'Length - 2 - Aft - Exp; + -- Compute Fore, allowing for Aft digits and the decimal dot + + Fore := To'Length - Field'Max (1, Aft) - 1; + + -- Allow for Exp and two more for E+ or E- if exponent present + + if Exp /= 0 then + Fore := Fore - 2 - Exp; end if; + -- Make sure we have enough room + if Fore < 1 then raise Layout_Error; end if; + -- Do the conversion and check length of result + Set_Image_Decimal (Item, Buf, Ptr, Scale, Fore, Aft, Exp); if Ptr > To'Length then diff --git a/gcc/ada/a-tifiio.adb b/gcc/ada/a-tifiio.adb index ae1a60d54ef..44100ee5624 100644 --- a/gcc/ada/a-tifiio.adb +++ b/gcc/ada/a-tifiio.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 1992-2007, Free Software Foundation, Inc. -- +-- Copyright (C) 1992-2008, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -638,11 +638,13 @@ package body Ada.Text_IO.Fixed_IO is -- been generated, compute the Aft next digits (without rounding). -- Once a non-zero digit is generated, determine the exact number -- of digits remaining and compute them with rounding. + -- Since a large number of iterations might be necessary in case -- of Aft = 1, the following optimization would be desirable. + -- Count the number Z of leading zero bits in the integer - -- representation of X, and start with producing - -- Aft + Z * 1000 / 3322 digits in the first scaled division. + -- representation of X, and start with producing Aft + Z * 1000 / + -- 3322 digits in the first scaled division. -- However, the floating-point routines are still used now ??? diff --git a/gcc/ada/a-witeio.adb b/gcc/ada/a-witeio.adb index 86a37b6fbe8..25d265c218e 100644 --- a/gcc/ada/a-witeio.adb +++ b/gcc/ada/a-witeio.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 1992-2007, Free Software Foundation, Inc. -- +-- Copyright (C) 1992-2008, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -1848,9 +1848,9 @@ package body Ada.Wide_Text_IO is -- a null character in the runtime, here the null characters are added -- just to have a correct filename length. - Err_Name : aliased String := "*stderr" & ASCII.Nul; - In_Name : aliased String := "*stdin" & ASCII.Nul; - Out_Name : aliased String := "*stdout" & ASCII.Nul; + Err_Name : aliased String := "*stderr" & ASCII.NUL; + In_Name : aliased String := "*stdin" & ASCII.NUL; + Out_Name : aliased String := "*stdout" & ASCII.NUL; begin ------------------------------- diff --git a/gcc/ada/a-wtdeau.adb b/gcc/ada/a-wtdeau.adb index fd6cc2eea42..1a9752fb8c2 100644 --- a/gcc/ada/a-wtdeau.adb +++ b/gcc/ada/a-wtdeau.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 1992-2006, Free Software Foundation, Inc. -- +-- Copyright (C) 1992-2008, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -203,16 +203,24 @@ package body Ada.Wide_Text_IO.Decimal_Aux is Ptr : Natural := 0; begin - if Exp = 0 then - Fore := To'Length - 1 - Aft; - else - Fore := To'Length - 2 - Aft - Exp; + -- Compute Fore, allowing for Aft digits and the decimal dot + + Fore := To'Length - Field'Max (1, Aft) - 1; + + -- Allow for Exp and two more for E+ or E- if exponent present + + if Exp /= 0 then + Fore := Fore - 2 - Exp; end if; + -- Make sure we have enough room + if Fore < 1 then raise Layout_Error; end if; + -- Do the conversion and check length of result + Set_Image_Decimal (Item, Buf, Ptr, Scale, Fore, Aft, Exp); if Ptr > To'Length then diff --git a/gcc/ada/a-ztdeau.adb b/gcc/ada/a-ztdeau.adb index d36d34fb8bd..e7f13ecc57b 100644 --- a/gcc/ada/a-ztdeau.adb +++ b/gcc/ada/a-ztdeau.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 1992-2006, Free Software Foundation, Inc. -- +-- Copyright (C) 1992-2008, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -203,16 +203,24 @@ package body Ada.Wide_Wide_Text_IO.Decimal_Aux is Ptr : Natural := 0; begin - if Exp = 0 then - Fore := To'Length - 1 - Aft; - else - Fore := To'Length - 2 - Aft - Exp; + -- Compute Fore, allowing for Aft digits and the decimal dot + + Fore := To'Length - Field'Max (1, Aft) - 1; + + -- Allow for Exp and two more for E+ or E- if exponent present + + if Exp /= 0 then + Fore := Fore - 2 - Exp; end if; + -- Make sure we have enough room + if Fore < 1 then raise Layout_Error; end if; + -- Do the conversion and check length of result + Set_Image_Decimal (Item, Buf, Ptr, Scale, Fore, Aft, Exp); if Ptr > To'Length then diff --git a/gcc/ada/a-ztexio.adb b/gcc/ada/a-ztexio.adb index 296202256e7..a85cdb30998 100644 --- a/gcc/ada/a-ztexio.adb +++ b/gcc/ada/a-ztexio.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 1992-2007, Free Software Foundation, Inc. -- +-- Copyright (C) 1992-2008, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -1848,9 +1848,9 @@ package body Ada.Wide_Wide_Text_IO is -- a null character in the runtime, here the null characters are added -- just to have a correct filename length. - Err_Name : aliased String := "*stderr" & ASCII.Nul; - In_Name : aliased String := "*stdin" & ASCII.Nul; - Out_Name : aliased String := "*stdout" & ASCII.Nul; + Err_Name : aliased String := "*stderr" & ASCII.NUL; + In_Name : aliased String := "*stdin" & ASCII.NUL; + Out_Name : aliased String := "*stdout" & ASCII.NUL; begin ------------------------------- diff --git a/gcc/ada/ada-tree.h b/gcc/ada/ada-tree.h index 27f9ef6ab42..b38c34da573 100644 --- a/gcc/ada/ada-tree.h +++ b/gcc/ada/ada-tree.h @@ -6,7 +6,7 @@ * * * C Header File * * * - * Copyright (C) 1992-2007, Free Software Foundation, Inc. * + * Copyright (C) 1992-2008, Free Software Foundation, Inc. * * * * GNAT is free software; you can redistribute it and/or modify it under * * terms of the GNU General Public License as published by the Free Soft- * @@ -69,8 +69,9 @@ struct lang_type GTY(()) {tree t; }; #define TYPE_FAT_POINTER_P(NODE) \ (TREE_CODE (NODE) == RECORD_TYPE && TYPE_IS_FAT_POINTER_P (NODE)) -/* For integral types and array types, nonzero if this is a packed array type. - Such types should not be extended to a larger size. */ +/* For integral types and array types, nonzero if this is a packed array type + used for bit-packed types. Such types should not be extended to a larger + size or validated against a specified size. */ #define TYPE_PACKED_ARRAY_TYPE_P(NODE) TYPE_LANG_FLAG_0 (NODE) #define TYPE_IS_PACKED_ARRAY_TYPE_P(NODE) \ diff --git a/gcc/ada/adaint.c b/gcc/ada/adaint.c index b65a1c7176c..62e540c9448 100644 --- a/gcc/ada/adaint.c +++ b/gcc/ada/adaint.c @@ -6,7 +6,7 @@ * * * C Implementation File * * * - * Copyright (C) 1992-2007, Free Software Foundation, Inc. * + * Copyright (C) 1992-2008, Free Software Foundation, Inc. * * * * GNAT is free software; you can redistribute it and/or modify it under * * terms of the GNU General Public License as published by the Free Soft- * @@ -359,6 +359,30 @@ __gnat_current_time return (OS_Time) res; } +/* Return the current local time as a string in the ISO 8601 format of + "YYYY-MM-DD HH:MM:SS.SS". The returned string is 22 + 1 (NULL) characters + long. */ + +void +__gnat_current_time_string + (char *result) +{ + const char *format = "%Y-%m-%d %H:%M:%S"; + /* Format string necessary to describe the ISO 8601 format */ + + const time_t t_val = time (NULL); + + strftime (result, 22, format, localtime (&t_val)); + /* Convert the local time into a string following the ISO format, copying + at most 22 characters into the result string. */ + + result [19] = '.'; + result [20] = '0'; + result [21] = '0'; + /* The sub-seconds are manually set to zero since type time_t lacks the + precision necessary for nanoseconds. */ +} + void __gnat_to_gm_time (OS_Time *p_time, @@ -434,7 +458,8 @@ __gnat_symlink (char *oldpath ATTRIBUTE_UNUSED, /* Try to lock a file, return 1 if success. */ -#if defined (__vxworks) || defined (__nucleus__) || defined (MSDOS) || defined (_WIN32) +#if defined (__vxworks) || defined (__nucleus__) || defined (MSDOS) \ + || defined (_WIN32) /* Version that does not use link. */ @@ -888,7 +913,7 @@ __gnat_open_new_temp (char *path, int fmode) strcpy (path, "GNAT-XXXXXX"); #if (defined (__FreeBSD__) || defined (__NetBSD__) || defined (__OpenBSD__) \ - || defined (linux)) && !defined (__vxworks) + || defined (linux) || defined(__GLIBC__)) && !defined (__vxworks) return mkstemp (path); #elif defined (__Lynx__) mktemp (path); @@ -981,7 +1006,7 @@ __gnat_tmp_name (char *tmp_filename) } #elif defined (linux) || defined (__FreeBSD__) || defined (__NetBSD__) \ - || defined (__OpenBSD__) + || defined (__OpenBSD__) || defined(__GLIBC__) #define MAX_SAFE_PATH 1000 char *tmpdir = getenv ("TMPDIR"); @@ -3030,7 +3055,7 @@ void GetTimeAsFileTime(LPFILETIME pTime) } #endif -#if defined (linux) +#if defined (linux) || defined(__GLIBC__) /* pthread affinity support */ int __gnat_pthread_setaffinity_np (pthread_t th, diff --git a/gcc/ada/adaint.h b/gcc/ada/adaint.h index 77724cdd794..7b1e86df960 100644 --- a/gcc/ada/adaint.h +++ b/gcc/ada/adaint.h @@ -6,7 +6,7 @@ * * * C Header File * * * - * Copyright (C) 1992-2007, Free Software Foundation, Inc. * + * Copyright (C) 1992-2008, Free Software Foundation, Inc. * * * * GNAT is free software; you can redistribute it and/or modify it under * * terms of the GNU General Public License as published by the Free Soft- * @@ -47,6 +47,7 @@ typedef long OS_Time; /* Type corresponding to GNAT.OS_Lib.OS_Time */ extern int __gnat_max_path_len; extern OS_Time __gnat_current_time (void); +extern void __gnat_current_time_string (char *); extern void __gnat_to_gm_time (OS_Time *, int *, int *, int *, int *, int *, int *); diff --git a/gcc/ada/ali.adb b/gcc/ada/ali.adb index 96624d6a835..31695a386ac 100644 --- a/gcc/ada/ali.adb +++ b/gcc/ada/ali.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 1992-2007, Free Software Foundation, Inc. -- +-- Copyright (C) 1992-2008, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -53,6 +53,7 @@ package body ALI is 'D' => True, -- dependency 'X' => True, -- xref 'S' => True, -- specific dispatching + 'Y' => True, -- limited_with others => False); -------------------- @@ -772,7 +773,7 @@ package body ALI is -- Acquire lines to be ignored if Read_Xref then - Ignore := ('U' | 'W' | 'D' | 'X' => False, others => True); + Ignore := ('U' | 'W' | 'Y' | 'D' | 'X' => False, others => True); -- Read_Lines parameter given @@ -818,7 +819,6 @@ package body ALI is No_Object => False, Normalize_Scalars => False, Ofile_Full_Name => Full_Object_File_Name, - Optimize_Alignment_Setting => 'O', Queuing_Policy => ' ', Restrictions => No_Restrictions, SAL_Interface => False, @@ -1041,11 +1041,6 @@ package body ALI is Fatal_Error_Ignore; end if; - -- Processing for Ox - - elsif C = 'O' then - ALIs.Table (Id).Optimize_Alignment_Setting := Getc; - -- Processing for Qx elsif C = 'Q' then @@ -1424,6 +1419,7 @@ package body ALI is UL.SAL_Interface := ALIs.Table (Id).SAL_Interface; UL.Body_Needed_For_SAL := False; UL.Elaborate_Body_Desirable := False; + UL.Optimize_Alignment := 'O'; if Debug_Flag_U then Write_Str (" ----> reading unit "); @@ -1626,6 +1622,19 @@ package body ALI is Check_At_End_Of_Field; + -- OL/OO/OS/OT parameters + + elsif C = 'O' then + C := Getc; + + if C = 'L' or else C = 'O' or else C = 'S' or else C = 'T' then + Units.Table (Units.Last).Optimize_Alignment := C; + else + Fatal_Error_Ignore; + end if; + + Check_At_End_Of_Field; + -- RC/RT parameters elsif C = 'R' then @@ -1678,7 +1687,7 @@ package body ALI is With_Loop : loop Check_Unknown_Line; - exit With_Loop when C /= 'W'; + exit With_Loop when C /= 'W' and then C /= 'Y'; if Ignore ('W') then Skip_Line; @@ -1693,6 +1702,7 @@ package body ALI is Withs.Table (Withs.Last).Elab_Desirable := False; Withs.Table (Withs.Last).Elab_All_Desirable := False; Withs.Table (Withs.Last).SAL_Interface := False; + Withs.Table (Withs.Last).Limited_With := (C = 'Y'); -- Generic case with no object file available diff --git a/gcc/ada/ali.ads b/gcc/ada/ali.ads index c632c659045..dd3b6cd6577 100644 --- a/gcc/ada/ali.ads +++ b/gcc/ada/ali.ads @@ -6,7 +6,7 @@ -- -- -- S p e c -- -- -- --- Copyright (C) 1992-2007, Free Software Foundation, Inc. -- +-- Copyright (C) 1992-2008, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -176,11 +176,6 @@ package ALI is -- Set to True if file was compiled with Normalize_Scalars. Not set if -- 'P' appears in Ignore_Lines. - Optimize_Alignment_Setting : Character; - -- Optimize_Alignment setting. Set to S/T if OS/OT parameters present, - -- otherwise set to 'O' (S/T/O = Space/Time/Off). Not set if 'P' appears - -- in Ignore_Lines. - Unit_Exception_Table : Boolean; -- Set to True if unit exception table pointer generated. Not set if 'P' -- appears in Ignore_Lines. @@ -358,6 +353,9 @@ package ALI is -- for the body right after the call for the spec, or at least as close -- together as possible. + Optimize_Alignment : Character; + -- Optimize_Alignment setting. Set to L/S/T/O for OL/OS/OT/OO present + end record; package Units is new Table.Table ( @@ -539,6 +537,8 @@ package ALI is SAL_Interface : Boolean := False; -- True if the Unit is an Interface of a Stand-Alone Library + Limited_With : Boolean := False; + -- True if unit is named in a limited_with_clause end record; package Withs is new Table.Table ( @@ -669,8 +669,8 @@ package ALI is -- Sdep (Source Dependency) Table -- ------------------------------------ - -- Each source dependency (D line) in an ALI file generates an - -- entry in the Sdep table. + -- Each source dependency (D line) in an ALI file generates an entry in the + -- Sdep table. -- Note: there will be no entries in this table if 'D' lines are ignored @@ -678,9 +678,9 @@ package ALI is -- Special value indicating no Sdep table entry First_Sdep_Entry : Sdep_Id := No_Sdep_Id + 1; - -- Id of first Sdep entry for current ali file. This is initialized to - -- the first Sdep entry in the table, and then incremented appropriately - -- as successive ALI files are scanned. + -- Id of first Sdep entry for current ali file. This is initialized to the + -- first Sdep entry in the table, and then incremented appropriately as + -- successive ALI files are scanned. type Sdep_Record is record @@ -688,24 +688,23 @@ package ALI is -- Name of source file Stamp : Time_Stamp_Type; - -- Time stamp value. Note that this will be all zero characters - -- for the dummy entries for missing or non-dependent files. + -- Time stamp value. Note that this will be all zero characters for the + -- dummy entries for missing or non-dependent files. Checksum : Word; - -- Checksum value. Note that this will be all zero characters - -- for the dummy entries for missing or non-dependent files + -- Checksum value. Note that this will be all zero characters for the + -- dummy entries for missing or non-dependent files Dummy_Entry : Boolean; - -- Set True for dummy entries that correspond to missing files - -- or files where no dependency relationship exists. + -- Set True for dummy entries that correspond to missing files or files + -- where no dependency relationship exists. Subunit_Name : Name_Id; -- Name_Id for subunit name if present, else No_Name Rfile : File_Name_Type; - -- Reference file name. Same as Sfile unless a Source_Reference - -- pragma was used, in which case it reflects the name used in - -- the pragma. + -- Reference file name. Same as Sfile unless a Source_Reference pragma + -- was used, in which case it reflects the name used in the pragma. Start_Line : Nat; -- Starting line number in file. Always 1, unless a Source_Reference @@ -726,8 +725,8 @@ package ALI is -- Use of Name Table Info -- ---------------------------- - -- All unit names and file names are entered into the Names table. The - -- Info fields of these entries are used as follows: + -- All unit names and file names are entered into the Names table. The Info + -- fields of these entries are used as follows: -- Unit name Info field has Unit_Id of unit table entry -- ALI file name Info field has ALI_Id of ALI table entry @@ -737,8 +736,8 @@ package ALI is -- Cross-Reference Data -- -------------------------- - -- The following table records cross-reference sections, there is one - -- entry for each X header line in the ALI file for an xref section. + -- The following table records cross-reference sections, there is one entry + -- for each X header line in the ALI file for an xref section. -- Note: there will be no entries in this table if 'X' lines are ignored diff --git a/gcc/ada/alloc.ads b/gcc/ada/alloc.ads index 3707ecf5543..7bfe9aa8162 100644 --- a/gcc/ada/alloc.ads +++ b/gcc/ada/alloc.ads @@ -99,6 +99,9 @@ package Alloc is Nodes_Initial : constant := 50_000; -- Atree Nodes_Increment : constant := 100; + Obsolescent_Warnings_Initial : constant := 50; -- Sem_Prag + Obsolescent_Warnings_Increment : constant := 200; + Orig_Nodes_Initial : constant := 50_000; -- Atree Orig_Nodes_Increment : constant := 100; diff --git a/gcc/ada/atree.adb b/gcc/ada/atree.adb index 2f504ba7a9e..67d8597997b 100644 --- a/gcc/ada/atree.adb +++ b/gcc/ada/atree.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 1992-2007, Free Software Foundation, Inc. -- +-- Copyright (C) 1992-2008, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -562,9 +562,9 @@ package body Atree is -- Local Subprograms -- ----------------------- - procedure Fix_Parents (Old_Node, New_Node : Node_Id); - -- Fixup parent pointers for the syntactic children of New_Node after - -- a copy, setting them to New_Node when they pointed to Old_Node. + procedure Fix_Parents (Ref_Node, Fix_Node : Node_Id); + -- Fixup parent pointers for the syntactic children of Fix_Node after + -- a copy, setting them to Fix_Node when they pointed to Ref_Node. function Allocate_Initialize_Node (Src : Node_Id; @@ -988,18 +988,18 @@ package body Atree is -- Fix_Parents -- ----------------- - procedure Fix_Parents (Old_Node, New_Node : Node_Id) is + procedure Fix_Parents (Ref_Node, Fix_Node : Node_Id) is - procedure Fix_Parent (Field : Union_Id; Old_Node, New_Node : Node_Id); - -- Fixup one parent pointer. Field is checked to see if it - -- points to a node, list, or element list that has a parent that - -- points to Old_Node. If so, the parent is reset to point to New_Node. + procedure Fix_Parent (Field : Union_Id); + -- Fixup one parent pointer. Field is checked to see if it points to + -- a node, list, or element list that has a parent that points to + -- Ref_Node. If so, the parent is reset to point to Fix_Node. ---------------- -- Fix_Parent -- ---------------- - procedure Fix_Parent (Field : Union_Id; Old_Node, New_Node : Node_Id) is + procedure Fix_Parent (Field : Union_Id) is begin -- Fix parent of node that is referenced by Field. Note that we must -- exclude the case where the node is a member of a list, because in @@ -1008,28 +1008,28 @@ package body Atree is if Field in Node_Range and then Present (Node_Id (Field)) and then not Nodes.Table (Node_Id (Field)).In_List - and then Parent (Node_Id (Field)) = Old_Node + and then Parent (Node_Id (Field)) = Ref_Node then - Set_Parent (Node_Id (Field), New_Node); + Set_Parent (Node_Id (Field), Fix_Node); -- Fix parent of list that is referenced by Field elsif Field in List_Range and then Present (List_Id (Field)) - and then Parent (List_Id (Field)) = Old_Node + and then Parent (List_Id (Field)) = Ref_Node then - Set_Parent (List_Id (Field), New_Node); + Set_Parent (List_Id (Field), Fix_Node); end if; end Fix_Parent; -- Start of processing for Fix_Parents begin - Fix_Parent (Field1 (New_Node), Old_Node, New_Node); - Fix_Parent (Field2 (New_Node), Old_Node, New_Node); - Fix_Parent (Field3 (New_Node), Old_Node, New_Node); - Fix_Parent (Field4 (New_Node), Old_Node, New_Node); - Fix_Parent (Field5 (New_Node), Old_Node, New_Node); + Fix_Parent (Field1 (Fix_Node)); + Fix_Parent (Field2 (Fix_Node)); + Fix_Parent (Field3 (Fix_Node)); + Fix_Parent (Field4 (Fix_Node)); + Fix_Parent (Field5 (Fix_Node)); end Fix_Parents; ----------------------------------- @@ -2404,7 +2404,7 @@ package body Atree is end if; New_Node := New_Copy (Source); - Fix_Parents (Source, New_Node); + Fix_Parents (Ref_Node => Source, Fix_Node => New_Node); -- We now set the parent of the new node to be the same as the -- parent of the source. Almost always this parent will be @@ -2448,7 +2448,7 @@ package body Atree is -- Fix parents of substituted node, since it has changed identity - Fix_Parents (New_Node, Old_Node); + Fix_Parents (Ref_Node => New_Node, Fix_Node => Old_Node); -- Since we are doing a replace, we assume that the original node -- is intended to become the new replaced node. The call would be @@ -2511,7 +2511,7 @@ package body Atree is Set_Must_Not_Freeze (Old_Node, Old_Must_Not_Freeze); end if; - Fix_Parents (New_Node, Old_Node); + Fix_Parents (Ref_Node => New_Node, Fix_Node => Old_Node); end Rewrite; ------------------ @@ -7337,7 +7337,7 @@ package body Atree is pragma Assert (N <= Nodes.Last); if Val > Error then - Set_Parent (Val, N); + Set_Parent (N => Val, Val => N); end if; Set_Node1 (N, Val); @@ -7348,7 +7348,7 @@ package body Atree is pragma Assert (N <= Nodes.Last); if Val > Error then - Set_Parent (Val, N); + Set_Parent (N => Val, Val => N); end if; Set_Node2 (N, Val); @@ -7359,7 +7359,7 @@ package body Atree is pragma Assert (N <= Nodes.Last); if Val > Error then - Set_Parent (Val, N); + Set_Parent (N => Val, Val => N); end if; Set_Node3 (N, Val); @@ -7370,7 +7370,7 @@ package body Atree is pragma Assert (N <= Nodes.Last); if Val > Error then - Set_Parent (Val, N); + Set_Parent (N => Val, Val => N); end if; Set_Node4 (N, Val); @@ -7381,7 +7381,7 @@ package body Atree is pragma Assert (N <= Nodes.Last); if Val > Error then - Set_Parent (Val, N); + Set_Parent (N => Val, Val => N); end if; Set_Node5 (N, Val); diff --git a/gcc/ada/back_end.adb b/gcc/ada/back_end.adb index a943b3aa4eb..a6600764988 100644 --- a/gcc/ada/back_end.adb +++ b/gcc/ada/back_end.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 1992-2007, Free Software Foundation, Inc. -- +-- Copyright (C) 1992-2008, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -125,10 +125,7 @@ package body Back_End is procedure Scan_Compiler_Arguments is Next_Arg : Pos := 1; - subtype Big_String is String (Positive); - type BSP is access Big_String; - - type Arg_Array is array (Nat) of BSP; + type Arg_Array is array (Nat) of Big_String_Ptr; type Arg_Array_Ptr is access Arg_Array; flag_stack_check : Int; @@ -235,9 +232,10 @@ package body Back_End is while Next_Arg < save_argc loop Look_At_Arg : declare - Argv_Ptr : constant BSP := save_argv (Next_Arg); - Argv_Len : constant Nat := Len_Arg (Next_Arg); - Argv : constant String := Argv_Ptr (1 .. Natural (Argv_Len)); + Argv_Ptr : constant Big_String_Ptr := save_argv (Next_Arg); + Argv_Len : constant Nat := Len_Arg (Next_Arg); + Argv : constant String := + Argv_Ptr (1 .. Natural (Argv_Len)); begin -- If the previous switch has set the Output_File_Name_Present diff --git a/gcc/ada/bcheck.adb b/gcc/ada/bcheck.adb index c397cc8dc92..3332d2083f8 100644 --- a/gcc/ada/bcheck.adb +++ b/gcc/ada/bcheck.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 1992-2007, Free Software Foundation, Inc. -- +-- Copyright (C) 1992-2008, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -43,7 +43,7 @@ package body Bcheck is ----------------------- -- The following checking subprograms make up the parts of the - -- configuration consistency check. + -- configuration consistency check. See bodies for details of checks. procedure Check_Consistent_Dispatching_Policy; procedure Check_Consistent_Dynamic_Elaboration_Checking; @@ -54,6 +54,7 @@ package body Bcheck is procedure Check_Consistent_Optimize_Alignment; procedure Check_Consistent_Queuing_Policy; procedure Check_Consistent_Restrictions; + procedure Check_Consistent_Restriction_No_Default_Initialization; procedure Check_Consistent_Zero_Cost_Exception_Handling; procedure Consistency_Error_Msg (Msg : String); @@ -90,6 +91,7 @@ package body Bcheck is Check_Consistent_Optimize_Alignment; Check_Consistent_Dynamic_Elaboration_Checking; Check_Consistent_Restrictions; + Check_Consistent_Restriction_No_Default_Initialization; Check_Consistent_Interrupt_States; Check_Consistent_Dispatching_Policy; end Check_Configuration_Consistency; @@ -700,34 +702,40 @@ package body Bcheck is -- Check_Consistent_Optimize_Alignment -- ----------------------------------------- - -- The rule is that all units other than internal units must be compiled - -- with the same setting for Optimize_Alignment. We can exclude internal - -- units since they are forced to compile with Optimize_Alignment (Off). + -- The rule is that all units which depend on the global default setting + -- of Optimize_Alignment must be compiled with the same settinng for this + -- default. Units which specify an explicit local value for this setting + -- are exempt from the consistency rule (this includes all internal units). procedure Check_Consistent_Optimize_Alignment is OA_Setting : Character := ' '; - -- Reset when we find a non-internal unit + -- Reset when we find a unit that depends on the default and does + -- not have a local specification of the Optimize_Alignment setting. - OA_Unit : ALI_Id; + OA_Unit : Unit_Id; -- Id of unit from which OA_Setting was set + C : Character; + begin - for A in ALIs.First .. ALIs.Last loop - if not Is_Internal_File_Name (ALIs.Table (A).Afile) then + for U in First_Unit_Entry .. Units.Last loop + C := Units.Table (U).Optimize_Alignment; + + if C /= 'L' then if OA_Setting = ' ' then - OA_Setting := ALIs.Table (A).Optimize_Alignment_Setting; - OA_Unit := A; + OA_Setting := C; + OA_Unit := U; - elsif OA_Setting = ALIs.Table (A).Optimize_Alignment_Setting then + elsif OA_Setting = C then null; else - Error_Msg_File_1 := ALIs.Table (OA_Unit).Sfile; - Error_Msg_File_2 := ALIs.Table (A).Sfile; + Error_Msg_Unit_1 := Units.Table (OA_Unit).Uname; + Error_Msg_Unit_2 := Units.Table (U).Uname; Consistency_Error_Msg - ("{ and { compiled with different " - & "Optimize_Alignment settings"); + ("$ and $ compiled with different " + & "default Optimize_Alignment settings"); return; end if; end if; @@ -775,10 +783,9 @@ package body Bcheck is -- Check_Consistent_Restrictions -- ----------------------------------- - -- The rule is that if a restriction is specified in any unit, - -- then all units must obey the restriction. The check applies - -- only to restrictions which require partition wide consistency, - -- and not to internal units. + -- The rule is that if a restriction is specified in any unit, then all + -- units must obey the restriction. The check applies only to restrictions + -- which require partition wide consistency, and not to internal units. procedure Check_Consistent_Restrictions is Restriction_File_Output : Boolean; @@ -811,7 +818,7 @@ package body Bcheck is declare M1 : constant String := "{ has restriction "; S : constant String := Restriction_Id'Image (R); - M2 : String (1 .. 200); -- big enough! + M2 : String (1 .. 2000); -- big enough! P : Integer; begin @@ -902,7 +909,7 @@ package body Bcheck is (" { (count = at least #)"); else Consistency_Error_Msg - (" % (count = #)"); + (" { (count = #)"); end if; end if; end if; @@ -950,6 +957,75 @@ package body Bcheck is end loop; end Check_Consistent_Restrictions; + ------------------------------------------------------------ + -- Check_Consistent_Restriction_No_Default_Initialization -- + ------------------------------------------------------------ + + -- The Restriction (No_Default_Initialization) has special consistency + -- rules. The rule is that no unit compiled without this restriction + -- that violates the restriction can WITH a unit that is compiled with + -- the restriction. + + procedure Check_Consistent_Restriction_No_Default_Initialization is + begin + -- Nothing to do if no one set this restriction + + if not Cumulative_Restrictions.Set (No_Default_Initialization) then + return; + end if; + + -- Nothing to do if no one violates the restriction + + if not Cumulative_Restrictions.Violated (No_Default_Initialization) then + return; + end if; + + -- Otherwise we go into a full scan to find possible problems + + for U in Units.First .. Units.Last loop + declare + UTE : Unit_Record renames Units.Table (U); + ATE : ALIs_Record renames ALIs.Table (UTE.My_ALI); + + begin + if ATE.Restrictions.Violated (No_Default_Initialization) then + for W in UTE.First_With .. UTE.Last_With loop + declare + AFN : constant File_Name_Type := Withs.Table (W).Afile; + + begin + -- The file name may not be present for withs of certain + -- generic run-time files. The test can be safely left + -- out in such cases anyway. + + if AFN /= No_File then + declare + WAI : constant ALI_Id := + ALI_Id (Get_Name_Table_Info (AFN)); + WTE : ALIs_Record renames ALIs.Table (WAI); + + begin + if WTE.Restrictions.Set + (No_Default_Initialization) + then + Error_Msg_Unit_1 := UTE.Uname; + Consistency_Error_Msg + ("unit $ compiled without restriction " + & "No_Default_Initialization"); + Error_Msg_Unit_1 := Withs.Table (W).Uname; + Consistency_Error_Msg + ("withs unit $, compiled with restriction " + & "No_Default_Initialization"); + end if; + end; + end if; + end; + end loop; + end if; + end; + end loop; + end Check_Consistent_Restriction_No_Default_Initialization; + --------------------------------------------------- -- Check_Consistent_Zero_Cost_Exception_Handling -- --------------------------------------------------- @@ -1056,15 +1132,7 @@ package body Bcheck is -- If consistency errors are tolerated, -- output the message as a warning. - declare - Warning_Msg : String (1 .. Msg'Length + 1); - - begin - Warning_Msg (1) := '?'; - Warning_Msg (2 .. Warning_Msg'Last) := Msg; - - Error_Msg (Warning_Msg); - end; + Error_Msg ('?' & Msg); -- Otherwise the consistency error is a true error diff --git a/gcc/ada/binde.adb b/gcc/ada/binde.adb index a98cdd5021e..fc1ebeb128c 100644 --- a/gcc/ada/binde.adb +++ b/gcc/ada/binde.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 1992-2007, Free Software Foundation, Inc. -- +-- Copyright (C) 1992-2008, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -867,10 +867,12 @@ package body Binde is -- Skip if this with is an interface to a stand-alone library. -- Skip also if no ALI file for this WITH, happens for language -- defined generics while bootstrapping the compiler (see body of - -- Lib.Writ.Write_With_Lines). + -- Lib.Writ.Write_With_Lines). Finally, skip if it is a limited + -- with clause, which does not impose an elaboration link. if not Withs.Table (W).SAL_Interface and then Withs.Table (W).Afile /= No_File + and then not Withs.Table (W).Limited_With then declare Info : constant Int := @@ -1237,8 +1239,8 @@ package body Binde is Make_Elab_Entry (Withs.Table (W).Uname, No_Elab_All_Link)); - -- Elaborate_All_Desirable case, for this we establish - -- the same links as above, but with a different reason. + -- Elaborate_All_Desirable case, for this we establish the + -- same links as above, but with a different reason. elsif Withs.Table (W).Elab_All_Desirable then @@ -1256,15 +1258,15 @@ package body Binde is Make_Elab_Entry (Withs.Table (W).Uname, No_Elab_All_Link)); - -- Pragma Elaborate case. We must build a link for the - -- withed unit itself, and also the corresponding body - -- if there is one. + -- Pragma Elaborate case. We must build a link for the + -- withed unit itself, and also the corresponding body if + -- there is one. - -- However, skip this processing if there is no ALI file - -- for the WITH entry, because this means it is a - -- generic (even when we fix the generics so that an ALI - -- file is present, we probably still will have no ALI - -- file for unchecked and other special cases). + -- However, skip this processing if there is no ALI file for + -- the WITH entry, because this means it is a generic (even + -- when we fix the generics so that an ALI file is present, + -- we probably still will have no ALI file for unchecked and + -- other special cases). elsif Withs.Table (W).Elaborate and then Withs.Table (W).Afile /= No_File @@ -1276,8 +1278,8 @@ package body Binde is (Corresponding_Body (Withed_Unit), U, Elab); end if; - -- Elaborate_Desirable case, for this we establish - -- the same links as above, but with a different reason. + -- Elaborate_Desirable case, for this we establish + -- the same links as above, but with a different reason. elsif Withs.Table (W).Elab_Desirable then Build_Link (Withed_Unit, U, Withed); @@ -1288,8 +1290,14 @@ package body Binde is U, Elab_Desirable); end if; - -- Case of normal WITH with no elaboration pragmas, just - -- build the single link to the directly referenced unit + -- A limited_with does not establish an elaboration + -- dependence (that's the whole point!). + + elsif Withs.Table (W).Limited_With then + null; + + -- Case of normal WITH with no elaboration pragmas, just + -- build the single link to the directly referenced unit else Build_Link (Withed_Unit, U, Withed); diff --git a/gcc/ada/bindgen.adb b/gcc/ada/bindgen.adb index fa9ad8ff6f5..475edd513f5 100644 --- a/gcc/ada/bindgen.adb +++ b/gcc/ada/bindgen.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 1992-2007, Free Software Foundation, Inc. -- +-- Copyright (C) 1992-2008, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -618,17 +618,27 @@ package body Bindgen is """__gnat_initialize_stack_limit"");"); end if; + -- Special processing when main program is CIL function/procedure + if VM_Target = CLI_Target and then Bind_Main_Program and then not No_Main_Subprogram then WBI (""); + -- Function case, use Set_Exit_Status to report the returned + -- status code, since that is the only mechanism available. + if ALIs.Table (ALIs.First).Main_Program = Func then WBI (" Result : Integer;"); + WBI (" procedure Set_Exit_Status (Code : Integer);"); + WBI (" pragma Import (C, Set_Exit_Status, " & + """__gnat_set_exit_status"");"); WBI (""); WBI (" function Ada_Main_Program return Integer;"); + -- Procedure case + else WBI (" procedure Ada_Main_Program;"); end if; @@ -797,12 +807,20 @@ package body Bindgen is WBI (""); Gen_Elab_Calls_Ada; + -- Case of main program is CIL function or procedure + if VM_Target = CLI_Target and then Bind_Main_Program and then not No_Main_Subprogram then + -- For function case, use Set_Exit_Status to set result + if ALIs.Table (ALIs.First).Main_Program = Func then WBI (" Result := Ada_Main_Program;"); + WBI (" Set_Exit_Status (Result);"); + + -- Procedure case + else WBI (" Ada_Main_Program;"); end if; @@ -2270,7 +2288,7 @@ package body Bindgen is if VM_Target = No_VM then Set_Main_Program_Name; - Set_String (""" & Ascii.NUL;"); + Set_String (""" & ASCII.NUL;"); else Set_String (Name_Buffer (1 .. Name_Len - 2) & """;"); end if; diff --git a/gcc/ada/bindusg.adb b/gcc/ada/bindusg.adb index e5829cf510a..a70aaa9ee96 100644 --- a/gcc/ada/bindusg.adb +++ b/gcc/ada/bindusg.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 1992-2007, Free Software Foundation, Inc. -- +-- Copyright (C) 1992-2008, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -271,7 +271,7 @@ package body Bindusg is -- Line for --RTS - Write_Line (" --RTS=dir specify the default source and " & + Write_Line (" --RTS=dir Specify the default source and " & "object search path"); -- Line for sfile diff --git a/gcc/ada/checks.adb b/gcc/ada/checks.adb index d815a534a21..1dfd0de9914 100644 --- a/gcc/ada/checks.adb +++ b/gcc/ada/checks.adb @@ -450,6 +450,17 @@ package body Checks is return; end if; + -- No check if accessing the Offset_To_Top component of a dispatch + -- table. They are safe by construction. + + if Present (Etype (P)) + and then RTU_Loaded (Ada_Tags) + and then RTE_Available (RE_Offset_To_Top_Ptr) + and then Etype (P) = RTE (RE_Offset_To_Top_Ptr) + then + return; + end if; + -- Otherwise go ahead and install the check Install_Null_Excluding_Check (P); @@ -1239,12 +1250,23 @@ package body Checks is return; end if; - exit when - not Is_OK_Static_Expression (ItemS) - or else - not Is_OK_Static_Expression (ItemT); + -- If the expressions for the discriminants are identical + -- and it is side-effect free (for now just an entity), + -- this may be a shared constraint, e.g. from a subtype + -- without a constraint introduced as a generic actual. + -- Examine other discriminants if any. + + if ItemS = ItemT + and then Is_Entity_Name (ItemS) + then + null; + + elsif not Is_OK_Static_Expression (ItemS) + or else not Is_OK_Static_Expression (ItemT) + then + exit; - if Expr_Value (ItemS) /= Expr_Value (ItemT) then + elsif Expr_Value (ItemS) /= Expr_Value (ItemT) then if Do_Access then -- needs run-time check. exit; else @@ -2723,10 +2745,13 @@ package body Checks is end if; end if; - -- Check that null-excluding objects are always initialized + -- Check that null-excluding objects are always initialized, except for + -- deferred constants, for which the expression will appear in the full + -- declaration. if K = N_Object_Declaration and then No (Expression (N)) + and then not Constant_Present (N) and then not No_Initialization (N) then -- Add an expression that assigns null. This node is needed by @@ -2742,9 +2767,9 @@ package body Checks is Reason => CE_Null_Not_Allowed); end if; - -- Check that a null-excluding component, formal or object is not - -- being assigned a null value. Otherwise generate a warning message - -- and replace Expression (N) by a N_Constraint_Error node. + -- Check that a null-excluding component, formal or object is not being + -- assigned a null value. Otherwise generate a warning message and + -- replace Expression (N) by an N_Contraint_Error node. if K /= N_Function_Specification then Expr := Expression (N); @@ -3368,14 +3393,14 @@ package body Checks is -- Nothing to do if the range of the result is known OK. We skip this -- for conversions, since the caller already did the check, and in any -- case the condition for deleting the check for a type conversion is - -- different in any case. + -- different. if Nkind (N) /= N_Type_Conversion then Determine_Range (N, OK, Lo, Hi); - -- Note in the test below that we assume that if a bound of the - -- range is equal to that of the type. That's not quite accurate - -- but we do this for the following reasons: + -- Note in the test below that we assume that the range is not OK + -- if a bound of the range is equal to that of the type. That's not + -- quite accurate but we do this for the following reasons: -- a) The way that Determine_Range works, it will typically report -- the bounds of the value as being equal to the bounds of the @@ -3385,7 +3410,7 @@ package body Checks is -- b) It is very unusual to have a situation in which this would -- generate an unnecessary overflow check (an example would be -- a subtype with a range 0 .. Integer'Last - 1 to which the - -- literal value one is added. + -- literal value one is added). -- c) The alternative is a lot of special casing in this routine -- which would partially duplicate Determine_Range processing. @@ -4121,12 +4146,7 @@ package body Checks is -- appropriate one for our purposes. if (Ekind (Ent) = E_Variable - or else - Ekind (Ent) = E_Constant - or else - Ekind (Ent) = E_Loop_Parameter - or else - Ekind (Ent) = E_In_Parameter) + or else Is_Constant_Object (Ent)) and then not Is_Library_Level_Entity (Ent) then Entry_OK := True; @@ -4371,7 +4391,8 @@ package body Checks is Duplicate_Subexpr_Move_Checks (Sub)), Right_Opnd => Make_Attribute_Reference (Loc, - Prefix => Duplicate_Subexpr_Move_Checks (A), + Prefix => + Duplicate_Subexpr_Move_Checks (A, Name_Req => True), Attribute_Name => Name_Range, Expressions => Num)), Reason => CE_Index_Check_Failed)); diff --git a/gcc/ada/checks.ads b/gcc/ada/checks.ads index c92e9cb12c2..0c9049471b4 100644 --- a/gcc/ada/checks.ads +++ b/gcc/ada/checks.ads @@ -6,7 +6,7 @@ -- -- -- S p e c -- -- -- --- Copyright (C) 1992-2007, Free Software Foundation, Inc. -- +-- Copyright (C) 1992-2008, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -211,7 +211,7 @@ package Checks is -- by the back end, but many are done by the front end. -- Overflow checks are similarly controlled by the Do_Overflow_Check flag. - -- The difference here is that if Backend_Overflow_Checks is is + -- The difference here is that if back end overflow checks are inactive -- (Backend_Overflow_Checks_On_Target set False), then the actual overflow -- checks are generated by the front end, but if back end overflow checks -- are active (Backend_Overflow_Checks_On_Target set True), then the back diff --git a/gcc/ada/clean.adb b/gcc/ada/clean.adb index bbe84edf61b..876ec5a19a3 100644 --- a/gcc/ada/clean.adb +++ b/gcc/ada/clean.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 2003-2007, Free Software Foundation, Inc. -- +-- Copyright (C) 2003-2008, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -1669,6 +1669,18 @@ package body Clean is end if; case Arg (2) is + when '-' => + if Arg'Length > Subdirs_Option'Length and then + Arg (1 .. Subdirs_Option'Length) = Subdirs_Option + then + Subdirs := + new String' + (Arg (Subdirs_Option'Length + 1 .. Arg'Last)); + + else + Bad_Argument; + end if; + when 'a' => if Arg'Length < 4 then Bad_Argument; @@ -1725,6 +1737,14 @@ package body Clean is end; end if; + when 'e' => + if Arg = "-eL" then + Follow_Links_For_Files := True; + + else + Bad_Argument; + end if; + when 'f' => Force_Deletions := True; @@ -1954,8 +1974,13 @@ package body Clean is Put_Line (" names may be omitted if -P<project> is specified"); New_Line; + Put_Line (" --subdirs=dir real obj/lib/exec dirs are subdirs"); + New_Line; + Put_Line (" -c Only delete compiler generated files"); Put_Line (" -D dir Specify dir as the object library"); + Put_Line (" -eL Follow symbolic links when processing " & + "project files"); Put_Line (" -f Force deletions of unwritable files"); Put_Line (" -F Full project path name " & "in brief error messages"); diff --git a/gcc/ada/comperr.adb b/gcc/ada/comperr.adb index 64ec0c7a44d..157945bb0d9 100644 --- a/gcc/ada/comperr.adb +++ b/gcc/ada/comperr.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 1992-2007, Free Software Foundation, Inc. -- +-- Copyright (C) 1992-2008, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -39,6 +39,7 @@ with Output; use Output; with Sinput; use Sinput; with Sprint; use Sprint; with Sdefault; use Sdefault; +with Targparm; use Targparm; with Treepr; use Treepr; with Types; use Types; @@ -112,6 +113,31 @@ package body Comperr is Abort_In_Progress := True; + -- Generate a "standard" error message instead of a bug box in case of + -- .NET compiler, since we do not support all constructs of the + -- language. Of course ideally, we should detect this before bombing + -- on e.g. an assertion error, but in practice most of these bombs + -- are due to a legitimate case of a construct not being supported (in + -- a sense they all are, since for sure we are not supporting something + -- if we bomb!) By giving this message, we provide a more reasonable + -- practical interface, since giving scary bug boxes on unsupported + -- features is definitely not helpful. + + -- Note that the call to Error_Msg_N below sets Serious_Errors_Detected + -- to 1, so we use the regular mechanism below in order to display a + -- "compilation abandoned" message and exit, so we still know we have + -- this case (and -gnatdk can still be used to get the bug box). + + if VM_Target = CLI_Target + and then Serious_Errors_Detected = 0 + and then not Debug_Flag_K + and then Sloc (Current_Error_Node) > No_Location + then + Error_Msg_N + ("unsupported construct in this context", + Current_Error_Node); + end if; + -- If any errors have already occurred, then we guess that the abort -- may well be caused by previous errors, and we don't make too much -- fuss about it, since we want to let programmer fix the errors first. diff --git a/gcc/ada/cstand.adb b/gcc/ada/cstand.adb index 7a036cd6314..1404d35ac41 100644 --- a/gcc/ada/cstand.adb +++ b/gcc/ada/cstand.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 1992-2007, Free Software Foundation, Inc. -- +-- Copyright (C) 1992-2008, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -1727,7 +1727,7 @@ package body CStand is Write_Eol; P ("package Standard is"); - P ("pragma Pure(Standard);"); + P ("pragma Pure (Standard);"); Write_Eol; P (" type Boolean is (False, True);"); diff --git a/gcc/ada/ctrl_c.c b/gcc/ada/ctrl_c.c index 5a5d5973f20..e9ec88de711 100644 --- a/gcc/ada/ctrl_c.c +++ b/gcc/ada/ctrl_c.c @@ -6,7 +6,7 @@ * * * C Implementation File * * * - * Copyright (C) 2002-2003, Free Software Foundation, Inc. * + * Copyright (C) 2002-2008, Free Software Foundation, Inc. * * * * GNAT is free software; you can redistribute it and/or modify it under * * terms of the GNU General Public License as published by the Free Soft- * @@ -50,7 +50,8 @@ void __gnat_uninstall_int_handler (void); /* POSIX implementation */ -#if (defined (_AIX) || defined (unix)) && !defined (__vxworks) +#if (defined (__unix__) || defined (_AIX) || defined (__APPLE__)) \ + && !defined (__vxworks) #include <signal.h> @@ -75,7 +76,12 @@ __gnat_install_int_handler (void (*proc) (void)) if (sigint_intercepted == 0) { act.sa_handler = __gnat_int_handler; +#if defined (__Lynx__) + /* LynxOS does not support SA_RESTART. */ + act.sa_flags = 0; +#else act.sa_flags = SA_RESTART; +#endif sigemptyset (&act.sa_mask); sigaction (SIGINT, &act, &original_act); } @@ -112,7 +118,10 @@ __gnat_int_handler (DWORD dwCtrlType) case CTRL_C_EVENT: case CTRL_BREAK_EVENT: if (sigint_intercepted != 0) - sigint_intercepted (); + { + sigint_intercepted (); + return TRUE; + } break; case CTRL_CLOSE_EVENT: @@ -120,6 +129,8 @@ __gnat_int_handler (DWORD dwCtrlType) case CTRL_SHUTDOWN_EVENT: break; } + + return FALSE; } void diff --git a/gcc/ada/cuintp.c b/gcc/ada/cuintp.c index ba3ffa090b5..90ea342f6b5 100644 --- a/gcc/ada/cuintp.c +++ b/gcc/ada/cuintp.c @@ -6,7 +6,7 @@ * * * C Implementation File * * * - * Copyright (C) 1992-2007, Free Software Foundation, Inc. * + * Copyright (C) 1992-2008, Free Software Foundation, Inc. * * * * GNAT is free software; you can redistribute it and/or modify it under * * terms of the GNU General Public License as published by the Free Soft- * @@ -101,11 +101,15 @@ UI_To_gnu (Uint Input, tree type) large as an integer not to overflow. REAL types are always fine, but INTEGER or ENUMERAL types we are handed may be too short. We use a base integer type node for the computations in this case and will - convert the final result back to the incoming type later on. */ + convert the final result back to the incoming type later on. + The base integer precision must be superior than 16. */ if (TREE_CODE (comp_type) != REAL_TYPE - && TYPE_PRECISION (comp_type) < TYPE_PRECISION (integer_type_node)) - comp_type = integer_type_node; + && TYPE_PRECISION (comp_type) < TYPE_PRECISION (long_integer_type_node)) + { + comp_type = long_integer_type_node; + gcc_assert (TYPE_PRECISION (comp_type) > 16); + } gnu_base = build_cst_from_int (comp_type, Base); diff --git a/gcc/ada/debug.adb b/gcc/ada/debug.adb index 48ff50bd737..94dc2198b78 100644 --- a/gcc/ada/debug.adb +++ b/gcc/ada/debug.adb @@ -93,7 +93,7 @@ package body Debug is -- dY Enable configurable run-time mode -- dZ Generate listing showing the contents of the dispatch tables - -- d.a + -- d.a Enable alignment promotion for non-scalar stand-alone objects -- d.b -- d.c -- d.d @@ -500,6 +500,12 @@ package body Debug is -- - In case of abstract subprograms the text "is abstract" is -- added at the end of the line. + -- d.a Enable alignment promotion for non-VMS targets. On VMS, by default + -- (in Optimize_Alignment (Off) mode), the alignment of stand-alone + -- objects is increased in some cases to enable the generation of + -- better code. Use of this debug flag enables this transformation + -- on non-VMS targets. + -- d.f Suppress folding of static expressions. This of course results -- in seriously non-conforming behavior, but is useful sometimes -- when tracking down handling of complex expressions. @@ -636,6 +642,8 @@ package body Debug is -- Documentation for gnatmake Debug Flags -- -------------------------------------------- + -- df Only output file names, not path names, in log + -- dn Do not delete temporary files created by gnatmake at the end -- of execution, such as temporary config pragma files, mapping -- files or project path files. diff --git a/gcc/ada/decl.c b/gcc/ada/decl.c index ee9c1c58cde..eabc9211e19 100644 --- a/gcc/ada/decl.c +++ b/gcc/ada/decl.c @@ -119,7 +119,8 @@ static tree make_type_from_size (tree, tree, bool); static unsigned int validate_alignment (Uint, Entity_Id, unsigned int); static unsigned int ceil_alignment (unsigned HOST_WIDE_INT); static void check_ok_for_atomic (tree, Entity_Id, bool); -static int compatible_signatures_p (tree ftype1, tree ftype2); +static int compatible_signatures_p (tree ftype1, tree ftype2); +static void rest_of_type_decl_compilation_no_defer (tree); /* Given GNAT_ENTITY, an entity in the incoming GNAT tree, return a GCC type corresponding to that entity. GNAT_ENTITY is assumed to @@ -671,19 +672,42 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) && !Present (Address_Clause (gnat_entity))) gnu_size = bitsize_unit_node; - /* If this is an atomic object with no specified size and alignment, - but where the size of the type is a constant, set the alignment to - the smallest not less than the size, or to the biggest meaningful - alignment, whichever is smaller. */ - if (Is_Atomic (gnat_entity) && !gnu_size && align == 0 + /* If this is an object with no specified size and alignment, and if + either it is atomic or we are not optimizing alignment for space + and it is a non-scalar variable, and the size of its type is a + constant, set the alignment to the smallest not less than the + size, or to the biggest meaningful one, whichever is smaller. */ + if (!gnu_size && align == 0 + && (Is_Atomic (gnat_entity) + || (Debug_Flag_Dot_A + && !Optimize_Alignment_Space (gnat_entity) + && kind == E_Variable + && AGGREGATE_TYPE_P (gnu_type) + && !const_flag && No (Renamed_Object (gnat_entity)) + && !imported_p && No (Address_Clause (gnat_entity)))) && TREE_CODE (TYPE_SIZE (gnu_type)) == INTEGER_CST) { + /* No point in jumping through all the hoops needed in order + to support BIGGEST_ALIGNMENT if we don't really have to. */ + unsigned int align_cap = Is_Atomic (gnat_entity) + ? BIGGEST_ALIGNMENT + : MAX_FIXED_MODE_SIZE; + if (!host_integerp (TYPE_SIZE (gnu_type), 1) - || 0 <= compare_tree_int (TYPE_SIZE (gnu_type), - BIGGEST_ALIGNMENT)) - align = BIGGEST_ALIGNMENT; + || compare_tree_int (TYPE_SIZE (gnu_type), align_cap) >= 0) + align = align_cap; else align = ceil_alignment (tree_low_cst (TYPE_SIZE (gnu_type), 1)); + + /* But make sure not to under-align the object. */ + if (align < TYPE_ALIGN (gnu_type)) + align = TYPE_ALIGN (gnu_type); + + /* And honor the minimum valid atomic alignment, if any. */ +#ifdef MINIMUM_ATOMIC_ALIGNMENT + if (align < MINIMUM_ATOMIC_ALIGNMENT) + align = MINIMUM_ATOMIC_ALIGNMENT; +#endif } /* If the object is set to have atomic components, find the component @@ -1376,7 +1400,8 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) gnu_type = make_unsigned_type (GET_MODE_BITSIZE (mode)); TYPE_PACKED_ARRAY_TYPE_P (gnu_type) - = Is_Packed_Array_Type (gnat_entity); + = (Is_Packed_Array_Type (gnat_entity) + && Is_Bit_Packed_Array (Original_Array_Type (gnat_entity))); /* Get the modulus in this type. If it overflows, assume it is because it is equal to 2**Esize. Note that there is no overflow checking @@ -1411,7 +1436,8 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) TYPE_UNSIGNED (gnu_subtype) = 1; TYPE_EXTRA_SUBTYPE_P (gnu_subtype) = 1; TYPE_PACKED_ARRAY_TYPE_P (gnu_subtype) - = Is_Packed_Array_Type (gnat_entity); + = (Is_Packed_Array_Type (gnat_entity) + && Is_Bit_Packed_Array (Original_Array_Type (gnat_entity))); layout_type (gnu_subtype); gnu_type = gnu_subtype; @@ -1449,7 +1475,8 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) gnu_expr, 0); gnu_type = make_node (INTEGER_TYPE); - if (Is_Packed_Array_Type (gnat_entity)) + if (Is_Packed_Array_Type (gnat_entity) + && Is_Bit_Packed_Array (Original_Array_Type (gnat_entity))) { esize = UI_To_Int (RM_Size (gnat_entity)); TYPE_PACKED_ARRAY_TYPE_P (gnu_type) = 1; @@ -1507,7 +1534,8 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) such values), we only get the good bits, since the unused bits are uninitialized. Both goals are accomplished by wrapping the modular value in an enclosing struct. */ - if (Is_Packed_Array_Type (gnat_entity)) + if (Is_Packed_Array_Type (gnat_entity) + && Is_Bit_Packed_Array (Original_Array_Type (gnat_entity))) { tree gnu_field_type = gnu_type; tree gnu_field; @@ -1815,7 +1843,6 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) && !Has_Aliased_Components (gnat_entity) && !Strict_Alignment (Component_Type (gnat_entity)) && TREE_CODE (tem) == RECORD_TYPE - && TYPE_MODE (tem) == BLKmode && host_integerp (TYPE_SIZE (tem), 1)) tem = make_packable_type (tem, false); @@ -2156,7 +2183,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) gnu_type = gnat_to_gnu_type (Original_Array_Type (gnat_entity)); for (index = array_dim - 1; index >= 0; index--) gnu_type = TREE_TYPE (gnu_type); - + /* One of the above calls might have caused us to be elaborated, so don't blow up if so. */ if (present_gnu_tree (gnat_entity)) @@ -2184,7 +2211,6 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) && !Has_Aliased_Components (gnat_entity) && !Strict_Alignment (Component_Type (gnat_entity)) && TREE_CODE (gnu_type) == RECORD_TYPE - && TYPE_MODE (gnu_type) == BLKmode && host_integerp (TYPE_SIZE (gnu_type), 1)) gnu_type = make_packable_type (gnu_type, false); @@ -2317,7 +2343,8 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) TYPE_CONVENTION_FORTRAN_P (gnu_type) = (Convention (gnat_entity) == Convention_Fortran); TYPE_PACKED_ARRAY_TYPE_P (gnu_type) - = Is_Packed_Array_Type (gnat_entity); + = (Is_Packed_Array_Type (gnat_entity) + && Is_Bit_Packed_Array (Original_Array_Type (gnat_entity))); /* If our size depends on a placeholder and the maximum size doesn't overflow, use it. */ @@ -3062,6 +3089,22 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) break; case E_Access_Subprogram_Type: + /* Use the special descriptor type for dispatch tables if needed, + that is to say for the Prim_Ptr of a-tags.ads and its clones. + Note that we are only required to do so for static tables in + order to be compatible with the C++ ABI, but Ada 2005 allows + to extend library level tagged types at the local level so + we do it in the non-static case as well. */ + if (TARGET_VTABLE_USES_DESCRIPTORS + && Is_Dispatch_Table_Entity (gnat_entity)) + { + gnu_type = fdesc_type_node; + gnu_size = TYPE_SIZE (gnu_type); + break; + } + + /* ... fall through ... */ + case E_Anonymous_Access_Subprogram_Type: /* If we are not defining this entity, and we have incomplete entities being processed above us, make a dummy type and @@ -3862,17 +3905,13 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) gnu_type = create_subprog_type (gnu_return_type, gnu_param_list, gnu_return_list, returns_unconstrained, - returns_by_ref, - Function_Returns_With_DSP (gnat_entity), - returns_by_target_ptr); + returns_by_ref, returns_by_target_ptr); if (has_stub) gnu_stub_type = create_subprog_type (gnu_return_type, gnu_stub_param_list, gnu_return_list, returns_unconstrained, - returns_by_ref, - Function_Returns_With_DSP (gnat_entity), - returns_by_target_ptr); + returns_by_ref, returns_by_target_ptr); /* A subprogram (something that doesn't return anything) shouldn't be considered Pure since there would be no reason for such a @@ -4417,12 +4456,10 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) if (TREE_CODE (gnu_scalar_type) == ENUMERAL_TYPE) { - TYPE_STUB_DECL (gnu_scalar_type) = gnu_decl; - /* Since this has both a typedef and a tag, avoid outputting the name twice. */ DECL_ARTIFICIAL (gnu_decl) = 1; - rest_of_type_compilation (gnu_scalar_type, global_bindings_p ()); + rest_of_type_decl_compilation (gnu_decl); } } @@ -4462,12 +4499,11 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) now proceed with the finalization of the deferred types. */ if (defer_finalize_level == 0 && defer_finalize_list) { - int toplev = global_bindings_p (); unsigned int i; tree t; for (i = 0; VEC_iterate (tree, defer_finalize_list, i, t); i++) - rest_of_decl_compilation (t, toplev, 0); + rest_of_type_decl_compilation_no_defer (t); VEC_free (tree, heap, defer_finalize_list); } @@ -4514,17 +4550,46 @@ gnat_to_gnu_field_decl (Entity_Id gnat_entity) return gnu_field; } -/* Wrap up compilation of T, a TYPE_DECL, possibly deferring it. */ +/* Wrap up compilation of DECL, a TYPE_DECL, possibly deferring it. + Every TYPE_DECL generated for a type definition must be passed + to this function once everything else has been done for it. */ void -rest_of_type_decl_compilation (tree t) +rest_of_type_decl_compilation (tree decl) { /* We need to defer finalizing the type if incomplete types are being deferred or if they are being processed. */ if (defer_incomplete_level || defer_finalize_level) - VEC_safe_push (tree, heap, defer_finalize_list, t); + VEC_safe_push (tree, heap, defer_finalize_list, decl); else - rest_of_decl_compilation (t, global_bindings_p (), 0); + rest_of_type_decl_compilation_no_defer (decl); +} + +/* Same as above but without deferring the compilation. This + function should not be invoked directly on a TYPE_DECL. */ + +static void +rest_of_type_decl_compilation_no_defer (tree decl) +{ + const int toplev = global_bindings_p (); + tree t = TREE_TYPE (decl); + + rest_of_decl_compilation (decl, toplev, 0); + + /* Now process all the variants. This is needed for STABS. */ + for (t = TYPE_MAIN_VARIANT (t); t; t = TYPE_NEXT_VARIANT (t)) + { + if (t == TREE_TYPE (decl)) + continue; + + if (!TYPE_STUB_DECL (t)) + { + TYPE_STUB_DECL (t) = build_decl (TYPE_DECL, DECL_NAME (decl), t); + DECL_ARTIFICIAL (TYPE_STUB_DECL (t)) = 1; + } + + rest_of_type_compilation (t, toplev); + } } /* Finalize any From_With_Type incomplete types. We do this after processing @@ -5058,7 +5123,7 @@ prepend_attributes (Entity_Id gnat_entity, struct attrib ** attr_list) (First (gnat_assoc))))))); } - switch (Get_Pragma_Id (Pragma_Identifier (Chars (gnat_temp)))) + switch (Get_Pragma_Id (Chars (Pragma_Identifier (gnat_temp)))) { case Pragma_Machine_Attribute: etype = ATTR_MACHINE_ATTRIBUTE; @@ -5354,12 +5419,12 @@ round_up_to_align (unsigned HOST_WIDE_INT t, unsigned int align) return t; } -/* TYPE is a RECORD_TYPE, UNION_TYPE, or QUAL_UNION_TYPE, with BLKmode that - is being used as the field type of a packed record if IN_RECORD is true, - or as the component type of a packed array if IN_RECORD is false. See - if we can rewrite it either as a type that has a non-BLKmode, which we - can pack tighter, or as a smaller type with BLKmode. If so, return the - new type. If not, return the original type. */ +/* TYPE is a RECORD_TYPE, UNION_TYPE or QUAL_UNION_TYPE that is being used + as the field type of a packed record if IN_RECORD is true, or as the + component type of a packed array if IN_RECORD is false. See if we can + rewrite it either as a type that has a non-BLKmode, which we can pack + tighter in the packed record case, or as a smaller type with BLKmode. + If so, return the new type. If not, return the original type. */ static tree make_packable_type (tree type, bool in_record) @@ -5784,7 +5849,9 @@ static int adjust_packed (tree field_type, tree record_type, int packed) { /* If the field contains an item of variable size, we cannot pack it - because we cannot create temporaries of non-fixed size. */ + because we cannot create temporaries of non-fixed size in case + we need to take the address of the field. See addressable_p and + the notes on the addressability issues for further details. */ if (is_variable_size (field_type)) return 0; @@ -6076,18 +6143,17 @@ is_variable_size (tree type) { tree field; - /* We need not be concerned about this at all if we don't have - strict alignment. */ - if (!STRICT_ALIGNMENT) - return false; - else if (!TREE_CONSTANT (TYPE_SIZE (type))) + if (!TREE_CONSTANT (TYPE_SIZE (type))) return true; - else if (TREE_CODE (type) == RECORD_TYPE && TYPE_IS_PADDING_P (type) - && !TREE_CONSTANT (DECL_SIZE (TYPE_FIELDS (type)))) + + if (TREE_CODE (type) == RECORD_TYPE + && TYPE_IS_PADDING_P (type) + && !TREE_CONSTANT (DECL_SIZE (TYPE_FIELDS (type)))) return true; - else if (TREE_CODE (type) != RECORD_TYPE - && TREE_CODE (type) != UNION_TYPE - && TREE_CODE (type) != QUAL_UNION_TYPE) + + if (TREE_CODE (type) != RECORD_TYPE + && TREE_CODE (type) != UNION_TYPE + && TREE_CODE (type) != QUAL_UNION_TYPE) return false; for (field = TYPE_FIELDS (type); field; field = TREE_CHAIN (field)) @@ -6786,15 +6852,13 @@ validate_size (Uint uint_size, tree gnu_type, Entity_Id gnat_object, size = size_binop (PLUS_EXPR, DECL_SIZE (TYPE_FIELDS (gnu_type)), size); /* Modify the size of the type to be that of the maximum size if it has a - discriminant or the size of a thin pointer if this is a fat pointer. */ + discriminant. */ if (type_size && CONTAINS_PLACEHOLDER_P (type_size)) type_size = max_size (type_size, true); - else if (TYPE_FAT_POINTER_P (gnu_type)) - type_size = bitsize_int (POINTER_SIZE); - /* If this is an access type, the minimum size is that given by the smallest - integral mode that's valid for pointers. */ - if (TREE_CODE (gnu_type) == POINTER_TYPE) + /* If this is an access type or a fat pointer, the minimum size is that given + by the smallest integral mode that's valid for pointers. */ + if ((TREE_CODE (gnu_type) == POINTER_TYPE) || TYPE_FAT_POINTER_P (gnu_type)) { enum machine_mode p_mode; diff --git a/gcc/ada/einfo.adb b/gcc/ada/einfo.adb index c04680c342a..7374a7e41ae 100644 --- a/gcc/ada/einfo.adb +++ b/gcc/ada/einfo.adb @@ -70,7 +70,6 @@ package body Einfo is -- Homonym Node4 -- First_Rep_Item Node6 -- Freeze_Node Node7 - -- Obsolescent_Warning Node24 -- The usage of other fields (and the entity kinds to which it applies) -- depends on the particular field (see Einfo spec for details). @@ -147,7 +146,6 @@ package body Einfo is -- Master_Id Node17 -- Modulus Uint17 -- Non_Limited_View Node17 - -- Object_Ref Node17 -- Prival Node17 -- Alias Node18 @@ -175,6 +173,7 @@ package body Einfo is -- Discriminant_Checking_Func Node20 -- Discriminant_Default_Value Node20 -- Last_Entity Node20 + -- Prival_Link Node20 -- Register_Exception_Call Node20 -- Scalar_Range Node20 @@ -198,22 +197,20 @@ package body Einfo is -- Associated_Final_Chain Node23 -- CR_Discriminant Node23 - -- Stored_Constraint Elist23 -- Entry_Cancel_Parameter Node23 + -- Enum_Pos_To_Rep Node23 -- Extra_Constrained Node23 -- Generic_Renamings Elist23 -- Inner_Instances Elist23 - -- Enum_Pos_To_Rep Node23 - -- Packed_Array_Type Node23 -- Limited_View Node23 - -- Privals_Chain Elist23 - -- Protected_Operation Node23 + -- Packed_Array_Type Node23 + -- Protection_Object Node23 + -- Stored_Constraint Elist23 - -- Obsolescent_Warning Node24 + -- Spec_PPC_List Node24 -- Abstract_Interface_Alias Node25 -- Abstract_Interfaces Elist25 - -- Current_Use_Clause Node25 -- Debug_Renaming_Link Node25 -- DT_Offset_To_Top_Func Node25 -- Task_Body_Procedure Node25 @@ -223,8 +220,10 @@ package body Einfo is -- Overridden_Operation Node26 -- Package_Instantiation Node26 -- Related_Type Node26 + -- Relative_Deadline_Variable Node26 -- Static_Initialization Node26 + -- Current_Use_Clause Node27 -- Wrapped_Entity Node27 -- Extra_Formals Node28 @@ -495,17 +494,18 @@ package body Einfo is -- Renamed_In_Spec Flag231 -- Implemented_By_Entry Flag232 -- Has_Pragma_Unmodified Flag233 - -- Is_Static_Dispatch_Table_Entity Flag234 + -- Is_Dispatch_Table_Entity Flag234 -- Is_Trivial_Subprogram Flag235 -- Warnings_Off_Used Flag236 -- Warnings_Off_Used_Unmodified Flag237 -- Warnings_Off_Used_Unreferenced Flag238 -- OK_To_Reorder_Components Flag239 + -- Has_Postconditions Flag240 + + -- Optimize_Alignment_Space Flag241 + -- Optimize_Alignment_Time Flag242 + -- Overlays_Constant Flag243 - -- (unused) Flag240 - -- (unused) Flag241 - -- (unused) Flag242 - -- (unused) Flag243 -- (unused) Flag244 -- (unused) Flag245 -- (unused) Flag246 @@ -741,8 +741,8 @@ package body Einfo is function Current_Use_Clause (Id : E) return E is begin - pragma Assert (Ekind (Id) = E_Package); - return Node25 (Id); + pragma Assert (Ekind (Id) = E_Package or else Is_Type (Id)); + return Node27 (Id); end Current_Use_Clause; function Current_Value (Id : E) return N is @@ -1043,8 +1043,8 @@ package body Einfo is function Can_Use_Internal_Rep (Id : E) return B is begin - pragma Assert (Is_Access_Subprogram_Type (Id)); - return Flag229 (Id); + pragma Assert (Is_Access_Subprogram_Type (Base_Type (Id))); + return Flag229 (Base_Type (Id)); end Can_Use_Internal_Rep; function Finalization_Chain_Entity (Id : E) return E is @@ -1319,6 +1319,12 @@ package body Einfo is return Flag188 (Id); end Has_Persistent_BSS; + function Has_Postconditions (Id : E) return B is + begin + pragma Assert (Is_Subprogram (Id)); + return Flag240 (Id); + end Has_Postconditions; + function Has_Pragma_Controlled (Id : E) return B is begin pragma Assert (Is_Access_Type (Id)); @@ -1687,16 +1693,21 @@ package body Einfo is return Flag74 (Id); end Is_CPP_Class; + function Is_Descendent_Of_Address (Id : E) return B is + begin + pragma Assert (Is_Type (Id)); + return Flag223 (Id); + end Is_Descendent_Of_Address; + function Is_Discrim_SO_Function (Id : E) return B is begin return Flag176 (Id); end Is_Discrim_SO_Function; - function Is_Descendent_Of_Address (Id : E) return B is + function Is_Dispatch_Table_Entity (Id : E) return B is begin - pragma Assert (Is_Type (Id)); - return Flag223 (Id); - end Is_Descendent_Of_Address; + return Flag234 (Id); + end Is_Dispatch_Table_Entity; function Is_Dispatching_Operation (Id : E) return B is begin @@ -2000,11 +2011,6 @@ package body Einfo is return Flag28 (Id); end Is_Statically_Allocated; - function Is_Static_Dispatch_Table_Entity (Id : E) return B is - begin - return Flag234 (Id); - end Is_Static_Dispatch_Table_Entity; - function Is_Synchronized_Interface (Id : E) return B is begin pragma Assert (Is_Interface (Id)); @@ -2270,23 +2276,30 @@ package body Einfo is return Uint10 (Id); end Normalized_Position_Max; - function Object_Ref (Id : E) return E is - begin - pragma Assert (Ekind (Id) = E_Protected_Body); - return Node17 (Id); - end Object_Ref; - - function Obsolescent_Warning (Id : E) return N is - begin - return Node24 (Id); - end Obsolescent_Warning; - function OK_To_Reorder_Components (Id : E) return B is begin pragma Assert (Is_Record_Type (Id)); return Flag239 (Base_Type (Id)); end OK_To_Reorder_Components; + function Optimize_Alignment_Space (Id : E) return B is + begin + pragma Assert + (Is_Type (Id) + or else Ekind (Id) = E_Constant + or else Ekind (Id) = E_Variable); + return Flag241 (Id); + end Optimize_Alignment_Space; + + function Optimize_Alignment_Time (Id : E) return B is + begin + pragma Assert + (Is_Type (Id) + or else Ekind (Id) = E_Constant + or else Ekind (Id) = E_Variable); + return Flag242 (Id); + end Optimize_Alignment_Time; + function Original_Array_Type (Id : E) return E is begin pragma Assert (Is_Array_Type (Id) or else Is_Modular_Integer_Type (Id)); @@ -2302,6 +2315,11 @@ package body Einfo is return Node22 (Id); end Original_Record_Component; + function Overlays_Constant (Id : E) return B is + begin + return Flag243 (Id); + end Overlays_Constant; + function Overridden_Operation (Id : E) return E is begin return Node26 (Id); @@ -2336,16 +2354,16 @@ package body Einfo is function Prival (Id : E) return E is begin - pragma Assert (Is_Protected_Private (Id)); + pragma Assert (Is_Protected_Component (Id)); return Node17 (Id); end Prival; - function Privals_Chain (Id : E) return L is + function Prival_Link (Id : E) return E is begin - pragma Assert (Is_Overloadable (Id) - or else Ekind (Id) = E_Entry_Family); - return Elist23 (Id); - end Privals_Chain; + pragma Assert (Ekind (Id) = E_Constant + or else Ekind (Id) = E_Variable); + return Node20 (Id); + end Prival_Link; function Private_Dependents (Id : E) return L is begin @@ -2371,11 +2389,14 @@ package body Einfo is return Node22 (Id); end Protected_Formal; - function Protected_Operation (Id : E) return N is + function Protection_Object (Id : E) return E is begin - pragma Assert (Is_Protected_Private (Id)); + pragma Assert (Ekind (Id) = E_Entry + or else Ekind (Id) = E_Entry_Family + or else Ekind (Id) = E_Function + or else Ekind (Id) = E_Procedure); return Node23 (Id); - end Protected_Operation; + end Protection_Object; function Reachable (Id : E) return B is begin @@ -2429,6 +2450,12 @@ package body Einfo is return Node26 (Id); end Related_Type; + function Relative_Deadline_Variable (Id : E) return E is + begin + pragma Assert (Is_Task_Type (Id)); + return Node26 (Implementation_Base_Type (Id)); + end Relative_Deadline_Variable; + function Renamed_Entity (Id : E) return N is begin return Node18 (Id); @@ -2551,6 +2578,12 @@ package body Einfo is return Node19 (Id); end Spec_Entity; + function Spec_PPC_List (Id : E) return N is + begin + pragma Assert (Is_Subprogram (Id)); + return Node24 (Id); + end Spec_PPC_List; + function Storage_Size_Variable (Id : E) return E is begin pragma Assert (Is_Access_Type (Id) or else Is_Task_Type (Id)); @@ -3109,8 +3142,8 @@ package body Einfo is procedure Set_Current_Use_Clause (Id : E; V : E) is begin - pragma Assert (Ekind (Id) = E_Package); - Set_Node25 (Id, V); + pragma Assert (Ekind (Id) = E_Package or else Is_Type (Id)); + Set_Node27 (Id, V); end Set_Current_Use_Clause; procedure Set_Current_Value (Id : E; V : N) is @@ -3415,7 +3448,9 @@ package body Einfo is procedure Set_Can_Use_Internal_Rep (Id : E; V : B := True) is begin - pragma Assert (Is_Access_Subprogram_Type (Id)); + pragma Assert + (Is_Access_Subprogram_Type (Id) + and then Id = Base_Type (Id)); Set_Flag229 (Id, V); end Set_Can_Use_Internal_Rep; @@ -3510,7 +3545,7 @@ package body Einfo is procedure Set_Has_Aliased_Components (Id : E; V : B := True) is begin - pragma Assert (Base_Type (Id) = Id); + pragma Assert (Id = Base_Type (Id)); Set_Flag135 (Id, V); end Set_Has_Aliased_Components; @@ -3531,14 +3566,14 @@ package body Einfo is procedure Set_Has_Atomic_Components (Id : E; V : B := True) is begin - pragma Assert (not Is_Type (Id) or else Base_Type (Id) = Id); + pragma Assert (not Is_Type (Id) or else Id = Base_Type (Id)); Set_Flag86 (Id, V); end Set_Has_Atomic_Components; procedure Set_Has_Biased_Representation (Id : E; V : B := True) is begin pragma Assert - ((V = False) or else (Is_Discrete_Type (Id) or Is_Object (Id))); + ((V = False) or else (Is_Discrete_Type (Id) or else Is_Object (Id))); Set_Flag139 (Id, V); end Set_Has_Biased_Representation; @@ -3578,7 +3613,7 @@ package body Einfo is procedure Set_Has_Controlled_Component (Id : E; V : B := True) is begin - pragma Assert (Base_Type (Id) = Id); + pragma Assert (Id = Base_Type (Id)); Set_Flag43 (Id, V); end Set_Has_Controlled_Component; @@ -3689,7 +3724,7 @@ package body Einfo is procedure Set_Has_Non_Standard_Rep (Id : E; V : B := True) is begin - pragma Assert (Base_Type (Id) = Id); + pragma Assert (Id = Base_Type (Id)); Set_Flag75 (Id, V); end Set_Has_Non_Standard_Rep; @@ -3709,6 +3744,12 @@ package body Einfo is Set_Flag188 (Id, V); end Set_Has_Persistent_BSS; + procedure Set_Has_Postconditions (Id : E; V : B := True) is + begin + pragma Assert (Is_Subprogram (Id)); + Set_Flag240 (Id, V); + end Set_Has_Postconditions; + procedure Set_Has_Pragma_Controlled (Id : E; V : B := True) is begin pragma Assert (Is_Access_Type (Id)); @@ -3850,7 +3891,7 @@ package body Einfo is procedure Set_Has_Storage_Size_Clause (Id : E; V : B := True) is begin pragma Assert (Is_Access_Type (Id) or else Is_Task_Type (Id)); - pragma Assert (Base_Type (Id) = Id); + pragma Assert (Id = Base_Type (Id)); Set_Flag23 (Id, V); end Set_Has_Storage_Size_Clause; @@ -3867,7 +3908,7 @@ package body Einfo is procedure Set_Has_Task (Id : E; V : B := True) is begin - pragma Assert (Base_Type (Id) = Id); + pragma Assert (Id = Base_Type (Id)); Set_Flag30 (Id, V); end Set_Has_Task; @@ -3880,7 +3921,7 @@ package body Einfo is procedure Set_Has_Unchecked_Union (Id : E; V : B := True) is begin - pragma Assert (Base_Type (Id) = Id); + pragma Assert (Id = Base_Type (Id)); Set_Flag123 (Id, V); end Set_Has_Unchecked_Union; @@ -3892,7 +3933,7 @@ package body Einfo is procedure Set_Has_Volatile_Components (Id : E; V : B := True) is begin - pragma Assert (not Is_Type (Id) or else Base_Type (Id) = Id); + pragma Assert (not Is_Type (Id) or else Id = Base_Type (Id)); Set_Flag87 (Id, V); end Set_Has_Volatile_Components; @@ -4095,6 +4136,11 @@ package body Einfo is Set_Flag176 (Id, V); end Set_Is_Discrim_SO_Function; + procedure Set_Is_Dispatch_Table_Entity (Id : E; V : B := True) is + begin + Set_Flag234 (Id, V); + end Set_Is_Dispatch_Table_Entity; + procedure Set_Is_Dispatching_Operation (Id : E; V : B := True) is begin pragma Assert @@ -4309,7 +4355,7 @@ package body Einfo is procedure Set_Is_Packed (Id : E; V : B := True) is begin - pragma Assert (Base_Type (Id) = Id); + pragma Assert (Id = Base_Type (Id)); Set_Flag51 (Id, V); end Set_Is_Packed; @@ -4420,11 +4466,6 @@ package body Einfo is Set_Flag28 (Id, V); end Set_Is_Statically_Allocated; - procedure Set_Is_Static_Dispatch_Table_Entity (Id : E; V : B := True) is - begin - Set_Flag234 (Id, V); - end Set_Is_Static_Dispatch_Table_Entity; - procedure Set_Is_Synchronized_Interface (Id : E; V : B := True) is begin pragma Assert (Is_Interface (Id)); @@ -4467,7 +4508,7 @@ package body Einfo is procedure Set_Is_Unchecked_Union (Id : E; V : B := True) is begin - pragma Assert (Base_Type (Id) = Id); + pragma Assert (Id = Base_Type (Id)); Set_Flag117 (Id, V); end Set_Is_Unchecked_Union; @@ -4635,7 +4676,7 @@ package body Einfo is procedure Set_No_Pool_Assigned (Id : E; V : B := True) is begin - pragma Assert (Is_Access_Type (Id) and then Base_Type (Id) = Id); + pragma Assert (Is_Access_Type (Id) and then Id = Base_Type (Id)); Set_Flag131 (Id, V); end Set_No_Pool_Assigned; @@ -4650,7 +4691,7 @@ package body Einfo is procedure Set_No_Strict_Aliasing (Id : E; V : B := True) is begin - pragma Assert (Is_Access_Type (Id) and then Base_Type (Id) = Id); + pragma Assert (Is_Access_Type (Id) and then Id = Base_Type (Id)); Set_Flag136 (Id, V); end Set_No_Strict_Aliasing; @@ -4695,17 +4736,6 @@ package body Einfo is Set_Uint10 (Id, V); end Set_Normalized_Position_Max; - procedure Set_Object_Ref (Id : E; V : E) is - begin - pragma Assert (Ekind (Id) = E_Protected_Body); - Set_Node17 (Id, V); - end Set_Object_Ref; - - procedure Set_Obsolescent_Warning (Id : E; V : N) is - begin - Set_Node24 (Id, V); - end Set_Obsolescent_Warning; - procedure Set_OK_To_Reorder_Components (Id : E; V : B := True) is begin pragma Assert @@ -4713,6 +4743,24 @@ package body Einfo is Set_Flag239 (Id, V); end Set_OK_To_Reorder_Components; + procedure Set_Optimize_Alignment_Space (Id : E; V : B := True) is + begin + pragma Assert + (Is_Type (Id) + or else Ekind (Id) = E_Constant + or else Ekind (Id) = E_Variable); + Set_Flag241 (Id, V); + end Set_Optimize_Alignment_Space; + + procedure Set_Optimize_Alignment_Time (Id : E; V : B := True) is + begin + pragma Assert + (Is_Type (Id) + or else Ekind (Id) = E_Constant + or else Ekind (Id) = E_Variable); + Set_Flag242 (Id, V); + end Set_Optimize_Alignment_Time; + procedure Set_Original_Array_Type (Id : E; V : E) is begin pragma Assert (Is_Array_Type (Id) or else Is_Modular_Integer_Type (Id)); @@ -4728,6 +4776,11 @@ package body Einfo is Set_Node22 (Id, V); end Set_Original_Record_Component; + procedure Set_Overlays_Constant (Id : E; V : B := True) is + begin + Set_Flag243 (Id, V); + end Set_Overlays_Constant; + procedure Set_Overridden_Operation (Id : E; V : E) is begin Set_Node26 (Id, V); @@ -4762,16 +4815,16 @@ package body Einfo is procedure Set_Prival (Id : E; V : E) is begin - pragma Assert (Is_Protected_Private (Id)); + pragma Assert (Is_Protected_Component (Id)); Set_Node17 (Id, V); end Set_Prival; - procedure Set_Privals_Chain (Id : E; V : L) is + procedure Set_Prival_Link (Id : E; V : E) is begin - pragma Assert (Is_Overloadable (Id) - or else Ekind (Id) = E_Entry_Family); - Set_Elist23 (Id, V); - end Set_Privals_Chain; + pragma Assert (Ekind (Id) = E_Constant + or else Ekind (Id) = E_Variable); + Set_Node20 (Id, V); + end Set_Prival_Link; procedure Set_Private_Dependents (Id : E; V : L) is begin @@ -4797,11 +4850,14 @@ package body Einfo is Set_Node22 (Id, V); end Set_Protected_Formal; - procedure Set_Protected_Operation (Id : E; V : N) is + procedure Set_Protection_Object (Id : E; V : E) is begin - pragma Assert (Is_Protected_Private (Id)); + pragma Assert (Ekind (Id) = E_Entry + or else Ekind (Id) = E_Entry_Family + or else Ekind (Id) = E_Function + or else Ekind (Id) = E_Procedure); Set_Node23 (Id, V); - end Set_Protected_Operation; + end Set_Protection_Object; procedure Set_Reachable (Id : E; V : B := True) is begin @@ -4855,6 +4911,12 @@ package body Einfo is Set_Node26 (Id, V); end Set_Related_Type; + procedure Set_Relative_Deadline_Variable (Id : E; V : E) is + begin + pragma Assert (Is_Task_Type (Id) and then Id = Base_Type (Id)); + Set_Node26 (Id, V); + end Set_Relative_Deadline_Variable; + procedure Set_Renamed_Entity (Id : E; V : N) is begin Set_Node18 (Id, V); @@ -4978,10 +5040,16 @@ package body Einfo is Set_Node19 (Id, V); end Set_Spec_Entity; + procedure Set_Spec_PPC_List (Id : E; V : N) is + begin + pragma Assert (Is_Subprogram (Id)); + Set_Node24 (Id, V); + end Set_Spec_PPC_List; + procedure Set_Storage_Size_Variable (Id : E; V : E) is begin pragma Assert (Is_Access_Type (Id) or else Is_Task_Type (Id)); - pragma Assert (Base_Type (Id) = Id); + pragma Assert (Id = Base_Type (Id)); Set_Node15 (Id, V); end Set_Storage_Size_Variable; @@ -5006,7 +5074,7 @@ package body Einfo is procedure Set_Strict_Alignment (Id : E; V : B := True) is begin - pragma Assert (Base_Type (Id) = Id); + pragma Assert (Id = Base_Type (Id)); Set_Flag145 (Id, V); end Set_Strict_Alignment; @@ -5062,7 +5130,7 @@ package body Einfo is procedure Set_Universal_Aliasing (Id : E; V : B := True) is begin - pragma Assert (Is_Type (Id) and then Base_Type (Id) = Id); + pragma Assert (Is_Type (Id) and then Id = Base_Type (Id)); Set_Flag216 (Id, V); end Set_Universal_Aliasing; @@ -5445,14 +5513,14 @@ package body Einfo is procedure Append_Entity (Id : Entity_Id; V : Entity_Id) is begin if Last_Entity (V) = Empty then - Set_First_Entity (V, Id); + Set_First_Entity (Id => V, V => Id); else Set_Next_Entity (Last_Entity (V), Id); end if; Set_Next_Entity (Id, Empty); Set_Scope (Id, V); - Set_Last_Entity (V, Id); + Set_Last_Entity (Id => V, V => Id); end Append_Entity; -------------------- @@ -5703,8 +5771,6 @@ package body Einfo is S := Scope (S); end if; end loop; - - return S; end Enclosing_Dynamic_Scope; ---------------------- @@ -6347,6 +6413,17 @@ package body Einfo is end if; end Is_By_Reference_Type; + ------------------------ + -- Is_Constant_Object -- + ------------------------ + + function Is_Constant_Object (Id : E) return B is + K : constant Entity_Kind := Ekind (Id); + begin + return + K = E_Constant or else K = E_In_Parameter or else K = E_Loop_Parameter; + end Is_Constant_Object; + --------------------- -- Is_Derived_Type -- --------------------- @@ -6367,8 +6444,8 @@ package body Einfo is return Present (Par) and then Nkind (Par) = N_Full_Type_Declaration - and then Nkind (Type_Definition (Par)) - = N_Derived_Type_Definition; + and then Nkind (Type_Definition (Par)) = + N_Derived_Type_Definition; end if; else @@ -6376,6 +6453,18 @@ package body Einfo is end if; end Is_Derived_Type; + -------------------- + -- Is_Discriminal -- + -------------------- + + function Is_Discriminal (Id : E) return B is + begin + return + (Ekind (Id) = E_Constant + or else Ekind (Id) = E_In_Parameter) + and then Present (Discriminal_Link (Id)); + end Is_Discriminal; + ---------------------- -- Is_Dynamic_Scope -- ---------------------- @@ -6454,6 +6543,64 @@ package body Einfo is end if; end Is_Indefinite_Subtype; + -------------------------------- + -- Is_Inherently_Limited_Type -- + -------------------------------- + + function Is_Inherently_Limited_Type (Id : E) return B is + Btype : constant Entity_Id := Base_Type (Id); + + begin + if Is_Private_Type (Btype) then + declare + Utyp : constant Entity_Id := Underlying_Type (Btype); + begin + if No (Utyp) then + return False; + else + return Is_Inherently_Limited_Type (Utyp); + end if; + end; + + elsif Is_Concurrent_Type (Btype) then + return True; + + elsif Is_Record_Type (Btype) then + if Is_Limited_Record (Btype) then + return not Is_Interface (Btype) + or else Is_Protected_Interface (Btype) + or else Is_Synchronized_Interface (Btype) + or else Is_Task_Interface (Btype); + + elsif Is_Class_Wide_Type (Btype) then + return Is_Inherently_Limited_Type (Root_Type (Btype)); + + else + declare + C : Entity_Id; + + begin + C := First_Component (Btype); + while Present (C) loop + if Is_Inherently_Limited_Type (Etype (C)) then + return True; + end if; + + C := Next_Component (C); + end loop; + end; + + return False; + end if; + + elsif Is_Array_Type (Btype) then + return Is_Inherently_Limited_Type (Component_Type (Btype)); + + else + return False; + end if; + end Is_Inherently_Limited_Type; + --------------------- -- Is_Limited_Type -- --------------------- @@ -6546,15 +6693,27 @@ package body Einfo is Ekind (Id) = E_Generic_Package; end Is_Package_Or_Generic_Package; - -------------------------- - -- Is_Protected_Private -- - -------------------------- + --------------- + -- Is_Prival -- + --------------- - function Is_Protected_Private (Id : E) return B is + function Is_Prival (Id : E) return B is begin - pragma Assert (Ekind (Id) = E_Component); - return Is_Protected_Type (Scope (Id)); - end Is_Protected_Private; + return + (Ekind (Id) = E_Constant + or else Ekind (Id) = E_Variable) + and then Present (Prival_Link (Id)); + end Is_Prival; + + ---------------------------- + -- Is_Protected_Component -- + ---------------------------- + + function Is_Protected_Component (Id : E) return B is + begin + return Ekind (Id) = E_Component + and then Is_Protected_Type (Scope (Id)); + end Is_Protected_Component; ------------------------------ -- Is_Protected_Record_Type -- @@ -6568,62 +6727,27 @@ package body Einfo is end Is_Protected_Record_Type; -------------------------------- - -- Is_Inherently_Limited_Type -- + -- Is_Standard_Character_Type -- -------------------------------- - function Is_Inherently_Limited_Type (Id : E) return B is - Btype : constant Entity_Id := Base_Type (Id); - + function Is_Standard_Character_Type (Id : E) return B is begin - if Is_Private_Type (Btype) then + if Is_Type (Id) then declare - Utyp : constant Entity_Id := Underlying_Type (Btype); + R : constant Entity_Id := Root_Type (Id); begin - if No (Utyp) then - return False; - else - return Is_Inherently_Limited_Type (Utyp); - end if; + return + R = Standard_Character + or else + R = Standard_Wide_Character + or else + R = Standard_Wide_Wide_Character; end; - elsif Is_Concurrent_Type (Btype) then - return True; - - elsif Is_Record_Type (Btype) then - if Is_Limited_Record (Btype) then - return not Is_Interface (Btype) - or else Is_Protected_Interface (Btype) - or else Is_Synchronized_Interface (Btype) - or else Is_Task_Interface (Btype); - - elsif Is_Class_Wide_Type (Btype) then - return Is_Inherently_Limited_Type (Root_Type (Btype)); - - else - declare - C : Entity_Id; - - begin - C := First_Component (Btype); - while Present (C) loop - if Is_Inherently_Limited_Type (Etype (C)) then - return True; - end if; - - C := Next_Component (C); - end loop; - end; - - return False; - end if; - - elsif Is_Array_Type (Btype) then - return Is_Inherently_Limited_Type (Component_Type (Btype)); - else return False; end if; - end Is_Inherently_Limited_Type; + end Is_Standard_Character_Type; -------------------- -- Is_String_Type -- @@ -6957,17 +7081,15 @@ package body Einfo is T := Etyp; - -- Return if there is a circularity in the inheritance chain. - -- This happens in some error situations and we do not want - -- to get stuck in this loop. + -- Return if there is a circularity in the inheritance chain. This + -- happens in some error situations and we do not want to get + -- stuck in this loop. if T = Base_Type (Id) then return T; end if; end loop; end if; - - raise Program_Error; end Root_Type; ----------------- @@ -7313,7 +7435,7 @@ package body Einfo is begin if (Is_Array_Type (Id) or else Is_Record_Type (Id)) - and then Base_Type (Id) = Id + and then Id = Base_Type (Id) then Write_Str (Prefix); Write_Str ("Component_Alignment = "); @@ -7385,6 +7507,7 @@ package body Einfo is W ("Has_Object_Size_Clause", Flag172 (Id)); W ("Has_Per_Object_Constraint", Flag154 (Id)); W ("Has_Persistent_BSS", Flag188 (Id)); + W ("Has_Postconditions", Flag240 (Id)); W ("Has_Pragma_Controlled", Flag27 (Id)); W ("Has_Pragma_Elaborate_Body", Flag150 (Id)); W ("Has_Pragma_Inline", Flag157 (Id)); @@ -7450,6 +7573,7 @@ package body Einfo is W ("Is_Controlling_Formal", Flag97 (Id)); W ("Is_Descendent_Of_Address", Flag223 (Id)); W ("Is_Discrim_SO_Function", Flag176 (Id)); + W ("Is_Dispatch_Table_Entity", Flag234 (Id)); W ("Is_Dispatching_Operation", Flag6 (Id)); W ("Is_Eliminated", Flag124 (Id)); W ("Is_Entry_Formal", Flag52 (Id)); @@ -7504,7 +7628,6 @@ package body Einfo is W ("Is_Return_Object", Flag209 (Id)); W ("Is_Shared_Passive", Flag60 (Id)); W ("Is_Synchronized_Interface", Flag199 (Id)); - W ("Is_Static_Dispatch_Table_Entity", Flag234 (Id)); W ("Is_Statically_Allocated", Flag28 (Id)); W ("Is_Tag", Flag78 (Id)); W ("Is_Tagged_Type", Flag55 (Id)); @@ -7538,6 +7661,9 @@ package body Einfo is W ("Non_Binary_Modulus", Flag58 (Id)); W ("Nonzero_Is_True", Flag162 (Id)); W ("OK_To_Reorder_Components", Flag239 (Id)); + W ("Optimize_Alignment_Space", Flag241 (Id)); + W ("Optimize_Alignment_Time", Flag242 (Id)); + W ("Overlays_Constant", Flag243 (Id)); W ("Reachable", Flag49 (Id)); W ("Referenced", Flag156 (Id)); W ("Referenced_As_LHS", Flag36 (Id)); @@ -8096,9 +8222,6 @@ package body Einfo is when Array_Kind => Write_Str ("First_Index"); - when E_Protected_Body => - Write_Str ("Object_Ref"); - when Enumeration_Kind => Write_Str ("First_Literal"); @@ -8246,6 +8369,10 @@ package body Einfo is when E_Component => Write_Str ("Discriminant_Checking_Func"); + when E_Constant | + E_Variable => + Write_Str ("Prival_Link"); + when E_Discriminant => Write_Str ("Discriminant_Default_Value"); @@ -8402,9 +8529,6 @@ package body Einfo is when E_Block => Write_Str ("Entry_Cancel_Parameter"); - when E_Component => - Write_Str ("Protected_Operation"); - when E_Discriminant => Write_Str ("CR_Discriminant"); @@ -8429,7 +8553,13 @@ package body Einfo is when E_Function | E_Procedure => - Write_Str ("Generic_Renamings"); + if Present (Scope (Id)) + and then Is_Protected_Type (Scope (Id)) + then + Write_Str ("Protection_Object"); + else + Write_Str ("Generic_Renamings"); + end if; when E_Package => if Is_Generic_Instance (Id) then @@ -8438,10 +8568,8 @@ package body Einfo is Write_Str ("Limited_View"); end if; - -- What about Privals_Chain for protected operations ??? - when Entry_Kind => - Write_Str ("Privals_Chain"); + Write_Str ("Protection_Object"); when others => Write_Str ("Field23??"); @@ -8453,9 +8581,14 @@ package body Einfo is ------------------------ procedure Write_Field24_Name (Id : Entity_Id) is - pragma Warnings (Off, Id); begin - Write_Str ("Obsolescent_Warning"); + case Ekind (Id) is + when Subprogram_Kind => + Write_Str ("Spec_PPC_List"); + + when others => + Write_Str ("???"); + end case; end Write_Field24_Name; ------------------------ @@ -8472,9 +8605,6 @@ package body Einfo is E_Function => Write_Str ("Abstract_Interface_Alias"); - when E_Package => - Write_Str ("Current_Use_Clause"); - when E_Record_Type | E_Record_Subtype | E_Record_Type_With_Private | @@ -8525,6 +8655,9 @@ package body Einfo is E_Variable => Write_Str ("Last_Assignment"); + when Task_Kind => + Write_Str ("Relative_Deadline_Variable"); + when others => Write_Str ("Field26??"); end case; @@ -8540,6 +8673,9 @@ package body Einfo is when E_Procedure => Write_Str ("Wrapped_Entity"); + when E_Package | Type_Kind => + Write_Str ("Current_Use_Clause"); + when others => Write_Str ("Field27??"); end case; diff --git a/gcc/ada/einfo.ads b/gcc/ada/einfo.ads index 145a262d2ba..10d7deb7aa1 100644 --- a/gcc/ada/einfo.ads +++ b/gcc/ada/einfo.ads @@ -284,13 +284,13 @@ package Einfo is -- attribute on other than the base type, and if assertions are enabled, -- an attempt to set the attribute on a subtype will raise an assert error. --- Other attributes are noted as applying the implementation base type only. --- These are representation attributes which must always apply to a full --- non-private type, and where the attributes are always on the full type. --- The attribute can be referenced on a subtype (and automatically retries --- the value from the implementation base type). However, it is an error --- to try to set the attribute on other than the implementation base type, --- and if assertions are enabled, an attempt to set the attribute on a +-- Other attributes are noted as applying to the [implementation base type +-- only]. These are representation attributes which must always apply to a +-- full non-private type, and where the attributes are always on the full +-- type. The attribute can be referenced on a subtype (and automatically +-- retries the value from the implementation base type). However, it is an +-- error to try to set the attribute on other than the implementation base +-- type, and if assertions are enabled, an attempt to set the attribute on a -- subtype will raise an assert error. -- Abstract_Interfaces (Elist25) @@ -638,10 +638,12 @@ package Einfo is -- created at the same time as the discriminal, and used to replace -- occurrences of the discriminant within the type declaration. --- Current_Use_Clause (Node25) --- Present in packages. Indicates the use clause currently in scope --- that makes the package use_visible. Used to detect redundant use --- clauses for the same package. +-- Current_Use_Clause (Node27) +-- Present in packages and in types. For packages, denotes the use +-- package clause currently in scope that makes the package use_visible. +-- For types, it denotes the use_type clause that makes the operators of +-- the type visible. Used for more precise warning messages on redundant +-- use clauses. -- Current_Value (Node9) -- Present in all object entities. Set in E_Variable, E_Constant, formal @@ -992,12 +994,12 @@ package Einfo is -- Equivalent_Type (Node18) -- Present in class wide types and subtypes, access to protected --- subprogram types, and in exception_types. For a classwide type, it +-- subprogram types, and in exception types. For a classwide type, it -- is always Empty. For a class wide subtype, it points to an entity -- created by the expander which gives Gigi an easily understandable -- equivalent of the class subtype with a known size (given by an -- initial value). See Exp_Util.Expand_Class_Wide_Subtype for further --- details. For E_exception_type, this points to the record containing +-- details. For E_Exception_Type, this points to the record containing -- the data necessary to represent exceptions (for further details, see -- System.Standard_Library. For access_to_protected subprograms, it -- denotes a record that holds pointers to the operation and to the @@ -1078,7 +1080,7 @@ package Einfo is -- must be retrieved through the entity designed by this field instead of -- being computed. --- Can_Use_Internal_Rep (Flag229) +-- Can_Use_Internal_Rep (Flag229) [base type only] -- Present in Access_Subprogram_Kind nodes. This flag is set by the -- front end and used by the back end. False means that the back end -- must represent the type in the same way as Convention-C types (and @@ -1536,11 +1538,11 @@ package Einfo is -- error exeption is correctly raised in this case at runtime. -- Has_Up_Level_Access (Flag215) --- Present in E_Variable and E_Constant entities. Set if the entity is --- declared in a local procedure p and is accessed in a procedure nested --- inside p. Only set when VM_Target /= No_VM currently. --- Why only set it under those conditions, sounds reasonable to always --- set this flag when appropriate ??? +-- Present in E_Variable and E_Constant entities. Set if the entity +-- is a local variable declared in a subprogram p and is accessed in +-- a subprogram nested inside p. Currently this flag is only set when +-- VM_Target /= No_VM, for efficiency, since only the .NET back-end +-- makes use of it to generate proper code for up-level references. -- Has_Nested_Block_With_Handler (Flag101) -- Present in scope entities. Set if there is a nested block within the @@ -1587,6 +1589,10 @@ package Einfo is -- to which the pragma applies, as well as the unit entity itself, for -- convenience in propagating the flag to contained entities. +-- Has_Postconditions (Flag240) +-- Present in subprogram entities. Set if postconditions are active for +-- the procedure, and a _postconditions procedure has been generated. + -- Has_Pragma_Controlled (Flag27) [implementation base type only] -- Present in access type entities. It is set if a pragma Controlled -- applies to the access type. @@ -2002,6 +2008,10 @@ package Einfo is -- Applies to all entities, true for task types and subtypes and for -- protected types and subtypes. +-- Is_Constant_Object (synthesized) +-- Applies to all entities, true for E_Constant, E_Loop_Parameter, and +-- E_In_Parameter entities. + -- Is_Constrained (Flag12) -- Present in types or subtypes which may have index, discriminant -- or range constraint (i.e. array types and subtypes, record types @@ -2061,6 +2071,14 @@ package Einfo is -- Present in all entities. Set only in E_Function entities that Layout -- creates to compute discriminant-dependent dynamic size/offset values. +-- Is_Discriminal (synthesized) +-- Applies to all entities, true for renamings of discriminants. Such +-- entities appear as constants or in parameters. + +-- Is_Dispatch_Table_Entity (Flag234) +-- Applies to all entities. Set to indicate to the backend that this +-- entity is associated with a dispatch table. + -- Is_Dispatching_Operation (Flag6) -- Present in all entities. Set true for procedures, functions, -- generic procedures and generic functions if the corresponding @@ -2506,6 +2524,10 @@ package Einfo is -- primitive wrappers. which are generated by the expander to wrap -- entries of protected or task types implementing a limited interface. +-- Is_Prival (synthesized) +-- Applies to all entities, true for renamings of private protected +-- components. Such entities appear as constants or variables. + -- Is_Private_Composite (Flag107) -- Present in composite types that have a private component. Used to -- enforce the rule that operations on the composite type that depend @@ -2522,6 +2544,10 @@ package Einfo is -- Applies to all entities, true for private types and subtypes, -- as well as for record with private types as subtypes +-- Is_Protected_Component (synthesized) +-- Applicable to all entities, true if the entity denotes a private +-- component of a protected type. + -- Is_Protected_Interface (Flag198) -- Present in types that are interfaces. True if interface is declared -- protected, or is derived from protected interfaces. @@ -2536,10 +2562,6 @@ package Einfo is -- example in the case of a variable name, then Gigi will generate an -- appropriate external name for use by the linker. --- Is_Protected_Private (synthesized) --- Applies to a record component. Returns true if this component --- is used to represent a private declaration of a protected type. - -- Is_Protected_Record_Type (synthesized) -- Applies to all entities, true if Is_Concurrent_Record_Type -- Corresponding_Concurrent_Type is a protected type. @@ -2560,8 +2582,8 @@ package Einfo is -- freeze time if the access type has a storage pool. -- Is_Raised (Flag224) --- Present in entities which denote exceptions. Set if the exception is --- thrown by a raise statement. +-- Present in exception entities. Set if the entity is referenced by a +-- a raise statement. -- Is_Real_Type (synthesized) -- Applies to all entities, true for real types and subtypes @@ -2607,6 +2629,11 @@ package Einfo is -- entities to which a pragma Shared_Passive is applied, and also in -- all entities within such packages. +-- Is_Standard_Character_Type (synthesized) +-- Applies to all entities, true for types and subtypes whose root type +-- is one of the standard character types (Character, Wide_Character, +-- Wide_Wide_Character). + -- Is_Statically_Allocated (Flag28) -- Present in all entities. This can only be set True for exception, -- variable, constant, and type/subtype entities. If the flag is set, @@ -2623,20 +2650,16 @@ package Einfo is -- flag set (since to allocate the object statically, its type must -- also be elaborated globally). --- Is_Static_Dispatch_Table_Entity (Flag234) --- Applies to all entities. Set to indicate to the backend that this --- entity is associated with an statically allocated dispatch table. - --- Is_Subprogram (synthesized) --- Applies to all entities, true for function, procedure and operator --- entities. - -- Is_String_Type (synthesized) -- Applies to all type entities. Determines if the given type is a -- string type, i.e. it is directly a string type or string subtype, -- or a string slice type, or an array type with one dimension and a -- component type that is a character type. +-- Is_Subprogram (synthesized) +-- Applies to all entities, true for function, procedure and operator +-- entities. + -- Is_Synchronized_Interface (Flag199) -- Present in types that are interfaces. True if interface is declared -- synchronized, task, or protected, or is derived from a synchronized @@ -2644,16 +2667,16 @@ package Einfo is -- Is_Tag (Flag78) -- Present in E_Component and E_Constant entities. For regular tagged --- type this flag is set on the tag component (whose name is Name_uTag) --- and for CPP_Class tagged types, this flag marks the pointer to the --- main vtable (i.e. the one to be extended by derivation). +-- type this flag is set on the tag component (whose name is Name_uTag). +-- For CPP_Class tagged types, this flag marks the pointer to the main +-- vtable (i.e. the one to be extended by derivation). -- Is_Tagged_Type (Flag55) -- Present in all entities. Set for an entity for a tagged type. -- Is_Task_Interface (Flag200) --- Present in types that are interfaces. True is interface is declared --- as such, or if it is derived from task interfaces. +-- Present in types that are interfaces. True if interface is declared as +-- a task interface, or if it is derived from task interfaces. -- Is_Task_Record_Type (synthesized) -- Applies to all entities. True if Is_Concurrent_Record_Type @@ -3094,11 +3117,21 @@ package Einfo is -- Applies to subprograms and subprogram types. Yields the number of -- formals as a value of type Pos. --- Obsolescent_Warning (Node24) --- Present in all entities. Set non-empty only if a pragma Obsolescent --- applying to the entity had a string argument, in which case it records --- the contents of the corresponding string literal node. This field is --- only accessed if the flag Is_Obsolescent is set. +-- Optimize_Alignment_Space (Flag241) +-- A flag present in type, subtype, variable, and constant entities. This +-- flag records that the type or object is to be layed out in a manner +-- consistent with Optimize_Alignment (Space) mode. The compiler and +-- binder ensure a consistent view of any given type or object. If pragma +-- Optimize_Alignment (Off) mode applies to the type/object, then neither +-- of the flags Optimize_Alignment_Space/Optimize_Alignment_Time is set. + +-- Optimize_Alignment_Time (Flag242) +-- A flag present in type, subtype, variable, and constant entities. This +-- flag records that the type or object is to be layed out in a manner +-- consistent with Optimize_Alignment (Time) mode. The compiler and +-- binder ensure a consistent view of any given type or object. If pragma +-- Optimize_Alignment (Off) mode applies to the type/object, then neither +-- of the flags Optimize_Alignment_Space/Optimize_Alignment_Time is set. -- Original_Array_Type (Node21) -- Present in modular types and array types and subtypes. Set only @@ -3107,11 +3140,6 @@ package Einfo is -- points to the original array type for which this is the packed -- array implementation type. --- Object_Ref (Node17) --- Present in protected bodies. This is an implicit prival for the --- Protection object associated with a protected object. See Prival --- for further details on the use of privals. - -- OK_To_Reorder_Components (Flag239) [base type only] -- Present in record types. Set if the back end is permitted to reorder -- the components. If not set, the record must be layed out in the order @@ -3138,6 +3166,10 @@ package Einfo is -- In subtypes (tagged and untagged): -- Points to the component in the base type. +-- Overlays_Constant (Flag243) +-- Present in all entities. Set only for a variable for which there is +-- an address clause which causes the variable to overlay a constant. + -- Overridden_Operation (Node26) -- Present in subprograms. For overriding operations, points to the -- user-defined parent subprogram that is being overridden. @@ -3182,6 +3214,15 @@ package Einfo is -- is an error to reference the primitive operations field of a type -- that is not tagged). +-- Prival (Node17) +-- Present in private components of protected types. Refers to the entity +-- of the component renaming declaration generated inside protected +-- subprograms, entries or barrier functions. + +-- Prival_Link (Node20) +-- Present in constants and variables which rename private components of +-- protected types. Set to the original private component. + -- Private_Dependents (Elist18) -- Present in private (sub)types. Records the subtypes of the -- private type, derivations from it, and records and arrays @@ -3202,20 +3243,6 @@ package Einfo is -- declaration of the type is seen. Subprograms that have such an -- access parameter are also placed in the list of private_dependents. --- Prival (Node17) --- Present in components. Used for representing private declarations --- of protected objects (private formal: by analogy to Discriminal_Link). --- Empty unless the synthesized Is_Protected_Private attribute is --- true. The entity used as a formal parameter that corresponds to --- the to the private declaration in protected operations. See --- "Private data in protected objects" for details. - --- Privals_Chain (Elist23) --- Present in protected operations (subprograms and entries). Links --- all occurrences of the Privals in the body of the operation, in --- order to patch their types at the end of their expansion. See --- "Private data in protected objects" for details. - -- Private_View (Node22) -- For each private type, three entities are allocated, the private view, -- the full view, and the shadow entity. The shadow entity contains a @@ -3237,16 +3264,10 @@ package Einfo is -- Present in protected operations. References the entity for the -- subprogram which implements the body of the operation. --- Protected_Operation (Node23) --- Present in components. Used for representing private declarations --- of protected objects. Empty unless the synthesized attribute --- Is_Protected_Private is True. This is the entity corresponding --- to the body of the protected operation currently being analyzed, --- and which will eventually use the current Prival associated with --- this component to refer to the renaming of a private object --- component. As soon as the expander generates this renaming, this --- attribute is changed to refer to the next protected subprogram. --- See "Private data in protected objects" for details. +-- Protection_Object (Node23) +-- Applies to protected entries, entry families and subprograms. Denotes +-- the entity which is used to rename the _object component of protected +-- types. -- Reachable (Flag49) -- Present in labels. The flag is set over the range of statements in @@ -3304,6 +3325,12 @@ package Einfo is -- Set to point to the entity of the associated tagged type or interface -- type. +-- Relative_Deadline_Variable (Node26) [implementation base type only] +-- Present in task type entities. This flag is set if a valid and +-- effective pragma Relative_Deadline applies to the base type. Points +-- to the entity for a variable that is created to hold the value given +-- in a Relative_Deadline pragma for a task type. + -- Renamed_Entity (Node18) -- Present in exceptions, packages, subprograms and generic units. Set -- for entities that are defined by a renaming declaration. Denotes the @@ -3487,7 +3514,7 @@ package Einfo is -- size of objects of the type is known at compile time. This flag is -- used to optimize some generated code sequences, and also to enable -- some error checks (e.g. disallowing component clauses on variable --- length objects. It is set conservatively (i.e. if it is True, the +-- length objects). It is set conservatively (i.e. if it is True, the -- size is certainly known at compile time, if it is False, then the -- size may or may not be known at compile time, but the code will -- assume that it is not known). @@ -3503,6 +3530,12 @@ package Einfo is -- case where there is a separate spec, where this field references -- the corresponding parameter entities in the spec. +-- Spec_PPC_List (Node24) +-- Present in subprogram entities. Points to a list of Precondition +-- and Postcondition N_Pragma nodes for preconditions and postconditions +-- declared in the spec. The last pragma encountered is at the head of +-- this list, so it is in reverse order of textual appearence. + -- Storage_Size_Variable (Node15) [implementation base type only] -- Present in access types and task type entities. This flag is set -- if a valid and effective pragma Storage_Size applies to the base @@ -3595,6 +3628,10 @@ package Einfo is -- checks associated with declared volatile variables, but if the test -- is for the purposes of suppressing optimizations, then the front -- end should test Treat_As_Volatile rather than Is_Volatile. +-- +-- Note: before testing Treat_As_Volatile, consider whether it would +-- be more appropriate to use Exp_Util.Is_Volatile_Reference instead, +-- which catches more cases of volatile references. -- Type_High_Bound (synthesized) -- Applies to scalar types. Returns the tree node (Node_Id) that contains @@ -4509,7 +4546,6 @@ package Einfo is -- Etype (Node5) -- First_Rep_Item (Node6) -- Freeze_Node (Node7) - -- Obsolescent_Warning (Node24) -- Address_Taken (Flag104) -- Can_Never_Be_Null (Flag38) @@ -4544,6 +4580,7 @@ package Einfo is -- Is_Compilation_Unit (Flag149) -- Is_Completely_Hidden (Flag103) -- Is_Discrim_SO_Function (Flag176) + -- Is_Dispatch_Table_Entity (Flag234) -- Is_Dispatching_Operation (Flag6) -- Is_Entry_Formal (Flag52) -- Is_Exported (Flag99) @@ -4574,7 +4611,6 @@ package Einfo is -- Is_Remote_Types (Flag61) -- Is_Renaming_Of_Object (Flag112) -- Is_Shared_Passive (Flag60) - -- Is_Static_Dispatch_Table_Entity (Flag234) -- Is_Statically_Allocated (Flag28) -- Is_Tagged_Type (Flag55) -- Is_Trivial_Subprogram (Flag235) @@ -4589,6 +4625,7 @@ package Einfo is -- Needs_Debug_Info (Flag147) -- Never_Set_In_Source (Flag115) -- No_Return (Flag113) + -- Overlays_Constant (Flag243) -- Referenced (Flag156) -- Referenced_As_LHS (Flag36) -- Referenced_As_Out_Parameter (Flag227) @@ -4608,6 +4645,7 @@ package Einfo is -- Is_Derived_Type (synth) -- Is_Dynamic_Scope (synth) -- Is_Limited_Type (synth) + -- Is_Standard_Character_Type (synth) -- Underlying_Type (synth) -- all classification attributes (synth) @@ -4671,6 +4709,8 @@ package Einfo is -- Known_To_Have_Preelab_Init (Flag207) -- Must_Be_On_Byte_Boundary (Flag183) -- Must_Have_Preelab_Init (Flag208) + -- Optimize_Alignment_Space (Flag241) + -- Optimize_Alignment_Time (Flag242) -- Size_Depends_On_Discriminant (Flag177) -- Size_Known_At_Compile_Time (Flag92) -- Strict_Alignment (Flag145) (base type only) @@ -4700,14 +4740,14 @@ package Einfo is -- Directly_Designated_Type (Node20) -- Needs_No_Actuals (Flag22) -- Can_Use_Internal_Rep (Flag229) - -- (plus type attributes) + -- (plus type attributes) -- E_Access_Subprogram_Type -- Equivalent_Type (Node18) (remote types only) -- Directly_Designated_Type (Node20) -- Needs_No_Actuals (Flag22) -- Can_Use_Internal_Rep (Flag229) - -- (plus type attributes) + -- (plus type attributes) -- E_Access_Type -- E_Access_Subtype @@ -4802,7 +4842,6 @@ package Einfo is -- Discriminant_Checking_Func (Node20) -- Interface_Name (Node21) (JGNAT usage only) -- Original_Record_Component (Node22) - -- Protected_Operation (Node23) -- DT_Offset_To_Top_Func (Node25) -- Related_Type (Node26) -- Has_Biased_Representation (Flag139) @@ -4812,7 +4851,6 @@ package Einfo is -- Is_Volatile (Flag16) -- Treat_As_Volatile (Flag41) -- Is_Return_Object (Flag209) - -- Is_Protected_Private (synth) -- Next_Component (synth) -- Next_Component_Or_Discriminant (synth) -- Next_Tag_Component (synth) @@ -4827,6 +4865,7 @@ package Einfo is -- Actual_Subtype (Node17) -- Renamed_Object (Node18) -- Size_Check_Code (Node19) (constants only) + -- Prival_Link (Node20) (privals only) -- Interface_Name (Node21) -- Related_Type (Node26) (constants only) -- Has_Alignment_Clause (Flag46) @@ -4839,10 +4878,12 @@ package Einfo is -- Has_Volatile_Components (Flag87) -- Is_Atomic (Flag85) -- Is_Eliminated (Flag124) + -- Is_Return_Object (Flag209) -- Is_True_Constant (Flag163) -- Is_Volatile (Flag16) + -- Optimize_Alignment_Space (Flag241) (constants only) + -- Optimize_Alignment_Time (Flag242) (constants only) -- Treat_As_Volatile (Flag41) - -- Is_Return_Object (Flag209) -- Address_Clause (synth) -- Alignment_Clause (synth) -- Constant_Value (synth) @@ -4893,7 +4934,7 @@ package Einfo is -- Last_Entity (Node20) -- Accept_Address (Elist21) -- Scope_Depth_Value (Uint22) - -- Privals_Chain (Elist23) (for a protected entry) + -- Protection_Object (Node23) (protected kind) -- Default_Expressions_Processed (Flag108) -- Entry_Accepted (Flag152) -- Is_AST_Entry (Flag132) (for entry only) @@ -4976,7 +5017,7 @@ package Einfo is -- Scope_Depth_Value (Uint22) -- Generic_Renamings (Elist23) (for an instance) -- Inner_Instances (Elist23) (generic function only) - -- Privals_Chain (Elist23) (protected func only) + -- Protection_Object (Node23) (for concurrent kind) -- Abstract_Interface_Alias (Node25) -- Overridden_Operation (Node26) -- Extra_Formals (Node28) @@ -4992,6 +5033,7 @@ package Einfo is -- Has_Master_Entity (Flag21) -- Has_Missing_Return (Flag142) -- Has_Nested_Block_With_Handler (Flag101) + -- Has_Postconditions (Flag240) -- Has_Recursive_Call (Flag143) -- Has_Subprogram_Descriptor (Flag93) -- Implemented_By_Entry (Flag232) (non-generic case only) @@ -5064,7 +5106,6 @@ package Einfo is -- Extra_Formal (Node15) -- Unset_Reference (Node16) -- Actual_Subtype (Node17) - -- Renamed_Object (Node18) -- Spec_Entity (Node19) -- Default_Value (Node20) @@ -5124,6 +5165,7 @@ package Einfo is -- First_Entity (Node17) -- Alias (Node18) -- Last_Entity (Node20) + -- Has_Postconditions (Flag240) -- Is_Machine_Code_Subprogram (Flag137) -- Is_Pure (Flag44) -- Is_Intrinsic_Subprogram (Flag64) @@ -5131,6 +5173,8 @@ package Einfo is -- Is_Primitive (Flag218) -- Is_Thunk (Flag225) -- Default_Expressions_Processed (Flag108) + -- Aren't there more flags and fields? seems like this list should be + -- more similar to the E_Function list, which is much longer ??? -- E_Ordinary_Fixed_Point_Type -- E_Ordinary_Fixed_Point_Subtype @@ -5162,7 +5206,7 @@ package Einfo is -- Generic_Renamings (Elist23) (for an instance) -- Inner_Instances (Elist23) (generic case only) -- Limited_View (Node23) (non-generic/instance) - -- Current_Use_Clause (Node25) + -- Current_Use_Clause (Node27) -- Package_Instantiation (Node26) -- Delay_Subprogram_Descriptors (Flag50) -- Body_Needed_For_SAL (Flag40) @@ -5233,7 +5277,8 @@ package Einfo is -- Scope_Depth_Value (Uint22) -- Generic_Renamings (Elist23) (for instance) -- Inner_Instances (Elist23) (for generic proc) - -- Privals_Chain (Elist23) (for protected proc) + -- Protection_Object (Node23) (for concurrent kind) + -- Spec_PPC_List (Node24) (non-generic case only) -- Abstract_Interface_Alias (Node25) -- Static_Initialization (Node26) (init_proc only) -- Overridden_Operation (Node26) @@ -5251,6 +5296,7 @@ package Einfo is -- Has_Completion (Flag26) -- Has_Master_Entity (Flag21) -- Has_Nested_Block_With_Handler (Flag101) + -- Has_Postconditions (Flag240) -- Has_Subprogram_Descriptor (Flag93) -- Implemented_By_Entry (Flag232) (non-generic case only) -- Is_Visible_Child_Unit (Flag116) @@ -5280,11 +5326,8 @@ package Einfo is -- First_Formal (synth) -- First_Formal_With_Extras (synth) -- Number_Formals (synth) - -- Delay_Cleanups (Flag114) - -- Discard_Names (Flag88) -- E_Protected_Body - -- Object_Ref (Node17) -- (any others??? First/Last Entity, Scope_Depth???) -- E_Protected_Object @@ -5438,6 +5481,7 @@ package Einfo is -- Sec_Stack_Needed_For_Return (Flag167) ??? -- Has_Entries (synth) -- Number_Entries (synth) + -- Relative_Deadline_Variable (Node26) (base type only) -- (plus type attributes) -- E_Variable @@ -5451,6 +5495,7 @@ package Einfo is -- Actual_Subtype (Node17) -- Renamed_Object (Node18) -- Size_Check_Code (Node19) + -- Prival_Link (Node20) -- Interface_Name (Node21) -- Shared_Var_Assign_Proc (Node22) -- Extra_Constrained (Node23) @@ -5461,15 +5506,17 @@ package Einfo is -- Has_Biased_Representation (Flag139) -- Has_Initial_Value (Flag219) -- Has_Size_Clause (Flag29) + -- Has_Up_Level_Access (Flag215) -- Has_Volatile_Components (Flag87) -- Is_Atomic (Flag85) -- Is_Eliminated (Flag124) -- Is_Shared_Passive (Flag60) -- Is_True_Constant (Flag163) -- Is_Volatile (Flag16) - -- Treat_As_Volatile (Flag41) -- Is_Return_Object (Flag209) - -- Has_Up_Level_Access (Flag215) + -- Optimize_Alignment_Space (Flag241) + -- Optimize_Alignment_Time (Flag242) + -- Treat_As_Volatile (Flag41) -- Address_Clause (synth) -- Alignment_Clause (synth) -- Constant_Value (synth) @@ -5562,9 +5609,10 @@ package Einfo is -- general manner, like any other variables: -- In initialization expressions for records. Note that the expressions - -- used in Priority, Storage_Size, and Task_Info pragmas are effectively - -- in this category, since these pragmas are converted to initialized - -- record fields in the Corresponding_Record_Type. + -- used in Priority, Storage_Size, Task_Info and Relative_Deadline + -- pragmas are effectively in this category, since these pragmas are + -- converted to initialized record fields in the Corresponding_Record_ + -- Type. -- In task and protected bodies, where the discriminant values may be -- referenced freely within these bodies. Discriminants can also appear @@ -5574,12 +5622,12 @@ package Einfo is -- objects. The following approach is used to simplify and minimize the -- special processing that is required. - -- When a record type with discriminants is processed, the semantic - -- processing creates the entities for the discriminants. It also creates - -- an additional set of entities, called discriminals, one for each of - -- the discriminants, and the Discriminal field of the discriminant entity - -- points to this additional entity, which is initially created as an - -- uninitialized (E_Void) entity. + -- When a record type with discriminants is analyzed, semantic processing + -- creates the entities for the discriminants. It also creates additional + -- sets of entities called discriminals, one for each of the discriminants, + -- and the Discriminal field of the discriminant entity points to this + -- additional entity, which is initially created as an uninitialized + -- (E_Void) entity. -- During expansion of expressions, any discriminant reference is replaced -- by a reference to the corresponding discriminal. When the initialization @@ -5590,17 +5638,17 @@ package Einfo is -- have already been replaced by references to these discriminals, which -- are now the formal parameters corresponding to the required objects. - -- In the case of a task or protected body, the semantics similarly - -- creates a set of discriminals for the discriminants of the task or - -- protected type. When the procedure is created for the task body, - -- the parameter passed in is a reference to the task value type, which - -- contains the required discriminant values. The expander creates a - -- set of declarations of the form: + -- In the case of a task or protected body, the semantics similarly creates + -- a set of discriminals for the discriminants of the task or protected + -- type. When the procedure is created for the task body, the parameter + -- passed in is a reference to the task value type, which contains the + -- required discriminant values. The expander creates a set of declarations + -- of the form: - -- discriminal : constant dtype renames _Task.discriminant; + -- discr_nameD : constant disrc_type renames _task.discr_name; - -- where discriminal is the discriminal entity referenced by the task - -- discriminant, and _Task is the task value passed in as the parameter. + -- where discr_nameD is the discriminal entity referenced by the task + -- discriminant, and _task is the task value passed in as the parameter. -- Again, any references to discriminants in the task body have been -- replaced by the discriminal reference, which is now an object that -- contains the required value. @@ -5613,15 +5661,15 @@ package Einfo is -- The one bit of trickiness arises in making sure that the right set of -- discriminals is used at the right time. First the task definition is -- processed. Any references to discriminants here are replaced by the - -- the corresponding *task* discriminals (the record type doesn't even - -- exist yet, since it is constructed as part of the expansion of the - -- task declaration, which happens after the semantic processing of the - -- task definition). The discriminants to be used for the corresponding - -- record are created at the same time as the other discriminals, and - -- held in the CR_Discriminant field of the discriminant. A use of the - -- discriminant in a bound for an entry family is replaced with the CR_ - -- discriminant because it controls the bound of the entry queue array - -- which is a component of the corresponding record. + -- corresponding *task* discriminals (the record type doesn't even exist + -- yet, since it is constructed as part of the expansion of the task + -- declaration, which happens after the semantic processing of the task + -- definition). The discriminants to be used for the corresponding record + -- are created at the same time as the other discriminals, and held in the + -- CR_Discriminant field of the discriminant. A use of the discriminant in + -- a bound for an entry family is replaced with the CR_Discriminant because + -- it controls the bound of the entry queue array which is a component of + -- the corresponding record. -- Just before the record initialization routine is constructed, the -- expander exchanges the task and record discriminals. This has two @@ -5634,57 +5682,52 @@ package Einfo is -- task body, and also for the discriminal declarations at the start of -- the task body. - --------------------------------------- - -- Private data in protected objects -- - --------------------------------------- - - -- Private object declarations in protected types pose problems - -- similar to those of discriminants. They are expanded to components - -- of a record which is passed as the parameter "_object" to expanded - -- forms of all protected operations. As with discriminants, timing - -- of this expansion is a problem. The sequence of statements for a - -- protected operation is expanded before the operation itself, so the - -- formal parameter for the record object containing the private data - -- does not exist when the references to that data are expanded. - - -- For this reason, private data is handled in the same way as - -- discriminants, expanding references to private data in protected - -- operations (which appear as components) to placeholders which will - -- eventually become renamings of the private selected components - -- of the "_object" formal parameter. These placeholders are called - -- "privals", by analogy to the "discriminals" used to implement - -- discriminants. They are attached to the component declaration nodes - -- representing the private object declarations of the protected type. - - -- As with discriminals, each protected subprogram needs a unique set - -- of privals, since they must refer to renamings of components of a - -- formal parameter of that operation. Entry bodies need another set, - -- which they all share and which is associated with renamings in the - -- Service_Entries procedure for the protected type (this is not yet - -- implemented???). This means that we must associate a new set of - -- privals (and discriminals) with the private declarations after - -- the body of a protected subprogram is processed. - - -- The last complication is the presence of discriminants and discriminated - -- components. In the corresponding record, the components are constrained - -- by the discriminants of the record, but within each protected operation - -- they are constrained by the discriminants of the actual. The actual - -- subtypes of those components are constructed as for other unconstrained - -- formals, but the privals are created before the formal object is added - -- to the parameter list of the protected operation, so they carry the - -- nominal subtype of the original component. After the protected operation - -- is actually created (in the expansion of the protected body) we must - -- patch the types of each prival occurrence with the proper actual subtype - -- which is by now set. The Privals_Chain is used for this patching. + --------------------------------------------------- + -- Handling of private data in protected objects -- + --------------------------------------------------- + + -- Private components in protected types pose problems similar to those + -- of discriminants. Private data is visible and can be directly referenced + -- from protected bodies. However, when protected entries and subprograms + -- are expanded into corresponding bodies and barrier functions, private + -- components lose their original context and visibility. + + -- To remedy this side effect of expansion, private components are expanded + -- into renamings called "privals", by analogy with "discriminals". + + -- private_comp : comp_type renames _object.private_comp; + + -- Prival declarations are inserted during the analysis of subprogram and + -- entry bodies to ensure proper visibility for any subsequent expansion. + -- _Object is the formal parameter of the generated corresponding body or + -- a local renaming which denotes the protected object obtained from entry + -- parameter _O. Privals receive minimal decoration upon creation and are + -- categorized as either E_Variable for the general case or E_Constant when + -- they appear in functions. + + -- Along with the local declarations, each private component carries a + -- placeholder which references the prival entity in the current body. This + -- form of indirection is used to resolve name clashes of privals and other + -- locally visible entities such as parameters, local objects, entry family + -- indexes or identifiers used in the barrier condition. + + -- When analyzing the statements of a protected subprogram or entry, any + -- reference to a private component must resolve to the locally declared + -- prival through normal visibility. In case of name conflicts (the cases + -- above), the prival is marked as hidden and acts as a weakly declared + -- entity. As a result, the reference points to the correct entity. When a + -- private component is denoted by an expanded name (prot_type.comp for + -- example), the expansion mechanism uses the placeholder of the component + -- to correct the Entity and Etype of the reference. ------------------- -- Type Synonyms -- ------------------- -- The following type synonyms are used to tidy up the function and - -- procedure declarations that follow, and also to make it possible - -- to meet the requirement for the XEINFO utility that all function - -- specs must fit on a single source line. + -- procedure declarations that follow, and also to make it possible to meet + -- the requirement for the XEINFO utility that all function specs must fit + -- on a single source line. subtype B is Boolean; subtype C is Component_Alignment_Kind; @@ -5837,6 +5880,7 @@ package Einfo is function Has_Object_Size_Clause (Id : E) return B; function Has_Per_Object_Constraint (Id : E) return B; function Has_Persistent_BSS (Id : E) return B; + function Has_Postconditions (Id : E) return B; function Has_Pragma_Controlled (Id : E) return B; function Has_Pragma_Elaborate_Body (Id : E) return B; function Has_Pragma_Inline (Id : E) return B; @@ -5901,6 +5945,7 @@ package Einfo is function Is_Controlled (Id : E) return B; function Is_Controlling_Formal (Id : E) return B; function Is_Discrim_SO_Function (Id : E) return B; + function Is_Dispatch_Table_Entity (Id : E) return B; function Is_Dispatching_Operation (Id : E) return B; function Is_Eliminated (Id : E) return B; function Is_Entry_Formal (Id : E) return B; @@ -5951,7 +5996,6 @@ package Einfo is function Is_Renaming_Of_Object (Id : E) return B; function Is_Return_Object (Id : E) return B; function Is_Shared_Passive (Id : E) return B; - function Is_Static_Dispatch_Table_Entity (Id : E) return B; function Is_Statically_Allocated (Id : E) return B; function Is_Synchronized_Interface (Id : E) return B; function Is_Tag (Id : E) return B; @@ -5998,23 +6042,24 @@ package Einfo is function Normalized_First_Bit (Id : E) return U; function Normalized_Position (Id : E) return U; function Normalized_Position_Max (Id : E) return U; - function Object_Ref (Id : E) return E; - function Obsolescent_Warning (Id : E) return N; function OK_To_Reorder_Components (Id : E) return B; + function Optimize_Alignment_Space (Id : E) return B; + function Optimize_Alignment_Time (Id : E) return B; function Original_Array_Type (Id : E) return E; function Original_Record_Component (Id : E) return E; + function Overlays_Constant (Id : E) return B; function Overridden_Operation (Id : E) return E; function Package_Instantiation (Id : E) return N; function Packed_Array_Type (Id : E) return E; function Parent_Subtype (Id : E) return E; function Primitive_Operations (Id : E) return L; function Prival (Id : E) return E; - function Privals_Chain (Id : E) return L; + function Prival_Link (Id : E) return E; function Private_Dependents (Id : E) return L; function Private_View (Id : E) return N; function Protected_Body_Subprogram (Id : E) return E; function Protected_Formal (Id : E) return E; - function Protected_Operation (Id : E) return E; + function Protection_Object (Id : E) return E; function RM_Size (Id : E) return U; function Reachable (Id : E) return B; function Referenced (Id : E) return B; @@ -6025,6 +6070,7 @@ package Einfo is function Related_Array_Object (Id : E) return E; function Related_Instance (Id : E) return E; function Related_Type (Id : E) return E; + function Relative_Deadline_Variable (Id : E) return E; function Renamed_Entity (Id : E) return N; function Renamed_In_Spec (Id : E) return B; function Renamed_Object (Id : E) return N; @@ -6046,6 +6092,7 @@ package Einfo is function Size_Depends_On_Discriminant (Id : E) return B; function Small_Value (Id : E) return R; function Spec_Entity (Id : E) return E; + function Spec_PPC_List (Id : E) return N; function Storage_Size_Variable (Id : E) return E; function Static_Elaboration_Desired (Id : E) return B; function Static_Initialization (Id : E) return N; @@ -6162,14 +6209,18 @@ package Einfo is function Is_Boolean_Type (Id : E) return B; function Is_By_Copy_Type (Id : E) return B; function Is_By_Reference_Type (Id : E) return B; + function Is_Constant_Object (Id : E) return B; function Is_Derived_Type (Id : E) return B; + function Is_Discriminal (Id : E) return B; function Is_Dynamic_Scope (Id : E) return B; function Is_Indefinite_Subtype (Id : E) return B; function Is_Limited_Type (Id : E) return B; function Is_Package_Or_Generic_Package (Id : E) return B; - function Is_Protected_Private (Id : E) return B; + function Is_Prival (Id : E) return B; + function Is_Protected_Component (Id : E) return B; function Is_Protected_Record_Type (Id : E) return B; function Is_Inherently_Limited_Type (Id : E) return B; + function Is_Standard_Character_Type (Id : E) return B; function Is_String_Type (Id : E) return B; function Is_Task_Record_Type (Id : E) return B; function Is_Wrapper_Package (Id : E) return B; @@ -6386,6 +6437,7 @@ package Einfo is procedure Set_Has_Object_Size_Clause (Id : E; V : B := True); procedure Set_Has_Per_Object_Constraint (Id : E; V : B := True); procedure Set_Has_Persistent_BSS (Id : E; V : B := True); + procedure Set_Has_Postconditions (Id : E; V : B := True); procedure Set_Has_Pragma_Controlled (Id : E; V : B := True); procedure Set_Has_Pragma_Elaborate_Body (Id : E; V : B := True); procedure Set_Has_Pragma_Inline (Id : E; V : B := True); @@ -6453,6 +6505,7 @@ package Einfo is procedure Set_Is_Controlling_Formal (Id : E; V : B := True); procedure Set_Is_Descendent_Of_Address (Id : E; V : B := True); procedure Set_Is_Discrim_SO_Function (Id : E; V : B := True); + procedure Set_Is_Dispatch_Table_Entity (Id : E; V : B := True); procedure Set_Is_Dispatching_Operation (Id : E; V : B := True); procedure Set_Is_Eliminated (Id : E; V : B := True); procedure Set_Is_Entry_Formal (Id : E; V : B := True); @@ -6508,7 +6561,6 @@ package Einfo is procedure Set_Is_Renaming_Of_Object (Id : E; V : B := True); procedure Set_Is_Return_Object (Id : E; V : B := True); procedure Set_Is_Shared_Passive (Id : E; V : B := True); - procedure Set_Is_Static_Dispatch_Table_Entity (Id : E; V : B := True); procedure Set_Is_Statically_Allocated (Id : E; V : B := True); procedure Set_Is_Synchronized_Interface (Id : E; V : B := True); procedure Set_Is_Tag (Id : E; V : B := True); @@ -6555,23 +6607,24 @@ package Einfo is procedure Set_Normalized_First_Bit (Id : E; V : U); procedure Set_Normalized_Position (Id : E; V : U); procedure Set_Normalized_Position_Max (Id : E; V : U); - procedure Set_Object_Ref (Id : E; V : E); - procedure Set_Obsolescent_Warning (Id : E; V : N); procedure Set_OK_To_Reorder_Components (Id : E; V : B := True); + procedure Set_Optimize_Alignment_Space (Id : E; V : B := True); + procedure Set_Optimize_Alignment_Time (Id : E; V : B := True); procedure Set_Original_Array_Type (Id : E; V : E); procedure Set_Original_Record_Component (Id : E; V : E); + procedure Set_Overlays_Constant (Id : E; V : B := True); procedure Set_Overridden_Operation (Id : E; V : E); procedure Set_Package_Instantiation (Id : E; V : N); procedure Set_Packed_Array_Type (Id : E; V : E); procedure Set_Parent_Subtype (Id : E; V : E); procedure Set_Primitive_Operations (Id : E; V : L); procedure Set_Prival (Id : E; V : E); - procedure Set_Privals_Chain (Id : E; V : L); + procedure Set_Prival_Link (Id : E; V : E); procedure Set_Private_Dependents (Id : E; V : L); procedure Set_Private_View (Id : E; V : N); procedure Set_Protected_Body_Subprogram (Id : E; V : E); procedure Set_Protected_Formal (Id : E; V : E); - procedure Set_Protected_Operation (Id : E; V : N); + procedure Set_Protection_Object (Id : E; V : E); procedure Set_RM_Size (Id : E; V : U); procedure Set_Reachable (Id : E; V : B := True); procedure Set_Referenced (Id : E; V : B := True); @@ -6582,6 +6635,7 @@ package Einfo is procedure Set_Related_Array_Object (Id : E; V : E); procedure Set_Related_Instance (Id : E; V : E); procedure Set_Related_Type (Id : E; V : E); + procedure Set_Relative_Deadline_Variable (Id : E; V : E); procedure Set_Renamed_Entity (Id : E; V : N); procedure Set_Renamed_In_Spec (Id : E; V : B := True); procedure Set_Renamed_Object (Id : E; V : N); @@ -6603,6 +6657,7 @@ package Einfo is procedure Set_Size_Known_At_Compile_Time (Id : E; V : B := True); procedure Set_Small_Value (Id : E; V : R); procedure Set_Spec_Entity (Id : E; V : E); + procedure Set_Spec_PPC_List (Id : E; V : N); procedure Set_Storage_Size_Variable (Id : E; V : E); procedure Set_Static_Elaboration_Desired (Id : E; V : B); procedure Set_Static_Initialization (Id : E; V : N); @@ -7029,6 +7084,7 @@ package Einfo is pragma Inline (Has_Object_Size_Clause); pragma Inline (Has_Per_Object_Constraint); pragma Inline (Has_Persistent_BSS); + pragma Inline (Has_Postconditions); pragma Inline (Has_Pragma_Controlled); pragma Inline (Has_Pragma_Elaborate_Body); pragma Inline (Has_Pragma_Inline); @@ -7110,6 +7166,7 @@ package Einfo is pragma Inline (Is_Descendent_Of_Address); pragma Inline (Is_Discrete_Or_Fixed_Point_Type); pragma Inline (Is_Discrete_Type); + pragma Inline (Is_Dispatch_Table_Entity); pragma Inline (Is_Dispatching_Operation); pragma Inline (Is_Elementary_Type); pragma Inline (Is_Eliminated); @@ -7189,7 +7246,6 @@ package Einfo is pragma Inline (Is_Scalar_Type); pragma Inline (Is_Shared_Passive); pragma Inline (Is_Signed_Integer_Type); - pragma Inline (Is_Static_Dispatch_Table_Entity); pragma Inline (Is_Statically_Allocated); pragma Inline (Is_Subprogram); pragma Inline (Is_Synchronized_Interface); @@ -7240,11 +7296,12 @@ package Einfo is pragma Inline (Normalized_First_Bit); pragma Inline (Normalized_Position); pragma Inline (Normalized_Position_Max); - pragma Inline (Object_Ref); - pragma Inline (Obsolescent_Warning); pragma Inline (OK_To_Reorder_Components); + pragma Inline (Optimize_Alignment_Space); + pragma Inline (Optimize_Alignment_Time); pragma Inline (Original_Array_Type); pragma Inline (Original_Record_Component); + pragma Inline (Overlays_Constant); pragma Inline (Overridden_Operation); pragma Inline (Package_Instantiation); pragma Inline (Packed_Array_Type); @@ -7252,12 +7309,12 @@ package Einfo is pragma Inline (Parent_Subtype); pragma Inline (Primitive_Operations); pragma Inline (Prival); - pragma Inline (Privals_Chain); + pragma Inline (Prival_Link); pragma Inline (Private_Dependents); pragma Inline (Private_View); pragma Inline (Protected_Body_Subprogram); pragma Inline (Protected_Formal); - pragma Inline (Protected_Operation); + pragma Inline (Protection_Object); pragma Inline (RM_Size); pragma Inline (Reachable); pragma Inline (Referenced); @@ -7268,6 +7325,7 @@ package Einfo is pragma Inline (Related_Array_Object); pragma Inline (Related_Instance); pragma Inline (Related_Type); + pragma Inline (Relative_Deadline_Variable); pragma Inline (Renamed_Entity); pragma Inline (Renamed_In_Spec); pragma Inline (Renamed_Object); @@ -7289,6 +7347,7 @@ package Einfo is pragma Inline (Size_Known_At_Compile_Time); pragma Inline (Small_Value); pragma Inline (Spec_Entity); + pragma Inline (Spec_PPC_List); pragma Inline (Storage_Size_Variable); pragma Inline (Static_Elaboration_Desired); pragma Inline (Static_Initialization); @@ -7362,6 +7421,7 @@ package Einfo is pragma Inline (Set_DT_Entry_Count); pragma Inline (Set_DT_Offset_To_Top_Func); pragma Inline (Set_DT_Position); + pragma Inline (Set_Relative_Deadline_Variable); pragma Inline (Set_Default_Expr_Function); pragma Inline (Set_Default_Expressions_Processed); pragma Inline (Set_Default_Value); @@ -7449,6 +7509,7 @@ package Einfo is pragma Inline (Set_Has_Object_Size_Clause); pragma Inline (Set_Has_Per_Object_Constraint); pragma Inline (Set_Has_Persistent_BSS); + pragma Inline (Set_Has_Postconditions); pragma Inline (Set_Has_Pragma_Controlled); pragma Inline (Set_Has_Pragma_Elaborate_Body); pragma Inline (Set_Has_Pragma_Inline); @@ -7517,6 +7578,7 @@ package Einfo is pragma Inline (Set_Is_Controlling_Formal); pragma Inline (Set_Is_Descendent_Of_Address); pragma Inline (Set_Is_Discrim_SO_Function); + pragma Inline (Set_Is_Dispatch_Table_Entity); pragma Inline (Set_Is_Dispatching_Operation); pragma Inline (Set_Is_Eliminated); pragma Inline (Set_Is_Entry_Formal); @@ -7572,7 +7634,6 @@ package Einfo is pragma Inline (Set_Is_Renaming_Of_Object); pragma Inline (Set_Is_Return_Object); pragma Inline (Set_Is_Shared_Passive); - pragma Inline (Set_Is_Static_Dispatch_Table_Entity); pragma Inline (Set_Is_Statically_Allocated); pragma Inline (Set_Is_Synchronized_Interface); pragma Inline (Set_Is_Tag); @@ -7619,23 +7680,24 @@ package Einfo is pragma Inline (Set_Normalized_First_Bit); pragma Inline (Set_Normalized_Position); pragma Inline (Set_Normalized_Position_Max); - pragma Inline (Set_Object_Ref); - pragma Inline (Set_Obsolescent_Warning); pragma Inline (Set_OK_To_Reorder_Components); + pragma Inline (Set_Optimize_Alignment_Space); + pragma Inline (Set_Optimize_Alignment_Time); pragma Inline (Set_Original_Array_Type); pragma Inline (Set_Original_Record_Component); + pragma Inline (Set_Overlays_Constant); pragma Inline (Set_Overridden_Operation); pragma Inline (Set_Package_Instantiation); pragma Inline (Set_Packed_Array_Type); pragma Inline (Set_Parent_Subtype); pragma Inline (Set_Primitive_Operations); pragma Inline (Set_Prival); - pragma Inline (Set_Privals_Chain); + pragma Inline (Set_Prival_Link); pragma Inline (Set_Private_Dependents); pragma Inline (Set_Private_View); pragma Inline (Set_Protected_Body_Subprogram); pragma Inline (Set_Protected_Formal); - pragma Inline (Set_Protected_Operation); + pragma Inline (Set_Protection_Object); pragma Inline (Set_RM_Size); pragma Inline (Set_Reachable); pragma Inline (Set_Referenced); @@ -7667,6 +7729,7 @@ package Einfo is pragma Inline (Set_Size_Known_At_Compile_Time); pragma Inline (Set_Small_Value); pragma Inline (Set_Spec_Entity); + pragma Inline (Set_Spec_PPC_List); pragma Inline (Set_Storage_Size_Variable); pragma Inline (Set_Static_Elaboration_Desired); pragma Inline (Set_Static_Initialization); diff --git a/gcc/ada/errout.adb b/gcc/ada/errout.adb index 106af0aa5ca..d898a306d67 100644 --- a/gcc/ada/errout.adb +++ b/gcc/ada/errout.adb @@ -50,8 +50,6 @@ with Stand; use Stand; with Style; with Uname; use Uname; -with Unchecked_Conversion; - package body Errout is Errors_Must_Be_Ignored : Boolean := False; @@ -797,7 +795,8 @@ package body Errout is -- If error message line length set, and this is a continuation message -- then all we do is to append the text to the text of the last message - -- with a comma space separator. + -- with a comma space separator (eliminating a possible (style) or + -- info prefix). if Error_Msg_Line_Length /= 0 and then Continuation @@ -808,6 +807,7 @@ package body Errout is Oldm : String_Ptr := Errors.Table (Cur_Msg).Text; Newm : String (1 .. Oldm'Last + 2 + Msglen); Newl : Natural; + M : Natural; begin -- First copy old message to new one and free it @@ -816,6 +816,16 @@ package body Errout is Newl := Oldm'Length; Free (Oldm); + -- Remove (style) or info: at start of message + + if Msglen > 8 and then Msg_Buffer (1 .. 8) = "(style) " then + M := 9; + elsif Msglen > 6 and then Msg_Buffer (1 .. 6) = "info: " then + M := 7; + else + M := 1; + end if; + -- Now deal with separation between messages. Normally this -- is simply comma space, but there are some special cases. @@ -830,16 +840,16 @@ package body Errout is -- successive parenthetical remarks into a single one with -- separating commas). - elsif Msg_Buffer (1) = '(' and then Msg_Buffer (Msglen) = ')' then + elsif Msg_Buffer (M) = '(' and then Msg_Buffer (Msglen) = ')' then -- Case where existing message ends in right paren, remove -- and separate parenthetical remarks with a comma. if Newm (Newl) = ')' then Newm (Newl) := ','; - Msg_Buffer (1) := ' '; + Msg_Buffer (M) := ' '; - -- Case where we are adding new parenthetical comment + -- Case where we are adding new parenthetical comment else Newl := Newl + 1; @@ -855,8 +865,9 @@ package body Errout is -- Append new message - Newm (Newl + 1 .. Newl + Msglen) := Msg_Buffer (1 .. Msglen); - Newl := Newl + Msglen; + Newm (Newl + 1 .. Newl + Msglen - M + 1) := + Msg_Buffer (M .. Msglen); + Newl := Newl + Msglen - M + 1; Errors.Table (Cur_Msg).Text := new String'(Newm (1 .. Newl)); end; @@ -956,9 +967,9 @@ package body Errout is and then Compiler_State = Parsing and then not All_Errors_Mode then - -- Don't delete unconditional messages and at this stage, - -- don't delete continuation lines (we attempted to delete - -- those earlier if the parent message was deleted. + -- Don't delete unconditional messages and at this stage, don't + -- delete continuation lines (we attempted to delete those earlier + -- if the parent message was deleted. if not Errors.Table (Cur_Msg).Uncond and then not Continuation @@ -1011,10 +1022,9 @@ package body Errout is -- Bump appropriate statistics count - if Errors.Table (Cur_Msg).Warn - or else Errors.Table (Cur_Msg).Style - then + if Errors.Table (Cur_Msg).Warn or Errors.Table (Cur_Msg).Style then Warnings_Detected := Warnings_Detected + 1; + else Total_Errors_Detected := Total_Errors_Detected + 1; @@ -1113,7 +1123,7 @@ package body Errout is Last_Killed := True; end if; - if not Is_Warning_Msg and then not Is_Style_Msg then + if not (Is_Warning_Msg or Is_Style_Msg) then Set_Posted (N); end if; end Error_Msg_NEL; @@ -1927,9 +1937,9 @@ package body Errout is and then Errors.Table (E).Optr = Loc - -- Don't remove if not warning message. Note that we do not - -- remove style messages here. They are warning messages but - -- not ones we want removed in this context. + -- Don't remove if not warning/info message. Note that we do + -- not remove style messages here. They are warning messages + -- but not ones we want removed in this context. and then Errors.Table (E).Warn @@ -1976,12 +1986,11 @@ package body Errout is and then Original_Node (N) /= N and then No (Condition (N)) then - -- Warnings may have been posted on subexpressions of - -- the original tree. We place the original node back - -- on the tree to remove those warnings, whose sloc - -- do not match those of any node in the current tree. - -- Given that we are in unreachable code, this modification - -- to the tree is harmless. + -- Warnings may have been posted on subexpressions of the original + -- tree. We place the original node back on the tree to remove + -- those warnings, whose sloc do not match those of any node in + -- the current tree. Given that we are in unreachable code, this + -- modification to the tree is harmless. declare Status : Traverse_Final_Result; @@ -2022,7 +2031,6 @@ package body Errout is begin if Is_Non_Empty_List (L) then Stat := First (L); - while Present (Stat) loop Remove_Warning_Messages (Stat); Next (Stat); @@ -2038,12 +2046,6 @@ package body Errout is (Identifier_Name : System.Address; File_Name : System.Address) is - type Big_String is array (Positive) of Character; - type Big_String_Ptr is access all Big_String; - - function To_Big_String_Ptr is new Unchecked_Conversion - (System.Address, Big_String_Ptr); - Ident : constant Big_String_Ptr := To_Big_String_Ptr (Identifier_Name); File : constant Big_String_Ptr := To_Big_String_Ptr (File_Name); Flen : Natural; @@ -2083,7 +2085,7 @@ package body Errout is for J in Name_Buffer'Range loop Name_Buffer (J) := Ident (J); - if Name_Buffer (J) = ASCII.Nul then + if Name_Buffer (J) = ASCII.NUL then Name_Len := J - 1; exit; end if; diff --git a/gcc/ada/errout.ads b/gcc/ada/errout.ads index b9b0616fe1c..83b50953010 100644 --- a/gcc/ada/errout.ads +++ b/gcc/ada/errout.ads @@ -6,7 +6,7 @@ -- -- -- S p e c -- -- -- --- Copyright (C) 1992-2007, Free Software Foundation, Inc. -- +-- Copyright (C) 1992-2008, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -275,14 +275,21 @@ package Errout is -- Insertion character ? (Question: warning message) -- The character ? appearing anywhere in a message makes the message -- warning instead of a normal error message, and the text of the - -- message will be preceded by "Warning:" instead of "Error:" in the - -- normal case. The handling of warnings if further controlled by the - -- Warning_Mode option (-w switch), see package Opt for further - -- details, and also by the current setting from pragma Warnings. This - -- pragma applies only to warnings issued from the semantic phase (not - -- the parser), but currently all relevant warnings are posted by the - -- semantic phase anyway. Messages starting with (style) are also - -- treated as warning messages. + -- message will be preceded by "warning:" in the normal case. The + -- handling of warnings if further controlled by the Warning_Mode + -- option (-w switch), see package Opt for further details, and also by + -- the current setting from pragma Warnings. This pragma applies only + -- to warnings issued from the semantic phase (not the parser), but + -- currently all relevant warnings are posted by the semantic phase + -- anyway. Messages starting with (style) are also treated as warning + -- messages. + -- + -- Note: when a warning message is output, the text of the message is + -- preceded by "warning: " in the normal case. An exception to this + -- rule occurs when the text of the message starts with "info: " in + -- which case this string is not prepended. This allows callers to + -- label certain warnings as informational messages, rather than as + -- warning messages requiring some action. -- -- Note: the presence of ? is ignored in continuation messages (i.e. -- messages starting with the \ insertion character). The warning diff --git a/gcc/ada/erroutc.adb b/gcc/ada/erroutc.adb index c8a0e17fde0..604fd5409e3 100644 --- a/gcc/ada/erroutc.adb +++ b/gcc/ada/erroutc.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 1992-2007, Free Software Foundation, Inc. -- +-- Copyright (C) 1992-2008, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -117,6 +117,7 @@ package body Erroutc is if Errors.Table (D).Warn or Errors.Table (D).Style then Warnings_Detected := Warnings_Detected - 1; + else Total_Errors_Detected := Total_Errors_Detected - 1; @@ -441,6 +442,12 @@ package body Erroutc is Length : Nat; -- Maximum total length of lines + Txt : constant String_Ptr := Errors.Table (E).Text; + Len : constant Natural := Txt'Length; + Ptr : Natural; + Split : Natural; + Start : Natural; + begin if Error_Msg_Line_Length = 0 then Length := Nat'Last; @@ -450,13 +457,21 @@ package body Erroutc is Max := Integer (Length - Column + 1); + -- For warning message, add "warning: " unless msg starts with "info: " + if Errors.Table (E).Warn then - Write_Str ("warning: "); - Max := Max - 9; + if Len < 6 or else Txt (Txt'First .. Txt'First + 5) /= "info: " then + Write_Str ("warning: "); + Max := Max - 9; + end if; + + -- No prefix needed for style message, since "(style)" is there already elsif Errors.Table (E).Style then null; + -- All other cases, add "error: " + elsif Opt.Unique_Error_Tag then Write_Str ("error: "); Max := Max - 7; @@ -464,74 +479,65 @@ package body Erroutc is -- Here we have to split the message up into multiple lines - declare - Txt : constant String_Ptr := Errors.Table (E).Text; - Len : constant Natural := Txt'Length; - Ptr : Natural; - Split : Natural; - Start : Natural; - - begin - Ptr := 1; - loop - -- Make sure we do not have ludicrously small line + Ptr := 1; + loop + -- Make sure we do not have ludicrously small line - Max := Integer'Max (Max, 20); + Max := Integer'Max (Max, 20); - -- If remaining text fits, output it respecting LF and we are done + -- If remaining text fits, output it respecting LF and we are done - if Len - Ptr < Max then - for J in Ptr .. Len loop - if Txt (J) = ASCII.LF then - Write_Eol; - Write_Spaces (Offs); - else - Write_Char (Txt (J)); - end if; - end loop; + if Len - Ptr < Max then + for J in Ptr .. Len loop + if Txt (J) = ASCII.LF then + Write_Eol; + Write_Spaces (Offs); + else + Write_Char (Txt (J)); + end if; + end loop; - return; + return; -- Line does not fit - else - Start := Ptr; + else + Start := Ptr; - -- First scan forward looing for a hard end of line + -- First scan forward looing for a hard end of line - for Scan in Ptr .. Ptr + Max - 1 loop - if Txt (Scan) = ASCII.LF then - Split := Scan - 1; - Ptr := Scan + 1; - goto Continue; - end if; - end loop; + for Scan in Ptr .. Ptr + Max - 1 loop + if Txt (Scan) = ASCII.LF then + Split := Scan - 1; + Ptr := Scan + 1; + goto Continue; + end if; + end loop; - -- Otherwise scan backwards looking for a space + -- Otherwise scan backwards looking for a space - for Scan in reverse Ptr .. Ptr + Max - 1 loop - if Txt (Scan) = ' ' then - Split := Scan - 1; - Ptr := Scan + 1; - goto Continue; - end if; - end loop; + for Scan in reverse Ptr .. Ptr + Max - 1 loop + if Txt (Scan) = ' ' then + Split := Scan - 1; + Ptr := Scan + 1; + goto Continue; + end if; + end loop; - -- If we fall through, no space, so split line arbitrarily + -- If we fall through, no space, so split line arbitrarily - Split := Ptr + Max - 1; - Ptr := Split + 1; - end if; + Split := Ptr + Max - 1; + Ptr := Split + 1; + end if; <<Continue>> - if Start <= Split then - Write_Line (Txt (Start .. Split)); - Write_Spaces (Offs); - end if; + if Start <= Split then + Write_Line (Txt (Start .. Split)); + Write_Spaces (Offs); + end if; - Max := Integer (Length - Column + 1); - end loop; - end; + Max := Integer (Length - Column + 1); + end loop; end Output_Msg_Text; -------------------- @@ -557,6 +563,7 @@ package body Erroutc is then if Errors.Table (E).Warn or Errors.Table (E).Style then Warnings_Detected := Warnings_Detected - 1; + else Total_Errors_Detected := Total_Errors_Detected - 1; @@ -1052,40 +1059,13 @@ package body Erroutc is Msg : String; Config : Boolean) is - pragma Assert (Msg'First = 1); - - Pattern : String := Msg; - Patlen : Natural := Msg'Length; - - Star_Start : Boolean; - Star_End : Boolean; - begin - if Pattern (1) = '*' then - Star_Start := True; - Pattern (1 .. Patlen - 1) := Pattern (2 .. Patlen); - Patlen := Patlen - 1; - else - Star_Start := False; - end if; - - if Pattern (Patlen) = '*' then - Star_End := True; - Patlen := Patlen - 1; - else - Star_End := False; - end if; - Specific_Warnings.Append ((Start => Loc, Msg => new String'(Msg), - Pattern => new String'(Pattern (1 .. Patlen)), - Patlen => Patlen, Stop => Source_Last (Current_Source_File), Open => True, Used => False, - Star_Start => Star_Start, - Star_End => Star_End, Config => Config)); end Set_Specific_Warning_Off; @@ -1200,8 +1180,7 @@ package body Erroutc is Is_Warning_Msg := False; Is_Style_Msg := - (Msg'Length > 7 - and then Msg (Msg'First .. Msg'First + 6) = "(style)"); + (Msg'Length > 7 and then Msg (Msg'First .. Msg'First + 6) = "(style)"); if Is_Style_Msg then Is_Serious_Error := False; @@ -1225,7 +1204,7 @@ package body Erroutc is end if; end loop; - if Is_Warning_Msg or else Is_Style_Msg then + if Is_Warning_Msg or Is_Style_Msg then Is_Serious_Error := False; end if; end Test_Style_Warning_Serious_Msg; @@ -1262,110 +1241,92 @@ package body Erroutc is (Loc : Source_Ptr; Msg : String_Ptr) return Boolean is - pragma Assert (Msg'First = 1); + function Matches (S : String; P : String) return Boolean; + -- Returns true if the String S patches the pattern P, which can contain + -- wild card chars (*). The entire pattern must match the entire string. - Msglen : constant Natural := Msg'Length; - Patlen : Natural; - -- Length of message - - Pattern : String_Ptr; - -- Pattern itself, excluding initial and final * - - Star_Start : Boolean; - Star_End : Boolean; - -- Indications of * at start and end of original pattern - - Msgp : Natural; - Patp : Natural; - -- Scan pointers for message and pattern - - begin - -- Loop through specific warning suppression entries + ------------- + -- Matches -- + ------------- - for J in Specific_Warnings.First .. Specific_Warnings.Last loop - declare - SWE : Specific_Warning_Entry renames Specific_Warnings.Table (J); + function Matches (S : String; P : String) return Boolean is + Slast : constant Natural := S'Last; + PLast : constant Natural := P'Last; - begin - -- Pragma applies if it is a configuration pragma, or if the - -- location is in range of a specific non-configuration pragma. + SPtr : Natural := S'First; + PPtr : Natural := P'First; - if SWE.Config - or else (SWE.Start <= Loc and then Loc <= SWE.Stop) - then - -- Check if message matches, dealing with * patterns + begin + -- Loop advancing through characters of string and pattern - Patlen := SWE.Patlen; - Pattern := SWE.Pattern; - Star_Start := SWE.Star_Start; - Star_End := SWE.Star_End; + SPtr := S'First; + PPtr := P'First; + loop + -- Return True if pattern is a single asterisk - -- Loop through possible starting positions in Msg + if PPtr = PLast and then P (PPtr) = '*' then + return True; - Outer : for M in 1 .. 1 + (Msglen - Patlen) loop + -- Return True if both pattern and string exhausted - -- See if pattern matches string starting at Msg (J) + elsif PPtr > PLast and then SPtr > Slast then + return True; - Msgp := M; - Patp := 1; - Inner : loop + -- Return False, if one exhausted and not the other - -- If pattern exhausted, then match if we are at end - -- of message, or if pattern ended with an asterisk, - -- otherwise match failure at this position. + elsif PPtr > PLast or else SPtr > Slast then + return False; - if Patp > Patlen then - if Msgp > Msglen or else Star_End then - SWE.Used := True; - return True; - else - exit Inner; - end if; + -- Case where pattern starts with asterisk - -- Otherwise if message exhausted (and we still have - -- pattern characters left), then match failure here. + elsif P (PPtr) = '*' then - elsif Msgp > Msglen then - exit Inner; - end if; + -- Try all possible starting positions in S for match with + -- the remaining characters of the pattern. This is the + -- recursive call that implements the scanner backup. - -- Here we have pattern and message characters left + for J in SPtr .. Slast loop + if Matches (S (J .. Slast), P (PPtr + 1 .. PLast)) then + return True; + end if; + end loop; - -- Handle "*" pattern match + return False; - if Patp < Patlen - 1 and then - Pattern (Patp .. Patp + 2) = """*""" - then - Patp := Patp + 3; + -- Dealt with end of string and *, advance if we have a match - -- Must have " and at least three chars in msg or we - -- have no match at this position. + elsif S (SPtr) = P (PPtr) then + SPtr := SPtr + 1; + PPtr := PPtr + 1; - exit Inner when Msg (Msgp) /= '"'; - Msgp := Msgp + 1; + -- If first characters do not match, that's decisive - -- Scan out " string " in message + else + return False; + end if; + end loop; + end Matches; - Scan : loop - exit Inner when Msgp = Msglen; - Msgp := Msgp + 1; - exit Scan when Msg (Msgp - 1) = '"'; - end loop Scan; + -- Start of processing for Warning_Specifically_Suppressed - -- If not "*" case, just compare character + begin + -- Loop through specific warning suppression entries - else - exit Inner when Pattern (Patp) /= Msg (Msgp); - Patp := Patp + 1; - Msgp := Msgp + 1; - end if; - end loop Inner; + for J in Specific_Warnings.First .. Specific_Warnings.Last loop + declare + SWE : Specific_Warning_Entry renames Specific_Warnings.Table (J); - -- Advance to next position if star at end of original - -- pattern, otherwise no more match attempts are possible + begin + -- Pragma applies if it is a configuration pragma, or if the + -- location is in range of a specific non-configuration pragma. - exit Outer when not Star_Start; - end loop Outer; + if SWE.Config + or else (SWE.Start <= Loc and then Loc <= SWE.Stop) + then + if Matches (Msg.all, SWE.Msg.all) then + SWE.Used := True; + return True; + end if; end if; end; end loop; diff --git a/gcc/ada/erroutc.ads b/gcc/ada/erroutc.ads index 1f4eebf3584..edc1140fbef 100644 --- a/gcc/ada/erroutc.ads +++ b/gcc/ada/erroutc.ads @@ -6,7 +6,7 @@ -- -- -- S p e c -- -- -- --- Copyright (C) 1992-2007, Free Software Foundation, Inc. -- +-- Copyright (C) 1992-2008, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -52,6 +52,7 @@ package Erroutc is Is_Style_Msg : Boolean := False; -- Set True to indicate if the current message is a style message + -- (i.e. a message whose text starts with the cahracters "(style)"). Is_Serious_Error : Boolean := False; -- Set by Set_Msg_Text to indicate if current message is serious error @@ -267,25 +268,12 @@ package Erroutc is Msg : String_Ptr; -- Message from pragma Warnings (Off, string) - Pattern : String_Ptr; - -- Same as Msg, excluding initial and final asterisks if present. The - -- lower bound of this string is always one. - - Patlen : Natural; - -- Length of pattern string (excluding initial/final asterisks) - Open : Boolean; -- Set to True if OFF has been encountered with no matching ON Used : Boolean; -- Set to True if entry has been used to suppress a warning - Star_Start : Boolean; - -- True if given pattern had * at start - - Star_End : Boolean; - -- True if given pattern had * at end - Config : Boolean; -- True if pragma is configuration pragma (in which case no matching -- Off pragma is required, and it is not required that a specific @@ -482,12 +470,12 @@ package Erroutc is procedure Test_Style_Warning_Serious_Msg (Msg : String); -- Sets Is_Warning_Msg true if Msg is a warning message (contains a - -- question mark character), and False otherwise. Sets Is_Style_Msg - -- true if Msg is a style message (starts with "(style)"). Sets - -- Is_Serious_Error True unless the message is a warning or style - -- message or contains the character | indicating a non-serious - -- error message. Note that the call has no effect for continuation - -- messages (those whose first character is \). + -- question mark character), and False otherwise. Is_Style_Msg is set true + -- if Msg is a style message (starts with "(style)". Sets Is_Serious_Error + -- True unless the message is a warning or style/info message or contains + -- the character | indicating a non-serious error message. Note that the + -- call has no effect for continuation messages (those whose first + -- character is '\'). function Warnings_Suppressed (Loc : Source_Ptr) return Boolean; -- Determines if given location is covered by a warnings off suppression diff --git a/gcc/ada/exp_aggr.adb b/gcc/ada/exp_aggr.adb index c334150b84a..c815369e821 100644 --- a/gcc/ada/exp_aggr.adb +++ b/gcc/ada/exp_aggr.adb @@ -300,7 +300,7 @@ package body Exp_Aggr is Hiv : Uint; -- The following constant determines the maximum size of an - -- aggregate produced by converting named to positional + -- array aggregate produced by converting named to positional -- notation (e.g. from others clauses). This avoids running -- away with attempts to convert huge aggregates, which hit -- memory limits in the backend. @@ -1170,9 +1170,9 @@ package body Exp_Aggr is -- If the component is itself an array of controlled types, whose -- value is given by a sub-aggregate, then the attach calls have -- been generated when individual subcomponent are assigned, and - -- and must not be done again to prevent malformed finalization - -- chains (see comments above, concerning the creation of a block - -- to hold inner finalization actions). + -- must not be done again to prevent malformed finalization chains + -- (see comments above, concerning the creation of a block to hold + -- inner finalization actions). if Present (Comp_Type) and then Controlled_Type (Comp_Type) @@ -1677,10 +1677,6 @@ package body Exp_Aggr is -- Build_Record_Aggr_Code -- ---------------------------- - ---------------------------- - -- Build_Record_Aggr_Code -- - ---------------------------- - function Build_Record_Aggr_Code (N : Node_Id; Typ : Entity_Id; @@ -6350,7 +6346,8 @@ package body Exp_Aggr is else -- The aggregate is static if all components are literals, or -- else all its components are static aggregates for the - -- component type. + -- component type. We also limit the size of a static aggregate + -- to prevent runaway static expressions. if Is_Array_Type (Comp_Type) or else Is_Record_Type (Comp_Type) @@ -6364,6 +6361,9 @@ package body Exp_Aggr is elsif Nkind (Expression (Expr)) /= N_Integer_Literal then return False; + + elsif not Aggr_Size_OK (Typ) then + return False; end if; -- Create a positional aggregate with the right number of diff --git a/gcc/ada/exp_atag.adb b/gcc/ada/exp_atag.adb index c2c37a7eb30..318614e598f 100644 --- a/gcc/ada/exp_atag.adb +++ b/gcc/ada/exp_atag.adb @@ -6,7 +6,7 @@ -- -- -- S p e c -- -- -- --- Copyright (C) 2006-2007, Free Software Foundation, Inc. -- +-- Copyright (C) 2006-2008, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -26,9 +26,11 @@ with Einfo; use Einfo; with Elists; use Elists; with Exp_Util; use Exp_Util; +with Namet; use Namet; with Nlists; use Nlists; with Nmake; use Nmake; with Rtsfind; use Rtsfind; +with Sinfo; use Sinfo; with Sem_Util; use Sem_Util; with Stand; use Stand; with Snames; use Snames; @@ -57,15 +59,6 @@ package body Exp_Atag is -- Generate: To_Type_Specific_Data_Ptr -- (To_Addr_Ptr (To_Address (Tag) - Typeinfo_Offset).all); - function Build_Predef_Prims - (Loc : Source_Ptr; - Tag_Node : Node_Id) return Node_Id; - -- Build code that retrieves the address of the dispatch table containing - -- the predefined Ada primitives: - -- - -- Generate: To_Predef_Prims_Table_Ptr - -- (To_Addr_Ptr (To_Address (Tag) - Predef_Prims_Offset).all); - ------------------------------------------------ -- Build_Common_Dispatching_Select_Statements -- ------------------------------------------------ @@ -239,10 +232,33 @@ package body Exp_Atag is Position : Uint) return Node_Id is begin + -- Build code that retrieves the address of the dispatch table + -- containing the predefined Ada primitives: + -- + -- Generate: + -- To_Predef_Prims_Table_Ptr + -- (To_Addr_Ptr (To_Address (Tag) - Predef_Prims_Offset).all); + return Make_Indexed_Component (Loc, Prefix => - Build_Predef_Prims (Loc, Tag_Node), + Unchecked_Convert_To (RTE (RE_Predef_Prims_Table_Ptr), + Make_Explicit_Dereference (Loc, + Unchecked_Convert_To (RTE (RE_Addr_Ptr), + Make_Function_Call (Loc, + Name => + Make_Expanded_Name (Loc, + Chars => Name_Op_Subtract, + Prefix => + New_Reference_To + (RTU_Entity (System_Storage_Elements), Loc), + Selector_Name => + Make_Identifier (Loc, + Chars => Name_Op_Subtract)), + Parameter_Associations => New_List ( + Unchecked_Convert_To (RTE (RE_Address), Tag_Node), + New_Reference_To (RTE (RE_DT_Predef_Prims_Offset), + Loc)))))), Expressions => New_List (Make_Integer_Literal (Loc, Position))); end Build_Get_Predefined_Prim_Op_Address; @@ -397,35 +413,37 @@ package body Exp_Atag is New_Reference_To (RTE (RE_Max_Predef_Prims), Loc)))); end Build_Inherit_Predefined_Prims; - ------------------------ - -- Build_Predef_Prims -- - ------------------------ + ------------------------- + -- Build_Offset_To_Top -- + ------------------------- - function Build_Predef_Prims - (Loc : Source_Ptr; - Tag_Node : Node_Id) return Node_Id + function Build_Offset_To_Top + (Loc : Source_Ptr; + This_Node : Node_Id) return Node_Id is + Tag_Node : Node_Id; + begin - return - Unchecked_Convert_To (RTE (RE_Predef_Prims_Table_Ptr), - Make_Explicit_Dereference (Loc, - Unchecked_Convert_To (RTE (RE_Addr_Ptr), - Make_Function_Call (Loc, - Name => - Make_Expanded_Name (Loc, - Chars => Name_Op_Subtract, - Prefix => - New_Reference_To - (RTU_Entity (System_Storage_Elements), Loc), - Selector_Name => - Make_Identifier (Loc, - Chars => Name_Op_Subtract)), + Tag_Node := + Make_Explicit_Dereference (Loc, + Unchecked_Convert_To (RTE (RE_Tag_Ptr), This_Node)); - Parameter_Associations => New_List ( - Unchecked_Convert_To (RTE (RE_Address), Tag_Node), - New_Reference_To (RTE (RE_DT_Predef_Prims_Offset), - Loc)))))); - end Build_Predef_Prims; + return + Make_Explicit_Dereference (Loc, + Unchecked_Convert_To (RTE (RE_Offset_To_Top_Ptr), + Make_Function_Call (Loc, + Name => + Make_Expanded_Name (Loc, + Chars => Name_Op_Subtract, + Prefix => New_Reference_To + (RTU_Entity (System_Storage_Elements), Loc), + Selector_Name => Make_Identifier (Loc, + Chars => Name_Op_Subtract)), + Parameter_Associations => New_List ( + Unchecked_Convert_To (RTE (RE_Address), Tag_Node), + New_Reference_To (RTE (RE_DT_Offset_To_Top_Offset), + Loc))))); + end Build_Offset_To_Top; ------------------------------------------ -- Build_Set_Predefined_Prim_Op_Address -- @@ -471,6 +489,60 @@ package body Exp_Atag is Expression => Address_Node); end Build_Set_Prim_Op_Address; + ----------------------------- + -- Build_Set_Size_Function -- + ----------------------------- + + function Build_Set_Size_Function + (Loc : Source_Ptr; + Tag_Node : Node_Id; + Size_Func : Entity_Id) return Node_Id is + begin + pragma Assert (Chars (Size_Func) = Name_uSize + and then RTE_Record_Component_Available (RE_Size_Func)); + return + Make_Assignment_Statement (Loc, + Name => + Make_Selected_Component (Loc, + Prefix => Build_TSD (Loc, Tag_Node), + Selector_Name => + New_Reference_To + (RTE_Record_Component (RE_Size_Func), Loc)), + Expression => + Unchecked_Convert_To (RTE (RE_Size_Ptr), + Make_Attribute_Reference (Loc, + Prefix => New_Reference_To (Size_Func, Loc), + Attribute_Name => Name_Unrestricted_Access))); + end Build_Set_Size_Function; + + ------------------------------------ + -- Build_Set_Static_Offset_To_Top -- + ------------------------------------ + + function Build_Set_Static_Offset_To_Top + (Loc : Source_Ptr; + Iface_Tag : Node_Id; + Offset_Value : Node_Id) return Node_Id is + begin + return + Make_Assignment_Statement (Loc, + Make_Explicit_Dereference (Loc, + Unchecked_Convert_To (RTE (RE_Offset_To_Top_Ptr), + Make_Function_Call (Loc, + Name => + Make_Expanded_Name (Loc, + Chars => Name_Op_Subtract, + Prefix => New_Reference_To + (RTU_Entity (System_Storage_Elements), Loc), + Selector_Name => Make_Identifier (Loc, + Chars => Name_Op_Subtract)), + Parameter_Associations => New_List ( + Unchecked_Convert_To (RTE (RE_Address), Iface_Tag), + New_Reference_To (RTE (RE_DT_Offset_To_Top_Offset), + Loc))))), + Offset_Value); + end Build_Set_Static_Offset_To_Top; + --------------- -- Build_TSD -- --------------- diff --git a/gcc/ada/exp_atag.ads b/gcc/ada/exp_atag.ads index 9d724f29140..2ac42a9d254 100644 --- a/gcc/ada/exp_atag.ads +++ b/gcc/ada/exp_atag.ads @@ -6,7 +6,7 @@ -- -- -- S p e c -- -- -- --- Copyright (C) 2006-2007, Free Software Foundation, Inc. -- +-- Copyright (C) 2006-2008, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -117,6 +117,19 @@ package Exp_Atag is -- New_Tag.Prims_Ptr (1 .. Num_Prims) := -- Old_Tag.Prims_Ptr (1 .. Num_Prims); + function Build_Offset_To_Top + (Loc : Source_Ptr; + This_Node : Node_Id) return Node_Id; + -- Build code that references the Offset_To_Top component of the primary + -- or secondary dispatch table associated with This_Node. This subprogram + -- provides a subset of the functionality provided by the function + -- Offset_To_Top of package Ada.Tags, and is only called by the frontend + -- when such routine is not available in a configurable runtime. + -- + -- Generates: + -- Offset_To_Top_Ptr + -- (Address!(Tag_Ptr!(This).all) - Offset_To_Top_Offset) + function Build_Set_Predefined_Prim_Op_Address (Loc : Source_Ptr; Tag_Node : Node_Id; @@ -145,4 +158,23 @@ package Exp_Atag is -- -- Generates: Tag.D (Position) := Value + function Build_Set_Size_Function + (Loc : Source_Ptr; + Tag_Node : Node_Id; + Size_Func : Entity_Id) return Node_Id; + -- Build code that saves in the TSD the address of the function + -- calculating _size of the object. + + function Build_Set_Static_Offset_To_Top + (Loc : Source_Ptr; + Iface_Tag : Node_Id; + Offset_Value : Node_Id) return Node_Id; + -- Build code that initialize the Offset_To_Top component of the + -- secondary dispatch table referenced by Iface_Tag. + -- + -- Generates: + -- Offset_To_Top_Ptr + -- (Address!(Tag_Ptr!(This).all) - Offset_To_Top_Offset).all + -- := Offset_Value + end Exp_Atag; diff --git a/gcc/ada/exp_attr.adb b/gcc/ada/exp_attr.adb index bf5e9d79bbd..b6d4ae8d6e3 100644 --- a/gcc/ada/exp_attr.adb +++ b/gcc/ada/exp_attr.adb @@ -30,6 +30,8 @@ with Einfo; use Einfo; with Elists; use Elists; with Exp_Atag; use Exp_Atag; with Exp_Ch2; use Exp_Ch2; +with Exp_Ch3; use Exp_Ch3; +with Exp_Ch6; use Exp_Ch6; with Exp_Ch9; use Exp_Ch9; with Exp_Imgv; use Exp_Imgv; with Exp_Pakd; use Exp_Pakd; @@ -37,6 +39,7 @@ with Exp_Strm; use Exp_Strm; with Exp_Tss; use Exp_Tss; with Exp_Util; use Exp_Util; with Exp_VFpt; use Exp_VFpt; +with Fname; use Fname; with Freeze; use Freeze; with Gnatvsn; use Gnatvsn; with Itypes; use Itypes; @@ -251,12 +254,20 @@ package body Exp_Attr is function May_Be_External_Call return Boolean is Subp : Entity_Id; + Par : Node_Id := Parent (N); + begin - if (Nkind (Parent (N)) = N_Procedure_Call_Statement - or else Nkind (Parent (N)) = N_Function_Call) - and then Is_Entity_Name (Name (Parent (N))) + -- Account for the case where the Access attribute is part of a + -- named parameter association. + + if Nkind (Par) = N_Parameter_Association then + Par := Parent (Par); + end if; + + if Nkind_In (Par, N_Procedure_Call_Statement, N_Function_Call) + and then Is_Entity_Name (Name (Par)) then - Subp := Entity (Name (Parent (N))); + Subp := Entity (Name (Par)); return not In_Open_Scopes (Scope (Subp)); else return False; @@ -272,8 +283,6 @@ package body Exp_Attr is -- current enclosing operation. if Is_Entity_Name (Pref) then - pragma Assert (In_Open_Scopes (Scope (Entity (Pref)))); - if May_Be_External_Call then Sub := New_Occurrence_Of @@ -284,10 +293,18 @@ package body Exp_Attr is (Protected_Body_Subprogram (Entity (Pref)), Loc); end if; + -- Don't traverse the scopes when the attribute occurs within an init + -- proc, because we directly use the _init formal of the init proc in + -- that case. + Curr := Current_Scope; - while Scope (Curr) /= Scope (Entity (Pref)) loop - Curr := Scope (Curr); - end loop; + if not Is_Init_Proc (Curr) then + pragma Assert (In_Open_Scopes (Scope (Entity (Pref)))); + + while Scope (Curr) /= Scope (Entity (Pref)) loop + Curr := Scope (Curr); + end loop; + end if; -- In case of protected entries the first formal of its Protected_ -- Body_Subprogram is the address of the object. @@ -298,6 +315,15 @@ package body Exp_Attr is (First_Formal (Protected_Body_Subprogram (Curr)), Loc); + -- If the current scope is an init proc, then use the address of the + -- _init formal as the object reference. + + elsif Is_Init_Proc (Curr) then + Obj_Ref := + Make_Attribute_Reference (Loc, + Prefix => New_Occurrence_Of (First_Formal (Curr), Loc), + Attribute_Name => Name_Address); + -- In case of protected subprograms the first formal of its -- Protected_Body_Subprogram is the object and we get its address. @@ -464,6 +490,7 @@ package body Exp_Attr is Typ : constant Entity_Id := Etype (N); Btyp : constant Entity_Id := Base_Type (Typ); Pref : constant Node_Id := Prefix (N); + Ptyp : constant Entity_Id := Etype (Pref); Exprs : constant List_Id := Expressions (N); Id : constant Attribute_Id := Get_Attribute_Id (Attribute_Name (N)); @@ -595,6 +622,19 @@ package body Exp_Attr is end; end if; + -- Ada 2005 (AI-318-02): If attribute prefix is a call to a build-in- + -- place function, then a temporary return object needs to be created + -- and access to it must be passed to the function. Currently we limit + -- such functions to those with inherently limited result subtypes, but + -- eventually we plan to expand the functions that are treated as + -- build-in-place to include other composite result types. + + if Ada_Version >= Ada_05 + and then Is_Build_In_Place_Function_Call (Pref) + then + Make_Build_In_Place_Call_In_Anonymous_Context (Pref); + end if; + -- Remaining processing depends on specific attribute case Id is @@ -620,111 +660,79 @@ package body Exp_Attr is if Id = Attribute_Unrestricted_Access and then Is_Subprogram (Directly_Designated_Type (Typ)) then - -- The following assertion ensures that this special management + -- The following conditions ensure that this special management -- is done only for "Address!(Prim'Unrestricted_Access)" nodes. -- At this stage other cases in which the designated type is -- still a subprogram (instead of an E_Subprogram_Type) are -- wrong because the semantics must have overridden the type of -- the node with the type imposed by the context. - pragma Assert (Nkind (Parent (N)) = N_Unchecked_Type_Conversion - and then Etype (Parent (N)) = RTE (RE_Address)); - - declare - Subp : constant Entity_Id := Directly_Designated_Type (Typ); - - Extra : Entity_Id := Empty; - New_Formal : Entity_Id; - Old_Formal : Entity_Id := First_Formal (Subp); - Subp_Typ : Entity_Id; + if Nkind (Parent (N)) = N_Unchecked_Type_Conversion + and then Etype (Parent (N)) = RTE (RE_Prim_Ptr) + then + Set_Etype (N, RTE (RE_Prim_Ptr)); - begin - Subp_Typ := Create_Itype (E_Subprogram_Type, N); - Set_Etype (Subp_Typ, Etype (Subp)); - Set_Returns_By_Ref (Subp_Typ, Returns_By_Ref (Subp)); + else + declare + Subp : constant Entity_Id := + Directly_Designated_Type (Typ); + Etyp : Entity_Id; + Extra : Entity_Id := Empty; + New_Formal : Entity_Id; + Old_Formal : Entity_Id := First_Formal (Subp); + Subp_Typ : Entity_Id; - if Present (Old_Formal) then - New_Formal := New_Copy (Old_Formal); - Set_First_Entity (Subp_Typ, New_Formal); + begin + Subp_Typ := Create_Itype (E_Subprogram_Type, N); + Set_Etype (Subp_Typ, Etype (Subp)); + Set_Returns_By_Ref (Subp_Typ, Returns_By_Ref (Subp)); - loop - Set_Scope (New_Formal, Subp_Typ); + if Present (Old_Formal) then + New_Formal := New_Copy (Old_Formal); + Set_First_Entity (Subp_Typ, New_Formal); - -- Handle itypes + loop + Set_Scope (New_Formal, Subp_Typ); + Etyp := Etype (New_Formal); - if Is_Itype (Etype (New_Formal)) then - Extra := New_Copy (Etype (New_Formal)); + -- Handle itypes. There is no need to duplicate + -- here the itypes associated with record types + -- (i.e the implicit full view of private types). - if Ekind (Extra) = E_Record_Subtype - or else Ekind (Extra) = E_Class_Wide_Subtype + if Is_Itype (Etyp) + and then Ekind (Base_Type (Etyp)) /= E_Record_Type then - Set_Cloned_Subtype (Extra, - Etype (New_Formal)); + Extra := New_Copy (Etyp); + Set_Parent (Extra, New_Formal); + Set_Etype (New_Formal, Extra); + Set_Scope (Extra, Subp_Typ); end if; - Set_Etype (New_Formal, Extra); - Set_Scope (Etype (New_Formal), Subp_Typ); - end if; - - Extra := New_Formal; - Next_Formal (Old_Formal); - exit when No (Old_Formal); - - Set_Next_Entity (New_Formal, - New_Copy (Old_Formal)); - Next_Entity (New_Formal); - end loop; + Extra := New_Formal; + Next_Formal (Old_Formal); + exit when No (Old_Formal); - Set_Next_Entity (New_Formal, Empty); - Set_Last_Entity (Subp_Typ, Extra); - end if; - - -- Now that the explicit formals have been duplicated, - -- any extra formals needed by the subprogram must be - -- created. - - if Present (Extra) then - Set_Extra_Formal (Extra, Empty); - end if; + Set_Next_Entity (New_Formal, + New_Copy (Old_Formal)); + Next_Entity (New_Formal); + end loop; - Create_Extra_Formals (Subp_Typ); - Set_Directly_Designated_Type (Typ, Subp_Typ); + Set_Next_Entity (New_Formal, Empty); + Set_Last_Entity (Subp_Typ, Extra); + end if; - -- Complete decoration of access-to-subprogram itype to - -- indicate to the backend that this itype corresponds to - -- a statically allocated dispatch table. + -- Now that the explicit formals have been duplicated, + -- any extra formals needed by the subprogram must be + -- created. - -- ??? more comments on structure here, three level parent - -- references are worrisome! + if Present (Extra) then + Set_Extra_Formal (Extra, Empty); + end if; - if Nkind (Ref_Object) in N_Has_Entity - and then Is_Dispatching_Operation (Entity (Ref_Object)) - and then Present (Parent (Parent (N))) - and then Nkind (Parent (Parent (N))) = N_Aggregate - and then Present (Parent (Parent (Parent (N)))) - then - declare - P : constant Node_Id := - Parent (Parent (Parent (N))); - Prim : constant Entity_Id := Entity (Ref_Object); - - begin - Set_Is_Static_Dispatch_Table_Entity (Typ, - (Is_Predefined_Dispatching_Operation (Prim) - and then Nkind (P) = N_Object_Declaration - and then Is_Static_Dispatch_Table_Entity - (Defining_Identifier (P))) - or else - (not Is_Predefined_Dispatching_Operation (Prim) - and then Nkind (P) = N_Aggregate - and then Present (Parent (P)) - and then Nkind (Parent (P)) - = N_Object_Declaration - and then Is_Static_Dispatch_Table_Entity - (Defining_Identifier (Parent (P))))); - end; - end if; - end; + Create_Extra_Formals (Subp_Typ); + Set_Directly_Designated_Type (Typ, Subp_Typ); + end; + end if; end if; if Is_Access_Protected_Subprogram_Type (Btyp) then @@ -897,12 +905,12 @@ package body Exp_Attr is if Is_Entity_Name (Pref) and then Is_Task_Type (Entity (Pref)) then - Task_Proc := Next_Entity (Root_Type (Etype (Pref))); + Task_Proc := Next_Entity (Root_Type (Ptyp)); while Present (Task_Proc) loop exit when Ekind (Task_Proc) = E_Procedure and then Etype (First_Formal (Task_Proc)) = - Corresponding_Record_Type (Etype (Pref)); + Corresponding_Record_Type (Ptyp); Next_Entity (Task_Proc); end loop; @@ -924,8 +932,8 @@ package body Exp_Attr is External_Subprogram (Entity (Selector_Name (Pref))), Loc)); elsif Nkind (Pref) = N_Explicit_Dereference - and then Ekind (Etype (Pref)) = E_Subprogram_Type - and then Convention (Etype (Pref)) = Convention_Protected + and then Ekind (Ptyp) = E_Subprogram_Type + and then Convention (Ptyp) = Convention_Protected then -- The prefix is be a dereference of an access_to_protected_ -- subprogram. The desired address is the second component of @@ -957,8 +965,8 @@ package body Exp_Attr is -- This processing is not needed in the VM case, where dispatching -- issues are taken care of by the virtual machine. - elsif Is_Class_Wide_Type (Etype (Pref)) - and then Is_Interface (Etype (Pref)) + elsif Is_Class_Wide_Type (Ptyp) + and then Is_Interface (Ptyp) and then VM_Target = No_VM and then not (Nkind (Pref) in N_Has_Entity and then Is_Subprogram (Entity (Pref))) @@ -972,7 +980,8 @@ package body Exp_Attr is return; end if; - -- Deal with packed array reference, other cases are handled by gigi + -- Deal with packed array reference, other cases are handled by + -- the back end. if Involves_Packed_Array_Reference (Pref) then Expand_Packed_Address_Reference (N); @@ -984,7 +993,6 @@ package body Exp_Attr is --------------- when Attribute_Alignment => Alignment : declare - Ptyp : constant Entity_Id := Etype (Pref); New_Node : Node_Id; begin @@ -1109,9 +1117,9 @@ package body Exp_Attr is -- Bit_Position -- ------------------ - -- We compute this if a component clause was present, otherwise - -- we leave the computation up to Gigi, since we don't know what - -- layout will be chosen. + -- We compute this if a component clause was present, otherwise we leave + -- the computation up to the back end, since we don't know what layout + -- will be chosen. -- Note that the attribute can apply to a naked record component -- in generated code (i.e. the prefix is an identifier that @@ -1278,9 +1286,9 @@ package body Exp_Attr is -- callable (Task_Id (Pref._disp_get_task_id)); if Ada_Version >= Ada_05 - and then Ekind (Etype (Pref)) = E_Class_Wide_Type - and then Is_Interface (Etype (Pref)) - and then Is_Task_Interface (Etype (Pref)) + and then Ekind (Ptyp) = E_Class_Wide_Type + and then Is_Interface (Ptyp) + and then Is_Task_Interface (Ptyp) then Rewrite (N, Make_Function_Call (Loc, @@ -1343,10 +1351,9 @@ package body Exp_Attr is Unchecked_Convert_To (Id_Kind, Make_Function_Call (Loc, Name => Name, - Parameter_Associations => New_List - (New_Reference_To ( - Object_Ref - (Corresponding_Body (Parent (Conctype))), Loc))))); + Parameter_Associations => New_List ( + New_Reference_To + (Find_Protection_Object (Current_Scope), Loc))))); -- Task case @@ -1376,8 +1383,8 @@ package body Exp_Attr is Rewrite (N, Unchecked_Convert_To (Id_Kind, Make_Function_Call (Loc, - Name => New_Reference_To ( - RTE (RE_Task_Entry_Caller), Loc), + Name => + New_Reference_To (RTE (RE_Task_Entry_Caller), Loc), Parameter_Associations => New_List ( Make_Integer_Literal (Loc, Intval => Int (Nest_Depth)))))); @@ -1408,7 +1415,6 @@ package body Exp_Attr is when Attribute_Constrained => Constrained : declare Formal_Ent : constant Entity_Id := Param_Entity (Pref); - Typ : constant Entity_Id := Etype (Pref); function Is_Constrained_Aliased_View (Obj : Node_Id) return Boolean; -- Ada 2005 (AI-363): Returns True if the object name Obj denotes a @@ -1427,7 +1433,6 @@ package body Exp_Attr is if Present (Renamed_Object (E)) then return Is_Constrained_Aliased_View (Renamed_Object (E)); - else return Is_Aliased (E) and then Is_Constrained (Etype (E)); end if; @@ -1503,8 +1508,8 @@ package body Exp_Attr is end if; -- If the prefix is not a variable or is aliased, then - -- definitely true; if it's a formal parameter without - -- an associated extra formal, then treat it as constrained. + -- definitely true; if it's a formal parameter without an + -- associated extra formal, then treat it as constrained. -- Ada 2005 (AI-363): An aliased prefix must be known to be -- constrained in order to set the attribute to True. @@ -1518,10 +1523,9 @@ package body Exp_Attr is then Res := True; - -- Variable case, just look at type to see if it is - -- constrained. Note that the one case where this is - -- not accurate (the procedure formal case), has been - -- handled above. + -- Variable case, look at type to see if it is constrained. + -- Note that the one case where this is not accurate (the + -- procedure formal case), has been handled above. -- We use the Underlying_Type here (and below) in case the -- type is private without discriminants, but the full type @@ -1536,11 +1540,10 @@ package body Exp_Attr is New_Reference_To (Boolean_Literals (Res), Loc)); end; - -- Prefix is not an entity name. These are also cases where - -- we can always tell at compile time by looking at the form - -- and type of the prefix. If an explicit dereference of an - -- object with constrained partial view, this is unconstrained - -- (Ada 2005 AI-363). + -- Prefix is not an entity name. These are also cases where we can + -- always tell at compile time by looking at the form and type of the + -- prefix. If an explicit dereference of an object with constrained + -- partial view, this is unconstrained (Ada 2005 AI-363). else Rewrite (N, @@ -1550,8 +1553,8 @@ package body Exp_Attr is or else (Nkind (Pref) = N_Explicit_Dereference and then - not Has_Constrained_Partial_View (Base_Type (Typ))) - or else Is_Constrained (Underlying_Type (Typ))), + not Has_Constrained_Partial_View (Base_Type (Ptyp))) + or else Is_Constrained (Underlying_Type (Ptyp))), Loc)); end if; @@ -1574,13 +1577,13 @@ package body Exp_Attr is -- Transforms 'Count attribute into a call to the Count function - when Attribute_Count => Count : - declare - Entnam : Node_Id; - Index : Node_Id; - Name : Node_Id; - Call : Node_Id; - Conctyp : Entity_Id; + when Attribute_Count => Count : declare + Call : Node_Id; + Conctyp : Entity_Id; + Entnam : Node_Id; + Entry_Id : Entity_Id; + Index : Node_Id; + Name : Node_Id; begin -- If the prefix is a member of an entry family, retrieve both @@ -1594,6 +1597,8 @@ package body Exp_Attr is Index := Empty; end if; + Entry_Id := Entity (Entnam); + -- Find the concurrent type in which this attribute is referenced -- (there had better be one). @@ -1605,7 +1610,6 @@ package body Exp_Attr is -- Protected case if Is_Protected_Type (Conctyp) then - case Corresponding_Runtime_Package (Conctyp) is when System_Tasking_Protected_Objects_Entries => Name := New_Reference_To (RTE (RE_Protected_Count), Loc); @@ -1614,26 +1618,24 @@ package body Exp_Attr is Make_Function_Call (Loc, Name => Name, Parameter_Associations => New_List ( - New_Reference_To ( - Object_Ref ( - Corresponding_Body (Parent (Conctyp))), Loc), - Entry_Index_Expression (Loc, - Entity (Entnam), Index, Scope (Entity (Entnam))))); + New_Reference_To + (Find_Protection_Object (Current_Scope), Loc), + Entry_Index_Expression + (Loc, Entry_Id, Index, Scope (Entry_Id)))); when System_Tasking_Protected_Objects_Single_Entry => - Name := New_Reference_To - (RTE (RE_Protected_Count_Entry), Loc); + Name := + New_Reference_To (RTE (RE_Protected_Count_Entry), Loc); Call := Make_Function_Call (Loc, Name => Name, Parameter_Associations => New_List ( - New_Reference_To ( - Object_Ref ( - Corresponding_Body (Parent (Conctyp))), Loc))); + New_Reference_To + (Find_Protection_Object (Current_Scope), Loc))); + when others => raise Program_Error; - end case; -- Task case @@ -1643,8 +1645,8 @@ package body Exp_Attr is Make_Function_Call (Loc, Name => New_Reference_To (RTE (RE_Task_Count), Loc), Parameter_Associations => New_List ( - Entry_Index_Expression - (Loc, Entity (Entnam), Index, Scope (Entity (Entnam))))); + Entry_Index_Expression (Loc, + Entry_Id, Index, Scope (Entry_Id)))); end if; -- The call returns type Natural but the context is universal integer @@ -1774,11 +1776,11 @@ package body Exp_Attr is -- Elaborated -- ---------------- - -- Elaborated is always True for preelaborated units, predefined - -- units, pure units and units which have Elaborate_Body pragmas. - -- These units have no elaboration entity. + -- Elaborated is always True for preelaborated units, predefined units, + -- pure units and units which have Elaborate_Body pragmas. These units + -- have no elaboration entity. - -- Note: The Elaborated attribute is never passed through to Gigi + -- Note: The Elaborated attribute is never passed to the back end when Attribute_Elaborated => Elaborated : declare Ent : constant Entity_Id := Entity (Pref); @@ -1802,12 +1804,12 @@ package body Exp_Attr is -- target-type (Y) - -- This is simply a direct conversion from the enumeration type - -- to the target integer type, which is treated by Gigi as a normal - -- integer conversion, treating the enumeration type as an integer, - -- which is exactly what we want! We set Conversion_OK to make sure - -- that the analyzer does not complain about what otherwise might - -- be an illegal conversion. + -- This is simply a direct conversion from the enumeration type to + -- the target integer type, which is treated by the back end as a + -- normal integer conversion, treating the enumeration type as an + -- integer, which is exactly what we want! We set Conversion_OK to + -- make sure that the analyzer does not complain about what otherwise + -- might be an illegal conversion. if Is_Non_Empty_List (Exprs) then Rewrite (N, @@ -1843,10 +1845,44 @@ package body Exp_Attr is Set_Etype (N, Typ); Analyze_And_Resolve (N, Typ); - end Enum_Rep; -------------- + -- Enum_Val -- + -------------- + + when Attribute_Enum_Val => Enum_Val : declare + Expr : Node_Id; + Btyp : constant Entity_Id := Base_Type (Ptyp); + + begin + -- X'Enum_Val (Y) expands to + + -- [constraint_error when _rep_to_pos (Y, False) = -1, msg] + -- X!(Y); + + Expr := Unchecked_Convert_To (Ptyp, First (Exprs)); + + Insert_Action (N, + Make_Raise_Constraint_Error (Loc, + Condition => + Make_Op_Eq (Loc, + Left_Opnd => + Make_Function_Call (Loc, + Name => + New_Reference_To (TSS (Btyp, TSS_Rep_To_Pos), Loc), + Parameter_Associations => New_List ( + Relocate_Node (Duplicate_Subexpr (Expr)), + New_Occurrence_Of (Standard_False, Loc))), + + Right_Opnd => Make_Integer_Literal (Loc, -1)), + Reason => CE_Range_Check_Failed)); + + Rewrite (N, Expr); + Analyze_And_Resolve (N, Ptyp); + end Enum_Val; + + -------------- -- Exponent -- -------------- @@ -1879,15 +1915,13 @@ package body Exp_Attr is -- First -- ----------- - when Attribute_First => declare - Ptyp : constant Entity_Id := Etype (Pref); + when Attribute_First => - begin -- If the prefix type is a constrained packed array type which -- already has a Packed_Array_Type representation defined, then -- replace this attribute with a direct reference to 'First of the - -- appropriate index subtype (since otherwise Gigi will try to give - -- us the value of 'First for this implementation type). + -- appropriate index subtype (since otherwise the back end will try + -- to give us the value of 'First for this implementation type). if Is_Constrained_Packed_Array (Ptyp) then Rewrite (N, @@ -1899,18 +1933,16 @@ package body Exp_Attr is elsif Is_Access_Type (Ptyp) then Apply_Access_Check (N); end if; - end; --------------- -- First_Bit -- --------------- - -- We compute this if a component clause was present, otherwise - -- we leave the computation up to Gigi, since we don't know what + -- Compute this if component clause was present, otherwise we leave the + -- computation to be completed in the back-end, since we don't know what -- layout will be chosen. - when Attribute_First_Bit => First_Bit : - declare + when Attribute_First_Bit => First_Bit : declare CE : constant Entity_Id := Entity (Selector_Name (Pref)); begin @@ -1938,10 +1970,10 @@ package body Exp_Attr is -- fixtype(integer-value) - -- we do all the required analysis of the conversion here, because - -- we do not want this to go through the fixed-point conversion - -- circuits. Note that gigi always treats fixed-point as equivalent - -- to the corresponding integer type anyway. + -- We do all the required analysis of the conversion here, because we do + -- not want this to go through the fixed-point conversion circuits. Note + -- that the back end always treats fixed-point as equivalent to the + -- corresponding integer type anyway. when Attribute_Fixed_Value => Fixed_Value : begin @@ -1985,11 +2017,7 @@ package body Exp_Attr is -- Note that we know that the type is a non-static subtype, or Fore -- would have itself been computed dynamically in Eval_Attribute. - when Attribute_Fore => Fore : - declare - Ptyp : constant Entity_Id := Etype (Pref); - - begin + when Attribute_Fore => Fore : begin Rewrite (N, Convert_To (Typ, Make_Function_Call (Loc, @@ -2037,7 +2065,7 @@ package body Exp_Attr is Id_Kind : Entity_Id; begin - if Etype (Pref) = Standard_Exception_Type then + if Ptyp = Standard_Exception_Type then Id_Kind := RTE (RE_Exception_Id); if Present (Renamed_Object (Entity (Pref))) then @@ -2054,9 +2082,9 @@ package body Exp_Attr is -- attributes applied to interfaces. if Ada_Version >= Ada_05 - and then Ekind (Etype (Pref)) = E_Class_Wide_Type - and then Is_Interface (Etype (Pref)) - and then Is_Task_Interface (Etype (Pref)) + and then Ekind (Ptyp) = E_Class_Wide_Type + and then Is_Interface (Ptyp) + and then Is_Task_Interface (Ptyp) then Rewrite (N, Unchecked_Convert_To (Id_Kind, @@ -2094,7 +2122,7 @@ package body Exp_Attr is begin Rewrite (N, Make_Attribute_Reference (Loc, - Prefix => New_Reference_To (Etype (Pref), Loc), + Prefix => New_Reference_To (Ptyp, Loc), Attribute_Name => Name_Image, Expressions => New_List (Relocate_Node (Pref)))); @@ -2184,10 +2212,9 @@ package body Exp_Attr is -- sourcetyp (streamread (strmtyp'Input (stream))); - -- where stmrearead is the given Read function that converts - -- an argument of type strmtyp to type sourcetyp or a type - -- from which it is derived. The extra conversion is required - -- for the derived case. + -- where stmrearead is the given Read function that converts an + -- argument of type strmtyp to type sourcetyp or a type from which + -- it is derived (extra conversion required for the derived case). Prag := Get_Stream_Convert_Pragma (P_Type); @@ -2322,10 +2349,9 @@ package body Exp_Attr is pragma Assert (Is_Record_Type (U_Type) or else Is_Protected_Type (U_Type)); - -- Ada 2005 (AI-216): Program_Error is raised when executing - -- the default implementation of the Input attribute of an - -- unchecked union type if the type lacks default discriminant - -- values. + -- Ada 2005 (AI-216): Program_Error is raised executing default + -- implementation of the Input attribute of an unchecked union + -- type if the type lacks default discriminant values. if Is_Unchecked_Union (Base_Type (U_Type)) and then No (Discriminant_Constraint (U_Type)) @@ -2400,10 +2426,10 @@ package body Exp_Attr is -- inttype(integer-value)) - -- we do all the required analysis of the conversion here, because - -- we do not want this to go through the fixed-point conversion - -- circuits. Note that gigi always treats fixed-point as equivalent - -- to the corresponding integer type anyway. + -- we do all the required analysis of the conversion here, because we do + -- not want this to go through the fixed-point conversion circuits. Note + -- that the back end always treats fixed-point as equivalent to the + -- corresponding integer type anyway. when Attribute_Integer_Value => Integer_Value : begin @@ -2421,19 +2447,24 @@ package body Exp_Attr is Apply_Type_Conversion_Checks (N); end Integer_Value; + ------------------- + -- Invalid_Value -- + ------------------- + + when Attribute_Invalid_Value => + Rewrite (N, Get_Simple_Init_Val (Ptyp, N)); + ---------- -- Last -- ---------- - when Attribute_Last => declare - Ptyp : constant Entity_Id := Etype (Pref); + when Attribute_Last => - begin -- If the prefix type is a constrained packed array type which -- already has a Packed_Array_Type representation defined, then -- replace this attribute with a direct reference to 'Last of the - -- appropriate index subtype (since otherwise Gigi will try to give - -- us the value of 'Last for this implementation type). + -- appropriate index subtype (since otherwise the back end will try + -- to give us the value of 'Last for this implementation type). if Is_Constrained_Packed_Array (Ptyp) then Rewrite (N, @@ -2445,18 +2476,16 @@ package body Exp_Attr is elsif Is_Access_Type (Ptyp) then Apply_Access_Check (N); end if; - end; -------------- -- Last_Bit -- -------------- - -- We compute this if a component clause was present, otherwise - -- we leave the computation up to Gigi, since we don't know what - -- layout will be chosen. + -- We compute this if a component clause was present, otherwise we leave + -- the computation up to the back end, since we don't know what layout + -- will be chosen. - when Attribute_Last_Bit => Last_Bit : - declare + when Attribute_Last_Bit => Last_Bit : declare CE : constant Entity_Id := Entity (Selector_Name (Pref)); begin @@ -2482,7 +2511,7 @@ package body Exp_Attr is -- Transforms 'Leading_Part into a call to the floating-point attribute -- function Leading_Part in Fat_xxx (where xxx is the root type) - -- Note: strictly, we should have special case code to deal with + -- Note: strictly, we should generate special case code to deal with -- absurdly large positive arguments (greater than Integer'Last), which -- result in returning the first argument unchanged, but it hardly seems -- worth the effort. We raise constraint error for absurdly negative @@ -2496,7 +2525,6 @@ package body Exp_Attr is ------------ when Attribute_Length => declare - Ptyp : constant Entity_Id := Etype (Pref); Ityp : Entity_Id; Xnum : Uint; @@ -2506,15 +2534,15 @@ package body Exp_Attr is if Is_Array_Type (Ptyp) and then Is_Packed (Ptyp) then Ityp := Get_Index_Subtype (N); - -- If the index type, Ityp, is an enumeration type with - -- holes, then we calculate X'Length explicitly using + -- If the index type, Ityp, is an enumeration type with holes, + -- then we calculate X'Length explicitly using -- Typ'Max -- (0, Ityp'Pos (X'Last (N)) - -- Ityp'Pos (X'First (N)) + 1); - -- Since the bounds in the template are the representation - -- values and gigi would get the wrong value. + -- Since the bounds in the template are the representation values + -- and the back end would get the wrong value. if Is_Enumeration_Type (Ityp) and then Present (Enum_Pos_To_Rep (Base_Type (Ityp))) @@ -2568,8 +2596,9 @@ package body Exp_Attr is -- If the prefix type is a constrained packed array type which -- already has a Packed_Array_Type representation defined, then -- replace this attribute with a direct reference to 'Range_Length - -- of the appropriate index subtype (since otherwise Gigi will try - -- to give us the value of 'Length for this implementation type). + -- of the appropriate index subtype (since otherwise the back end + -- will try to give us the value of 'Length for this + -- implementation type). elsif Is_Constrained (Ptyp) then Rewrite (N, @@ -2579,23 +2608,21 @@ package body Exp_Attr is Analyze_And_Resolve (N, Typ); end if; - -- If we have a packed array that is not bit packed, which was - -- Access type case elsif Is_Access_Type (Ptyp) then Apply_Access_Check (N); - -- If the designated type is a packed array type, then we - -- convert the reference to: + -- If the designated type is a packed array type, then we convert + -- the reference to: -- typ'Max (0, 1 + -- xtyp'Pos (Pref'Last (Expr)) - -- xtyp'Pos (Pref'First (Expr))); - -- This is a bit complex, but it is the easiest thing to do - -- that works in all cases including enum types with holes - -- xtyp here is the appropriate index type. + -- This is a bit complex, but it is the easiest thing to do that + -- works in all cases including enum types with holes xtyp here + -- is the appropriate index type. declare Dtyp : constant Entity_Id := Designated_Type (Ptyp); @@ -2642,7 +2669,7 @@ package body Exp_Attr is end if; end; - -- Otherwise leave it to gigi + -- Otherwise leave it to the back end else Apply_Universal_Integer_Attribute_Checks (N); @@ -2678,7 +2705,7 @@ package body Exp_Attr is ------------------ -- Machine_Size is equivalent to Object_Size, so transform it into - -- Object_Size and that way Gigi never sees Machine_Size. + -- Object_Size and that way the back end never sees Machine_Size. when Attribute_Machine_Size => Rewrite (N, @@ -2693,8 +2720,8 @@ package body Exp_Attr is -------------- -- The only case that can get this far is the dynamic case of the old - -- Ada 83 Mantissa attribute for the fixed-point case. For this case, we - -- expand: + -- Ada 83 Mantissa attribute for the fixed-point case. For this case, + -- we expand: -- typ'Mantissa @@ -2704,10 +2731,7 @@ package body Exp_Attr is -- (Integer'Integer_Value (typ'First), -- Integer'Integer_Value (typ'Last))); - when Attribute_Mantissa => Mantissa : declare - Ptyp : constant Entity_Id := Etype (Pref); - - begin + when Attribute_Mantissa => Mantissa : begin Rewrite (N, Convert_To (Typ, Make_Function_Call (Loc, @@ -2860,12 +2884,17 @@ package body Exp_Attr is Asn_Stm : Node_Id; begin + -- Find the nearest subprogram body, ignoring _Preconditions + Subp := N; loop Subp := Parent (Subp); - exit when Nkind (Subp) = N_Subprogram_Body; + exit when Nkind (Subp) = N_Subprogram_Body + and then Chars (Defining_Entity (Subp)) /= Name_uPostconditions; end loop; + -- Insert the assignment at the start of the declarations + Asn_Stm := Make_Object_Declaration (Loc, Defining_Identifier => Tnn, @@ -3098,7 +3127,7 @@ package body Exp_Attr is --------- -- For enumeration types with a standard representation, Pos is - -- handled by Gigi. + -- handled by the back end. -- For enumeration types, with a non-standard representation we -- generate a call to the _Rep_To_Pos function created when the @@ -3162,9 +3191,9 @@ package body Exp_Attr is -- Position -- -------------- - -- We compute this if a component clause was present, otherwise - -- we leave the computation up to Gigi, since we don't know what - -- layout will be chosen. + -- We compute this if a component clause was present, otherwise we leave + -- the computation up to the back end, since we don't know what layout + -- will be chosen. when Attribute_Position => Position : declare @@ -3192,9 +3221,10 @@ package body Exp_Attr is when Attribute_Pred => Pred : declare - Ptyp : constant Entity_Id := Base_Type (Etype (Pref)); + Etyp : constant Entity_Id := Base_Type (Ptyp); begin + -- For enumeration types with non-standard representations, we -- expand typ'Pred (x) into @@ -3202,11 +3232,14 @@ package body Exp_Attr is -- If the representation is contiguous, we compute instead -- Lit1 + Rep_to_Pos (x -1), to catch invalid representations. + -- The conversion function Enum_Pos_To_Rep is defined on the + -- base type, not the subtype, so we have to use the base type + -- explicitly for this and other enumeration attributes. if Is_Enumeration_Type (Ptyp) - and then Present (Enum_Pos_To_Rep (Ptyp)) + and then Present (Enum_Pos_To_Rep (Etyp)) then - if Has_Contiguous_Rep (Ptyp) then + if Has_Contiguous_Rep (Etyp) then Rewrite (N, Unchecked_Convert_To (Ptyp, Make_Op_Add (Loc, @@ -3217,7 +3250,7 @@ package body Exp_Attr is Make_Function_Call (Loc, Name => New_Reference_To - (TSS (Ptyp, TSS_Rep_To_Pos), Loc), + (TSS (Etyp, TSS_Rep_To_Pos), Loc), Parameter_Associations => New_List ( @@ -3238,13 +3271,16 @@ package body Exp_Attr is Append_To (Exprs, Rep_To_Pos_Flag (Ptyp, Loc)); Rewrite (N, Make_Indexed_Component (Loc, - Prefix => New_Reference_To (Enum_Pos_To_Rep (Ptyp), Loc), + Prefix => + New_Reference_To + (Enum_Pos_To_Rep (Etyp), Loc), Expressions => New_List ( Make_Op_Subtract (Loc, Left_Opnd => Make_Function_Call (Loc, Name => - New_Reference_To (TSS (Ptyp, TSS_Rep_To_Pos), Loc), + New_Reference_To + (TSS (Etyp, TSS_Rep_To_Pos), Loc), Parameter_Associations => Exprs), Right_Opnd => Make_Integer_Literal (Loc, 1))))); end if; @@ -3333,8 +3369,6 @@ package body Exp_Attr is New_Itype := Create_Itype (E_Access_Type, N); Set_Etype (New_Itype, New_Itype); - Init_Esize (New_Itype); - Init_Size_Align (New_Itype); Set_Directly_Designated_Type (New_Itype, Corresponding_Record_Type (Conctyp)); Freeze_Itype (New_Itype, N); @@ -3400,10 +3434,7 @@ package body Exp_Attr is -- Range_Length -- ------------------ - when Attribute_Range_Length => Range_Length : declare - P_Type : constant Entity_Id := Etype (Pref); - - begin + when Attribute_Range_Length => Range_Length : begin -- The only special processing required is for the case where -- Range_Length is applied to an enumeration type with holes. -- In this case we transform @@ -3417,8 +3448,8 @@ package body Exp_Attr is -- So that the result reflects the proper Pos values instead -- of the underlying representations. - if Is_Enumeration_Type (P_Type) - and then Has_Non_Standard_Rep (P_Type) + if Is_Enumeration_Type (Ptyp) + and then Has_Non_Standard_Rep (Ptyp) then Rewrite (N, Make_Op_Add (Loc, @@ -3427,28 +3458,29 @@ package body Exp_Attr is Left_Opnd => Make_Attribute_Reference (Loc, Attribute_Name => Name_Pos, - Prefix => New_Occurrence_Of (P_Type, Loc), + Prefix => New_Occurrence_Of (Ptyp, Loc), Expressions => New_List ( Make_Attribute_Reference (Loc, Attribute_Name => Name_Last, - Prefix => New_Occurrence_Of (P_Type, Loc)))), + Prefix => New_Occurrence_Of (Ptyp, Loc)))), Right_Opnd => Make_Attribute_Reference (Loc, Attribute_Name => Name_Pos, - Prefix => New_Occurrence_Of (P_Type, Loc), + Prefix => New_Occurrence_Of (Ptyp, Loc), Expressions => New_List ( Make_Attribute_Reference (Loc, Attribute_Name => Name_First, - Prefix => New_Occurrence_Of (P_Type, Loc))))), + Prefix => New_Occurrence_Of (Ptyp, Loc))))), Right_Opnd => Make_Integer_Literal (Loc, 1))); Analyze_And_Resolve (N, Typ); - -- For all other cases, attribute is handled by Gigi, but we need - -- to deal with the case of the range check on a universal integer. + -- For all other cases, the attribute is handled by the back end, but + -- we need to deal with the case of the range check on a universal + -- integer. else Apply_Universal_Integer_Attribute_Checks (N); @@ -3631,6 +3663,20 @@ package body Exp_Attr is when Attribute_Remainder => Expand_Fpt_Attribute_RR (N); + ------------ + -- Result -- + ------------ + + -- Transform 'Result into reference to _Result formal. At the point + -- where a legal 'Result attribute is expanded, we know that we are in + -- the context of a _Postcondition function with a _Result parameter. + + when Attribute_Result => + Rewrite (N, + Make_Identifier (Loc, + Chars => Name_uResult)); + Analyze_And_Resolve (N, Typ); + ----------- -- Round -- ----------- @@ -3705,7 +3751,6 @@ package body Exp_Attr is Attribute_VADS_Size => Size : declare - Ptyp : constant Entity_Id := Etype (Pref); Siz : Uint; New_Node : Node_Id; @@ -3751,19 +3796,16 @@ package body Exp_Attr is else if (not Is_Entity_Name (Pref) or else not Is_Type (Entity (Pref))) - and then (Is_Scalar_Type (Etype (Pref)) - or else Is_Constrained (Etype (Pref))) + and then (Is_Scalar_Type (Ptyp) or else Is_Constrained (Ptyp)) then - Rewrite (Pref, New_Occurrence_Of (Etype (Pref), Loc)); + Rewrite (Pref, New_Occurrence_Of (Ptyp, Loc)); end if; -- For a scalar type for which no size was explicitly given, -- VADS_Size means Object_Size. This is the other respect in -- which VADS_Size differs from Size. - if Is_Scalar_Type (Etype (Pref)) - and then No (Size_Clause (Etype (Pref))) - then + if Is_Scalar_Type (Ptyp) and then No (Size_Clause (Ptyp)) then Set_Attribute_Name (N, Name_Object_Size); -- In all other cases, Size and VADS_Size are the sane @@ -3774,9 +3816,9 @@ package body Exp_Attr is end if; end if; - -- For class-wide types, X'Class'Size is transformed into a - -- direct reference to the Size of the class type, so that gigi - -- does not have to deal with the X'Class'Size reference. + -- For class-wide types, X'Class'Size is transformed into a direct + -- reference to the Size of the class type, so that the back end does + -- not have to deal with the X'Class'Size reference. if Is_Entity_Name (Pref) and then Is_Class_Wide_Type (Entity (Pref)) @@ -3873,7 +3915,7 @@ package body Exp_Attr is end if; end; - -- All other cases are handled by Gigi + -- All other cases are handled by the back end else Apply_Universal_Integer_Attribute_Checks (N); @@ -3883,8 +3925,8 @@ package body Exp_Attr is if Is_Entity_Name (Pref) and then Is_Formal (Entity (Pref)) - and then Is_Array_Type (Etype (Pref)) - and then Is_Packed (Etype (Pref)) + and then Is_Array_Type (Ptyp) + and then Is_Packed (Ptyp) then Rewrite (N, Make_Attribute_Reference (Loc, @@ -3895,13 +3937,13 @@ package body Exp_Attr is end if; -- If Size applies to a dereference of an access to unconstrained - -- packed array, GIGI needs to see its unconstrained nominal type, - -- but also a hint to the actual constrained type. + -- packed array, the back end needs to see its unconstrained + -- nominal type, but also a hint to the actual constrained type. if Nkind (Pref) = N_Explicit_Dereference - and then Is_Array_Type (Etype (Pref)) - and then not Is_Constrained (Etype (Pref)) - and then Is_Packed (Etype (Pref)) + and then Is_Array_Type (Ptyp) + and then not Is_Constrained (Ptyp) + and then Is_Packed (Ptyp) then Set_Actual_Designated_Subtype (Pref, Get_Actual_Subtype (Pref)); @@ -3954,11 +3996,8 @@ package body Exp_Attr is -- Storage_Size -- ------------------ - when Attribute_Storage_Size => Storage_Size : - declare - Ptyp : constant Entity_Id := Etype (Pref); + when Attribute_Storage_Size => Storage_Size : begin - begin -- Access type case, always go to the root type -- The case of access types results in a value of zero for the case @@ -4086,7 +4125,6 @@ package body Exp_Attr is ----------------- when Attribute_Stream_Size => Stream_Size : declare - Ptyp : constant Entity_Id := Etype (Pref); Size : Int; begin @@ -4115,9 +4153,10 @@ package body Exp_Attr is when Attribute_Succ => Succ : declare - Ptyp : constant Entity_Id := Base_Type (Etype (Pref)); + Etyp : constant Entity_Id := Base_Type (Ptyp); begin + -- For enumeration types with non-standard representations, we -- expand typ'Succ (x) into @@ -4127,9 +4166,9 @@ package body Exp_Attr is -- Lit1 + Rep_to_Pos (x+1), to catch invalid representations. if Is_Enumeration_Type (Ptyp) - and then Present (Enum_Pos_To_Rep (Ptyp)) + and then Present (Enum_Pos_To_Rep (Etyp)) then - if Has_Contiguous_Rep (Ptyp) then + if Has_Contiguous_Rep (Etyp) then Rewrite (N, Unchecked_Convert_To (Ptyp, Make_Op_Add (Loc, @@ -4140,7 +4179,7 @@ package body Exp_Attr is Make_Function_Call (Loc, Name => New_Reference_To - (TSS (Ptyp, TSS_Rep_To_Pos), Loc), + (TSS (Etyp, TSS_Rep_To_Pos), Loc), Parameter_Associations => New_List ( @@ -4160,14 +4199,16 @@ package body Exp_Attr is Append_To (Exprs, Rep_To_Pos_Flag (Ptyp, Loc)); Rewrite (N, Make_Indexed_Component (Loc, - Prefix => New_Reference_To (Enum_Pos_To_Rep (Ptyp), Loc), + Prefix => + New_Reference_To + (Enum_Pos_To_Rep (Etyp), Loc), Expressions => New_List ( Make_Op_Add (Loc, Left_Opnd => Make_Function_Call (Loc, Name => New_Reference_To - (TSS (Ptyp, TSS_Rep_To_Pos), Loc), + (TSS (Etyp, TSS_Rep_To_Pos), Loc), Parameter_Associations => Exprs), Right_Opnd => Make_Integer_Literal (Loc, 1))))); end if; @@ -4210,7 +4251,7 @@ package body Exp_Attr is Ttyp := Entity (Pref); Prefix_Is_Type := True; else - Ttyp := Etype (Pref); + Ttyp := Ptyp; Prefix_Is_Type := False; end if; @@ -4284,9 +4325,9 @@ package body Exp_Attr is -- terminated (Task_Id (Pref._disp_get_task_id)); if Ada_Version >= Ada_05 - and then Ekind (Etype (Pref)) = E_Class_Wide_Type - and then Is_Interface (Etype (Pref)) - and then Is_Task_Interface (Etype (Pref)) + and then Ekind (Ptyp) = E_Class_Wide_Type + and then Is_Interface (Ptyp) + and then Is_Task_Interface (Ptyp) then Rewrite (N, Make_Function_Call (Loc, @@ -4410,8 +4451,8 @@ package body Exp_Attr is --------- -- For enumeration types with a standard representation, and for all - -- other types, Val is handled by Gigi. For enumeration types with - -- a non-standard representation we use the _Pos_To_Rep array that + -- other types, Val is handled by the back end. For enumeration types + -- with a non-standard representation we use the _Pos_To_Rep array that -- was created when the type was frozen. when Attribute_Val => Val : @@ -4473,8 +4514,7 @@ package body Exp_Attr is when Attribute_Valid => Valid : declare - Ptyp : constant Entity_Id := Etype (Pref); - Btyp : Entity_Id := Base_Type (Ptyp); + Btyp : Entity_Id := Base_Type (Ptyp); Tst : Node_Id; Save_Validity_Checks_On : constant Boolean := Validity_Checks_On; @@ -4555,7 +4595,7 @@ package body Exp_Attr is -- Non VAX float case else - Find_Fat_Info (Etype (Pref), Ftp, Pkg); + Find_Fat_Info (Ptyp, Ftp, Pkg); -- If the floating-point object might be unaligned, we need -- to call the special routine Unaligned_Valid, which makes @@ -5029,11 +5069,11 @@ package body Exp_Attr is Rewrite_Stream_Proc_Call (Pname); end Write; - -- Component_Size is handled by Gigi, unless the component size is known - -- at compile time, which is always true in the packed array case. It is - -- important that the packed array case is handled in the front end (see - -- Eval_Attribute) since Gigi would otherwise get confused by the - -- equivalent packed array type. + -- Component_Size is handled by the back end, unless the component size + -- is known at compile time, which is always true in the packed array + -- case. It is important that the packed array case is handled in the + -- front end (see Eval_Attribute) since the back end would otherwise get + -- confused by the equivalent packed array type. when Attribute_Component_Size => null; @@ -5053,7 +5093,7 @@ package body Exp_Attr is -- static cases have already been evaluated during semantic processing, -- but in any case the back end should not count on this). - -- Gigi also handles the non-class-wide cases of Size + -- The back end also handles the non-class-wide cases of Size when Attribute_Bit_Order | Attribute_Code_Address | @@ -5063,8 +5103,8 @@ package body Exp_Attr is Attribute_Pool_Address => null; - -- The following attributes are also handled by Gigi, but return a - -- universal integer result, so may need a conversion for checking + -- The following attributes are also handled by the back end, but return + -- a universal integer result, so may need a conversion for checking -- that the result is in range. when Attribute_Aft | @@ -5091,6 +5131,7 @@ package body Exp_Attr is Attribute_Fast_Math | Attribute_Has_Access_Values | Attribute_Has_Discriminants | + Attribute_Has_Tagged_Values | Attribute_Large | Attribute_Machine_Emax | Attribute_Machine_Emin | @@ -5126,8 +5167,8 @@ package body Exp_Attr is raise Program_Error; -- The Asm_Input and Asm_Output attributes are not expanded at this - -- stage, but will be eliminated in the expansion of the Asm call, - -- see Exp_Intr for details. So Gigi will never see these either. + -- stage, but will be eliminated in the expansion of the Asm call, see + -- Exp_Intr for details. So the back end will never see these either. when Attribute_Asm_Input | Attribute_Asm_Output => @@ -5274,11 +5315,79 @@ package body Exp_Attr is Nam : TSS_Name_Type) return Entity_Id is Ent : constant Entity_Id := TSS (Typ, Nam); + begin if Present (Ent) then return Ent; end if; + -- Stream attributes for strings are expanded into library calls. The + -- following checks are disabled when the run-time is not available or + -- when compiling predefined types due to bootstrap issues. As a result, + -- the compiler will generate in-place stream routines for string types + -- that appear in GNAT's library, but will generate calls via rtsfind + -- to library routines for user code. + -- ??? For now, disable this code for JVM, since this generates a + -- VerifyError exception at run-time on e.g. c330001. + -- This is disabled for AAMP, to avoid making dependences on files not + -- supported in the AAMP library (such as s-fileio.adb). + + if VM_Target /= JVM_Target + and then not AAMP_On_Target + and then + not Is_Predefined_File_Name (Unit_File_Name (Current_Sem_Unit)) + then + + -- String as defined in package Ada + + if Typ = Standard_String then + if Nam = TSS_Stream_Input then + return RTE (RE_String_Input); + + elsif Nam = TSS_Stream_Output then + return RTE (RE_String_Output); + + elsif Nam = TSS_Stream_Read then + return RTE (RE_String_Read); + + else pragma Assert (Nam = TSS_Stream_Write); + return RTE (RE_String_Write); + end if; + + -- Wide_String as defined in package Ada + + elsif Typ = Standard_Wide_String then + if Nam = TSS_Stream_Input then + return RTE (RE_Wide_String_Input); + + elsif Nam = TSS_Stream_Output then + return RTE (RE_Wide_String_Output); + + elsif Nam = TSS_Stream_Read then + return RTE (RE_Wide_String_Read); + + else pragma Assert (Nam = TSS_Stream_Write); + return RTE (RE_Wide_String_Write); + end if; + + -- Wide_Wide_String as defined in package Ada + + elsif Typ = Standard_Wide_Wide_String then + if Nam = TSS_Stream_Input then + return RTE (RE_Wide_Wide_String_Input); + + elsif Nam = TSS_Stream_Output then + return RTE (RE_Wide_Wide_String_Output); + + elsif Nam = TSS_Stream_Read then + return RTE (RE_Wide_Wide_String_Read); + + else pragma Assert (Nam = TSS_Stream_Write); + return RTE (RE_Wide_Wide_String_Write); + end if; + end if; + end if; + if Is_Tagged_Type (Typ) and then Is_Derived_Type (Typ) then diff --git a/gcc/ada/exp_ch11.adb b/gcc/ada/exp_ch11.adb index dbe3ebe73ad..ac3590179e4 100644 --- a/gcc/ada/exp_ch11.adb +++ b/gcc/ada/exp_ch11.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 1992-2007, Free Software Foundation, Inc. -- +-- Copyright (C) 1992-2008, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -1463,6 +1463,7 @@ package body Exp_Ch11 is Id : Entity_Id := Entity (Name (N)); begin + Name_Len := 0; Build_Location_String (Loc); -- If the exception is a renaming, use the exception that it diff --git a/gcc/ada/exp_ch13.adb b/gcc/ada/exp_ch13.adb index 11b3fef8861..3ba47ec4446 100644 --- a/gcc/ada/exp_ch13.adb +++ b/gcc/ada/exp_ch13.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 1992-2007, Free Software Foundation, Inc. -- +-- Copyright (C) 1992-2008, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -145,21 +145,29 @@ package body Exp_Ch13 is -- For Storage_Size for an access type, create a variable to hold -- the value of the specified size with name typeV and expand an - -- assignment statement to initialze this value. + -- assignment statement to initialize this value. elsif Is_Access_Type (Ent) then - V := Make_Defining_Identifier (Loc, - New_External_Name (Chars (Ent), 'V')); - Insert_Action (N, - Make_Object_Declaration (Loc, - Defining_Identifier => V, - Object_Definition => - New_Reference_To (RTE (RE_Storage_Offset), Loc), - Expression => - Convert_To (RTE (RE_Storage_Offset), Expression (N)))); + -- We don't need the variable for a storage size of zero + + if not No_Pool_Assigned (Ent) then + V := + Make_Defining_Identifier (Loc, + Chars => New_External_Name (Chars (Ent), 'V')); - Set_Storage_Size_Variable (Ent, Entity_Id (V)); + -- Insert the declaration of the object + + Insert_Action (N, + Make_Object_Declaration (Loc, + Defining_Identifier => V, + Object_Definition => + New_Reference_To (RTE (RE_Storage_Offset), Loc), + Expression => + Convert_To (RTE (RE_Storage_Offset), Expression (N)))); + + Set_Storage_Size_Variable (Ent, Entity_Id (V)); + end if; end if; -- Other attributes require no expansion @@ -207,6 +215,15 @@ package body Exp_Ch13 is return; end if; + -- Remember that we are processing a freezing entity and its freezing + -- nodes. This flag (non-zero = set) is used to avoid the need of + -- climbing through the tree while processing the freezing actions (ie. + -- to avoid generating spurious warnings or to avoid killing constant + -- indications while processing the code associated with freezing + -- actions). We use a counter to deal with nesting. + + Inside_Freezing_Actions := Inside_Freezing_Actions + 1; + -- If we are freezing entities defined in protected types, they belong -- in the enclosing scope, given that the original type has been -- expanded away. The same is true for entities in task types, in @@ -224,7 +241,6 @@ package body Exp_Ch13 is elsif Ekind (E_Scope) = E_Subprogram_Body then E_Scope := Corresponding_Spec (Unit_Declaration_Node (E_Scope)); - end if; S := Current_Scope; @@ -339,6 +355,11 @@ package body Exp_Ch13 is elsif In_Outer_Scope then Pop_Scope; end if; + + -- Restore previous value of the nesting-level counter that records + -- whether we are inside a (possibly nested) call to this procedure. + + Inside_Freezing_Actions := Inside_Freezing_Actions - 1; end Expand_N_Freeze_Entity; ------------------------------------------- diff --git a/gcc/ada/exp_ch2.adb b/gcc/ada/exp_ch2.adb index 95291d49245..82ac5eea7f4 100644 --- a/gcc/ada/exp_ch2.adb +++ b/gcc/ada/exp_ch2.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 1992-2007, Free Software Foundation, Inc. -- +-- Copyright (C) 1992-2008, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -80,12 +80,12 @@ package body Exp_Ch2 is -- Dispatches to specific expansion procedures. procedure Expand_Entry_Index_Parameter (N : Node_Id); - -- A reference to the identifier in the entry index specification of - -- protected entry body is modified to a reference to a constant definition - -- equal to the index of the entry family member being called. This - -- constant is calculated as part of the elaboration of the expanded code - -- for the body, and is calculated from the object-wide entry index - -- returned by Next_Entry_Call. + -- A reference to the identifier in the entry index specification of an + -- entry body is modified to a reference to a constant definition equal to + -- the index of the entry family member being called. This constant is + -- calculated as part of the elaboration of the expanded code for the body, + -- and is calculated from the object-wide entry index returned by Next_ + -- Entry_Call. procedure Expand_Entry_Parameter (N : Node_Id); -- A reference to an entry parameter is modified to be a reference to the @@ -98,12 +98,10 @@ package body Exp_Ch2 is -- represent the operation within the protected object. In other cases -- Expand_Formal is a no-op. - procedure Expand_Protected_Private (N : Node_Id); - -- A reference to a private component of a protected type is expanded to a - -- component selected from the record used to implement the protected - -- object. Such a record is passed to all operations on a protected object - -- in a parameter named _object. This object is a constant in the body of a - -- function, and a variable within a procedure or entry body. + procedure Expand_Protected_Component (N : Node_Id); + -- A reference to a private component of a protected type is expanded into + -- a reference to the corresponding prival in the current protected entry + -- or subprogram. procedure Expand_Renaming (N : Node_Id); -- For renamings, just replace the identifier by the corresponding @@ -332,16 +330,12 @@ package body Exp_Ch2 is elsif Is_Entry_Formal (E) then Expand_Entry_Parameter (N); - elsif Ekind (E) = E_Component - and then Is_Protected_Private (E) - then - -- Protect against junk use of tasking in no run time mode - + elsif Is_Protected_Component (E) then if No_Run_Time_Mode then return; end if; - Expand_Protected_Private (N); + Expand_Protected_Component (N); elsif Ekind (E) = E_Entry_Index_Parameter then Expand_Entry_Index_Parameter (N); @@ -385,11 +379,7 @@ package body Exp_Ch2 is -- Interpret possible Current_Value for constant case - elsif (Ekind (E) = E_Constant - or else - Ekind (E) = E_In_Parameter - or else - Ekind (E) = E_Loop_Parameter) + elsif Is_Constant_Object (E) and then Present (Current_Value (E)) then Expand_Current_Value (N); @@ -401,8 +391,10 @@ package body Exp_Ch2 is ---------------------------------- procedure Expand_Entry_Index_Parameter (N : Node_Id) is + Index_Con : constant Entity_Id := Entry_Index_Constant (Entity (N)); begin - Set_Entity (N, Entry_Index_Constant (Entity (N))); + Set_Entity (N, Index_Con); + Set_Etype (N, Etype (Index_Con)); end Expand_Entry_Index_Parameter; ---------------------------- @@ -477,10 +469,14 @@ package body Exp_Ch2 is -- we also generate an extra parameter to hold the Constrained -- attribute of the actual. No renaming is generated for this flag. + -- Calling Node_Posssible_Modifications in the expander is dubious, + -- because this generates a cross-reference entry, and should be + -- done during semantic processing so it is called in -gnatc mode??? + if Ekind (Entity (N)) /= E_In_Parameter and then In_Assignment_Context (N) then - Note_Possible_Modification (N); + Note_Possible_Modification (N, Sure => True); end if; Rewrite (N, New_Occurrence_Of (Renamed_Object (Entity (N)), Loc)); @@ -564,93 +560,54 @@ package body Exp_Ch2 is end if; end Expand_N_Real_Literal; - ------------------------------ - -- Expand_Protected_Private -- - ------------------------------ + -------------------------------- + -- Expand_Protected_Component -- + -------------------------------- - procedure Expand_Protected_Private (N : Node_Id) is - Loc : constant Source_Ptr := Sloc (N); - E : constant Entity_Id := Entity (N); - Op : constant Node_Id := Protected_Operation (E); - Scop : Entity_Id; - Lo : Node_Id; - Hi : Node_Id; - D_Range : Node_Id; - - begin - if Nkind (Op) /= N_Subprogram_Body - or else Nkind (Specification (Op)) /= N_Function_Specification - then - Set_Ekind (Prival (E), E_Variable); - else - Set_Ekind (Prival (E), E_Constant); - end if; + procedure Expand_Protected_Component (N : Node_Id) is - -- If the private component appears in an assignment (either lhs or - -- rhs) and is a one-dimensional array constrained by a discriminant, - -- rewrite as P (Lo .. Hi) with an explicit range, so that discriminal - -- is directly visible. This solves delicate visibility problems. + function Inside_Eliminated_Body return Boolean; + -- Determine whether the current entity is inside a subprogram or an + -- entry which has been marked as eliminated. - if Comes_From_Source (N) - and then Is_Array_Type (Etype (E)) - and then Number_Dimensions (Etype (E)) = 1 - and then not Within_Init_Proc - then - Lo := Type_Low_Bound (Etype (First_Index (Etype (E)))); - Hi := Type_High_Bound (Etype (First_Index (Etype (E)))); - - if Nkind (Parent (N)) = N_Assignment_Statement - and then ((Is_Entity_Name (Lo) - and then Ekind (Entity (Lo)) = E_In_Parameter) - or else (Is_Entity_Name (Hi) - and then - Ekind (Entity (Hi)) = E_In_Parameter)) - then - D_Range := New_Node (N_Range, Loc); + ---------------------------- + -- Inside_Eliminated_Body -- + ---------------------------- - if Is_Entity_Name (Lo) - and then Ekind (Entity (Lo)) = E_In_Parameter - then - Set_Low_Bound (D_Range, - Make_Identifier (Loc, Chars (Entity (Lo)))); - else - Set_Low_Bound (D_Range, Duplicate_Subexpr (Lo)); - end if; + function Inside_Eliminated_Body return Boolean is + S : Entity_Id := Current_Scope; - if Is_Entity_Name (Hi) - and then Ekind (Entity (Hi)) = E_In_Parameter + begin + while Present (S) loop + if (Ekind (S) = E_Entry + or else Ekind (S) = E_Entry_Family + or else Ekind (S) = E_Function + or else Ekind (S) = E_Procedure) + and then Is_Eliminated (S) then - Set_High_Bound (D_Range, - Make_Identifier (Loc, Chars (Entity (Hi)))); - else - Set_High_Bound (D_Range, Duplicate_Subexpr (Hi)); + return True; end if; - Rewrite (N, - Make_Slice (Loc, - Prefix => New_Occurrence_Of (E, Loc), - Discrete_Range => D_Range)); - - Analyze_And_Resolve (N, Etype (E)); - return; - end if; - end if; - - -- The type of the reference is the type of the prival, which may differ - -- from that of the original component if it is an itype. - - Set_Entity (N, Prival (E)); - Set_Etype (N, Etype (Prival (E))); - Scop := Current_Scope; + S := Scope (S); + end loop; - -- Find entity for protected operation, which must be on scope stack + return False; + end Inside_Eliminated_Body; - while not Is_Protected_Type (Scope (Scop)) loop - Scop := Scope (Scop); - end loop; + -- Start of processing for Expand_Protected_Component - Append_Elmt (N, Privals_Chain (Scop)); - end Expand_Protected_Private; + begin + -- Eliminated bodies are not expanded and thus do not need privals + + if not Inside_Eliminated_Body then + declare + Priv : constant Entity_Id := Prival (Entity (N)); + begin + Set_Entity (N, Priv); + Set_Etype (N, Etype (Priv)); + end; + end if; + end Expand_Protected_Component; --------------------- -- Expand_Renaming -- diff --git a/gcc/ada/exp_ch3.adb b/gcc/ada/exp_ch3.adb index 046a98556aa..3ec27893af0 100644 --- a/gcc/ada/exp_ch3.adb +++ b/gcc/ada/exp_ch3.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 1992-2007, Free Software Foundation, Inc. -- +-- Copyright (C) 1992-2008, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -570,7 +570,7 @@ package body Exp_Ch3 is Name => Comp, Expression => Get_Simple_Init_Val - (Comp_Type, Loc, Component_Size (A_Type)))); + (Comp_Type, Nod, Component_Size (A_Type)))); else Clean_Task_Names (Comp_Type, Proc_Id); @@ -680,7 +680,18 @@ package body Exp_Ch3 is and then Root_Type (A_Type) /= Standard_Wide_Wide_String) then Proc_Id := - Make_Defining_Identifier (Loc, Make_Init_Proc_Name (A_Type)); + Make_Defining_Identifier (Loc, + Chars => Make_Init_Proc_Name (A_Type)); + + -- If No_Default_Initialization restriction is active, then we don't + -- want to build an init_proc, but we need to mark that an init_proc + -- would be needed if this restriction was not active (so that we can + -- detect attempts to call it), so set a dummy init_proc in place. + + if Restriction_Active (No_Default_Initialization) then + Set_Init_Proc (A_Type, Proc_Id); + return; + end if; Body_Stmts := Init_One_Dimension (1); @@ -1018,15 +1029,17 @@ package body Exp_Ch3 is begin -- Build the discriminant checking function for each variant, label -- all components of that variant with the function's name. + -- We only Generate a discriminant-checking function only if the + -- variant is not empty, to prevent the creation of dead code. Discr_Name := Entity (Name (Variant_Part_Node)); Variant := First_Non_Pragma (Variants (Variant_Part_Node)); while Present (Variant) loop - Func_Id := Build_Dcheck_Function (Discr_Name, Variant); Component_List_Node := Component_List (Variant); if not Null_Present (Component_List_Node) then + Func_Id := Build_Dcheck_Function (Discr_Name, Variant); Decl := First_Non_Pragma (Component_Items (Component_List_Node)); @@ -2172,10 +2185,6 @@ package body Exp_Ch3 is begin Body_Stmts := New_List; Body_Node := New_Node (N_Subprogram_Body, Loc); - - Proc_Id := - Make_Defining_Identifier (Loc, - Chars => Make_Init_Proc_Name (Rec_Type)); Set_Ekind (Proc_Id, E_Procedure); Proc_Spec_Node := New_Node (N_Procedure_Specification, Loc); @@ -2567,7 +2576,7 @@ package body Exp_Ch3 is elsif Component_Needs_Simple_Initialization (Typ) then Stmts := Build_Assignment - (Id, Get_Simple_Init_Val (Typ, Loc, Esize (Id))); + (Id, Get_Simple_Init_Val (Typ, N, Esize (Id))); -- Nothing needed for this case @@ -2635,7 +2644,7 @@ package body Exp_Ch3 is elsif Component_Needs_Simple_Initialization (Typ) then Append_List_To (Statement_List, Build_Assignment - (Id, Get_Simple_Init_Val (Typ, Loc, Esize (Id)))); + (Id, Get_Simple_Init_Val (Typ, N, Esize (Id)))); end if; end if; @@ -3003,7 +3012,6 @@ package body Exp_Ch3 is end if; Id := First_Component (Rec_Id); - while Present (Id) loop Comp_Decl := Parent (Id); Typ := Etype (Id); @@ -3024,6 +3032,8 @@ package body Exp_Ch3 is -- Start of processing for Build_Record_Init_Proc begin + -- Check for value type, which means no initialization required + Rec_Type := Defining_Identifier (N); if Is_Value_Type (Rec_Type) then @@ -3080,6 +3090,20 @@ package body Exp_Ch3 is elsif Requires_Init_Proc (Rec_Type) or else Is_Unchecked_Union (Rec_Type) then + Proc_Id := + Make_Defining_Identifier (Loc, + Chars => Make_Init_Proc_Name (Rec_Type)); + + -- If No_Default_Initialization restriction is active, then we don't + -- want to build an init_proc, but we need to mark that an init_proc + -- would be needed if this restriction was not active (so that we can + -- detect attempts to call it), so set a dummy init_proc in place. + + if Restriction_Active (No_Default_Initialization) then + Set_Init_Proc (Rec_Type, Proc_Id); + return; + end if; + Build_Offset_To_Top_Functions; Build_Init_Procedure; Set_Is_Public (Proc_Id, Is_Public (Pe)); @@ -3121,13 +3145,12 @@ package body Exp_Ch3 is procedure Collect_Itypes (Comp : Node_Id) is Ref : Node_Id; Sub_Aggr : Node_Id; - Typ : Entity_Id; + Typ : constant Entity_Id := Etype (Comp); begin - if Is_Array_Type (Etype (Comp)) - and then Is_Itype (Etype (Comp)) + if Is_Array_Type (Typ) + and then Is_Itype (Typ) then - Typ := Etype (Comp); Ref := Make_Itype_Reference (Loc); Set_Itype (Ref, Typ); Append_Freeze_Action (Rec_Type, Ref); @@ -3189,6 +3212,11 @@ package body Exp_Ch3 is -- Ri1 : Index; -- begin + + -- if Left_Hi < Left_Lo then + -- return; + -- end if; + -- if Rev then -- Li1 := Left_Hi; -- Ri1 := Right_Hi; @@ -3198,18 +3226,14 @@ package body Exp_Ch3 is -- end if; -- loop - -- if Rev then - -- exit when Li1 < Left_Lo; - -- else - -- exit when Li1 > Left_Hi; - -- end if; - -- Target (Li1) := Source (Ri1); -- if Rev then + -- exit when Li1 = Left_Lo; -- Li1 := Index'pred (Li1); -- Ri1 := Index'pred (Ri1); -- else + -- exit when Li1 = Left_Hi; -- Li1 := Index'succ (Li1); -- Ri1 := Index'succ (Ri1); -- end if; @@ -3276,6 +3300,16 @@ package body Exp_Ch3 is Stats := New_List; + -- Build test for empty slice case + + Append_To (Stats, + Make_If_Statement (Loc, + Condition => + Make_Op_Lt (Loc, + Left_Opnd => New_Occurrence_Of (Left_Hi, Loc), + Right_Opnd => New_Occurrence_Of (Left_Lo, Loc)), + Then_Statements => New_List (Make_Simple_Return_Statement (Loc)))); + -- Build initializations for indices declare @@ -3326,7 +3360,7 @@ package body Exp_Ch3 is Expressions => New_List (New_Occurrence_Of (Rnn, Loc))))), End_Label => Empty); - -- Build exit condition + -- Build the exit condition and increment/decrement statements declare F_Ass : constant List_Id := New_List; @@ -3336,31 +3370,10 @@ package body Exp_Ch3 is Append_To (F_Ass, Make_Exit_Statement (Loc, Condition => - Make_Op_Gt (Loc, + Make_Op_Eq (Loc, Left_Opnd => New_Occurrence_Of (Lnn, Loc), Right_Opnd => New_Occurrence_Of (Left_Hi, Loc)))); - Append_To (B_Ass, - Make_Exit_Statement (Loc, - Condition => - Make_Op_Lt (Loc, - Left_Opnd => New_Occurrence_Of (Lnn, Loc), - Right_Opnd => New_Occurrence_Of (Left_Lo, Loc)))); - - Prepend_To (Statements (Loops), - Make_If_Statement (Loc, - Condition => New_Occurrence_Of (Rev, Loc), - Then_Statements => B_Ass, - Else_Statements => F_Ass)); - end; - - -- Build the increment/decrement statements - - declare - F_Ass : constant List_Id := New_List; - B_Ass : constant List_Id := New_List; - - begin Append_To (F_Ass, Make_Assignment_Statement (Loc, Name => New_Occurrence_Of (Lnn, Loc), @@ -3384,6 +3397,13 @@ package body Exp_Ch3 is New_Occurrence_Of (Rnn, Loc))))); Append_To (B_Ass, + Make_Exit_Statement (Loc, + Condition => + Make_Op_Eq (Loc, + Left_Opnd => New_Occurrence_Of (Lnn, Loc), + Right_Opnd => New_Occurrence_Of (Left_Lo, Loc)))); + + Append_To (B_Ass, Make_Assignment_Statement (Loc, Name => New_Occurrence_Of (Lnn, Loc), Expression => @@ -4220,6 +4240,12 @@ package body Exp_Ch3 is and then not Suppress_Init_Proc (Typ) then + Check_Restriction (No_Default_Initialization, N); + + if Restriction_Active (No_Default_Initialization) then + return; + end if; + -- The call to the initialization procedure does NOT freeze the -- object being initialized. This is because the call is not a -- source level call. This works fine, because the only possible @@ -4260,8 +4286,9 @@ package body Exp_Ch3 is and then not Is_Internal (Def_Id) and then not Has_Init_Expression (N) then + Check_Restriction (No_Default_Initialization, N); Set_No_Initialization (N, False); - Set_Expression (N, Get_Simple_Init_Val (Typ, Loc, Esize (Def_Id))); + Set_Expression (N, Get_Simple_Init_Val (Typ, N, Esize (Def_Id))); Analyze_And_Resolve (Expression (N), Typ); end if; @@ -5437,10 +5464,18 @@ package body Exp_Ch3 is Set_Is_Frozen (Def_Id, False); + -- Do not add the spec of predefined primitives in case of + -- CPP tagged type derivations that have convention CPP. + + if Is_CPP_Class (Root_Type (Def_Id)) + and then Convention (Def_Id) = Convention_CPP + then + null; + -- Do not add the spec of the predefined primitives if we are -- compiling under restriction No_Dispatching_Calls - if not Restriction_Active (No_Dispatching_Calls) then + elsif not Restriction_Active (No_Dispatching_Calls) then Make_Predefined_Primitive_Specs (Def_Id, Predef_List, Renamed_Eq); Insert_List_Before_And_Analyze (N, Predef_List); @@ -5614,11 +5649,19 @@ package body Exp_Ch3 is if Is_Tagged_Type (Def_Id) and then not Is_Interface (Def_Id) then + -- Do not add the body of predefined primitives in case of + -- CPP tagged type derivations that have convention CPP. + + if Is_CPP_Class (Root_Type (Def_Id)) + and then Convention (Def_Id) = Convention_CPP + then + null; -- Do not add the body of the predefined primitives if we are - -- compiling under restriction No_Dispatching_Calls + -- compiling under restriction No_Dispatching_Calls of if we + -- are compiling a CPP tagged type. - if not Restriction_Active (No_Dispatching_Calls) then + elsif not Restriction_Active (No_Dispatching_Calls) then Predef_List := Predefined_Primitive_Bodies (Def_Id, Renamed_Eq); Append_Freeze_Actions (Def_Id, Predef_List); end if; @@ -5814,28 +5857,18 @@ package body Exp_Ch3 is then declare Loc : constant Source_Ptr := Sloc (N); - Desig_Type : constant Entity_Id := Designated_Type (Def_Id); + Desig_Type : constant Entity_Id := Designated_Type (Def_Id); Pool_Object : Entity_Id; - Siz_Exp : Node_Id; Freeze_Action_Typ : Entity_Id; begin - if Has_Storage_Size_Clause (Def_Id) then - Siz_Exp := Expression (Parent (Storage_Size_Variable (Def_Id))); - else - Siz_Exp := Empty; - end if; - -- Case 1 -- Rep Clause "for Def_Id'Storage_Size use 0;" -- ---> don't use any storage pool - if Has_Storage_Size_Clause (Def_Id) - and then Compile_Time_Known_Value (Siz_Exp) - and then Expr_Value (Siz_Exp) = 0 - then + if No_Pool_Assigned (Def_Id) then null; -- Case 2 @@ -6046,9 +6079,10 @@ package body Exp_Ch3 is function Get_Simple_Init_Val (T : Entity_Id; - Loc : Source_Ptr; + N : Node_Id; Size : Uint := No_Uint) return Node_Id is + Loc : constant Source_Ptr := Sloc (N); Val : Node_Id; Result : Node_Id; Val_RE : RE_Id; @@ -6057,6 +6091,10 @@ package body Exp_Ch3 is -- This is the size to be used for computation of the appropriate -- initial value for the Normalize_Scalars and Initialize_Scalars case. + IV_Attribute : constant Boolean := + Nkind (N) = N_Attribute_Reference + and then Attribute_Name (N) = Name_Invalid_Value; + Lo_Bound : Uint; Hi_Bound : Uint; -- These are the values computed by the procedure Check_Subtype_Bounds @@ -6133,7 +6171,7 @@ package body Exp_Ch3 is -- an Unchecked_Convert to the private type. if Is_Private_Type (T) then - Val := Get_Simple_Init_Val (Underlying_Type (T), Loc, Size); + Val := Get_Simple_Init_Val (Underlying_Type (T), N, Size); -- A special case, if the underlying value is null, then qualify it -- with the underlying type, so that the null is properly typed @@ -6160,10 +6198,11 @@ package body Exp_Ch3 is return Result; - -- For scalars, we must have normalize/initialize scalars case + -- For scalars, we must have normalize/initialize scalars case, or + -- if the node N is an 'Invalid_Value attribute node. elsif Is_Scalar_Type (T) then - pragma Assert (Init_Or_Norm_Scalars); + pragma Assert (Init_Or_Norm_Scalars or IV_Attribute); -- Compute size of object. If it is given by the caller, we can use -- it directly, otherwise we use Esize (T) as an estimate. As far as @@ -6188,7 +6227,7 @@ package body Exp_Ch3 is -- Processing for Normalize_Scalars case - if Normalize_Scalars then + if Normalize_Scalars and then not IV_Attribute then -- If zero is invalid, it is a convenient value to use that is -- for sure an appropriate invalid value in all situations. @@ -6252,7 +6291,7 @@ package body Exp_Ch3 is end; end if; - -- Here for Initialize_Scalars case + -- Here for Initialize_Scalars case (or Invalid_Value attribute used) else -- For float types, use float values from System.Scalar_Values @@ -6347,7 +6386,7 @@ package body Exp_Ch3 is Make_Others_Choice (Loc)), Expression => Get_Simple_Init_Val - (Component_Type (T), Loc, Esize (Root_Type (T)))))); + (Component_Type (T), N, Esize (Root_Type (T)))))); -- Access type is initialized to null @@ -6615,14 +6654,6 @@ package body Exp_Ch3 is New_Reference_To (Iface_Tag, Loc))); end if; - -- Issue error if Set_Offset_To_Top is not available in a - -- configurable run-time environment. - - if not RTE_Available (RE_Set_Offset_To_Top) then - Error_Msg_CRT ("abstract interface types", Typ); - return; - end if; - Comp_Typ := Scope (Tag_Comp); -- Initialize the entries of the table of interfaces. We generate a @@ -6636,17 +6667,26 @@ package body Exp_Ch3 is pragma Assert (Present (DT_Offset_To_Top_Func (Tag_Comp))); + -- Issue error if Set_Dynamic_Offset_To_Top is not available in a + -- configurable run-time environment. + + if not RTE_Available (RE_Set_Dynamic_Offset_To_Top) then + Error_Msg_CRT + ("variable size record with interface types", Typ); + return; + end if; + -- Generate: - -- Set_Offset_To_Top + -- Set_Dynamic_Offset_To_Top -- (This => Init, -- Interface_T => Iface'Tag, - -- Is_Constant => False, -- Offset_Value => n, -- Offset_Func => Fn'Address) Append_To (Stmts_List, Make_Procedure_Call_Statement (Loc, - Name => New_Reference_To (RTE (RE_Set_Offset_To_Top), Loc), + Name => New_Reference_To + (RTE (RE_Set_Dynamic_Offset_To_Top), Loc), Parameter_Associations => New_List ( Make_Attribute_Reference (Loc, Prefix => New_Copy_Tree (Target), @@ -6657,8 +6697,6 @@ package body Exp_Ch3 is (Node (First_Elmt (Access_Disp_Table (Iface))), Loc)), - New_Occurrence_Of (Standard_False, Loc), - Unchecked_Convert_To (RTE (RE_Storage_Offset), Make_Attribute_Reference (Loc, @@ -6700,42 +6738,63 @@ package body Exp_Ch3 is -- Normal case: No discriminants in the parent type else + -- Don't need to set any value if this interface shares + -- the primary dispatch table + + if not Is_Parent (Iface, Typ) then + Append_To (Stmts_List, + Build_Set_Static_Offset_To_Top (Loc, + Iface_Tag => + New_Reference_To (Iface_Tag, Loc), + Offset_Value => + Unchecked_Convert_To (RTE (RE_Storage_Offset), + Make_Attribute_Reference (Loc, + Prefix => + Make_Selected_Component (Loc, + Prefix => New_Copy_Tree (Target), + Selector_Name => + New_Reference_To (Tag_Comp, Loc)), + Attribute_Name => Name_Position)))); + end if; + -- Generate: - -- Set_Offset_To_Top + -- Register_Interface_Offset -- (This => Init, -- Interface_T => Iface'Tag, -- Is_Constant => True, -- Offset_Value => n, -- Offset_Func => null); - Append_To (Stmts_List, - Make_Procedure_Call_Statement (Loc, - Name => New_Reference_To - (RTE (RE_Set_Offset_To_Top), Loc), - Parameter_Associations => New_List ( - Make_Attribute_Reference (Loc, - Prefix => New_Copy_Tree (Target), - Attribute_Name => Name_Address), + if RTE_Available (RE_Register_Interface_Offset) then + Append_To (Stmts_List, + Make_Procedure_Call_Statement (Loc, + Name => New_Reference_To + (RTE (RE_Register_Interface_Offset), Loc), + Parameter_Associations => New_List ( + Make_Attribute_Reference (Loc, + Prefix => New_Copy_Tree (Target), + Attribute_Name => Name_Address), - Unchecked_Convert_To (RTE (RE_Tag), - New_Reference_To - (Node (First_Elmt - (Access_Disp_Table (Iface))), - Loc)), + Unchecked_Convert_To (RTE (RE_Tag), + New_Reference_To + (Node (First_Elmt + (Access_Disp_Table (Iface))), + Loc)), - New_Occurrence_Of (Standard_True, Loc), + New_Occurrence_Of (Standard_True, Loc), - Unchecked_Convert_To - (RTE (RE_Storage_Offset), - Make_Attribute_Reference (Loc, - Prefix => - Make_Selected_Component (Loc, - Prefix => New_Copy_Tree (Target), - Selector_Name => - New_Reference_To (Tag_Comp, Loc)), - Attribute_Name => Name_Position)), + Unchecked_Convert_To + (RTE (RE_Storage_Offset), + Make_Attribute_Reference (Loc, + Prefix => + Make_Selected_Component (Loc, + Prefix => New_Copy_Tree (Target), + Selector_Name => + New_Reference_To (Tag_Comp, Loc)), + Attribute_Name => Name_Position)), - Make_Null (Loc)))); + Make_Null (Loc)))); + end if; end if; end Initialize_Tag; @@ -6816,6 +6875,32 @@ package body Exp_Ch3 is Comp_Typ : Entity_Id; Idx : Node_Id; + function Is_Constant_Bound (Exp : Node_Id) return Boolean; + -- To simplify handling of array components. Determines whether the + -- given bound is constant (a constant or enumeration literal, or an + -- integer literal) as opposed to per-object, through an expression + -- or a discriminant. + + ----------------------- + -- Is_Constant_Bound -- + ----------------------- + + function Is_Constant_Bound (Exp : Node_Id) return Boolean is + begin + if Nkind (Exp) = N_Integer_Literal then + return True; + else + return + Is_Entity_Name (Exp) + and then Present (Entity (Exp)) + and then + (Ekind (Entity (Exp)) = E_Constant + or else Ekind (Entity (Exp)) = E_Enumeration_Literal); + end if; + end Is_Constant_Bound; + + -- Start of processing for Is_Variable_Sized_Record + begin pragma Assert (Is_Record_Type (E)); @@ -6840,15 +6925,9 @@ package body Exp_Ch3 is Idx := First_Index (Comp_Typ); while Present (Idx) loop if Nkind (Idx) = N_Range then - if (Nkind (Low_Bound (Idx)) = N_Identifier - and then Present (Entity (Low_Bound (Idx))) - and then - Ekind (Entity (Low_Bound (Idx))) /= E_Constant) - or else - (Nkind (High_Bound (Idx)) = N_Identifier - and then Present (Entity (High_Bound (Idx))) - and then - Ekind (Entity (High_Bound (Idx))) /= E_Constant) + if not Is_Constant_Bound (Low_Bound (Idx)) + or else + not Is_Constant_Bound (High_Bound (Idx)) then return True; end if; @@ -7506,6 +7585,7 @@ package body Exp_Ch3 is if Ada_Version >= Ada_05 and then VM_Target = No_VM + and then RTE_Available (RE_Select_Specific_Data) then -- These primitives are defined abstract in interface types @@ -7608,8 +7688,14 @@ package body Exp_Ch3 is -- initialization of its dispatch table. or else (not Is_Interface (Tag_Typ) - and then - Is_Interface (Etype (Tag_Typ))) + and then Is_Interface (Etype (Tag_Typ))) + + -- Ada 205 (AI-251): We must also generate these subprograms if + -- the parent of an nonlimited interface is a limited interface + + or else (Is_Interface (Tag_Typ) + and then not Is_Limited_Interface (Tag_Typ) + and then Is_Limited_Interface (Etype (Tag_Typ))) then if not Is_Limited_Type (Tag_Typ) then Append_To (Res, @@ -7999,6 +8085,7 @@ package body Exp_Ch3 is and then Is_Limited_Record (Etype (Tag_Typ))) or else (Is_Concurrent_Record_Type (Tag_Typ) and then Has_Abstract_Interfaces (Tag_Typ))) + and then RTE_Available (RE_Select_Specific_Data) then Append_To (Res, Make_Disp_Asynchronous_Select_Body (Tag_Typ)); Append_To (Res, Make_Disp_Conditional_Select_Body (Tag_Typ)); diff --git a/gcc/ada/exp_ch3.ads b/gcc/ada/exp_ch3.ads index 04669679893..d51724af3cd 100644 --- a/gcc/ada/exp_ch3.ads +++ b/gcc/ada/exp_ch3.ads @@ -6,7 +6,7 @@ -- -- -- S p e c -- -- -- --- Copyright (C) 1992-2007, Free Software Foundation, Inc. -- +-- Copyright (C) 1992-2008, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -133,16 +133,18 @@ package Exp_Ch3 is function Get_Simple_Init_Val (T : Entity_Id; - Loc : Source_Ptr; + N : Node_Id; Size : Uint := No_Uint) return Node_Id; -- For a type which Needs_Simple_Initialization (see above), prepares the - -- tree for an expression representing the required initial value. Loc is - -- the source location used in constructing this tree which is returned as - -- the result of the call. The Size parameter indicates the target size of - -- the object if it is known (indicated by a value that is not No_Uint and - -- is greater than zero). If Size is not given (Size set to No_Uint, or - -- non-positive), then the Esize of T is used as an estimate of the Size. - -- The object size is needed to prepare a known invalid value for use by - -- Normalize_Scalars. + -- tree for an expression representing the required initial value. N is a + -- node whose source location used in constructing this tree which is + -- returned as the result of the call. The Size parameter indicates the + -- target size of the object if it is known (indicated by a value that is + -- not No_Uint and is greater than zero). If Size is not given (Size set to + -- No_Uint, or non-positive), then the Esize of T is used as an estimate of + -- the Size. The object size is needed to prepare a known invalid value for + -- use by Normalize_Scalars. A call to this routine where T is a scalar + -- type is only valid if we are in Normalize_Scalars or Initialize_Scalars + -- mode, or if N is the node for a 'Invalid_Value attribute node. end Exp_Ch3; diff --git a/gcc/ada/exp_ch4.adb b/gcc/ada/exp_ch4.adb index 0473fc0fb68..ee440f14424 100644 --- a/gcc/ada/exp_ch4.adb +++ b/gcc/ada/exp_ch4.adb @@ -1852,6 +1852,10 @@ package body Exp_Ch4 is Ensure_Defined (Etype (R), N); Apply_Length_Check (R, Etype (L)); + if Nkind (N) = N_Op_Xor then + Silly_Boolean_Array_Xor_Test (N, Etype (L)); + end if; + if Nkind (Parent (N)) = N_Assignment_Statement and then Safe_In_Place_Array_Op (Name (Parent (N)), L, R) then @@ -1860,7 +1864,7 @@ package body Exp_Ch4 is elsif Nkind (Parent (N)) = N_Op_Not and then Nkind (N) = N_Op_And and then - Safe_In_Place_Array_Op (Name (Parent (Parent (N))), L, R) + Safe_In_Place_Array_Op (Name (Parent (Parent (N))), L, R) then return; else @@ -2812,7 +2816,7 @@ package body Exp_Ch4 is function Needs_Initialization_Call (N : Node_Id) return Boolean; -- Determine whether node N is a subtype indicator allocator which - -- asts a coextension. Such coextensions need initialization. + -- acts a coextension. Such coextensions need initialization. ------------------------------- -- Inside_A_Return_Statement -- @@ -2943,27 +2947,34 @@ package body Exp_Ch4 is Ref := New_Copy_Tree (Coext); end if; - -- Generate: - -- initialize (Ref) - -- attach_to_final_list (Ref, Flist, 2) + -- No initialization call if not allowed - if Needs_Initialization_Call (Coext) then - Insert_Actions (N, - Make_Init_Call ( - Ref => Ref, - Typ => Etype (Coext), - Flist_Ref => Flist, - With_Attach => Make_Integer_Literal (Loc, Uint_2))); + Check_Restriction (No_Default_Initialization, N); - -- Generate: - -- attach_to_final_list (Ref, Flist, 2) + if not Restriction_Active (No_Default_Initialization) then - else - Insert_Action (N, - Make_Attach_Call ( - Obj_Ref => Ref, - Flist_Ref => New_Copy_Tree (Flist), - With_Attach => Make_Integer_Literal (Loc, Uint_2))); + -- Generate: + -- initialize (Ref) + -- attach_to_final_list (Ref, Flist, 2) + + if Needs_Initialization_Call (Coext) then + Insert_Actions (N, + Make_Init_Call ( + Ref => Ref, + Typ => Etype (Coext), + Flist_Ref => Flist, + With_Attach => Make_Integer_Literal (Loc, Uint_2))); + + -- Generate: + -- attach_to_final_list (Ref, Flist, 2) + + else + Insert_Action (N, + Make_Attach_Call ( + Obj_Ref => Ref, + Flist_Ref => New_Copy_Tree (Flist), + With_Attach => Make_Integer_Literal (Loc, Uint_2))); + end if; end if; Next_Elmt (Coext_Elmt); @@ -3174,10 +3185,11 @@ package body Exp_Ch4 is -- Case of simple initialization required if Needs_Simple_Initialization (T) then + Check_Restriction (No_Default_Initialization, N); Rewrite (Expression (N), Make_Qualified_Expression (Loc, Subtype_Mark => New_Occurrence_Of (T, Loc), - Expression => Get_Simple_Init_Val (T, Loc))); + Expression => Get_Simple_Init_Val (T, N))); Analyze_And_Resolve (Expression (Expression (N)), T); Analyze_And_Resolve (Expression (N), T); @@ -3193,292 +3205,299 @@ package body Exp_Ch4 is -- Case of initialization procedure present, must be called else - Init := Base_Init_Proc (T); - Nod := N; - Temp := Make_Defining_Identifier (Loc, New_Internal_Name ('P')); - - -- Construct argument list for the initialization routine call - - Arg1 := - Make_Explicit_Dereference (Loc, - Prefix => New_Reference_To (Temp, Loc)); - Set_Assignment_OK (Arg1); - Temp_Type := PtrT; + Check_Restriction (No_Default_Initialization, N); - -- The initialization procedure expects a specific type. if the - -- context is access to class wide, indicate that the object being - -- allocated has the right specific type. + if not Restriction_Active (No_Default_Initialization) then + Init := Base_Init_Proc (T); + Nod := N; + Temp := Make_Defining_Identifier (Loc, New_Internal_Name ('P')); - if Is_Class_Wide_Type (Dtyp) then - Arg1 := Unchecked_Convert_To (T, Arg1); - end if; - - -- If designated type is a concurrent type or if it is private - -- type whose definition is a concurrent type, the first argument - -- in the Init routine has to be unchecked conversion to the - -- corresponding record type. If the designated type is a derived - -- type, we also convert the argument to its root type. - - if Is_Concurrent_Type (T) then - Arg1 := - Unchecked_Convert_To (Corresponding_Record_Type (T), Arg1); + -- Construct argument list for the initialization routine call - elsif Is_Private_Type (T) - and then Present (Full_View (T)) - and then Is_Concurrent_Type (Full_View (T)) - then Arg1 := - Unchecked_Convert_To - (Corresponding_Record_Type (Full_View (T)), Arg1); - - elsif Etype (First_Formal (Init)) /= Base_Type (T) then - declare - Ftyp : constant Entity_Id := Etype (First_Formal (Init)); + Make_Explicit_Dereference (Loc, + Prefix => New_Reference_To (Temp, Loc)); + Set_Assignment_OK (Arg1); + Temp_Type := PtrT; - begin - Arg1 := OK_Convert_To (Etype (Ftyp), Arg1); - Set_Etype (Arg1, Ftyp); - end; - end if; + -- The initialization procedure expects a specific type. if the + -- context is access to class wide, indicate that the object + -- being allocated has the right specific type. - Args := New_List (Arg1); + if Is_Class_Wide_Type (Dtyp) then + Arg1 := Unchecked_Convert_To (T, Arg1); + end if; - -- For the task case, pass the Master_Id of the access type as - -- the value of the _Master parameter, and _Chain as the value - -- of the _Chain parameter (_Chain will be defined as part of - -- the generated code for the allocator). + -- If designated type is a concurrent type or if it is private + -- type whose definition is a concurrent type, the first + -- argument in the Init routine has to be unchecked conversion + -- to the corresponding record type. If the designated type is + -- a derived type, we also convert the argument to its root + -- type. - -- In Ada 2005, the context may be a function that returns an - -- anonymous access type. In that case the Master_Id has been - -- created when expanding the function declaration. + if Is_Concurrent_Type (T) then + Arg1 := + Unchecked_Convert_To (Corresponding_Record_Type (T), Arg1); - if Has_Task (T) then - if No (Master_Id (Base_Type (PtrT))) then + elsif Is_Private_Type (T) + and then Present (Full_View (T)) + and then Is_Concurrent_Type (Full_View (T)) + then + Arg1 := + Unchecked_Convert_To + (Corresponding_Record_Type (Full_View (T)), Arg1); - -- If we have a non-library level task with the restriction - -- No_Task_Hierarchy set, then no point in expanding. + elsif Etype (First_Formal (Init)) /= Base_Type (T) then + declare + Ftyp : constant Entity_Id := Etype (First_Formal (Init)); + begin + Arg1 := OK_Convert_To (Etype (Ftyp), Arg1); + Set_Etype (Arg1, Ftyp); + end; + end if; - if not Is_Library_Level_Entity (T) - and then Restriction_Active (No_Task_Hierarchy) - then - return; - end if; + Args := New_List (Arg1); - -- The designated type was an incomplete type, and the - -- access type did not get expanded. Salvage it now. + -- For the task case, pass the Master_Id of the access type as + -- the value of the _Master parameter, and _Chain as the value + -- of the _Chain parameter (_Chain will be defined as part of + -- the generated code for the allocator). - pragma Assert (Present (Parent (Base_Type (PtrT)))); - Expand_N_Full_Type_Declaration (Parent (Base_Type (PtrT))); - end if; + -- In Ada 2005, the context may be a function that returns an + -- anonymous access type. In that case the Master_Id has been + -- created when expanding the function declaration. - -- If the context of the allocator is a declaration or an - -- assignment, we can generate a meaningful image for it, - -- even though subsequent assignments might remove the - -- connection between task and entity. We build this image - -- when the left-hand side is a simple variable, a simple - -- indexed assignment or a simple selected component. + if Has_Task (T) then + if No (Master_Id (Base_Type (PtrT))) then - if Nkind (Parent (N)) = N_Assignment_Statement then - declare - Nam : constant Node_Id := Name (Parent (N)); + -- If we have a non-library level task with restriction + -- No_Task_Hierarchy set, then no point in expanding. - begin - if Is_Entity_Name (Nam) then - Decls := - Build_Task_Image_Decls ( - Loc, - New_Occurrence_Of - (Entity (Nam), Sloc (Nam)), T); - - elsif Nkind_In - (Nam, N_Indexed_Component, N_Selected_Component) - and then Is_Entity_Name (Prefix (Nam)) + if not Is_Library_Level_Entity (T) + and then Restriction_Active (No_Task_Hierarchy) then - Decls := - Build_Task_Image_Decls - (Loc, Nam, Etype (Prefix (Nam))); - else - Decls := Build_Task_Image_Decls (Loc, T, T); + return; end if; - end; - elsif Nkind (Parent (N)) = N_Object_Declaration then - Decls := - Build_Task_Image_Decls ( - Loc, Defining_Identifier (Parent (N)), T); + -- The designated type was an incomplete type, and the + -- access type did not get expanded. Salvage it now. - else - Decls := Build_Task_Image_Decls (Loc, T, T); - end if; - - Append_To (Args, - New_Reference_To - (Master_Id (Base_Type (Root_Type (PtrT))), Loc)); - Append_To (Args, Make_Identifier (Loc, Name_uChain)); + pragma Assert (Present (Parent (Base_Type (PtrT)))); + Expand_N_Full_Type_Declaration + (Parent (Base_Type (PtrT))); + end if; - Decl := Last (Decls); - Append_To (Args, - New_Occurrence_Of (Defining_Identifier (Decl), Loc)); + -- If the context of the allocator is a declaration or an + -- assignment, we can generate a meaningful image for it, + -- even though subsequent assignments might remove the + -- connection between task and entity. We build this image + -- when the left-hand side is a simple variable, a simple + -- indexed assignment or a simple selected component. + + if Nkind (Parent (N)) = N_Assignment_Statement then + declare + Nam : constant Node_Id := Name (Parent (N)); + + begin + if Is_Entity_Name (Nam) then + Decls := + Build_Task_Image_Decls + (Loc, + New_Occurrence_Of + (Entity (Nam), Sloc (Nam)), T); + + elsif Nkind_In + (Nam, N_Indexed_Component, N_Selected_Component) + and then Is_Entity_Name (Prefix (Nam)) + then + Decls := + Build_Task_Image_Decls + (Loc, Nam, Etype (Prefix (Nam))); + else + Decls := Build_Task_Image_Decls (Loc, T, T); + end if; + end; - -- Has_Task is false, Decls not used + elsif Nkind (Parent (N)) = N_Object_Declaration then + Decls := + Build_Task_Image_Decls + (Loc, Defining_Identifier (Parent (N)), T); - else - Decls := No_List; - end if; + else + Decls := Build_Task_Image_Decls (Loc, T, T); + end if; - -- Add discriminants if discriminated type + Append_To (Args, + New_Reference_To + (Master_Id (Base_Type (Root_Type (PtrT))), Loc)); + Append_To (Args, Make_Identifier (Loc, Name_uChain)); - declare - Dis : Boolean := False; - Typ : Entity_Id; + Decl := Last (Decls); + Append_To (Args, + New_Occurrence_Of (Defining_Identifier (Decl), Loc)); - begin - if Has_Discriminants (T) then - Dis := True; - Typ := T; + -- Has_Task is false, Decls not used - elsif Is_Private_Type (T) - and then Present (Full_View (T)) - and then Has_Discriminants (Full_View (T)) - then - Dis := True; - Typ := Full_View (T); + else + Decls := No_List; end if; - if Dis then - -- If the allocated object will be constrained by the - -- default values for discriminants, then build a - -- subtype with those defaults, and change the allocated - -- subtype to that. Note that this happens in fewer - -- cases in Ada 2005 (AI-363). - - if not Is_Constrained (Typ) - and then Present (Discriminant_Default_Value - (First_Discriminant (Typ))) - and then (Ada_Version < Ada_05 - or else not Has_Constrained_Partial_View (Typ)) + -- Add discriminants if discriminated type + + declare + Dis : Boolean := False; + Typ : Entity_Id; + + begin + if Has_Discriminants (T) then + Dis := True; + Typ := T; + + elsif Is_Private_Type (T) + and then Present (Full_View (T)) + and then Has_Discriminants (Full_View (T)) then - Typ := Build_Default_Subtype (Typ, N); - Set_Expression (N, New_Reference_To (Typ, Loc)); + Dis := True; + Typ := Full_View (T); end if; - Discr := First_Elmt (Discriminant_Constraint (Typ)); - while Present (Discr) loop - Nod := Node (Discr); - Append (New_Copy_Tree (Node (Discr)), Args); + if Dis then - -- AI-416: when the discriminant constraint is an - -- anonymous access type make sure an accessibility - -- check is inserted if necessary (3.10.2(22.q/2)) + -- If the allocated object will be constrained by the + -- default values for discriminants, then build a + -- subtype with those defaults, and change the allocated + -- subtype to that. Note that this happens in fewer + -- cases in Ada 2005 (AI-363). - if Ada_Version >= Ada_05 - and then Ekind (Etype (Nod)) = E_Anonymous_Access_Type + if not Is_Constrained (Typ) + and then Present (Discriminant_Default_Value + (First_Discriminant (Typ))) + and then (Ada_Version < Ada_05 + or else + not Has_Constrained_Partial_View (Typ)) then - Apply_Accessibility_Check (Nod, Typ); + Typ := Build_Default_Subtype (Typ, N); + Set_Expression (N, New_Reference_To (Typ, Loc)); end if; - Next_Elmt (Discr); - end loop; - end if; - end; + Discr := First_Elmt (Discriminant_Constraint (Typ)); + while Present (Discr) loop + Nod := Node (Discr); + Append (New_Copy_Tree (Node (Discr)), Args); - -- We set the allocator as analyzed so that when we analyze the - -- expression actions node, we do not get an unwanted recursive - -- expansion of the allocator expression. + -- AI-416: when the discriminant constraint is an + -- anonymous access type make sure an accessibility + -- check is inserted if necessary (3.10.2(22.q/2)) - Set_Analyzed (N, True); - Nod := Relocate_Node (N); + if Ada_Version >= Ada_05 + and then + Ekind (Etype (Nod)) = E_Anonymous_Access_Type + then + Apply_Accessibility_Check (Nod, Typ); + end if; - -- Here is the transformation: - -- input: new T - -- output: Temp : constant ptr_T := new T; - -- Init (Temp.all, ...); - -- <CTRL> Attach_To_Final_List (Finalizable (Temp.all)); - -- <CTRL> Initialize (Finalizable (Temp.all)); + Next_Elmt (Discr); + end loop; + end if; + end; - -- Here ptr_T is the pointer type for the allocator, and is the - -- subtype of the allocator. + -- We set the allocator as analyzed so that when we analyze the + -- expression actions node, we do not get an unwanted recursive + -- expansion of the allocator expression. - Temp_Decl := - Make_Object_Declaration (Loc, - Defining_Identifier => Temp, - Constant_Present => True, - Object_Definition => New_Reference_To (Temp_Type, Loc), - Expression => Nod); + Set_Analyzed (N, True); + Nod := Relocate_Node (N); - Set_Assignment_OK (Temp_Decl); - Insert_Action (N, Temp_Decl, Suppress => All_Checks); + -- Here is the transformation: + -- input: new T + -- output: Temp : constant ptr_T := new T; + -- Init (Temp.all, ...); + -- <CTRL> Attach_To_Final_List (Finalizable (Temp.all)); + -- <CTRL> Initialize (Finalizable (Temp.all)); - -- If the designated type is a task type or contains tasks, - -- create block to activate created tasks, and insert - -- declaration for Task_Image variable ahead of call. + -- Here ptr_T is the pointer type for the allocator, and is the + -- subtype of the allocator. - if Has_Task (T) then - declare - L : constant List_Id := New_List; - Blk : Node_Id; + Temp_Decl := + Make_Object_Declaration (Loc, + Defining_Identifier => Temp, + Constant_Present => True, + Object_Definition => New_Reference_To (Temp_Type, Loc), + Expression => Nod); - begin - Build_Task_Allocate_Block (L, Nod, Args); - Blk := Last (L); + Set_Assignment_OK (Temp_Decl); + Insert_Action (N, Temp_Decl, Suppress => All_Checks); - Insert_List_Before (First (Declarations (Blk)), Decls); - Insert_Actions (N, L); - end; + -- If the designated type is a task type or contains tasks, + -- create block to activate created tasks, and insert + -- declaration for Task_Image variable ahead of call. - else - Insert_Action (N, - Make_Procedure_Call_Statement (Loc, - Name => New_Reference_To (Init, Loc), - Parameter_Associations => Args)); - end if; + if Has_Task (T) then + declare + L : constant List_Id := New_List; + Blk : Node_Id; + begin + Build_Task_Allocate_Block (L, Nod, Args); + Blk := Last (L); + Insert_List_Before (First (Declarations (Blk)), Decls); + Insert_Actions (N, L); + end; - if Controlled_Type (T) then + else + Insert_Action (N, + Make_Procedure_Call_Statement (Loc, + Name => New_Reference_To (Init, Loc), + Parameter_Associations => Args)); + end if; - -- Postpone the generation of a finalization call for the - -- current allocator if it acts as a coextension. + if Controlled_Type (T) then - if Is_Dynamic_Coextension (N) then - if No (Coextensions (N)) then - Set_Coextensions (N, New_Elmt_List); - end if; + -- Postpone the generation of a finalization call for the + -- current allocator if it acts as a coextension. - Append_Elmt (New_Copy_Tree (Arg1), Coextensions (N)); + if Is_Dynamic_Coextension (N) then + if No (Coextensions (N)) then + Set_Coextensions (N, New_Elmt_List); + end if; - else - Flist := Get_Allocator_Final_List (N, Base_Type (T), PtrT); + Append_Elmt (New_Copy_Tree (Arg1), Coextensions (N)); + + else + Flist := + Get_Allocator_Final_List (N, Base_Type (T), PtrT); - -- Anonymous access types created for access parameters - -- are attached to an explicitly constructed controller, - -- which ensures that they can be finalized properly, even - -- if their deallocation might not happen. The list - -- associated with the controller is doubly-linked. For - -- other anonymous access types, the object may end up - -- on the global final list which is singly-linked. - -- Work needed for access discriminants in Ada 2005 ??? + -- Anonymous access types created for access parameters + -- are attached to an explicitly constructed controller, + -- which ensures that they can be finalized properly, + -- even if their deallocation might not happen. The list + -- associated with the controller is doubly-linked. For + -- other anonymous access types, the object may end up + -- on the global final list which is singly-linked. + -- Work needed for access discriminants in Ada 2005 ??? - if Ekind (PtrT) = E_Anonymous_Access_Type + if Ekind (PtrT) = E_Anonymous_Access_Type and then Nkind (Associated_Node_For_Itype (PtrT)) - not in N_Subprogram_Specification - then - Attach_Level := Uint_1; - else - Attach_Level := Uint_2; - end if; + not in N_Subprogram_Specification + then + Attach_Level := Uint_1; + else + Attach_Level := Uint_2; + end if; - Insert_Actions (N, - Make_Init_Call ( - Ref => New_Copy_Tree (Arg1), - Typ => T, - Flist_Ref => Flist, - With_Attach => Make_Integer_Literal - (Loc, Attach_Level))); + Insert_Actions (N, + Make_Init_Call ( + Ref => New_Copy_Tree (Arg1), + Typ => T, + Flist_Ref => Flist, + With_Attach => Make_Integer_Literal (Loc, + Intval => Attach_Level))); + end if; end if; - end if; - Rewrite (N, New_Reference_To (Temp, Loc)); - Analyze_And_Resolve (N, PtrT); + Rewrite (N, New_Reference_To (Temp, Loc)); + Analyze_And_Resolve (N, PtrT); + end if; end if; end; @@ -4110,6 +4129,15 @@ package body Exp_Ch4 is return; end if; + -- Ada 2005 (AI-318-02): If the prefix is a call to a build-in-place + -- function, then additional actuals must be passed. + + if Ada_Version >= Ada_05 + and then Is_Build_In_Place_Function_Call (P) + then + Make_Build_In_Place_Call_In_Anonymous_Context (P); + end if; + -- If the prefix is an access type, then we unconditionally rewrite -- if as an explicit deference. This simplifies processing for several -- cases, including packed array cases and certain cases in which @@ -6236,6 +6264,7 @@ package body Exp_Ch4 is Convert_To_Actual_Subtype (Opnd); Arr := Etype (Opnd); Ensure_Defined (Arr, N); + Silly_Boolean_Array_Not_Test (N, Arr); if Nkind (Parent (N)) = N_Assignment_Statement then if Safe_In_Place_Array_Op (Name (Parent (N)), N, Empty) then @@ -6758,6 +6787,15 @@ package body Exp_Ch4 is Generate_Discriminant_Check (N); end if; + -- Ada 2005 (AI-318-02): If the prefix is a call to a build-in-place + -- function, then additional actuals must be passed. + + if Ada_Version >= Ada_05 + and then Is_Build_In_Place_Function_Call (P) + then + Make_Build_In_Place_Call_In_Anonymous_Context (P); + end if; + -- Gigi cannot handle unchecked conversions that are the prefix of a -- selected component with discriminants. This must be checked during -- expansion, because during analysis the type of the selector is not @@ -7025,6 +7063,15 @@ package body Exp_Ch4 is Analyze_And_Resolve (Pfx, Ptp); end if; + -- Ada 2005 (AI-318-02): If the prefix is a call to a build-in-place + -- function, then additional actuals must be passed. + + if Ada_Version >= Ada_05 + and then Is_Build_In_Place_Function_Call (Pfx) + then + Make_Build_In_Place_Call_In_Anonymous_Context (Pfx); + end if; + -- Range checks are potentially also needed for cases involving -- a slice indexed by a subtype indication, but Do_Range_Check -- can currently only be set for expressions ??? @@ -9072,7 +9119,8 @@ package body Exp_Ch4 is -- configurable run time setting. if not RTE_Available (RE_IW_Membership) then - Error_Msg_CRT ("abstract interface types", N); + Error_Msg_CRT + ("dynamic membership test on interface types", N); return Empty; end if; diff --git a/gcc/ada/exp_ch5.adb b/gcc/ada/exp_ch5.adb index 24e7a7f08a1..68965c71493 100644 --- a/gcc/ada/exp_ch5.adb +++ b/gcc/ada/exp_ch5.adb @@ -109,9 +109,8 @@ package body Exp_Ch5 is -- statements. procedure Expand_Simple_Function_Return (N : Node_Id); - -- Expand simple return from function. Called by - -- Expand_N_Simple_Return_Statement in case we're returning from a function - -- body. + -- Expand simple return from function. In the case where we are returning + -- from a function body this is called by Expand_N_Simple_Return_Statement. function Make_Tag_Ctrl_Assignment (N : Node_Id) return List_Id; -- Generate the necessary code for controlled and tagged assignment, @@ -3207,54 +3206,59 @@ package body Exp_Ch5 is -- return not (expression); - if Nkind (N) = N_If_Statement - and then No (Elsif_Parts (N)) - and then Present (Else_Statements (N)) - and then List_Length (Then_Statements (N)) = 1 - and then List_Length (Else_Statements (N)) = 1 - then - declare - Then_Stm : constant Node_Id := First (Then_Statements (N)); - Else_Stm : constant Node_Id := First (Else_Statements (N)); + -- Only do these optimizations if we are at least at -O1 level - begin - if Nkind (Then_Stm) = N_Simple_Return_Statement - and then - Nkind (Else_Stm) = N_Simple_Return_Statement - then - declare - Then_Expr : constant Node_Id := Expression (Then_Stm); - Else_Expr : constant Node_Id := Expression (Else_Stm); + if Optimization_Level > 0 then + if Nkind (N) = N_If_Statement + and then No (Elsif_Parts (N)) + and then Present (Else_Statements (N)) + and then List_Length (Then_Statements (N)) = 1 + and then List_Length (Else_Statements (N)) = 1 + then + declare + Then_Stm : constant Node_Id := First (Then_Statements (N)); + Else_Stm : constant Node_Id := First (Else_Statements (N)); - begin - if Nkind (Then_Expr) = N_Identifier - and then - Nkind (Else_Expr) = N_Identifier - then - if Entity (Then_Expr) = Standard_True - and then Entity (Else_Expr) = Standard_False - then - Rewrite (N, - Make_Simple_Return_Statement (Loc, - Expression => Relocate_Node (Condition (N)))); - Analyze (N); - return; - - elsif Entity (Then_Expr) = Standard_False - and then Entity (Else_Expr) = Standard_True + begin + if Nkind (Then_Stm) = N_Simple_Return_Statement + and then + Nkind (Else_Stm) = N_Simple_Return_Statement + then + declare + Then_Expr : constant Node_Id := Expression (Then_Stm); + Else_Expr : constant Node_Id := Expression (Else_Stm); + + begin + if Nkind (Then_Expr) = N_Identifier + and then + Nkind (Else_Expr) = N_Identifier then - Rewrite (N, - Make_Simple_Return_Statement (Loc, - Expression => - Make_Op_Not (Loc, - Right_Opnd => Relocate_Node (Condition (N))))); - Analyze (N); - return; + if Entity (Then_Expr) = Standard_True + and then Entity (Else_Expr) = Standard_False + then + Rewrite (N, + Make_Simple_Return_Statement (Loc, + Expression => Relocate_Node (Condition (N)))); + Analyze (N); + return; + + elsif Entity (Then_Expr) = Standard_False + and then Entity (Else_Expr) = Standard_True + then + Rewrite (N, + Make_Simple_Return_Statement (Loc, + Expression => + Make_Op_Not (Loc, + Right_Opnd => + Relocate_Node (Condition (N))))); + Analyze (N); + return; + end if; end if; - end if; - end; - end if; - end; + end; + end if; + end; + end if; end if; end Expand_N_If_Statement; @@ -3463,6 +3467,15 @@ package body Exp_Ch5 is procedure Expand_N_Simple_Return_Statement (N : Node_Id) is begin + -- Defend agains previous errors (ie. the return statement calls a + -- function that is not available in configurable runtime). + + if Present (Expression (N)) + and then Nkind (Expression (N)) = N_Empty + then + return; + end if; + -- Distinguish the function and non-function cases: case Ekind (Return_Applies_To (Return_Statement_Entity (N))) is @@ -3504,6 +3517,16 @@ package body Exp_Ch5 is Lab_Node : Node_Id; begin + -- Call postconditions procedure if procedure with active postconditions + + if Ekind (Scope_Id) = E_Procedure + and then Has_Postconditions (Scope_Id) + then + Insert_Action (N, + Make_Procedure_Call_Statement (Loc, + Name => Make_Identifier (Loc, Name_uPostconditions))); + end if; + -- If it is a return from a procedure do no extra steps if Kind = E_Procedure or else Kind = E_Generic_Procedure then @@ -3572,16 +3595,15 @@ package body Exp_Ch5 is elsif Is_Protected_Type (Scope_Id) then Call := Make_Procedure_Call_Statement (Loc, - Name => New_Reference_To - (RTE (RE_Complete_Entry_Body), Loc), - Parameter_Associations => New_List - (Make_Attribute_Reference (Loc, + Name => + New_Reference_To (RTE (RE_Complete_Entry_Body), Loc), + Parameter_Associations => New_List ( + Make_Attribute_Reference (Loc, Prefix => New_Reference_To - (Object_Ref - (Corresponding_Body (Parent (Scope_Id))), - Loc), - Attribute_Name => Name_Unchecked_Access))); + (Find_Protection_Object (Current_Scope), Loc), + Attribute_Name => + Name_Unchecked_Access))); Insert_Before (N, Call); Analyze (Call); @@ -3614,28 +3636,30 @@ package body Exp_Ch5 is -- The type of the expression (not necessarily the same as R_Type) begin - -- We rewrite "return <expression>;" to be: + -- For the case of a simple return that does not come from an extended + -- return, in the case of Ada 2005 where we are returning a limited + -- type, we rewrite "return <expression>;" to be: -- return _anon_ : <return_subtype> := <expression> -- The expansion produced by Expand_N_Extended_Return_Statement will -- contain simple return statements (for example, a block containing -- simple return of the return object), which brings us back here with - -- Comes_From_Extended_Return_Statement set. To avoid infinite - -- recursion, we do not transform into an extended return if - -- Comes_From_Extended_Return_Statement is True. + -- Comes_From_Extended_Return_Statement set. The reason for the barrier + -- checking for a simple return that does not come from an extended + -- return is to avoid this infinite recursion. -- The reason for this design is that for Ada 2005 limited returns, we -- need to reify the return object, so we can build it "in place", and -- we need a block statement to hang finalization and tasking stuff. -- ??? In order to avoid disruption, we avoid translating to extended - -- return except in the cases where we really need to (Ada 2005 - -- inherently limited). We would prefer eventually to do this - -- translation in all cases except perhaps for the case of Ada 95 - -- inherently limited, in order to fully exercise the code in - -- Expand_N_Extended_Return_Statement, and in order to do - -- build-in-place for efficiency when it is not required. + -- return except in the cases where we really need to (Ada 2005 for + -- inherently limited). We might prefer to do this translation in all + -- cases (except perhaps for the case of Ada 95 inherently limited), + -- in order to fully exercise the Expand_N_Extended_Return_Statement + -- code. This would also allow us to to the build-in-place optimization + -- for efficiency even in cases where it is semantically not required. -- As before, we check the type of the return expression rather than the -- return type of the function, because the latter may be a limited @@ -3644,7 +3668,7 @@ package body Exp_Ch5 is if not Comes_From_Extended_Return_Statement (N) and then Is_Inherently_Limited_Type (Etype (Expression (N))) - and then Ada_Version >= Ada_05 -- ??? + and then Ada_Version >= Ada_05 and then not Debug_Flag_Dot_L then declare @@ -3845,7 +3869,7 @@ package body Exp_Ch5 is -- secondary stack. else - Set_Storage_Pool (N, RTE (RE_SS_Pool)); + Set_Storage_Pool (N, RTE (RE_SS_Pool)); -- If we are generating code for the VM do not use -- SS_Allocate since everything is heap-allocated anyway. @@ -3987,6 +4011,113 @@ package body Exp_Ch5 is Reason => PE_Accessibility_Check_Failed)); end; end if; + + -- Generate call to postcondition checks if they are present + + if Ekind (Scope_Id) = E_Function + and then Has_Postconditions (Scope_Id) + then + -- We are going to reference the returned value twice in this case, + -- once in the call to _Postconditions, and once in the actual return + -- statement, but we can't have side effects happening twice, and in + -- any case for efficiency we don't want to do the computation twice. + + -- If the returned expression is an entity name, we don't need to + -- worry since it is efficient and safe to reference it twice, that's + -- also true for literals other than string literals, and for the + -- case of X.all where X is an entity name. + + if Is_Entity_Name (Exp) + or else Nkind_In (Exp, N_Character_Literal, + N_Integer_Literal, + N_Real_Literal) + or else (Nkind (Exp) = N_Explicit_Dereference + and then Is_Entity_Name (Prefix (Exp))) + then + null; + + -- Otherwise we are going to need a temporary to capture the value + + else + declare + Tnn : constant Entity_Id := + Make_Defining_Identifier (Loc, + New_Internal_Name ('T')); + + begin + -- For a complex expression of an elementary type, capture + -- value in the temporary and use it as the reference. + + if Is_Elementary_Type (R_Type) then + Insert_Action (Exp, + Make_Object_Declaration (Loc, + Defining_Identifier => Tnn, + Constant_Present => True, + Object_Definition => New_Occurrence_Of (R_Type, Loc), + Expression => Relocate_Node (Exp)), + Suppress => All_Checks); + + Rewrite (Exp, New_Occurrence_Of (Tnn, Loc)); + + -- If we have something we can rename, generate a renaming of + -- the object and replace the expression with a reference + + elsif Is_Object_Reference (Exp) then + Insert_Action (Exp, + Make_Object_Renaming_Declaration (Loc, + Defining_Identifier => Tnn, + Subtype_Mark => New_Occurrence_Of (R_Type, Loc), + Name => Relocate_Node (Exp)), + Suppress => All_Checks); + + Rewrite (Exp, New_Occurrence_Of (Tnn, Loc)); + + -- Otherwise we have something like a string literal or an + -- aggregate. We could copy the value, but that would be + -- inefficient. Instead we make a reference to the value and + -- capture this reference with a renaming, the expression is + -- then replaced by a dereference of this renaming. + + else + -- For now, copy the value, since the code below does not + -- seem to work correctly ??? + + Insert_Action (Exp, + Make_Object_Declaration (Loc, + Defining_Identifier => Tnn, + Constant_Present => True, + Object_Definition => New_Occurrence_Of (R_Type, Loc), + Expression => Relocate_Node (Exp)), + Suppress => All_Checks); + + Rewrite (Exp, New_Occurrence_Of (Tnn, Loc)); + + -- Insert_Action (Exp, + -- Make_Object_Renaming_Declaration (Loc, + -- Defining_Identifier => Tnn, + -- Access_Definition => + -- Make_Access_Definition (Loc, + -- All_Present => True, + -- Subtype_Mark => New_Occurrence_Of (R_Type, Loc)), + -- Name => + -- Make_Reference (Loc, + -- Prefix => Relocate_Node (Exp))), + -- Suppress => All_Checks); + + -- Rewrite (Exp, + -- Make_Explicit_Dereference (Loc, + -- Prefix => New_Occurrence_Of (Tnn, Loc))); + end if; + end; + end if; + + -- Generate call to _postconditions + + Insert_Action (Exp, + Make_Procedure_Call_Statement (Loc, + Name => Make_Identifier (Loc, Name_uPostconditions), + Parameter_Associations => New_List (Duplicate_Subexpr (Exp)))); + end if; end Expand_Simple_Function_Return; ------------------------------ diff --git a/gcc/ada/exp_ch6.adb b/gcc/ada/exp_ch6.adb index c5f88c7a898..a8470b6f2c5 100644 --- a/gcc/ada/exp_ch6.adb +++ b/gcc/ada/exp_ch6.adb @@ -1,4 +1,4 @@ ------------------------------------------------------------------------------- +----------------------------------------------------------------------------- -- -- -- GNAT COMPILER COMPONENTS -- -- -- @@ -110,13 +110,16 @@ package body Exp_Ch6 is procedure Add_Final_List_Actual_To_Build_In_Place_Call (Function_Call : Node_Id; Function_Id : Entity_Id; - Acc_Type : Entity_Id); + Acc_Type : Entity_Id; + Sel_Comp : Node_Id := Empty); -- Ada 2005 (AI-318-02): For a build-in-place call, if the result type has -- controlled parts, add an actual parameter that is a pointer to -- appropriate finalization list. The finalization list is that of the -- current scope, except for "new Acc'(F(...))" in which case it's the -- finalization list of the access type returned by the allocator. Acc_Type - -- is that type in the allocator case; Empty otherwise. + -- is that type in the allocator case; Empty otherwise. If Sel_Comp is + -- not Empty, then it denotes a selected component and the finalization + -- list is obtained from the _controller list of the prefix object. procedure Add_Task_Actuals_To_Build_In_Place_Call (Function_Call : Node_Id; @@ -379,12 +382,16 @@ package body Exp_Ch6 is procedure Add_Final_List_Actual_To_Build_In_Place_Call (Function_Call : Node_Id; Function_Id : Entity_Id; - Acc_Type : Entity_Id) + Acc_Type : Entity_Id; + Sel_Comp : Node_Id := Empty) is Loc : constant Source_Ptr := Sloc (Function_Call); Final_List : Node_Id; Final_List_Actual : Node_Id; Final_List_Formal : Node_Id; + Is_Ctrl_Result : constant Boolean := + Controlled_Type + (Underlying_Type (Etype (Function_Id))); begin -- No such extra parameter is needed if there are no controlled parts. @@ -395,7 +402,7 @@ package body Exp_Ch6 is -- must be treated the same as a call to class-wide functions. Both of -- these situations require that a finalization list be passed. - if not Controlled_Type (Underlying_Type (Etype (Function_Id))) + if not Is_Ctrl_Result and then not Is_Tagged_Type (Underlying_Type (Etype (Function_Id))) then return; @@ -416,6 +423,14 @@ package body Exp_Ch6 is Present (Associated_Final_Chain (Base_Type (Acc_Type)))) then Final_List := Find_Final_List (Acc_Type); + + -- If Sel_Comp is present and the function result is controlled, then + -- the finalization list will be obtained from the _controller list of + -- the selected component's prefix object. + + elsif Present (Sel_Comp) and then Is_Ctrl_Result then + Final_List := Find_Final_List (Current_Scope, Sel_Comp); + else Final_List := Find_Final_List (Current_Scope); end if; @@ -1016,7 +1031,7 @@ package body Exp_Ch6 is Low_Bound => Make_Attribute_Reference (Loc, Prefix => New_Occurrence_Of (Var, Loc), - Attribute_name => Name_First), + Attribute_Name => Name_First), High_Bound => Make_Attribute_Reference (Loc, Prefix => New_Occurrence_Of (Var, Loc), @@ -1541,8 +1556,7 @@ package body Exp_Ch6 is -- formal subtype are not the same, requiring a check. -- It is necessary to exclude tagged types because of "downward - -- conversion" errors and a strange assertion error in namet - -- from gnatf in bug 1215-001 ??? + -- conversion" errors. elsif Is_Access_Type (E_Formal) and then not Same_Type (E_Formal, Etype (Actual)) @@ -1662,9 +1676,9 @@ package body Exp_Ch6 is -- This procedure handles expansion of function calls and procedure call -- statements (i.e. it serves as the body for Expand_N_Function_Call and - -- Expand_N_Procedure_Call_Statement. Processing for calls includes: + -- Expand_N_Procedure_Call_Statement). Processing for calls includes: - -- Replace call to Raise_Exception by Raise_Exception always if possible + -- Replace call to Raise_Exception by Raise_Exception_Always if possible -- Provide values of actuals for all formals in Extra_Formals list -- Replace "call" to enumeration literal function by literal itself -- Rewrite call to predefined operator as operator @@ -1694,12 +1708,12 @@ package body Exp_Ch6 is function Inherited_From_Formal (S : Entity_Id) return Entity_Id; -- Within an instance, a type derived from a non-tagged formal derived - -- type inherits from the original parent, not from the actual. This is - -- tested in 4723-003. The current derivation mechanism has the derived - -- type inherit from the actual, which is only correct outside of the - -- instance. If the subprogram is inherited, we test for this particular - -- case through a convoluted tree traversal before setting the proper - -- subprogram to be called. + -- type inherits from the original parent, not from the actual. The + -- current derivation mechanism has the derived type inherit from the + -- actual, which is only correct outside of the instance. If the + -- subprogram is inherited, we test for this particular case through a + -- convoluted tree traversal before setting the proper subprogram to be + -- called. -------------------------- -- Add_Actual_Parameter -- @@ -1919,11 +1933,11 @@ package body Exp_Ch6 is -- Replace call to Raise_Exception by call to Raise_Exception_Always -- if we can tell that the first parameter cannot possibly be null. - -- This helps optimization and also generation of warnings. + -- This improves efficiency by avoiding a run-time test. -- We do not do this if Raise_Exception_Always does not exist, which -- can happen in configurable run time profiles which provide only a - -- Raise_Exception, which is in fact an unconditional raise anyway. + -- Raise_Exception. if Is_RTE (Subp, RE_Raise_Exception) and then RTE_Available (RE_Raise_Exception_Always) @@ -2547,21 +2561,31 @@ package body Exp_Ch6 is if Nkind_In (N, N_Function_Call, N_Procedure_Call_Statement) and then Present (Controlling_Argument (N)) - and then VM_Target = No_VM then - Expand_Dispatching_Call (N); + if VM_Target = No_VM then + Expand_Dispatching_Call (N); - -- The following return is worrisome. Is it really OK to - -- skip all remaining processing in this procedure ??? + -- The following return is worrisome. Is it really OK to + -- skip all remaining processing in this procedure ??? - return; + return; + + -- Expansion of a dispatching call results in an indirect call, which + -- in turn causes current values to be killed (see Resolve_Call), so + -- on VM targets we do the call here to ensure consistent warnings + -- between VM and non-VM targets. + + else + Kill_Current_Values; + end if; + end if; -- Similarly, expand calls to RCI subprograms on which pragma -- All_Calls_Remote applies. The rewriting will be reanalyzed -- later. Do this only when the call comes from source since we do -- not want such a rewriting to occur in expanded code. - elsif Is_All_Remote_Call (N) then + if Is_All_Remote_Call (N) then Expand_All_Calls_Remote_Subprogram_Call (N); -- Similarly, do not add extra actuals for an entry call whose entity @@ -3110,34 +3134,6 @@ package body Exp_Ch6 is end if; end; end if; - - -- Special processing for Ada 2005 AI-329, which requires a call to - -- Raise_Exception to raise Constraint_Error if the Exception_Id is - -- null. Note that we never need to do this in GNAT mode, or if the - -- parameter to Raise_Exception is a use of Identity, since in these - -- cases we know that the parameter is never null. - - -- Note: We must check that the node has not been inlined. This is - -- required because under zfp the Raise_Exception subprogram has the - -- pragma inline_always (and hence the call has been expanded above - -- into a block containing the code of the subprogram). - - if Ada_Version >= Ada_05 - and then not GNAT_Mode - and then Is_RTE (Subp, RE_Raise_Exception) - and then Nkind (N) = N_Procedure_Call_Statement - and then (Nkind (First_Actual (N)) /= N_Attribute_Reference - or else Attribute_Name (First_Actual (N)) /= Name_Identity) - then - declare - RCE : constant Node_Id := - Make_Raise_Constraint_Error (Loc, - Reason => CE_Null_Exception_Id); - begin - Insert_After (N, RCE); - Analyze (RCE); - end; - end if; end Expand_Call; -------------------------- @@ -3978,12 +3974,9 @@ package body Exp_Ch6 is Loc : constant Source_Ptr := Sloc (N); H : constant Node_Id := Handled_Statement_Sequence (N); Body_Id : Entity_Id; - Spec_Id : Entity_Id; Except_H : Node_Id; - Scop : Entity_Id; - Dec : Node_Id; - Next_Op : Node_Id; L : List_Id; + Spec_Id : Entity_Id; procedure Add_Return (S : List_Id); -- Append a return statement to the statement sequence S if the last @@ -4165,6 +4158,8 @@ package body Exp_Ch6 is if Is_Scalar_Type (Etype (F)) and then Ekind (F) = E_Out_Parameter then + Check_Restriction (No_Default_Initialization, F); + -- Insert the initialization. We turn off validity checks -- for this assignment, since we do not want any check on -- the initial value itself (which may well be invalid). @@ -4172,7 +4167,7 @@ package body Exp_Ch6 is Insert_Before_And_Analyze (First (L), Make_Assignment_Statement (Loc, Name => New_Occurrence_Of (F, Loc), - Expression => Get_Simple_Init_Val (Etype (F), Loc)), + Expression => Get_Simple_Init_Val (Etype (F), N)), Suppress => Validity_Check); end if; @@ -4181,34 +4176,6 @@ package body Exp_Ch6 is end; end if; - Scop := Scope (Spec_Id); - - -- Add discriminal renamings to protected subprograms. Install new - -- discriminals for expansion of the next subprogram of this protected - -- type, if any. - - if Is_List_Member (N) - and then Present (Parent (List_Containing (N))) - and then Nkind (Parent (List_Containing (N))) = N_Protected_Body - then - Add_Discriminal_Declarations - (Declarations (N), Scop, Name_uObject, Loc); - Add_Private_Declarations - (Declarations (N), Scop, Name_uObject, Loc); - - -- Associate privals and discriminals with the next protected - -- operation body to be expanded. These are used to expand references - -- to private data objects and discriminants, respectively. - - Next_Op := Next_Protected_Operation (N); - - if Present (Next_Op) then - Dec := Parent (Base_Type (Scop)); - Set_Privals (Dec, Next_Op, Loc); - Set_Discriminals (Dec); - end if; - end if; - -- Clear out statement list for stubbed procedure if Present (Corresponding_Spec (N)) then @@ -4226,6 +4193,16 @@ package body Exp_Ch6 is end if; end if; + -- Create a set of discriminals for the next protected subprogram body + + if Is_List_Member (N) + and then Present (Parent (List_Containing (N))) + and then Nkind (Parent (List_Containing (N))) = N_Protected_Body + and then Present (Next_Protected_Operation (N)) + then + Set_Discriminals (Parent (Base_Type (Scope (Spec_Id)))); + end if; + -- Returns_By_Ref flag is normally set when the subprogram is frozen -- but subprograms with no specs are not frozen. @@ -4324,37 +4301,6 @@ package body Exp_Ch6 is Detect_Infinite_Recursion (N, Spec_Id); end if; - -- Finally, if we are in Normalize_Scalars mode, then any scalar out - -- parameters must be initialized to the appropriate default value. - - if Ekind (Spec_Id) = E_Procedure and then Normalize_Scalars then - declare - Floc : Source_Ptr; - Formal : Entity_Id; - Stm : Node_Id; - - begin - Formal := First_Formal (Spec_Id); - while Present (Formal) loop - Floc := Sloc (Formal); - - if Ekind (Formal) = E_Out_Parameter - and then Is_Scalar_Type (Etype (Formal)) - then - Stm := - Make_Assignment_Statement (Floc, - Name => New_Occurrence_Of (Formal, Floc), - Expression => - Get_Simple_Init_Val (Etype (Formal), Floc)); - Prepend (Stm, Declarations (N)); - Analyze (Stm); - end if; - - Next_Formal (Formal); - end loop; - end; - end if; - -- Set to encode entity names in package body before gigi is called Qualify_Entity_Names (N); @@ -4780,7 +4726,7 @@ package body Exp_Ch6 is New_Reference_To (Node (Next_Elmt (Iface_DT_Ptr)), Loc), Position => DT_Position (Prim), Address_Node => - Unchecked_Convert_To (RTE (RE_Address), + Unchecked_Convert_To (RTE (RE_Prim_Ptr), Make_Attribute_Reference (Loc, Prefix => New_Reference_To (Thunk_Id, Loc), Attribute_Name => Name_Unrestricted_Access))), @@ -4792,7 +4738,7 @@ package body Exp_Ch6 is Loc), Position => DT_Position (Prim), Address_Node => - Unchecked_Convert_To (RTE (RE_Address), + Unchecked_Convert_To (RTE (RE_Prim_Ptr), Make_Attribute_Reference (Loc, Prefix => New_Reference_To (Prim, Loc), Attribute_Name => Name_Unrestricted_Access))))); @@ -5250,8 +5196,16 @@ package body Exp_Ch6 is Add_Alloc_Form_Actual_To_Build_In_Place_Call (Func_Call, Function_Id, Alloc_Form => Caller_Allocation); - Add_Final_List_Actual_To_Build_In_Place_Call - (Func_Call, Function_Id, Acc_Type => Empty); + -- If Lhs is a selected component, then pass it along so that its prefix + -- object will be used as the source of the finalization list. + + if Nkind (Lhs) = N_Selected_Component then + Add_Final_List_Actual_To_Build_In_Place_Call + (Func_Call, Function_Id, Acc_Type => Empty, Sel_Comp => Lhs); + else + Add_Final_List_Actual_To_Build_In_Place_Call + (Func_Call, Function_Id, Acc_Type => Empty); + end if; Add_Task_Actuals_To_Build_In_Place_Call (Func_Call, Function_Id, Make_Identifier (Loc, Name_uMaster)); diff --git a/gcc/ada/exp_ch7.adb b/gcc/ada/exp_ch7.adb index 678f8441011..916f7af0a10 100644 --- a/gcc/ada/exp_ch7.adb +++ b/gcc/ada/exp_ch7.adb @@ -137,18 +137,20 @@ package body Exp_Ch7 is Is_Master : Boolean; Is_Protected_Subprogram : Boolean; Is_Task_Allocation_Block : Boolean; - Is_Asynchronous_Call_Block : Boolean) return Node_Id; - -- Expand the clean-up procedure for controlled and/or transient - -- block, and/or task master or task body, or blocks used to - -- implement task allocation or asynchronous entry calls, or - -- procedures used to implement protected procedures. Clean is the - -- entity for such a procedure. Mark is the entity for the secondary - -- stack mark, if empty only controlled block clean-up will be - -- performed. Flist is the entity for the local final list, if empty - -- only transient scope clean-up will be performed. The flags - -- Is_Task and Is_Master control the calls to the corresponding - -- finalization actions for a task body or for an entity that is a - -- task master. + Is_Asynchronous_Call_Block : Boolean; + Chained_Cleanup_Action : Node_Id) return Node_Id; + -- Expand the clean-up procedure for a controlled and/or transient block, + -- and/or task master or task body, or a block used to implement task + -- allocation or asynchronous entry calls, or a procedure used to implement + -- protected procedures. Clean is the entity for such a procedure. Mark + -- is the entity for the secondary stack mark, if empty only controlled + -- block clean-up will be performed. Flist is the entity for the local + -- final list, if empty only transient scope clean-up will be performed. + -- The flags Is_Task and Is_Master control the calls to the corresponding + -- finalization actions for a task body or for an entity that is a task + -- master. Finally if Chained_Cleanup_Action is present, it is a reference + -- to a previous cleanup procedure, a call to which is appended at the + -- end of the generated one. procedure Set_Node_To_Be_Wrapped (N : Node_Id); -- Set the field Node_To_Be_Wrapped of the current scope @@ -1120,6 +1122,9 @@ package body Exp_Ch7 is Nkind (N) = N_Block_Statement and then Is_Asynchronous_Call_Block (N); + Previous_At_End_Proc : constant Node_Id := + At_End_Proc (Handled_Statement_Sequence (N)); + Clean : Entity_Id; Loc : Source_Ptr; Mark : Entity_Id := Empty; @@ -1244,11 +1249,18 @@ package body Exp_Ch7 is Is_Master, Is_Protected, Is_Task_Allocation, - Is_Asynchronous_Call)); + Is_Asynchronous_Call, + Previous_At_End_Proc)); + + -- The previous AT END procedure, if any, has been captured in Clean: + -- reset it to Empty now because we check further on that we never + -- overwrite an existing AT END call. + + Set_At_End_Proc (Handled_Statement_Sequence (N), Empty); - -- If exception handlers are present, wrap the Sequence of - -- statements in a block because it is not possible to get - -- exception handlers and an AT END call in the same scope. + -- If exception handlers are present, wrap the Sequence of statements in + -- a block because it is not possible to get exception handlers and an + -- AT END call in the same scope. if Present (Exception_Handlers (Handled_Statement_Sequence (N))) then @@ -1330,7 +1342,7 @@ package body Exp_Ch7 is (Handled_Statement_Sequence (N), Sloc (First (Declarations (N)))); -- The declarations of the _Clean procedure and finalization chain - -- replace the old declarations that have been moved inward + -- replace the old declarations that have been moved inward. Set_Declarations (N, New_Decls); Analyze_Declarations (New_Decls); @@ -1342,9 +1354,9 @@ package body Exp_Ch7 is begin -- If the construct is a protected subprogram, then the call to - -- the corresponding unprotected program appears in a block which - -- is the last statement in the body, and it is this block that - -- must be covered by the At_End handler. + -- the corresponding unprotected subprogram appears in a block which + -- is the last statement in the body, and it is this block that must + -- be covered by the At_End handler. if Is_Protected then HSS := Handled_Statement_Sequence @@ -1353,6 +1365,10 @@ package body Exp_Ch7 is HSS := Handled_Statement_Sequence (N); end if; + -- Never overwrite an existing AT END call + + pragma Assert (No (At_End_Proc (HSS))); + Set_At_End_Proc (HSS, New_Occurrence_Of (Clean, Loc)); Expand_At_End_Handler (HSS, Empty); end; @@ -1708,10 +1724,16 @@ package body Exp_Ch7 is R : Node_Id; begin + -- If the restriction No_Finalization applies, then there's not any + -- finalization list available to return, so return Empty. + + if Restriction_Active (No_Finalization) then + return Empty; + -- Case of an internal component. The Final list is the record -- controller of the enclosing record. - if Present (Ref) then + elsif Present (Ref) then R := Ref; loop case Nkind (R) is @@ -1741,10 +1763,13 @@ package body Exp_Ch7 is Selector_Name => Make_Identifier (Loc, Name_uController)), Selector_Name => Make_Identifier (Loc, Name_F)); - -- Case of a dynamically allocated object. The final list is the - -- corresponding list controller (the next entity in the scope of the - -- access type with the right type). If the type comes from a With_Type - -- clause, no controller was created, we use the global chain instead. + -- Case of a dynamically allocated object whose access type has an + -- Associated_Final_Chain. The final list is the corresponding list + -- controller (the next entity in the scope of the access type with + -- the right type). If the type comes from a With_Type clause, no + -- controller was created, we use the global chain instead. (The code + -- related to with_type clauses should presumably be removed at some + -- point since that feature is obsolete???) -- An anonymous access type either has a list created for it when the -- allocator is a for an access parameter or an access discriminant, @@ -1752,19 +1777,21 @@ package body Exp_Ch7 is -- context is a declaration or an assignment. elsif Is_Access_Type (E) - and then (Ekind (E) /= E_Anonymous_Access_Type - or else - Present (Associated_Final_Chain (E))) + and then (Present (Associated_Final_Chain (E)) + or else From_With_Type (E)) then - if not From_With_Type (E) then + if From_With_Type (E) then + return New_Reference_To (RTE (RE_Global_Final_List), Sloc (E)); + + -- Use the access type's associated finalization chain + + else return Make_Selected_Component (Loc, Prefix => New_Reference_To (Associated_Final_Chain (Base_Type (E)), Loc), Selector_Name => Make_Identifier (Loc, Name_F)); - else - return New_Reference_To (RTE (RE_Global_Final_List), Sloc (E)); end if; else @@ -2233,7 +2260,8 @@ package body Exp_Ch7 is Is_Master : Boolean; Is_Protected_Subprogram : Boolean; Is_Task_Allocation_Block : Boolean; - Is_Asynchronous_Call_Block : Boolean) return Node_Id + Is_Asynchronous_Call_Block : Boolean; + Chained_Cleanup_Action : Node_Id) return Node_Id is Loc : constant Source_Ptr := Sloc (Clean); Stmt : constant List_Id := New_List; @@ -2476,6 +2504,12 @@ package body Exp_Ch7 is New_Reference_To (Mark, Loc)))); end if; + if Present (Chained_Cleanup_Action) then + Append_To (Stmt, + Make_Procedure_Call_Statement (Loc, + Name => Chained_Cleanup_Action)); + end if; + Sbody := Make_Subprogram_Body (Loc, Specification => @@ -3372,13 +3406,14 @@ package body Exp_Ch7 is Insert_List_Before_And_Analyze (First (List_Containing (N)), Nodes); - -- Generate the Finalization calls by finalizing the list - -- controller right away. It will be re-finalized on scope - -- exit but it doesn't matter. It cannot be done when the - -- call initializes a renaming object though because in this - -- case, the object becomes a pointer to the temporary and thus - -- increases its life span. Ditto if this is a renaming of a - -- component of an expression (such as a function call). . + -- Generate the Finalization calls by finalizing the list controller + -- right away. It will be re-finalized on scope exit but it doesn't + -- matter. It cannot be done when the call initializes a renaming + -- object though because in this case, the object becomes a pointer + -- to the temporary and thus increases its life span. Ditto if this + -- is a renaming of a component of an expression (such as a function + -- call). + -- Note that there is a problem if an actual in the call needs -- finalization, because in that case the call itself is the master, -- and the actual should be finalized on return from the call ??? diff --git a/gcc/ada/exp_ch9.adb b/gcc/ada/exp_ch9.adb index 2fa47520947..b999bfaa6c4 100644 --- a/gcc/ada/exp_ch9.adb +++ b/gcc/ada/exp_ch9.adb @@ -38,6 +38,8 @@ with Exp_Tss; use Exp_Tss; with Exp_Util; use Exp_Util; with Freeze; use Freeze; with Hostparm; +with Itypes; use Itypes; +with Namet; use Namet; with Nlists; use Nlists; with Nmake; use Nmake; with Opt; use Opt; @@ -79,28 +81,27 @@ package body Exp_Ch9 is Ent : Entity_Id; Index : Node_Id; Tsk : Entity_Id) return Node_Id; - -- Compute the index position for an entry call. Tsk is the target - -- task. If the bounds of some entry family depend on discriminants, - -- the expression computed by this function uses the discriminants - -- of the target task. + -- Compute the index position for an entry call. Tsk is the target task. If + -- the bounds of some entry family depend on discriminants, the expression + -- computed by this function uses the discriminants of the target task. procedure Add_Object_Pointer - (Decls : List_Id; - Pid : Entity_Id; - Loc : Source_Ptr); - -- Prepend an object pointer declaration to the declaration list - -- Decls. This object pointer is initialized to a type conversion - -- of the System.Address pointer passed to entry barrier functions - -- and entry body procedures. + (Loc : Source_Ptr; + Conc_Typ : Entity_Id; + Decls : List_Id); + -- Prepend an object pointer declaration to the declaration list Decls. + -- This object pointer is initialized to a type conversion of the System. + -- Address pointer passed to entry barrier functions and entry body + -- procedures. procedure Add_Formal_Renamings (Spec : Node_Id; Decls : List_Id; Ent : Entity_Id; Loc : Source_Ptr); - -- Create renaming declarations for the formals, inside the procedure - -- that implements an entry body. The renamings make the original names - -- of the formals accessible to gdb, and serve no other purpose. + -- Create renaming declarations for the formals, inside the procedure that + -- implements an entry body. The renamings make the original names of the + -- formals accessible to gdb, and serve no other purpose. -- Spec is the specification of the procedure being built. -- Decls is the list of declarations to be enhanced. -- Ent is the entity for the original entry body. @@ -118,10 +119,10 @@ package body Exp_Ch9 is -- for the specified entry body. function Build_Barrier_Function_Specification - (Def_Id : Entity_Id; - Loc : Source_Ptr) return Node_Id; - -- Build a specification for a function implementing - -- the protected entry barrier of the specified entry body. + (Loc : Source_Ptr; + Def_Id : Entity_Id) return Node_Id; + -- Build a specification for a function implementing the protected entry + -- barrier of the specified entry body. function Build_Entry_Count_Expression (Concurrent_Type : Node_Id; @@ -187,17 +188,29 @@ package body Exp_Ch9 is (N : Node_Id; Ent : Entity_Id; Pid : Node_Id) return Node_Id; - -- Build the procedure implementing the statement sequence of - -- the specified entry body. + -- Build the procedure implementing the statement sequence of the specified + -- entry body. function Build_Protected_Entry_Specification - (Def_Id : Entity_Id; - Ent_Id : Entity_Id; - Loc : Source_Ptr) return Node_Id; - -- Build a specification for a procedure implementing - -- the statement sequence of the specified entry body. - -- Add attributes associating it with the entry defining identifier - -- Ent_Id. + (Loc : Source_Ptr; + Def_Id : Entity_Id; + Ent_Id : Entity_Id) return Node_Id; + -- Build a specification for the procedure implementing the statemens of + -- the specified entry body. Add attributes associating it with the entry + -- defining identifier Ent_Id. + + function Build_Protected_Spec + (N : Node_Id; + Obj_Type : Entity_Id; + Ident : Entity_Id; + Unprotected : Boolean := False) return List_Id; + -- Utility shared by Build_Protected_Sub_Spec and Expand_Access_Protected_ + -- Subprogram_Type. Builds signature of protected subprogram, adding the + -- formal that corresponds to the object itself. For an access to protected + -- subprogram, there is no object type to specify, so the parameter has + -- type Address and mode In. An indirect call through such a pointer will + -- convert the address to a reference to the actual object. The object is + -- a limited record and therefore a by_reference type. function Build_Protected_Subprogram_Body (N : Node_Id; @@ -211,19 +224,6 @@ package body Exp_Ch9 is -- a cleanup handler that unlocks the object in all cases. -- (see Exp_Ch7.Expand_Cleanup_Actions). - function Build_Protected_Spec - (N : Node_Id; - Obj_Type : Entity_Id; - Unprotected : Boolean := False; - Ident : Entity_Id) return List_Id; - -- Utility shared by Build_Protected_Sub_Spec and Expand_Access_Protected_ - -- Subprogram_Type. Builds signature of protected subprogram, adding the - -- formal that corresponds to the object itself. For an access to protected - -- subprogram, there is no object type to specify, so the additional - -- parameter has type Address and mode In. An indirect call through such - -- a pointer converts the address to a reference to the actual object. - -- The object is a limited record and therefore a by_reference type. - function Build_Selected_Name (Prefix : Entity_Id; Selector : Entity_Id; @@ -271,6 +271,14 @@ package body Exp_Ch9 is -- For each entry family in a concurrent type, create an anonymous array -- type of the right size, and add a component to the corresponding_record. + function Concurrent_Object + (Spec_Id : Entity_Id; + Conc_Typ : Entity_Id) return Entity_Id; + -- Given a subprogram entity Spec_Id and concurrent type Conc_Typ, return + -- the entity associated with the concurrent object in the Protected_Body_ + -- Subprogram or the Task_Body_Procedure of Spec_Id. The returned entity + -- denotes formal parameter _O, _object or _task. + function Copy_Result_Type (Res : Node_Id) return Node_Id; -- Copy the result type of a function specification, when building the -- internal operation corresponding to a protected function, or when @@ -279,6 +287,13 @@ package body Exp_Ch9 is -- same parameter names and the same resolved types, but with new entities -- for the formals. + procedure Debug_Private_Data_Declarations (Decls : List_Id); + -- Decls is a list which may contain the declarations created by Install_ + -- Private_Data_Declarations. All generated entities are marked as needing + -- debug info and debug nodes are manually generation where necessary. This + -- step of the expansion must to be done after private data has been moved + -- to its final resting scope to ensure proper visibility of debug objects. + function Family_Offset (Loc : Source_Ptr; Hi : Node_Id; @@ -330,16 +345,11 @@ package body Exp_Ch9 is -- when P is Name_uPriority, the call will also find Interrupt_Priority. -- ??? Should be implemented with the rep item chain mechanism. - function Index_Constant_Declaration - (N : Node_Id; - Index_Id : Entity_Id; - Prot : Entity_Id) return List_Id; - -- For an entry family and its barrier function, we define a local entity - -- that maps the index in the call into the entry index into the object: - -- - -- I : constant Index_Type := Index_Type'Val ( - -- E - <<index of first family member>> + - -- Protected_Entry_Index (Index_Type'Pos (Index_Type'First))); + function Index_Object (Spec_Id : Entity_Id) return Entity_Id; + -- Given a subprogram identifier, return the entity which is associated + -- with the protection entry index in the Protected_Body_Subprogram or the + -- Task_Body_Procedure of Spec_Id. The returned entity denotes formal + -- parameter _E. function Is_Potentially_Large_Family (Base_Index : Entity_Id; @@ -394,16 +404,6 @@ package body Exp_Ch9 is -- a rescheduling is required, so this optimization is not allowed. This -- function returns True if the optimization is permitted. - procedure Update_Prival_Subtypes (N : Node_Id); - -- The actual subtypes of the privals will differ from the type of the - -- private declaration in the original protected type, if the protected - -- type has discriminants or if the prival has constrained components. - -- This is because the privals are generated out of sequence w.r.t. the - -- analysis of a protected body. After generating the bodies for protected - -- operations, we set correctly the type of all references to privals, by - -- means of a recursive tree traversal, which is heavy-handed but - -- correct. - ----------------------------- -- Actual_Index_Expression -- ----------------------------- @@ -599,84 +599,6 @@ package body Exp_Ch9 is return Expr; end Actual_Index_Expression; - ---------------------------------- - -- Add_Discriminal_Declarations -- - ---------------------------------- - - procedure Add_Discriminal_Declarations - (Decls : List_Id; - Typ : Entity_Id; - Name : Name_Id; - Loc : Source_Ptr) - is - D : Entity_Id; - - begin - if Has_Discriminants (Typ) then - D := First_Discriminant (Typ); - - while Present (D) loop - - Prepend_To (Decls, - Make_Object_Renaming_Declaration (Loc, - Defining_Identifier => Discriminal (D), - Subtype_Mark => New_Reference_To (Etype (D), Loc), - Name => - Make_Selected_Component (Loc, - Prefix => Make_Identifier (Loc, Name), - Selector_Name => Make_Identifier (Loc, Chars (D))))); - - Next_Discriminant (D); - end loop; - end if; - end Add_Discriminal_Declarations; - - ------------------------ - -- Add_Object_Pointer -- - ------------------------ - - procedure Add_Object_Pointer - (Decls : List_Id; - Pid : Entity_Id; - Loc : Source_Ptr) - is - Decl : Node_Id; - Obj_Ptr : Node_Id; - - begin - -- Prepend the declaration of _object. This must be first in the - -- declaration list, since it is used by the discriminal and - -- prival declarations. - -- ??? An attempt to make this a renaming was unsuccessful. - -- - -- type poVP is access poV; - -- _object : poVP := poVP!O; - - Obj_Ptr := - Make_Defining_Identifier (Loc, - Chars => - New_External_Name - (Chars (Corresponding_Record_Type (Pid)), 'P')); - - Decl := - Make_Object_Declaration (Loc, - Defining_Identifier => - Make_Defining_Identifier (Loc, Name_uObject), - Object_Definition => New_Reference_To (Obj_Ptr, Loc), - Expression => - Unchecked_Convert_To (Obj_Ptr, - Make_Identifier (Loc, Name_uO))); - Set_Debug_Info_Needed (Defining_Identifier (Decl)); - Prepend_To (Decls, Decl); - - Prepend_To (Decls, - Make_Full_Type_Declaration (Loc, - Defining_Identifier => Obj_Ptr, - Type_Definition => Make_Access_To_Object_Definition (Loc, - Subtype_Indication => - New_Reference_To (Corresponding_Record_Type (Pid), Loc)))); - end Add_Object_Pointer; - -------------------------- -- Add_Formal_Renamings -- -------------------------- @@ -701,8 +623,8 @@ package body Exp_Ch9 is begin Formal := First_Formal (Ent); while Present (Formal) loop - Comp := Entry_Component (Formal); - New_F := + Comp := Entry_Component (Formal); + New_F := Make_Defining_Identifier (Sloc (Formal), Chars => Chars (Formal)); Set_Etype (New_F, Etype (Formal)); @@ -726,7 +648,8 @@ package body Exp_Ch9 is Decl := Make_Object_Renaming_Declaration (Loc, Defining_Identifier => New_F, - Subtype_Mark => New_Reference_To (Etype (Formal), Loc), + Subtype_Mark => + New_Reference_To (Etype (Formal), Loc), Name => Make_Explicit_Dereference (Loc, Make_Selected_Component (Loc, @@ -742,117 +665,59 @@ package body Exp_Ch9 is end loop; end Add_Formal_Renamings; - ------------------------------ - -- Add_Private_Declarations -- - ------------------------------ + ------------------------ + -- Add_Object_Pointer -- + ------------------------ - procedure Add_Private_Declarations - (Decls : List_Id; - Typ : Entity_Id; - Name : Name_Id; - Loc : Source_Ptr) + procedure Add_Object_Pointer + (Loc : Source_Ptr; + Conc_Typ : Entity_Id; + Decls : List_Id) is - Body_Ent : constant Entity_Id := Corresponding_Body (Parent (Typ)); - Def : constant Node_Id := Protected_Definition (Parent (Typ)); - - Decl : Node_Id; - P : Node_Id; - Pdef : Entity_Id; + Rec_Typ : constant Entity_Id := Corresponding_Record_Type (Conc_Typ); + Decl : Node_Id; + Obj_Ptr : Node_Id; begin - pragma Assert (Nkind (Def) = N_Protected_Definition); - - if Present (Private_Declarations (Def)) then - P := First (Private_Declarations (Def)); - while Present (P) loop - if Nkind (P) = N_Component_Declaration then - Pdef := Defining_Identifier (P); - - -- The privals are declared before the current body is - -- analyzed, for visibility reasons. Set their Sloc so - -- that it is consistent with their renaming declaration, - -- to prevent anomalies in gdb. - - -- This kludgy model for privals should be redesigned ??? - - Set_Sloc (Prival (Pdef), Loc); - - Decl := - Make_Object_Renaming_Declaration (Loc, - Defining_Identifier => Prival (Pdef), - Subtype_Mark => New_Reference_To (Etype (Pdef), Loc), - Name => - Make_Selected_Component (Loc, - Prefix => Make_Identifier (Loc, Name), - Selector_Name => Make_Identifier (Loc, Chars (Pdef)))); - Set_Debug_Info_Needed (Defining_Identifier (Decl)); - Prepend_To (Decls, Decl); - end if; - - Next (P); - end loop; - end if; - - -- One more "prival" for object itself, with the right protection type - - declare - Protection_Type : RE_Id; - - begin - -- Could this be simplified using Corresponding_Runtime_Package??? - - if Has_Attach_Handler (Typ) then - if Restricted_Profile then - if Has_Entries (Typ) then - Protection_Type := RE_Protection_Entry; - else - Protection_Type := RE_Protection; - end if; - else - Protection_Type := RE_Static_Interrupt_Protection; - end if; - - elsif Has_Interrupt_Handler (Typ) then - Protection_Type := RE_Dynamic_Interrupt_Protection; - - -- The type has explicit entries or generated primitive entry - -- wrappers. - - elsif Has_Entries (Typ) - or else (Ada_Version >= Ada_05 - and then Present (Interface_List (Parent (Typ)))) - then - case Corresponding_Runtime_Package (Typ) is - when System_Tasking_Protected_Objects_Entries => - Protection_Type := RE_Protection_Entries; + -- Create the renaming declaration for the Protection object of a + -- protected type. _Object is used by Complete_Entry_Body. + -- ??? An attempt to make this a renaming was unsuccessful. - when System_Tasking_Protected_Objects_Single_Entry => - Protection_Type := RE_Protection_Entry; + -- Build the entity for the access type - when others => - raise Program_Error; - end case; + Obj_Ptr := + Make_Defining_Identifier (Loc, + New_External_Name (Chars (Rec_Typ), 'P')); - else - Protection_Type := RE_Protection; - end if; + -- Generate: + -- _object : poVP := poVP!O; - -- Adjust Sloc, as for the other privals + Decl := + Make_Object_Declaration (Loc, + Defining_Identifier => + Make_Defining_Identifier (Loc, Name_uObject), + Object_Definition => + New_Reference_To (Obj_Ptr, Loc), + Expression => + Unchecked_Convert_To (Obj_Ptr, + Make_Identifier (Loc, Name_uO))); + Set_Debug_Info_Needed (Defining_Identifier (Decl)); + Prepend_To (Decls, Decl); - Set_Sloc (Object_Ref (Body_Ent), Loc); + -- Generate: + -- type poVP is access poV; - Decl := - Make_Object_Renaming_Declaration (Loc, - Defining_Identifier => Object_Ref (Body_Ent), - Subtype_Mark => New_Reference_To (RTE (Protection_Type), Loc), - Name => - Make_Selected_Component (Loc, - Prefix => Make_Identifier (Loc, Name), - Selector_Name => Make_Identifier (Loc, Name_uObject))); - Set_Debug_Info_Needed (Defining_Identifier (Decl)); - Prepend_To (Decls, Decl); - end; - end Add_Private_Declarations; + Decl := + Make_Full_Type_Declaration (Loc, + Defining_Identifier => + Obj_Ptr, + Type_Definition => + Make_Access_To_Object_Definition (Loc, + Subtype_Indication => + New_Reference_To (Rec_Typ, Loc))); + Set_Debug_Info_Needed (Defining_Identifier (Decl)); + Prepend_To (Decls, Decl); + end Add_Object_Pointer; ----------------------- -- Build_Accept_Body -- @@ -1018,67 +883,37 @@ package body Exp_Ch9 is Pid : Node_Id) return Node_Id is Loc : constant Source_Ptr := Sloc (N); + Func_Id : constant Entity_Id := Barrier_Function (Ent); Ent_Formals : constant Node_Id := Entry_Body_Formal_Part (N); - Index_Spec : constant Node_Id := Entry_Index_Specification - (Ent_Formals); - Op_Decls : constant List_Id := New_List; - Bdef : Entity_Id; - Bspec : Node_Id; - EBF : Node_Id; + Op_Decls : constant List_Id := New_List; + Func_Body : Node_Id; begin - Bdef := - Make_Defining_Identifier (Loc, - Chars => Chars (Barrier_Function (Ent))); - Bspec := Build_Barrier_Function_Specification (Bdef, Loc); - - -- <object pointer declaration> - -- <discriminant renamings> - -- <private object renamings> - -- Add discriminal and private renamings. These names have - -- already been used to expand references to discriminants - -- and private data. - - Add_Discriminal_Declarations (Op_Decls, Pid, Name_uObject, Loc); - Add_Private_Declarations (Op_Decls, Pid, Name_uObject, Loc); - Add_Object_Pointer (Op_Decls, Pid, Loc); - - -- If this is the barrier for an entry family, the entry index is - -- visible in the body of the barrier. Create a local variable that - -- converts the entry index (which is the last formal of the barrier - -- function) into the appropriate offset into the entry array. The - -- entry index constant must be set, as for the entry body, so that - -- local references to the entry index are correctly replaced with - -- the local variable. This parallels what is done for entry bodies. - - if Present (Index_Spec) then - declare - Index_Id : constant Entity_Id := Defining_Identifier (Index_Spec); - Index_Con : constant Entity_Id := - Make_Defining_Identifier (Loc, - Chars => New_Internal_Name ('J')); - begin - Set_Entry_Index_Constant (Index_Id, Index_Con); - Append_List_To (Op_Decls, - Index_Constant_Declaration (N, Index_Id, Pid)); - end; - end if; + -- Add a declaration for the Protection object, renaming declarations + -- for the discriminals and privals and finally a declaration for the + -- entry family index (if applicable). + + Install_Private_Data_Declarations + (Loc, Func_Id, Pid, N, Op_Decls, True, Ekind (Ent) = E_Entry_Family); -- Note: the condition in the barrier function needs to be properly -- processed for the C/Fortran boolean possibility, but this happens -- automatically since the return statement does this normalization. - EBF := + Func_Body := Make_Subprogram_Body (Loc, - Specification => Bspec, + Specification => + Build_Barrier_Function_Specification (Loc, + Make_Defining_Identifier (Loc, Chars (Func_Id))), Declarations => Op_Decls, Handled_Statement_Sequence => Make_Handled_Sequence_Of_Statements (Loc, Statements => New_List ( Make_Simple_Return_Statement (Loc, Expression => Condition (Ent_Formals))))); - Set_Is_Entry_Barrier_Function (EBF); - return EBF; + Set_Is_Entry_Barrier_Function (Func_Body); + + return Func_Body; end Build_Barrier_Function; ------------------------------------------ @@ -1086,25 +921,29 @@ package body Exp_Ch9 is ------------------------------------------ function Build_Barrier_Function_Specification - (Def_Id : Entity_Id; - Loc : Source_Ptr) return Node_Id + (Loc : Source_Ptr; + Def_Id : Entity_Id) return Node_Id is begin Set_Debug_Info_Needed (Def_Id); + return Make_Function_Specification (Loc, Defining_Unit_Name => Def_Id, Parameter_Specifications => New_List ( Make_Parameter_Specification (Loc, - Defining_Identifier => Make_Defining_Identifier (Loc, Name_uO), + Defining_Identifier => + Make_Defining_Identifier (Loc, Name_uO), Parameter_Type => New_Reference_To (RTE (RE_Address), Loc)), Make_Parameter_Specification (Loc, - Defining_Identifier => Make_Defining_Identifier (Loc, Name_uE), + Defining_Identifier => + Make_Defining_Identifier (Loc, Name_uE), Parameter_Type => New_Reference_To (RTE (RE_Protected_Entry_Index), Loc))), - Result_Definition => New_Reference_To (Standard_Boolean, Loc)); + Result_Definition => + New_Reference_To (Standard_Boolean, Loc)); end Build_Barrier_Function_Specification; -------------------------- @@ -1629,6 +1468,7 @@ package body Exp_Ch9 is is New_Formals : constant List_Id := New_List; Formal : Node_Id; + Param_Type : Node_Id; begin Formal := First (Formals); @@ -1636,6 +1476,22 @@ package body Exp_Ch9 is -- Create an explicit copy of the entry parameter + -- When creating the wrapper subprogram for a primitive operation + -- of a protected interface we must construct an equivalent + -- signature to that of the overriding operation. For regular + -- parameters we can just use the type of the formal, but for + -- access to subprogram parameters we need to reanalyze the + -- parameter type to create local entities for the signature of + -- the subprogram type. Using the entities of the overriding + -- subprogram will result in out-of-scope errors in the back-end. + + if Nkind (Parameter_Type (Formal)) = N_Access_Definition then + Param_Type := Copy_Separate_Tree (Parameter_Type (Formal)); + else + Param_Type := + New_Reference_To (Etype (Parameter_Type (Formal)), Loc); + end if; + Append_To (New_Formals, Make_Parameter_Specification (Loc, Defining_Identifier => @@ -1643,8 +1499,7 @@ package body Exp_Ch9 is Chars => Chars (Defining_Identifier (Formal))), In_Present => In_Present (Formal), Out_Present => Out_Present (Formal), - Parameter_Type => New_Reference_To (Etype ( - Parameter_Type (Formal)), Loc))); + Parameter_Type => Param_Type)); Next (Formal); end loop; @@ -1748,12 +1603,18 @@ package body Exp_Ch9 is -- not implement any interfaces and are compiled with the -gnat05 -- switch. In this case, a default first parameter is created. + -- If the interface operation has an access parameter, create a copy + -- of it, with the same null exclusion indicator if present. + if Present (First_Param) then if Nkind (Parameter_Type (First_Param)) = N_Access_Definition then Obj_Param_Typ := Make_Access_Definition (Loc, Subtype_Mark => New_Reference_To (Obj_Typ, Loc)); + Set_Null_Exclusion_Present (Obj_Param_Typ, + Null_Exclusion_Present (Parameter_Type (First_Param))); + else Obj_Param_Typ := New_Reference_To (Obj_Typ, Loc); end if; @@ -1945,7 +1806,7 @@ package body Exp_Ch9 is Siz := Empty; Ent := First_Entity (Typ); - Add_Object_Pointer (Decls, Typ, Loc); + Add_Object_Pointer (Loc, Typ, Decls); while Present (Ent) loop @@ -2036,11 +1897,20 @@ package body Exp_Ch9 is -- Ada 2005 (AI-287): Do not set/get the has_master_entity reminder -- in internal scopes, unless present already.. Required for nested - -- limited aggregates. This could use some more explanation ???? + -- limited aggregates, where the expansion of task components may + -- generate inner blocks. If the block is the rewriting of a call + -- this is valid master. if Ada_Version >= Ada_05 then while Is_Internal (S) loop - S := Scope (S); + if Nkind (Parent (S)) = N_Block_Statement + and then + Nkind (Original_Node (Parent (S))) = N_Procedure_Call_Statement + then + exit; + else + S := Scope (S); + end if; end loop; end if; @@ -2111,6 +1981,7 @@ package body Exp_Ch9 is is Loc : constant Source_Ptr := Sloc (N); + Decls : constant List_Id := Declarations (N); End_Lab : constant Node_Id := End_Label (Handled_Statement_Sequence (N)); End_Loc : constant Source_Ptr := @@ -2120,12 +1991,12 @@ package body Exp_Ch9 is Han_Loc : Source_Ptr; -- Used for the exception handler, inserted at end of the body - Op_Decls : constant List_Id := New_List; + Op_Decls : constant List_Id := New_List; + Complete : Node_Id; Edef : Entity_Id; Espec : Node_Id; - Op_Stats : List_Id; Ohandle : Node_Id; - Complete : Node_Id; + Op_Stats : List_Id; begin -- Set the source location on the exception handler only when debugging @@ -2143,19 +2014,23 @@ package body Exp_Ch9 is Edef := Make_Defining_Identifier (Loc, Chars => Chars (Protected_Body_Subprogram (Ent))); - Espec := Build_Protected_Entry_Specification (Edef, Empty, Loc); - - -- <object pointer declaration> + Espec := + Build_Protected_Entry_Specification (Loc, Edef, Empty); - -- Add object pointer declaration. This is needed by the discriminal and - -- prival renamings, which should already have been inserted into the - -- declaration list. + -- Add the following declarations: + -- type poVP is access poV; + -- _object : poVP := poVP (_O); + -- + -- where _O is the formal parameter associated with the concurrent + -- object. These declarations are needed for Complete_Entry_Body. - Add_Object_Pointer (Op_Decls, Pid, Loc); + Add_Object_Pointer (Loc, Pid, Op_Decls); - -- Add renamings for formals for use by debugger + -- Add renamings for all formals, the Protection object, discriminals, + -- privals and the entry indix constant for use by debugger. Add_Formal_Renamings (Espec, Op_Decls, Ent, Loc); + Debug_Private_Data_Declarations (Decls); case Corresponding_Runtime_Package (Pid) is when System_Tasking_Protected_Objects_Entries => @@ -2171,22 +2046,21 @@ package body Exp_Ch9 is end case; Op_Stats := New_List ( - Make_Block_Statement (Loc, - Declarations => Declarations (N), - Handled_Statement_Sequence => - Handled_Statement_Sequence (N)), - - Make_Procedure_Call_Statement (End_Loc, - Name => Complete, - Parameter_Associations => New_List ( - Make_Attribute_Reference (End_Loc, - Prefix => - Make_Selected_Component (End_Loc, - Prefix => - Make_Identifier (End_Loc, Name_uObject), + Make_Block_Statement (Loc, + Declarations => Decls, + Handled_Statement_Sequence => + Handled_Statement_Sequence (N)), - Selector_Name => - Make_Identifier (End_Loc, Name_uObject)), + Make_Procedure_Call_Statement (End_Loc, + Name => Complete, + Parameter_Associations => New_List ( + Make_Attribute_Reference (End_Loc, + Prefix => + Make_Selected_Component (End_Loc, + Prefix => + Make_Identifier (End_Loc, Name_uObject), + Selector_Name => + Make_Identifier (End_Loc, Name_uObject)), Attribute_Name => Name_Unchecked_Access)))); -- When exceptions can not be propagated, we never need to call @@ -2199,8 +2073,8 @@ package body Exp_Ch9 is Declarations => Op_Decls, Handled_Statement_Sequence => Make_Handled_Sequence_Of_Statements (Loc, - Op_Stats, - End_Label => End_Lab)); + Statements => Op_Stats, + End_Label => End_Lab)); else Ohandle := Make_Others_Choice (Loc); @@ -2260,37 +2134,39 @@ package body Exp_Ch9 is ----------------------------------------- function Build_Protected_Entry_Specification - (Def_Id : Entity_Id; - Ent_Id : Entity_Id; - Loc : Source_Ptr) return Node_Id + (Loc : Source_Ptr; + Def_Id : Entity_Id; + Ent_Id : Entity_Id) return Node_Id is - P : Entity_Id; + P : constant Entity_Id := Make_Defining_Identifier (Loc, Name_uP); begin Set_Debug_Info_Needed (Def_Id); - P := Make_Defining_Identifier (Loc, Name_uP); if Present (Ent_Id) then Append_Elmt (P, Accept_Address (Ent_Id)); end if; - return Make_Procedure_Specification (Loc, - Defining_Unit_Name => Def_Id, - Parameter_Specifications => New_List ( - Make_Parameter_Specification (Loc, - Defining_Identifier => Make_Defining_Identifier (Loc, Name_uO), - Parameter_Type => - New_Reference_To (RTE (RE_Address), Loc)), + return + Make_Procedure_Specification (Loc, + Defining_Unit_Name => Def_Id, + Parameter_Specifications => New_List ( + Make_Parameter_Specification (Loc, + Defining_Identifier => + Make_Defining_Identifier (Loc, Name_uO), + Parameter_Type => + New_Reference_To (RTE (RE_Address), Loc)), - Make_Parameter_Specification (Loc, - Defining_Identifier => P, - Parameter_Type => - New_Reference_To (RTE (RE_Address), Loc)), + Make_Parameter_Specification (Loc, + Defining_Identifier => P, + Parameter_Type => + New_Reference_To (RTE (RE_Address), Loc)), - Make_Parameter_Specification (Loc, - Defining_Identifier => Make_Defining_Identifier (Loc, Name_uE), - Parameter_Type => - New_Reference_To (RTE (RE_Protected_Entry_Index), Loc)))); + Make_Parameter_Specification (Loc, + Defining_Identifier => + Make_Defining_Identifier (Loc, Name_uE), + Parameter_Type => + New_Reference_To (RTE (RE_Protected_Entry_Index), Loc)))); end Build_Protected_Entry_Specification; -------------------------- @@ -2300,27 +2176,27 @@ package body Exp_Ch9 is function Build_Protected_Spec (N : Node_Id; Obj_Type : Entity_Id; - Unprotected : Boolean := False; - Ident : Entity_Id) return List_Id + Ident : Entity_Id; + Unprotected : Boolean := False) return List_Id is - Loc : constant Source_Ptr := Sloc (N); - Decl : Node_Id; - Formal : Entity_Id; - New_Plist : List_Id; - New_Param : Node_Id; + Loc : constant Source_Ptr := Sloc (N); + Decl : Node_Id; + Formal : Entity_Id; + New_Plist : List_Id; + New_Param : Node_Id; begin New_Plist := New_List; + Formal := First_Formal (Ident); while Present (Formal) loop New_Param := Make_Parameter_Specification (Loc, Defining_Identifier => Make_Defining_Identifier (Sloc (Formal), Chars (Formal)), - In_Present => In_Present (Parent (Formal)), - Out_Present => Out_Present (Parent (Formal)), - Parameter_Type => - New_Reference_To (Etype (Formal), Loc)); + In_Present => In_Present (Parent (Formal)), + Out_Present => Out_Present (Parent (Formal)), + Parameter_Type => New_Reference_To (Etype (Formal), Loc)); if Unprotected then Set_Protected_Formal (Formal, Defining_Identifier (New_Param)); @@ -2340,9 +2216,10 @@ package body Exp_Ch9 is Make_Defining_Identifier (Loc, Name_uObject), In_Present => True, Out_Present => - (Etype (Ident) = Standard_Void_Type - and then not Is_RTE (Obj_Type, RE_Address)), - Parameter_Type => New_Reference_To (Obj_Type, Loc)); + (Etype (Ident) = Standard_Void_Type + and then not Is_RTE (Obj_Type, RE_Address)), + Parameter_Type => + New_Reference_To (Obj_Type, Loc)); Set_Debug_Info_Needed (Defining_Identifier (Decl)); Prepend_To (New_Plist, Decl); @@ -2354,13 +2231,13 @@ package body Exp_Ch9 is --------------------------------------- function Build_Protected_Sub_Specification - (N : Node_Id; - Prottyp : Entity_Id; - Mode : Subprogram_Protection_Mode) return Node_Id + (N : Node_Id; + Prot_Typ : Entity_Id; + Mode : Subprogram_Protection_Mode) return Node_Id is Loc : constant Source_Ptr := Sloc (N); Decl : Node_Id; - Ident : Entity_Id; + Def_Id : Entity_Id; New_Id : Entity_Id; New_Plist : List_Id; New_Spec : Node_Id; @@ -2371,24 +2248,23 @@ package body Exp_Ch9 is Unprotected_Mode => 'N'); begin - if Ekind - (Defining_Unit_Name (Specification (N))) = E_Subprogram_Body + if Ekind (Defining_Unit_Name (Specification (N))) = + E_Subprogram_Body then Decl := Unit_Declaration_Node (Corresponding_Spec (N)); else Decl := N; end if; - Ident := Defining_Unit_Name (Specification (Decl)); + Def_Id := Defining_Unit_Name (Specification (Decl)); New_Plist := - Build_Protected_Spec (Decl, - Corresponding_Record_Type (Prottyp), - Mode = Unprotected_Mode, Ident); - + Build_Protected_Spec + (Decl, Corresponding_Record_Type (Prot_Typ), Def_Id, + Mode = Unprotected_Mode); New_Id := Make_Defining_Identifier (Loc, - Chars => Build_Selected_Name (Prottyp, Ident, Append_Chr (Mode))); + Chars => Build_Selected_Name (Prot_Typ, Def_Id, Append_Chr (Mode))); -- The unprotected operation carries the user code, and debugging -- information must be generated for it, even though this spec does @@ -2399,15 +2275,14 @@ package body Exp_Ch9 is Set_Debug_Info_Needed (New_Id); if Nkind (Specification (Decl)) = N_Procedure_Specification then - return + New_Spec := Make_Procedure_Specification (Loc, Defining_Unit_Name => New_Id, Parameter_Specifications => New_Plist); - else - -- We need to create a new specification for the anonymous - -- subprogram type. + -- Create a new specification for the anonymous subprogram type + else New_Spec := Make_Function_Specification (Loc, Defining_Unit_Name => New_Id, @@ -2416,8 +2291,9 @@ package body Exp_Ch9 is Copy_Result_Type (Result_Definition (Specification (Decl)))); Set_Return_Present (Defining_Unit_Name (New_Spec)); - return New_Spec; end if; + + return New_Spec; end Build_Protected_Sub_Specification; ------------------------------------- @@ -2591,11 +2467,12 @@ package body Exp_Ch9 is end if; else - Unprot_Call := Make_Procedure_Call_Statement (Loc, - Name => - Make_Identifier (Loc, - Chars (Defining_Unit_Name (N_Op_Spec))), - Parameter_Associations => Uactuals); + Unprot_Call := + Make_Procedure_Call_Statement (Loc, + Name => + Make_Identifier (Loc, + Chars (Defining_Unit_Name (N_Op_Spec))), + Parameter_Associations => Uactuals); end if; -- Wrap call in block that will be covered by an at_end handler @@ -2941,6 +2818,30 @@ package body Exp_Ch9 is -- the _Task_Id or _Object from the result of doing an unchecked -- conversion to convert the value to the corresponding record type. + if Nkind (Concval) = N_Function_Call + and then Is_Task_Type (Conctyp) + and then Ada_Version >= Ada_05 + then + declare + Obj : constant Entity_Id := + Make_Defining_Identifier (Loc, New_Internal_Name ('F')); + Decl : Node_Id; + + begin + Decl := + Make_Object_Declaration (Loc, + Defining_Identifier => Obj, + Object_Definition => New_Occurrence_Of (Conctyp, Loc), + Expression => Relocate_Node (Concval)); + Set_Etype (Obj, Conctyp); + Decls := New_List (Decl); + Rewrite (Concval, New_Occurrence_Of (Obj, Loc)); + end; + + else + Decls := New_List; + end if; + Parm1 := Concurrent_Ref (Concval); -- Second parameter is the entry index, computed by the routine @@ -2966,12 +2867,11 @@ package body Exp_Ch9 is Expression => Actual_Index_Expression ( Loc, Entity (Ename), Index, Concval)); - Decls := New_List (Xdecl); + Append_To (Decls, Xdecl); Parm2 := New_Reference_To (X, Loc); else Xdecl := Empty; - Decls := New_List; Parm2 := Empty; end if; @@ -3488,36 +3388,33 @@ package body Exp_Ch9 is ----------------------------------- function Build_Task_Proc_Specification (T : Entity_Id) return Node_Id is - Loc : constant Source_Ptr := Sloc (T); - Nam : constant Name_Id := Chars (T); - Ent : Entity_Id; + Loc : constant Source_Ptr := Sloc (T); + Spec_Id : Entity_Id; begin - Ent := + Spec_Id := Make_Defining_Identifier (Loc, - Chars => New_External_Name (Nam, 'B')); - Set_Is_Internal (Ent); + Chars => New_External_Name (Chars (T), 'B')); + Set_Is_Internal (Spec_Id); -- Associate the procedure with the task, if this is the declaration -- (and not the body) of the procedure. if No (Task_Body_Procedure (T)) then - Set_Task_Body_Procedure (T, Ent); + Set_Task_Body_Procedure (T, Spec_Id); end if; return Make_Procedure_Specification (Loc, - Defining_Unit_Name => Ent, - Parameter_Specifications => - New_List ( - Make_Parameter_Specification (Loc, - Defining_Identifier => - Make_Defining_Identifier (Loc, Name_uTask), - Parameter_Type => - Make_Access_Definition (Loc, - Subtype_Mark => - New_Reference_To - (Corresponding_Record_Type (T), Loc))))); + Defining_Unit_Name => Spec_Id, + Parameter_Specifications => New_List ( + Make_Parameter_Specification (Loc, + Defining_Identifier => + Make_Defining_Identifier (Loc, Name_uTask), + Parameter_Type => + Make_Access_Definition (Loc, + Subtype_Mark => + New_Reference_To (Corresponding_Record_Type (T), Loc))))); end Build_Task_Proc_Specification; --------------------------------------- @@ -3528,25 +3425,24 @@ package body Exp_Ch9 is (N : Node_Id; Pid : Node_Id) return Node_Id is - Loc : constant Source_Ptr := Sloc (N); - N_Op_Spec : Node_Id; - Op_Decls : List_Id; + Decls : constant List_Id := Declarations (N); begin + -- Add renamings for the Protection object, discriminals, privals and + -- the entry indix constant for use by debugger. + + Debug_Private_Data_Declarations (Decls); + -- Make an unprotected version of the subprogram for use within the same -- object, with a new name and an additional parameter representing the -- object. - Op_Decls := Declarations (N); - N_Op_Spec := - Build_Protected_Sub_Specification (N, Pid, Unprotected_Mode); - return - Make_Subprogram_Body (Loc, - Specification => N_Op_Spec, - Declarations => Op_Decls, - Handled_Statement_Sequence => - Handled_Statement_Sequence (N)); + Make_Subprogram_Body (Sloc (N), + Specification => + Build_Protected_Sub_Specification (N, Pid, Unprotected_Mode), + Declarations => Decls, + Handled_Statement_Sequence => Handled_Statement_Sequence (N)); end Build_Unprotected_Subprogram_Body; ---------------------------- @@ -3565,9 +3461,7 @@ package body Exp_Ch9 is begin Efam := First_Entity (Conctyp); - while Present (Efam) loop - if Ekind (Efam) = E_Entry_Family then Efam_Type := Make_Defining_Identifier (Loc, @@ -3577,6 +3471,7 @@ package body Exp_Ch9 is Bas : Entity_Id := Base_Type (Etype (Discrete_Subtype_Definition (Parent (Efam)))); + Bas_Decl : Node_Id := Empty; Lo, Hi : Node_Id; @@ -3586,15 +3481,17 @@ package body Exp_Ch9 is if Is_Potentially_Large_Family (Bas, Conctyp, Lo, Hi) then Bas := - Make_Defining_Identifier (Loc, New_Internal_Name ('B')); + Make_Defining_Identifier (Loc, + Chars => New_Internal_Name ('B')); + Bas_Decl := Make_Subtype_Declaration (Loc, Defining_Identifier => Bas, - Subtype_Indication => + Subtype_Indication => Make_Subtype_Indication (Loc, Subtype_Mark => New_Occurrence_Of (Standard_Integer, Loc), - Constraint => + Constraint => Make_Range_Constraint (Loc, Range_Expression => Make_Range (Loc, Make_Integer_Literal @@ -3652,6 +3549,28 @@ package body Exp_Ch9 is end loop; end Collect_Entry_Families; + ----------------------- + -- Concurrent_Object -- + ----------------------- + + function Concurrent_Object + (Spec_Id : Entity_Id; + Conc_Typ : Entity_Id) return Entity_Id + is + begin + -- Parameter _O or _object + + if Is_Protected_Type (Conc_Typ) then + return First_Formal (Protected_Body_Subprogram (Spec_Id)); + + -- Parameter _task + + else + pragma Assert (Is_Task_Type (Conc_Typ)); + return First_Formal (Task_Body_Procedure (Conc_Typ)); + end if; + end Concurrent_Object; + ---------------------- -- Copy_Result_Type -- ---------------------- @@ -3823,10 +3742,9 @@ package body Exp_Ch9 is else pragma Assert (Is_Protected_Type (Entity (N))); + return - New_Reference_To ( - Object_Ref (Corresponding_Body (Parent (Base_Type (Ntyp)))), - Loc); + New_Reference_To (Find_Protection_Object (Current_Scope), Loc); end if; else @@ -3867,6 +3785,50 @@ package body Exp_Ch9 is end if; end Convert_Concurrent; + ------------------------------------- + -- Debug_Private_Data_Declarations -- + ------------------------------------- + + procedure Debug_Private_Data_Declarations (Decls : List_Id) is + Debug_Nod : Node_Id; + Decl : Node_Id; + + begin + Decl := First (Decls); + while Present (Decl) + and then not Comes_From_Source (Decl) + loop + -- Declaration for concurrent entity _object and its access type, + -- along with the entry index subtype: + -- type prot_typVP is access prot_typV; + -- _object : prot_typVP := prot_typV (_O); + -- subtype Jnn is <Type of Index> range Low .. High; + + if Nkind_In (Decl, N_Full_Type_Declaration, N_Object_Declaration) then + Set_Debug_Info_Needed (Defining_Identifier (Decl)); + + -- Declaration for the Protection object, discriminals, privals and + -- entry index constant: + -- conc_typR : protection_typ renames _object._object; + -- discr_nameD : discr_typ renames _object.discr_name; + -- discr_nameD : discr_typ renames _task.discr_name; + -- prival_name : comp_typ renames _object.comp_name; + -- J : constant Jnn := + -- Jnn'Val (_E - <Index expression> + Jnn'Pos (Jnn'First)); + + elsif Nkind (Decl) = N_Object_Renaming_Declaration then + Set_Debug_Info_Needed (Defining_Identifier (Decl)); + Debug_Nod := Debug_Renaming_Declaration (Decl); + + if Present (Debug_Nod) then + Insert_After (Decl, Debug_Nod); + end if; + end if; + + Next (Decl); + end loop; + end Debug_Private_Data_Declarations; + ---------------------------- -- Entry_Index_Expression -- ---------------------------- @@ -4276,7 +4238,7 @@ package body Exp_Ch9 is E_T : constant Entity_Id := Make_Defining_Identifier (Loc, Chars => New_Internal_Name ('E')); P_List : constant List_Id := Build_Protected_Spec - (N, RTE (RE_Address), False, D_T); + (N, RTE (RE_Address), D_T, False); Decl1 : Node_Id; Decl2 : Node_Id; Def1 : Node_Id; @@ -4288,7 +4250,7 @@ package body Exp_Ch9 is Def1 := Make_Access_Function_Definition (Loc, Parameter_Specifications => P_List, - Result_Definition => + Result_Definition => Copy_Result_Type (Result_Definition (Type_Definition (N)))); else @@ -4314,7 +4276,7 @@ package body Exp_Ch9 is Make_Defining_Identifier (Loc, New_Internal_Name ('P')), Component_Definition => Make_Component_Definition (Loc, - Aliased_Present => False, + Aliased_Present => False, Subtype_Indication => New_Occurrence_Of (RTE (RE_Address), Loc))), @@ -4323,13 +4285,13 @@ package body Exp_Ch9 is Make_Defining_Identifier (Loc, New_Internal_Name ('S')), Component_Definition => Make_Component_Definition (Loc, - Aliased_Present => False, + Aliased_Present => False, Subtype_Indication => New_Occurrence_Of (D_T2, Loc)))); Decl2 := Make_Full_Type_Declaration (Loc, Defining_Identifier => E_T, - Type_Definition => + Type_Definition => Make_Record_Definition (Loc, Component_List => Make_Component_List (Loc, @@ -4345,11 +4307,10 @@ package body Exp_Ch9 is -------------------------- procedure Expand_Entry_Barrier (N : Node_Id; Ent : Entity_Id) is - Loc : constant Source_Ptr := Sloc (N); - Prot : constant Entity_Id := Scope (Ent); - Spec_Decl : constant Node_Id := Parent (Prot); - Cond : constant Node_Id := + Cond : constant Node_Id := Condition (Entry_Body_Formal_Part (N)); + Prot : constant Entity_Id := Scope (Ent); + Spec_Decl : constant Node_Id := Parent (Prot); Func : Node_Id; B_F : Node_Id; Body_Decl : Node_Id; @@ -4365,7 +4326,7 @@ package body Exp_Ch9 is -- unprotected version of a protected operation. The specification has -- been produced when the protected type declaration was elaborated. We -- build the body, insert it in the enclosing scope, but analyze it in - -- the current context. A more uniform approach would be to treat + -- the current context. A more uniform approach would be to treat the -- barrier just as a protected function, and discard the protected -- version of it because it is never called. @@ -4382,9 +4343,6 @@ package body Exp_Ch9 is Insert_Before_And_Analyze (Body_Decl, B_F); - Update_Prival_Subtypes (B_F); - - Set_Privals (Spec_Decl, N, Loc, After_Barrier => True); Set_Discriminals (Spec_Decl); Set_Scope (Func, Scope (Prot)); @@ -4447,43 +4405,6 @@ package body Exp_Ch9 is Check_Restriction (Simple_Barriers, Cond); end Expand_Entry_Barrier; - ------------------------------------ - -- Expand_Entry_Body_Declarations -- - ------------------------------------ - - procedure Expand_Entry_Body_Declarations (N : Node_Id) is - Loc : constant Source_Ptr := Sloc (N); - Index_Spec : Node_Id; - - begin - if Expander_Active then - - -- Expand entry bodies corresponding to entry families - -- by assigning a placeholder for the constant that will - -- be used to expand references to the entry index parameter. - - Index_Spec := - Entry_Index_Specification (Entry_Body_Formal_Part (N)); - - if Present (Index_Spec) then - declare - Index_Con : constant Entity_Id := - Make_Defining_Identifier (Loc, - Chars => New_Internal_Name ('J')); - begin - -- Mark the index constant as having a valid value since it - -- will act as a renaming of the original entry index which - -- is known to be valid. - - Set_Is_Known_Valid (Index_Con); - - Set_Entry_Index_Constant - (Defining_Identifier (Index_Spec), Index_Con); - end; - end if; - end if; - end Expand_Entry_Body_Declarations; - ------------------------------ -- Expand_N_Abort_Statement -- ------------------------------ @@ -6395,48 +6316,12 @@ package body Exp_Ch9 is ------------------------- procedure Expand_N_Entry_Body (N : Node_Id) is - Loc : constant Source_Ptr := Sloc (N); - Dec : constant Node_Id := Parent (Current_Scope); - Ent_Formals : constant Node_Id := Entry_Body_Formal_Part (N); - Index_Spec : constant Node_Id := - Entry_Index_Specification (Ent_Formals); - Next_Op : Node_Id; - First_Decl : constant Node_Id := First (Declarations (N)); - Index_Decl : List_Id; - begin - -- Add the renamings for private declarations and discriminants - - Add_Discriminal_Declarations - (Declarations (N), Defining_Identifier (Dec), Name_uObject, Loc); - Add_Private_Declarations - (Declarations (N), Defining_Identifier (Dec), Name_uObject, Loc); + -- Associate discriminals with the next protected operation body to be + -- expanded. - if Present (Index_Spec) then - Index_Decl := - Index_Constant_Declaration - (N, - Defining_Identifier (Index_Spec), Defining_Identifier (Dec)); - - -- If the entry has local declarations, insert index declaration - -- before them, because the index may be used therein. - - if Present (First_Decl) then - Insert_List_Before (First_Decl, Index_Decl); - else - Append_List_To (Declarations (N), Index_Decl); - end if; - end if; - - -- Associate privals and discriminals with the next protected operation - -- body to be expanded. These are used to expand references to private - -- data objects and discriminants, respectively. - - Next_Op := Next_Protected_Operation (N); - - if Present (Next_Op) then - Set_Privals (Dec, Next_Op, Loc); - Set_Discriminals (Dec); + if Present (Next_Protected_Operation (N)) then + Set_Discriminals (Parent (Current_Scope)); end if; end Expand_N_Entry_Body; @@ -6444,8 +6329,8 @@ package body Exp_Ch9 is -- Expand_N_Entry_Call_Statement -- ----------------------------------- - -- An entry call is expanded into GNARLI calls to implement - -- a simple entry call (see Build_Simple_Entry_Call). + -- An entry call is expanded into GNARLI calls to implement a simple entry + -- call (see Build_Simple_Entry_Call). procedure Expand_N_Entry_Call_Statement (N : Node_Id) is Concval : Node_Id; @@ -6846,10 +6731,8 @@ package body Exp_Ch9 is Current_Node := New_Op_Body; Analyze (New_Op_Body); - Update_Prival_Subtypes (New_Op_Body); - -- Build the corresponding protected operation. It may - -- appear that this is needed only this is a visible + -- appear that this is needed only if this is a visible -- operation of the type, or if it is an interrupt handler, -- and this was the strategy used previously in GNAT. -- However, the operation may be exported through a @@ -6860,14 +6743,14 @@ package body Exp_Ch9 is if Present (Corresponding_Spec (Op_Body)) then Op_Decl := - Unit_Declaration_Node (Corresponding_Spec (Op_Body)); + Unit_Declaration_Node (Corresponding_Spec (Op_Body)); - if - Nkind (Parent (Op_Decl)) = N_Protected_Definition + if Nkind (Parent (Op_Decl)) = + N_Protected_Definition then New_Op_Body := - Build_Protected_Subprogram_Body ( - Op_Body, Pid, Specification (New_Op_Body)); + Build_Protected_Subprogram_Body ( + Op_Body, Pid, Specification (New_Op_Body)); Insert_After (Current_Node, New_Op_Body); Analyze (New_Op_Body); @@ -6905,8 +6788,6 @@ package body Exp_Ch9 is Current_Node := New_Op_Body; Analyze (New_Op_Body); - Update_Prival_Subtypes (New_Op_Body); - when N_Implicit_Label_Declaration => null; @@ -7098,10 +6979,10 @@ package body Exp_Ch9 is -- the specs refer to this type. procedure Expand_N_Protected_Type_Declaration (N : Node_Id) is - Loc : constant Source_Ptr := Sloc (N); - Prottyp : constant Entity_Id := Defining_Identifier (N); + Loc : constant Source_Ptr := Sloc (N); + Prot_Typ : constant Entity_Id := Defining_Identifier (N); - Pdef : constant Node_Id := Protected_Definition (N); + Pdef : constant Node_Id := Protected_Definition (N); -- This contains two lists; one for visible and one for private decls Rec_Decl : Node_Id; @@ -7156,10 +7037,10 @@ package body Exp_Ch9 is -- Start of processing for Expand_N_Protected_Type_Declaration begin - if Present (Corresponding_Record_Type (Prottyp)) then + if Present (Corresponding_Record_Type (Prot_Typ)) then return; else - Rec_Decl := Build_Corresponding_Record (N, Prottyp, Loc); + Rec_Decl := Build_Corresponding_Record (N, Prot_Typ, Loc); end if; Cdecls := Component_Items (Component_List (Type_Definition (Rec_Decl))); @@ -7182,12 +7063,13 @@ package body Exp_Ch9 is -- This replacement is not applied to default expressions, for which -- the discriminal is correct. - if Has_Discriminants (Prottyp) then + if Has_Discriminants (Prot_Typ) then declare Disc : Entity_Id; Decl : Node_Id; + begin - Disc := First_Discriminant (Prottyp); + Disc := First_Discriminant (Prot_Typ); Decl := First (Discriminant_Specifications (Rec_Decl)); while Present (Disc) loop Append_Elmt (Discriminal (Disc), Discr_Map); @@ -7203,7 +7085,7 @@ package body Exp_Ch9 is -- Add components for entry families. For each entry family, create an -- anonymous type declaration with the same size, and analyze the type. - Collect_Entry_Families (Loc, Cdecls, Current_Node, Prottyp); + Collect_Entry_Families (Loc, Cdecls, Current_Node, Prot_Typ); -- Prepend the _Object field with the right type to the component list. -- We need to compute the number of entries, and in some cases the @@ -7215,13 +7097,13 @@ package body Exp_Ch9 is Protection_Subtype : Node_Id; Entry_Count_Expr : constant Node_Id := Build_Entry_Count_Expression - (Prottyp, Cdecls, Loc); + (Prot_Typ, Cdecls, Loc); begin -- Could this be simplified using Corresponding_Runtime_Package??? - if Has_Attach_Handler (Prottyp) then - Ritem := First_Rep_Item (Prottyp); + if Has_Attach_Handler (Prot_Typ) then + Ritem := First_Rep_Item (Prot_Typ); while Present (Ritem) loop if Nkind (Ritem) = N_Pragma and then Pragma_Name (Ritem) = Name_Attach_Handler @@ -7233,7 +7115,7 @@ package body Exp_Ch9 is end loop; if Restricted_Profile then - if Has_Entries (Prottyp) then + if Has_Entries (Prot_Typ) then Protection_Subtype := New_Reference_To (RTE (RE_Protection_Entry), Loc); else @@ -7255,7 +7137,7 @@ package body Exp_Ch9 is Make_Integer_Literal (Loc, Num_Attach_Handler)))); end if; - elsif Has_Interrupt_Handler (Prottyp) then + elsif Has_Interrupt_Handler (Prot_Typ) then Protection_Subtype := Make_Subtype_Indication ( Sloc => Loc, @@ -7268,11 +7150,11 @@ package body Exp_Ch9 is -- Type has explicit entries or generated primitive entry wrappers - elsif Has_Entries (Prottyp) + elsif Has_Entries (Prot_Typ) or else (Ada_Version >= Ada_05 and then Present (Interface_List (N))) then - case Corresponding_Runtime_Package (Prottyp) is + case Corresponding_Runtime_Package (Prot_Typ) is when System_Tasking_Protected_Objects_Entries => Protection_Subtype := Make_Subtype_Indication (Loc, @@ -7364,7 +7246,7 @@ package body Exp_Ch9 is Make_Subprogram_Declaration (Loc, Specification => Build_Protected_Sub_Specification - (Priv, Prottyp, Unprotected_Mode)); + (Priv, Prot_Typ, Unprotected_Mode)); Insert_After (Current_Node, Sub); Analyze (Sub); @@ -7379,7 +7261,7 @@ package body Exp_Ch9 is Make_Subprogram_Declaration (Loc, Specification => Build_Protected_Sub_Specification - (Priv, Prottyp, Protected_Mode)); + (Priv, Prot_Typ, Protected_Mode)); Insert_After (Current_Node, Sub); Analyze (Sub); @@ -7482,7 +7364,7 @@ package body Exp_Ch9 is -- add an expression to the aggregate which is the initial value of -- this array. The array is declared after all protected subprograms. - if Has_Entries (Prottyp) then + if Has_Entries (Prot_Typ) then Entries_Aggr := Make_Aggregate (Loc, Expressions => New_List); @@ -7509,7 +7391,7 @@ package body Exp_Ch9 is Make_Subprogram_Declaration (Loc, Specification => Build_Protected_Sub_Specification - (Comp, Prottyp, Unprotected_Mode)); + (Comp, Prot_Typ, Unprotected_Mode)); Insert_After (Current_Node, Sub); Analyze (Sub); @@ -7527,7 +7409,7 @@ package body Exp_Ch9 is Make_Subprogram_Declaration (Loc, Specification => Build_Protected_Sub_Specification - (Comp, Prottyp, Protected_Mode)); + (Comp, Prot_Typ, Protected_Mode)); Insert_After (Current_Node, Sub); Analyze (Sub); @@ -7540,13 +7422,13 @@ package body Exp_Ch9 is if Ada_Version >= Ada_05 and then Present (Abstract_Interfaces - (Corresponding_Record_Type (Prottyp))) + (Corresponding_Record_Type (Prot_Typ))) then Sub := Make_Subprogram_Declaration (Loc, Specification => Build_Protected_Sub_Specification - (Comp, Prottyp, Dispatching_Mode)); + (Comp, Prot_Typ, Dispatching_Mode)); Insert_After (Current_Node, Sub); Analyze (Sub); @@ -7571,31 +7453,31 @@ package body Exp_Ch9 is elsif Nkind (Comp) = N_Entry_Declaration then E_Count := E_Count + 1; Comp_Id := Defining_Identifier (Comp); - Set_Privals_Chain (Comp_Id, New_Elmt_List); + Edef := Make_Defining_Identifier (Loc, - Build_Selected_Name (Prottyp, Comp_Id, 'E')); + Build_Selected_Name (Prot_Typ, Comp_Id, 'E')); Sub := Make_Subprogram_Declaration (Loc, Specification => - Build_Protected_Entry_Specification (Edef, Comp_Id, Loc)); + Build_Protected_Entry_Specification (Loc, Edef, Comp_Id)); Insert_After (Current_Node, Sub); Analyze (Sub); - Set_Protected_Body_Subprogram ( - Defining_Identifier (Comp), - Defining_Unit_Name (Specification (Sub))); + Set_Protected_Body_Subprogram + (Defining_Identifier (Comp), + Defining_Unit_Name (Specification (Sub))); Current_Node := Sub; Bdef := Make_Defining_Identifier (Loc, - Build_Selected_Name (Prottyp, Comp_Id, 'B')); + Chars => Build_Selected_Name (Prot_Typ, Comp_Id, 'B')); Sub := Make_Subprogram_Declaration (Loc, Specification => - Build_Barrier_Function_Specification (Bdef, Loc)); + Build_Barrier_Function_Specification (Loc, Bdef)); Insert_After (Current_Node, Sub); Analyze (Sub); @@ -7632,33 +7514,32 @@ package body Exp_Ch9 is if Nkind (Comp) = N_Entry_Declaration then E_Count := E_Count + 1; Comp_Id := Defining_Identifier (Comp); - Set_Privals_Chain (Comp_Id, New_Elmt_List); + Edef := Make_Defining_Identifier (Loc, - Build_Selected_Name (Prottyp, Comp_Id, 'E')); - + Build_Selected_Name (Prot_Typ, Comp_Id, 'E')); Sub := Make_Subprogram_Declaration (Loc, Specification => - Build_Protected_Entry_Specification (Edef, Comp_Id, Loc)); + Build_Protected_Entry_Specification (Loc, Edef, Comp_Id)); Insert_After (Current_Node, Sub); Analyze (Sub); - Set_Protected_Body_Subprogram ( - Defining_Identifier (Comp), - Defining_Unit_Name (Specification (Sub))); + Set_Protected_Body_Subprogram + (Defining_Identifier (Comp), + Defining_Unit_Name (Specification (Sub))); Current_Node := Sub; Bdef := Make_Defining_Identifier (Loc, - Build_Selected_Name (Prottyp, Comp_Id, 'E')); + Chars => Build_Selected_Name (Prot_Typ, Comp_Id, 'E')); Sub := Make_Subprogram_Declaration (Loc, Specification => - Build_Barrier_Function_Specification (Bdef, Loc)); + Build_Barrier_Function_Specification (Loc, Bdef)); Insert_After (Current_Node, Sub); Analyze (Sub); @@ -7670,7 +7551,7 @@ package body Exp_Ch9 is -- Collect pointers to the protected subprogram and the barrier -- of the current entry, for insertion into Entry_Bodies_Array. - Append ( + Append_To (Expressions (Entries_Aggr), Make_Aggregate (Loc, Expressions => New_List ( Make_Attribute_Reference (Loc, @@ -7678,8 +7559,7 @@ package body Exp_Ch9 is Attribute_Name => Name_Unrestricted_Access), Make_Attribute_Reference (Loc, Prefix => New_Reference_To (Edef, Loc), - Attribute_Name => Name_Unrestricted_Access))), - Expressions (Entries_Aggr)); + Attribute_Name => Name_Unrestricted_Access)))); end if; Next (Comp); @@ -7689,11 +7569,12 @@ package body Exp_Ch9 is -- Emit declaration for Entry_Bodies_Array, now that the addresses of -- all protected subprograms have been collected. - if Has_Entries (Prottyp) then - Body_Id := Make_Defining_Identifier (Sloc (Prottyp), - New_External_Name (Chars (Prottyp), 'A')); + if Has_Entries (Prot_Typ) then + Body_Id := + Make_Defining_Identifier (Sloc (Prot_Typ), + Chars => New_External_Name (Chars (Prot_Typ), 'A')); - case Corresponding_Runtime_Package (Prottyp) is + case Corresponding_Runtime_Package (Prot_Typ) is when System_Tasking_Protected_Objects_Entries => Body_Arr := Make_Object_Declaration (Loc, Defining_Identifier => Body_Id, @@ -7737,19 +7618,19 @@ package body Exp_Ch9 is Current_Node := Body_Arr; Analyze (Body_Arr); - Set_Entry_Bodies_Array (Prottyp, Body_Id); + Set_Entry_Bodies_Array (Prot_Typ, Body_Id); -- Finally, build the function that maps an entry index into the -- corresponding body. A pointer to this function is placed in each -- object of the type. Except for a ravenscar-like profile (no abort, -- no entry queue, 1 entry) - if Corresponding_Runtime_Package (Prottyp) - = System_Tasking_Protected_Objects_Entries + if Corresponding_Runtime_Package (Prot_Typ) = + System_Tasking_Protected_Objects_Entries then Sub := Make_Subprogram_Declaration (Loc, - Specification => Build_Find_Body_Index_Spec (Prottyp)); + Specification => Build_Find_Body_Index_Spec (Prot_Typ)); Insert_After (Current_Node, Sub); Analyze (Sub); end if; @@ -9253,9 +9134,11 @@ package body Exp_Ch9 is New_N : Node_Id; begin - -- Here we start the expansion by generating discriminal declarations + -- Add renaming declarations for discriminals and a declaration for the + -- entry family index (if applicable). - Add_Discriminal_Declarations (Declarations (N), Ttyp, Name_uTask, Loc); + Install_Private_Data_Declarations + (Loc, Task_Body_Procedure (Ttyp), Ttyp, N, Declarations (N)); -- Add a call to Abort_Undefer at the very beginning of the task -- body since this body is called with abort still deferred. @@ -9286,15 +9169,15 @@ package body Exp_Ch9 is New_N := Make_Subprogram_Body (Loc, - Specification => Build_Task_Proc_Specification (Ttyp), - Declarations => Declarations (N), + Specification => Build_Task_Proc_Specification (Ttyp), + Declarations => Declarations (N), Handled_Statement_Sequence => Handled_Statement_Sequence (N)); - -- If the task contains generic instantiations, cleanup actions - -- are delayed until after instantiation. Transfer the activation - -- chain to the subprogram, to insure that the activation call is - -- properly generated. It the task body contains inner tasks, indicate - -- that the subprogram is a task master. + -- If the task contains generic instantiations, cleanup actions are + -- delayed until after instantiation. Transfer the activation chain to + -- the subprogram, to insure that the activation call is properly + -- generated. It the task body contains inner tasks, indicate that the + -- subprogram is a task master. if Delay_Cleanups (Ttyp) then Set_Activation_Chain_Entity (New_N, Activation_Chain_Entity (N)); @@ -9348,7 +9231,6 @@ package body Exp_Ch9 is if Nkind (Vis_Decl) = N_Entry_Declaration and then Ekind (Defining_Identifier (Vis_Decl)) = E_Entry then - -- Create the specification of the wrapper Wrap_Body := @@ -9392,6 +9274,10 @@ package body Exp_Ch9 is -- or -- taskZ : Size_Type := Size_Type (size_expression); + -- Note: No variable is needed to hold the task relative deadline since + -- its value would never be static because the parameter is of a private + -- type (Ada.Real_Time.Time_Span). + -- Next we create a corresponding record type declaration used to represent -- values of this task. The general form of this type declaration is @@ -9434,6 +9320,11 @@ package body Exp_Ch9 is -- present in the pragma, and is used to provide the Task_Image parameter -- to the call to Create_Task. + -- The _Relative_Deadline field is present only if a Relative_Deadline + -- pragma appears in the task definition. The expression captures the + -- argument that was present in the pragma, and is used to provide the + -- Relative_Deadline parameter to the call to Create_Task. + -- When a task is declared, an instance of the task value record is -- created. The elaboration of this declaration creates the correct bounds -- for the entry families, and also evaluates the size, priority, and @@ -9465,10 +9356,10 @@ package body Exp_Ch9 is -- the case of a simple entry. procedure Expand_N_Task_Type_Declaration (N : Node_Id) is - Loc : constant Source_Ptr := Sloc (N); - Tasktyp : constant Entity_Id := Etype (Defining_Identifier (N)); - Tasknm : constant Name_Id := Chars (Tasktyp); - Taskdef : constant Node_Id := Task_Definition (N); + Loc : constant Source_Ptr := Sloc (N); + Tasktyp : constant Entity_Id := Etype (Defining_Identifier (N)); + Tasknm : constant Name_Id := Chars (Tasktyp); + Taskdef : constant Node_Id := Task_Definition (N); Proc_Spec : Node_Id; Rec_Decl : Node_Id; @@ -9752,6 +9643,34 @@ package body Exp_Ch9 is (Taskdef, Name_Task_Info))))))); end if; + -- Add the _Relative_Deadline component if a Relative_Deadline pragma is + -- present. If we are using a restricted run time this component will + -- not be added (deadlines are not allowed by the Ravenscar profile). + + if not Restricted_Profile + and then Present (Taskdef) + and then Has_Relative_Deadline_Pragma (Taskdef) + then + Append_To (Cdecls, + Make_Component_Declaration (Loc, + Defining_Identifier => + Make_Defining_Identifier (Loc, Name_uRelative_Deadline), + + Component_Definition => + Make_Component_Definition (Loc, + Aliased_Present => False, + Subtype_Indication => + New_Reference_To (RTE (RE_Time_Span), Loc)), + + Expression => + Convert_To (RTE (RE_Time_Span), + Relocate_Node ( + Expression (First ( + Pragma_Argument_Associations ( + Find_Task_Or_Protected_Pragma + (Taskdef, Name_Relative_Deadline)))))))); + end if; + Insert_After (Size_Decl, Rec_Decl); -- Analyze the record declaration immediately after construction, @@ -10425,56 +10344,10 @@ package body Exp_Ch9 is -- Expand_Protected_Body_Declarations -- ---------------------------------------- - -- Part of the expansion of a protected body involves the creation of a - -- declaration that can be referenced from the statement sequences of the - -- entry bodies: - - -- A : Address; - - -- This declaration is inserted in the declarations of the service entries - -- procedure for the protected body, and it is important that it be - -- inserted before the statements of the entry body statement sequences are - -- analyzed. Thus it would be too late to create this declaration in the - -- Expand_N_Protected_Body routine, which is why there is a separate - -- procedure to be called directly from Sem_Ch9. - - -- Ann is used to hold the address of the record containing the parameters - -- (see Expand_N_Entry_Call for more details on how this record is built). - -- References to the parameters do an unchecked conversion of this address - -- to a pointer to the required record type, and then access the field that - -- holds the value of the required parameter. The entity for the address - -- variable is held as the top stack element (i.e. the last element) of the - -- Accept_Address stack in the corresponding entry entity, and this element - -- must be set in place before the statements are processed. - - -- No stack is needed for entry bodies, since they cannot be nested, but it - -- is kept for consistency between protected and task entries. The stack - -- will never contain more than one element. There is also only one such - -- variable for a given protected body, but this is placed on the - -- Accept_Address stack of all of the entries, again for consistency. - - -- To expand the requeue statement, a label is provided at the end of the - -- loop in the entry service routine created by the expander (see - -- Expand_N_Protected_Body for details), so that the statement can be - -- skipped after the requeue is complete. This label is created during the - -- expansion of the entry body, which will take place after the expansion - -- of the requeue statements that it contains, so a placeholder defining - -- identifier is associated with the task type here. - - -- Another label is provided following case statement created by the - -- expander. This label is need for implementing return statement from - -- entry body so that a return can be expanded as a goto to this label. - -- This label is created during the expansion of the entry body, which - -- will take place after the expansion of the return statements that it - -- contains. Therefore, just like the label for expanding requeues, we - -- need another placeholder for the label. - procedure Expand_Protected_Body_Declarations (N : Node_Id; Spec_Id : Entity_Id) is - Op : Node_Id; - begin if No_Run_Time_Mode then Error_Msg_CRT ("protected body", N); @@ -10482,15 +10355,11 @@ package body Exp_Ch9 is elsif Expander_Active then - -- Associate privals with the first subprogram or entry body to be - -- expanded. These are used to expand references to private data - -- objects. - - Op := First_Protected_Operation (Declarations (N)); + -- Associate discriminals with the first subprogram or entry body to + -- be expanded. - if Present (Op) then + if Present (First_Protected_Operation (Declarations (N))) then Set_Discriminals (Parent (Spec_Id)); - Set_Privals (Parent (Spec_Id), Op, Sloc (N)); end if; end if; end Expand_Protected_Body_Declarations; @@ -10811,131 +10680,434 @@ package body Exp_Ch9 is return First_Op; end First_Protected_Operation; - --------------------------------- - -- Is_Potentially_Large_Family -- - --------------------------------- - - function Is_Potentially_Large_Family - (Base_Index : Entity_Id; - Conctyp : Entity_Id; - Lo : Node_Id; - Hi : Node_Id) return Boolean - is - begin - return Scope (Base_Index) = Standard_Standard - and then Base_Index = Base_Type (Standard_Integer) - and then Has_Discriminants (Conctyp) - and then Present - (Discriminant_Default_Value (First_Discriminant (Conctyp))) - and then - (Denotes_Discriminant (Lo, True) - or else Denotes_Discriminant (Hi, True)); - end Is_Potentially_Large_Family; - - -------------------------------- - -- Index_Constant_Declaration -- - -------------------------------- + --------------------------------------- + -- Install_Private_Data_Declarations -- + --------------------------------------- - function Index_Constant_Declaration - (N : Node_Id; - Index_Id : Entity_Id; - Prot : Entity_Id) return List_Id + procedure Install_Private_Data_Declarations + (Loc : Source_Ptr; + Spec_Id : Entity_Id; + Conc_Typ : Entity_Id; + Body_Nod : Node_Id; + Decls : List_Id; + Barrier : Boolean := False; + Family : Boolean := False) is - Loc : constant Source_Ptr := Sloc (N); - Decls : constant List_Id := New_List; - Index_Con : constant Entity_Id := Entry_Index_Constant (Index_Id); - Index_Typ : Entity_Id; - - Hi : Node_Id := Type_High_Bound (Etype (Index_Id)); - Lo : Node_Id := Type_Low_Bound (Etype (Index_Id)); + Is_Protected : constant Boolean := Is_Protected_Type (Conc_Typ); + Decl : Node_Id; + Def : Node_Id; + Insert_Node : Node_Id := Empty; + Obj_Ent : Entity_Id; + + procedure Add (Decl : Node_Id); + -- Add a single declaration after Insert_Node. If this is the first + -- addition, Decl is added to the front of Decls and it becomes the + -- insertion node. + + function Replace_Bound (Bound : Node_Id) return Node_Id; + -- The bounds of an entry index may depend on discriminants, create a + -- reference to the corresponding prival. Otherwise return a duplicate + -- of the original bound. + + --------- + -- Add -- + --------- + + procedure Add (Decl : Node_Id) is + begin + if No (Insert_Node) then + Prepend_To (Decls, Decl); + else + Insert_After (Insert_Node, Decl); + end if; - function Replace_Discriminant (Bound : Node_Id) return Node_Id; - -- The bounds of the entry index may depend on discriminants, so each - -- declaration of an entry_index_constant must have its own subtype - -- declaration, using the local renaming of the object discriminant. + Insert_Node := Decl; + end Add; -------------------------- -- Replace_Discriminant -- -------------------------- - function Replace_Discriminant (Bound : Node_Id) return Node_Id is + function Replace_Bound (Bound : Node_Id) return Node_Id is begin if Nkind (Bound) = N_Identifier - and then Ekind (Entity (Bound)) = E_Constant - and then Present (Discriminal_Link (Entity (Bound))) + and then Is_Discriminal (Entity (Bound)) then return Make_Identifier (Loc, Chars (Entity (Bound))); else return Duplicate_Subexpr (Bound); end if; - end Replace_Discriminant; + end Replace_Bound; - -- Start of processing for Index_Constant_Declaration + -- Start of processing for Install_Private_Data_Declarations begin - Set_Discriminal_Link (Index_Con, Index_Id); + -- Step 1: Retrieve the concurrent object entity. Obj_Ent can denote + -- formal parameter _O, _object or _task depending on the context. + + Obj_Ent := Concurrent_Object (Spec_Id, Conc_Typ); - if Is_Entity_Name ( - Original_Node (Discrete_Subtype_Definition (Parent (Index_Id)))) + -- Special processing of _O for barrier functions, protected entries + -- and families. + + if Barrier + or else + (Is_Protected + and then + (Ekind (Spec_Id) = E_Entry + or else Ekind (Spec_Id) = E_Entry_Family)) then - -- Simple case: entry family is given by a subtype mark, and index - -- constant has the same type, no replacement needed. + declare + Conc_Rec : constant Entity_Id := + Corresponding_Record_Type (Conc_Typ); + Typ_Id : constant Entity_Id := + Make_Defining_Identifier (Loc, + New_External_Name (Chars (Conc_Rec), 'P')); + begin + -- Generate: + -- type prot_typVP is access prot_typV; - Index_Typ := Etype (Index_Id); + Decl := + Make_Full_Type_Declaration (Loc, + Defining_Identifier => Typ_Id, + Type_Definition => + Make_Access_To_Object_Definition (Loc, + Subtype_Indication => + New_Reference_To (Conc_Rec, Loc))); + Add (Decl); - else - Hi := Replace_Discriminant (Hi); - Lo := Replace_Discriminant (Lo); + -- Generate: + -- _object : prot_typVP := prot_typV (_O); - Index_Typ := Make_Defining_Identifier (Loc, New_Internal_Name ('J')); + Decl := + Make_Object_Declaration (Loc, + Defining_Identifier => + Make_Defining_Identifier (Loc, Name_uObject), + Object_Definition => New_Reference_To (Typ_Id, Loc), + Expression => + Unchecked_Convert_To (Typ_Id, + New_Reference_To (Obj_Ent, Loc))); + Add (Decl); - Append ( - Make_Subtype_Declaration (Loc, - Defining_Identifier => Index_Typ, - Subtype_Indication => - Make_Subtype_Indication (Loc, - Subtype_Mark => - New_Occurrence_Of (Base_Type (Etype (Index_Id)), Loc), - Constraint => - Make_Range_Constraint (Loc, - Range_Expression => Make_Range (Loc, Lo, Hi)))), - Decls); + -- Set the reference to the concurrent object + Obj_Ent := Defining_Identifier (Decl); + end; end if; - Append ( - Make_Object_Declaration (Loc, - Defining_Identifier => Index_Con, - Constant_Present => True, - Object_Definition => New_Occurrence_Of (Index_Typ, Loc), + -- Step 2: Create the Protection object and build its declaration for + -- any protected entry (family) of subprogram. - Expression => - Make_Attribute_Reference (Loc, - Prefix => New_Reference_To (Index_Typ, Loc), - Attribute_Name => Name_Val, + if Is_Protected then + declare + Prot_Ent : constant Entity_Id := + Make_Defining_Identifier (Loc, + New_Internal_Name ('R')); + Prot_Typ : RE_Id; - Expressions => New_List ( + begin + Set_Protection_Object (Spec_Id, Prot_Ent); - Make_Op_Add (Loc, - Left_Opnd => - Make_Op_Subtract (Loc, - Left_Opnd => Make_Identifier (Loc, Name_uE), - Right_Opnd => - Entry_Index_Expression (Loc, - Defining_Identifier (N), Empty, Prot)), + -- Determine the proper protection type - Right_Opnd => - Make_Attribute_Reference (Loc, - Prefix => New_Reference_To (Index_Typ, Loc), - Attribute_Name => Name_Pos, - Expressions => New_List ( - Make_Attribute_Reference (Loc, - Prefix => New_Reference_To (Index_Typ, Loc), - Attribute_Name => Name_First))))))), - Decls); + if Has_Attach_Handler (Conc_Typ) + and then not Restricted_Profile + then + Prot_Typ := RE_Static_Interrupt_Protection; + + elsif Has_Interrupt_Handler (Conc_Typ) then + Prot_Typ := RE_Dynamic_Interrupt_Protection; + + -- The type has explicit entries or generated primitive entry + -- wrappers. + + elsif Has_Entries (Conc_Typ) + or else + (Ada_Version >= Ada_05 + and then Present (Interface_List (Parent (Conc_Typ)))) + then + case Corresponding_Runtime_Package (Conc_Typ) is + when System_Tasking_Protected_Objects_Entries => + Prot_Typ := RE_Protection_Entries; + + when System_Tasking_Protected_Objects_Single_Entry => + Prot_Typ := RE_Protection_Entry; + + when others => + raise Program_Error; + end case; + + else + Prot_Typ := RE_Protection; + end if; + + -- Generate: + -- conc_typR : protection_typ renames _object._object; + + Decl := + Make_Object_Renaming_Declaration (Loc, + Defining_Identifier => Prot_Ent, + Subtype_Mark => + New_Reference_To (RTE (Prot_Typ), Loc), + Name => + Make_Selected_Component (Loc, + Prefix => + New_Reference_To (Obj_Ent, Loc), + Selector_Name => + Make_Identifier (Loc, Name_uObject))); + Add (Decl); + end; + end if; + + -- Step 3: Add discriminant renamings (if any) + + if Has_Discriminants (Conc_Typ) then + declare + D : Entity_Id; + + begin + D := First_Discriminant (Conc_Typ); + while Present (D) loop - return Decls; - end Index_Constant_Declaration; + -- Adjust the source location + + Set_Sloc (Discriminal (D), Loc); + + -- Generate: + -- discr_name : discr_typ renames _object.discr_name; + -- or + -- discr_name : discr_typ renames _task.discr_name; + + Decl := + Make_Object_Renaming_Declaration (Loc, + Defining_Identifier => Discriminal (D), + Subtype_Mark => New_Reference_To (Etype (D), Loc), + Name => + Make_Selected_Component (Loc, + Prefix => New_Reference_To (Obj_Ent, Loc), + Selector_Name => Make_Identifier (Loc, Chars (D)))); + Add (Decl); + + Next_Discriminant (D); + end loop; + end; + end if; + + -- Step 4: Add private component renamings (if any) + + if Is_Protected then + Def := Protected_Definition (Parent (Conc_Typ)); + + if Present (Private_Declarations (Def)) then + declare + Comp : Node_Id; + Comp_Id : Entity_Id; + Decl_Id : Entity_Id; + + begin + Comp := First (Private_Declarations (Def)); + while Present (Comp) loop + if Nkind (Comp) = N_Component_Declaration then + Comp_Id := Defining_Identifier (Comp); + Decl_Id := + Make_Defining_Identifier (Loc, Chars (Comp_Id)); + + -- Minimal decoration + + if Ekind (Spec_Id) = E_Function then + Set_Ekind (Decl_Id, E_Constant); + else + Set_Ekind (Decl_Id, E_Variable); + end if; + + Set_Prival (Comp_Id, Decl_Id); + Set_Prival_Link (Decl_Id, Comp_Id); + Set_Is_Aliased (Decl_Id, Is_Aliased (Comp_Id)); + + -- Generate: + -- comp_name : comp_typ renames _object.comp_name; + + Decl := + Make_Object_Renaming_Declaration (Loc, + Defining_Identifier => Decl_Id, + Subtype_Mark => + New_Reference_To (Etype (Comp_Id), Loc), + Name => + Make_Selected_Component (Loc, + Prefix => + New_Reference_To (Obj_Ent, Loc), + Selector_Name => + Make_Identifier (Loc, Chars (Comp_Id)))); + Add (Decl); + end if; + + Next (Comp); + end loop; + end; + end if; + end if; + + -- Step 5: Add the declaration of the entry index and the associated + -- type for barrier functions and entry families. + + if (Barrier and then Family) + or else Ekind (Spec_Id) = E_Entry_Family + then + declare + E : constant Entity_Id := Index_Object (Spec_Id); + Index : constant Entity_Id := + Defining_Identifier ( + Entry_Index_Specification ( + Entry_Body_Formal_Part (Body_Nod))); + Index_Con : constant Entity_Id := + Make_Defining_Identifier (Loc, Chars (Index)); + High : Node_Id; + Index_Typ : Entity_Id; + Low : Node_Id; + + begin + -- Minimal decoration + + Set_Ekind (Index_Con, E_Constant); + Set_Entry_Index_Constant (Index, Index_Con); + Set_Discriminal_Link (Index_Con, Index); + + -- Retrieve the bounds of the entry family + + High := Type_High_Bound (Etype (Index)); + Low := Type_Low_Bound (Etype (Index)); + + -- In the simple case the entry family is given by a subtype + -- mark and the index constant has the same type. + + if Is_Entity_Name (Original_Node ( + Discrete_Subtype_Definition (Parent (Index)))) + then + Index_Typ := Etype (Index); + + -- Otherwise a new subtype declaration is required + + else + High := Replace_Bound (High); + Low := Replace_Bound (Low); + + Index_Typ := + Make_Defining_Identifier (Loc, New_Internal_Name ('J')); + + -- Generate: + -- subtype Jnn is <Etype of Index> range Low .. High; + + Decl := + Make_Subtype_Declaration (Loc, + Defining_Identifier => Index_Typ, + Subtype_Indication => + Make_Subtype_Indication (Loc, + Subtype_Mark => + New_Reference_To (Base_Type (Etype (Index)), Loc), + Constraint => + Make_Range_Constraint (Loc, + Range_Expression => + Make_Range (Loc, Low, High)))); + Add (Decl); + end if; + + Set_Etype (Index_Con, Index_Typ); + + -- Create the object which designates the index: + -- J : constant Jnn := + -- Jnn'Val (_E - <index expr> + Jnn'Pos (Jnn'First)); + -- + -- where Jnn is the subtype created above or the original type of + -- the index, _E is a formal of the protected body subprogram and + -- <index expr> is the index of the first family member. + + Decl := + Make_Object_Declaration (Loc, + Defining_Identifier => Index_Con, + Constant_Present => True, + Object_Definition => + New_Reference_To (Index_Typ, Loc), + + Expression => + Make_Attribute_Reference (Loc, + Prefix => + New_Reference_To (Index_Typ, Loc), + Attribute_Name => Name_Val, + + Expressions => New_List ( + + Make_Op_Add (Loc, + Left_Opnd => + Make_Op_Subtract (Loc, + Left_Opnd => + New_Reference_To (E, Loc), + Right_Opnd => + Entry_Index_Expression (Loc, + Defining_Identifier (Body_Nod), + Empty, Conc_Typ)), + + Right_Opnd => + Make_Attribute_Reference (Loc, + Prefix => + New_Reference_To (Index_Typ, Loc), + Attribute_Name => Name_Pos, + Expressions => New_List ( + Make_Attribute_Reference (Loc, + Prefix => + New_Reference_To (Index_Typ, Loc), + Attribute_Name => Name_First))))))); + Add (Decl); + end; + end if; + end Install_Private_Data_Declarations; + + --------------------------------- + -- Is_Potentially_Large_Family -- + --------------------------------- + + function Is_Potentially_Large_Family + (Base_Index : Entity_Id; + Conctyp : Entity_Id; + Lo : Node_Id; + Hi : Node_Id) return Boolean + is + begin + return Scope (Base_Index) = Standard_Standard + and then Base_Index = Base_Type (Standard_Integer) + and then Has_Discriminants (Conctyp) + and then Present + (Discriminant_Default_Value (First_Discriminant (Conctyp))) + and then + (Denotes_Discriminant (Lo, True) + or else Denotes_Discriminant (Hi, True)); + end Is_Potentially_Large_Family; + + ------------------ + -- Index_Object -- + ------------------ + + function Index_Object (Spec_Id : Entity_Id) return Entity_Id is + Bod_Subp : constant Entity_Id := Protected_Body_Subprogram (Spec_Id); + Formal : Entity_Id; + + begin + Formal := First_Formal (Bod_Subp); + while Present (Formal) loop + + -- Look for formal parameter _E + + if Chars (Formal) = Name_uE then + return Formal; + end if; + + Next_Formal (Formal); + end loop; + + -- A protected body subprogram should always have the parameter in + -- question. + + raise Program_Error; + end Index_Object; -------------------------------- -- Make_Initialize_Protection -- @@ -11162,7 +11334,7 @@ package body Exp_Ch9 is -- or, in the case of Ravenscar: - -- Install_Handlers + -- Install_Restricted_Handlers -- ((Expr1, Proc1'access), ...., (ExprN, ProcN'access)); declare @@ -11171,19 +11343,6 @@ package body Exp_Ch9 is Ritem : Node_Id := First_Rep_Item (Ptyp); begin - if not Restricted then - - -- Appends the _object argument - - Append_To (Args, - Make_Attribute_Reference (Loc, - Prefix => - Make_Selected_Component (Loc, - Prefix => Make_Identifier (Loc, Name_uInit), - Selector_Name => Make_Identifier (Loc, Name_uObject)), - Attribute_Name => Name_Unchecked_Access)); - end if; - -- Build the Attach_Handler table argument while Present (Ritem) loop @@ -11218,12 +11377,39 @@ package body Exp_Ch9 is Append_To (Args, Make_Aggregate (Loc, Table)); - -- Append the Install_Handler call to the statements + -- Append the Install_Handlers (or Install_Restricted_Handlers) + -- call to the statements. - Append_To (L, - Make_Procedure_Call_Statement (Loc, - Name => New_Reference_To (RTE (RE_Install_Handlers), Loc), - Parameter_Associations => Args)); + if Restricted then + -- Call a simplified version of Install_Handlers to be used + -- when the Ravenscar restrictions are in effect + -- (Install_Restricted_Handlers). + + Append_To (L, + Make_Procedure_Call_Statement (Loc, + Name => + New_Reference_To + (RTE (RE_Install_Restricted_Handlers), Loc), + Parameter_Associations => Args)); + + else + -- First, prepends the _object argument + + Prepend_To (Args, + Make_Attribute_Reference (Loc, + Prefix => + Make_Selected_Component (Loc, + Prefix => Make_Identifier (Loc, Name_uInit), + Selector_Name => Make_Identifier (Loc, Name_uObject)), + Attribute_Name => Name_Unchecked_Access)); + + -- Then, insert call to Install_Handlers + + Append_To (L, + Make_Procedure_Call_Statement (Loc, + Name => New_Reference_To (RTE (RE_Install_Handlers), Loc), + Parameter_Associations => Args)); + end if; end; end if; @@ -11347,18 +11533,43 @@ package body Exp_Ch9 is if not Restricted_Profile then + -- Deadline parameter. If no Relative_Deadline pragma is present, + -- then the deadline is Time_Span_Zero. If a pragma is present, then + -- the deadline is taken from the _Relative_Deadline field of the + -- task value record, which was set from the pragma value. Note that + -- this parameter must not be generated for the restricted profiles + -- since Ravenscar does not allow deadlines. + + -- Case where pragma Relative_Deadline applies: use given value + + if Present (Tdef) and then Has_Relative_Deadline_Pragma (Tdef) then + Append_To (Args, + Make_Selected_Component (Loc, + Prefix => Make_Identifier (Loc, Name_uInit), + Selector_Name => + Make_Identifier (Loc, Name_uRelative_Deadline))); + + -- No pragma Relative_Deadline apply to the task + + else + Append_To (Args, + New_Reference_To (RTE (RE_Time_Span_Zero), Loc)); + end if; + -- Number of entries. This is an expression of the form: - -- + -- n + _Init.a'Length + _Init.a'B'Length + ... - -- + -- where a,b... are the entry family names for the task definition - Ecount := Build_Entry_Count_Expression ( - Ttyp, - Component_Items (Component_List ( - Type_Definition (Parent ( - Corresponding_Record_Type (Ttyp))))), - Loc); + Ecount := + Build_Entry_Count_Expression + (Ttyp, + Component_Items + (Component_List + (Type_Definition + (Parent (Corresponding_Record_Type (Ttyp))))), + Loc); Append_To (Args, Ecount); -- Master parameter. This is a reference to the _Master parameter of @@ -11375,17 +11586,55 @@ package body Exp_Ch9 is end if; -- State parameter. This is a pointer to the task body procedure. The - -- required value is obtained by taking the address of the task body - -- procedure and converting it (with an unchecked conversion) to the - -- type required by the task kernel. For further details, see the - -- description of Expand_N_Task_Body + -- required value is obtained by taking 'Unrestricted_Access of the task + -- body procedure and converting it (with an unchecked conversion) to + -- the type required by the task kernel. For further details, see the + -- description of Expand_N_Task_Body. We use 'Unrestricted_Access rather + -- than 'Address in order to avoid creating trampolines. - Append_To (Args, - Unchecked_Convert_To (RTE (RE_Task_Procedure_Access), - Make_Attribute_Reference (Loc, - Prefix => - New_Occurrence_Of (Get_Task_Body_Procedure (Ttyp), Loc), - Attribute_Name => Name_Address))); + declare + Body_Proc : constant Node_Id := Get_Task_Body_Procedure (Ttyp); + Subp_Ptr_Typ : constant Node_Id := + Create_Itype (E_Access_Subprogram_Type, Tdec); + Ref : constant Node_Id := Make_Itype_Reference (Loc); + + begin + Set_Directly_Designated_Type (Subp_Ptr_Typ, Body_Proc); + Set_Etype (Subp_Ptr_Typ, Subp_Ptr_Typ); + + -- Be sure to freeze a reference to the access-to-subprogram type, + -- otherwise gigi will complain that it's in the wrong scope, because + -- it's actually inside the init procedure for the record type that + -- corresponds to the task type. + + -- This processing is causing a crash in the .NET/JVM back ends that + -- is not yet understood, so skip it in these cases ??? + + if VM_Target = No_VM then + Set_Itype (Ref, Subp_Ptr_Typ); + Append_Freeze_Action (Task_Rec, Ref); + + Append_To (Args, + Unchecked_Convert_To (RTE (RE_Task_Procedure_Access), + Make_Qualified_Expression (Loc, + Subtype_Mark => New_Reference_To (Subp_Ptr_Typ, Loc), + Expression => + Make_Attribute_Reference (Loc, + Prefix => + New_Occurrence_Of (Body_Proc, Loc), + Attribute_Name => Name_Unrestricted_Access)))); + + -- For the .NET/JVM cases revert to the original code below ??? + + else + Append_To (Args, + Unchecked_Convert_To (RTE (RE_Task_Procedure_Access), + Make_Attribute_Reference (Loc, + Prefix => + New_Occurrence_Of (Body_Proc, Loc), + Attribute_Name => Name_Address))); + end if; + end; -- Discriminants parameter. This is just the address of the task -- value record itself (which contains the discriminant values @@ -11684,125 +11933,6 @@ package body Exp_Ch9 is end if; end Set_Discriminals; - ----------------- - -- Set_Privals -- - ----------------- - - procedure Set_Privals - (Dec : Node_Id; - Op : Node_Id; - Loc : Source_Ptr; - After_Barrier : Boolean := False) - is - P_Decl : Node_Id; - P_Id : Entity_Id; - Priv : Entity_Id; - Def : Node_Id; - Body_Ent : Entity_Id; - For_Barrier : constant Boolean := - Nkind (Op) = N_Entry_Body and then not After_Barrier; - - Prec_Decl : constant Node_Id := - Parent (Corresponding_Record_Type - (Defining_Identifier (Dec))); - Prec_Def : constant Entity_Id := Type_Definition (Prec_Decl); - Obj_Decl : Node_Id; - P_Subtype : Entity_Id; - Assoc_L : constant Elist_Id := New_Elmt_List; - Op_Id : Entity_Id; - - begin - pragma Assert (Nkind (Dec) = N_Protected_Type_Declaration); - pragma Assert (Nkind_In (Op, N_Subprogram_Body, N_Entry_Body)); - - Def := Protected_Definition (Dec); - - if Present (Private_Declarations (Def)) then - P_Decl := First (Private_Declarations (Def)); - while Present (P_Decl) loop - if Nkind (P_Decl) = N_Component_Declaration then - P_Id := Defining_Identifier (P_Decl); - - if For_Barrier then - Priv := - Make_Defining_Identifier (Loc, - Chars => New_External_Name (Chars (P_Id), 'P')); - else - Priv := - Make_Defining_Identifier (Loc, - Chars => New_External_Name (Chars (P_Id))); - end if; - - Set_Ekind (Priv, E_Variable); - Set_Etype (Priv, Etype (P_Id)); - Set_Scope (Priv, Scope (P_Id)); - Set_Esize (Priv, Esize (Etype (P_Id))); - Set_Is_Aliased (Priv, Is_Aliased (P_Id)); - Set_Alignment (Priv, Alignment (Etype (P_Id))); - - -- If the type of the component is an itype, we must create a - -- new itype for the corresponding prival in each protected - -- operation, to avoid scoping problems. We create new itypes - -- by copying the tree for the component definition. - -- (Ada 2005) If the itype is an anonymous access type created - -- for an access definition for a component, it is declared in - -- the enclosing scope, and we do no create a local version of - -- it, to prevent scoping anomalies in gigi. - - if Is_Itype (Etype (P_Id)) - and then not - (Is_Access_Type (Etype (P_Id)) - and then Is_Local_Anonymous_Access (Etype (P_Id))) - then - Append_Elmt (P_Id, Assoc_L); - Append_Elmt (Priv, Assoc_L); - - if Nkind (Op) = N_Entry_Body then - Op_Id := Defining_Identifier (Op); - else - Op_Id := Defining_Unit_Name (Specification (Op)); - end if; - - Discard_Node - (New_Copy_Tree (P_Decl, Assoc_L, New_Scope => Op_Id)); - end if; - - Set_Protected_Operation (P_Id, Op); - Set_Prival (P_Id, Priv); - end if; - - Next (P_Decl); - end loop; - end if; - - -- There is one more implicit private decl: the object itself. "prival" - -- for this is attached to the protected body defining identifier. - - Body_Ent := Corresponding_Body (Dec); - - Priv := - Make_Defining_Identifier (Sloc (Body_Ent), - Chars => New_External_Name (Chars (Body_Ent), 'R')); - - -- Set the Etype to the implicit subtype of Protection created when - -- the protected type declaration was expanded. This node will not - -- be analyzed until it is used as the defining identifier for the - -- renaming declaration in the protected operation body, and it will - -- be needed in the references expanded before that body is expanded. - -- Since the Protection field is aliased, set Is_Aliased as well. - - Obj_Decl := First (Component_Items (Component_List (Prec_Def))); - while Chars (Defining_Identifier (Obj_Decl)) /= Name_uObject loop - Next (Obj_Decl); - end loop; - - P_Subtype := Etype (Defining_Identifier (Obj_Decl)); - Set_Ekind (Priv, E_Variable); - Set_Etype (Priv, P_Subtype); - Set_Is_Aliased (Priv); - Set_Object_Ref (Body_Ent, Priv); - end Set_Privals; - ----------------------- -- Trivial_Accept_OK -- ----------------------- @@ -11838,168 +11968,4 @@ package body Exp_Ch9 is end case; end Trivial_Accept_OK; - ---------------------------- - -- Update_Prival_Subtypes -- - ---------------------------- - - procedure Update_Prival_Subtypes (N : Node_Id) is - - function Process (N : Node_Id) return Traverse_Result; - -- Update the etype of occurrences of privals whose etype does not - -- match the current Etype of the prival entity itself. - - procedure Update_Array_Bounds (E : Entity_Id); - -- Itypes generated for array expressions may depend on the - -- determinants of the protected object, and need to be processed - -- separately because they are not attached to the tree. - - procedure Update_Index_Types (N : Node_Id); - -- Similarly, update the types of expressions in indexed components - -- which may depend on other discriminants. - - ------------- - -- Process -- - ------------- - - function Process (N : Node_Id) return Traverse_Result is - begin - if Is_Entity_Name (N) then - declare - E : constant Entity_Id := Entity (N); - begin - if Present (E) - and then (Ekind (E) = E_Constant - or else Ekind (E) = E_Variable) - and then Nkind (Parent (E)) = N_Object_Renaming_Declaration - and then not Is_Scalar_Type (Etype (E)) - and then Etype (N) /= Etype (E) - then - - -- Ensure that reference and entity have the same Etype, - -- to prevent back-end inconsistencies. - - Set_Etype (N, Etype (E)); - Update_Index_Types (N); - - elsif Present (E) - and then Ekind (E) = E_Constant - and then Present (Discriminal_Link (E)) - then - Set_Etype (N, Etype (E)); - end if; - end; - - return OK; - - elsif Nkind_In (N, N_Defining_Identifier, - N_Defining_Operator_Symbol, - N_Defining_Character_Literal) - then - return Skip; - - elsif Nkind (N) = N_String_Literal then - - -- Array type, but bounds are constant - - return OK; - - elsif Nkind (N) = N_Object_Declaration - and then Is_Itype (Etype (Defining_Identifier (N))) - and then Is_Array_Type (Etype (Defining_Identifier (N))) - then - Update_Array_Bounds (Etype (Defining_Identifier (N))); - return OK; - - -- For array components of discriminated records, use the base type - -- directly, because it may depend indirectly on the discriminants of - -- the protected type. - - -- Cleaner would be a systematic mechanism to compute actual subtypes - -- of private components??? - - elsif Nkind (N) in N_Has_Etype - and then Present (Etype (N)) - and then Is_Array_Type (Etype (N)) - and then Nkind (N) = N_Selected_Component - and then Has_Discriminants (Etype (Prefix (N))) - then - Set_Etype (N, Base_Type (Etype (N))); - Update_Index_Types (N); - return OK; - - else - if Nkind (N) in N_Has_Etype - and then Present (Etype (N)) - and then Is_Itype (Etype (N)) then - - if Is_Array_Type (Etype (N)) then - Update_Array_Bounds (Etype (N)); - - elsif Is_Scalar_Type (Etype (N)) then - Update_Prival_Subtypes (Type_Low_Bound (Etype (N))); - Update_Prival_Subtypes (Type_High_Bound (Etype (N))); - end if; - end if; - - return OK; - end if; - end Process; - - ------------------------- - -- Update_Array_Bounds -- - ------------------------- - - procedure Update_Array_Bounds (E : Entity_Id) is - Ind : Node_Id; - begin - Ind := First_Index (E); - while Present (Ind) loop - Update_Prival_Subtypes (Type_Low_Bound (Etype (Ind))); - Update_Prival_Subtypes (Type_High_Bound (Etype (Ind))); - Next_Index (Ind); - end loop; - end Update_Array_Bounds; - - ------------------------ - -- Update_Index_Types -- - ------------------------ - - procedure Update_Index_Types (N : Node_Id) is - Indx1 : Node_Id; - I_Typ : Node_Id; - - begin - -- If the prefix has an actual subtype that is different from the - -- nominal one, update the types of the indices, so that the proper - -- constraints are applied. Do not apply this transformation to a - -- packed array, where the index type is computed for a byte array - -- and is different from the source index. - - if Nkind (Parent (N)) = N_Indexed_Component - and then - not Is_Bit_Packed_Array (Etype (Prefix (Parent (N)))) - then - Indx1 := First (Expressions (Parent (N))); - I_Typ := First_Index (Etype (N)); - - while Present (Indx1) and then Present (I_Typ) loop - - if not Is_Entity_Name (Indx1) then - Set_Etype (Indx1, Base_Type (Etype (I_Typ))); - end if; - - Next (Indx1); - Next_Index (I_Typ); - end loop; - end if; - end Update_Index_Types; - - procedure Traverse is new Traverse_Proc (Process); - - -- Start of processing for Update_Prival_Subtypes - - begin - Traverse (N); - end Update_Prival_Subtypes; - end Exp_Ch9; diff --git a/gcc/ada/exp_ch9.ads b/gcc/ada/exp_ch9.ads index df3cdeb9fbf..71c1e830c3c 100644 --- a/gcc/ada/exp_ch9.ads +++ b/gcc/ada/exp_ch9.ads @@ -6,7 +6,7 @@ -- -- -- S p e c -- -- -- --- Copyright (C) 1992-2007, Free Software Foundation, Inc. -- +-- Copyright (C) 1992-2008, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -25,7 +25,6 @@ -- Expand routines for chapter 9 constructs -with Namet; use Namet; with Types; use Types; package Exp_Ch9 is @@ -37,41 +36,6 @@ package Exp_Ch9 is -- This type is used to distinguish the different protection modes of a -- protected subprogram. - procedure Add_Discriminal_Declarations - (Decls : List_Id; - Typ : Entity_Id; - Name : Name_Id; - Loc : Source_Ptr); - -- This routine is used to add discriminal declarations to task and - -- protected operation bodies. The discriminants are available by normal - -- selection from the concurrent object (whose name is passed as the third - -- parameter). Discriminant references inside the body have already - -- been replaced by references to the corresponding discriminals. The - -- declarations constructed by this procedure hook the references up with - -- the objects: - -- - -- discriminal_name : discr_type renames name.discriminant_name; - -- - -- Obviously we could have expanded the discriminant references in the - -- first place to be the appropriate selection, but this turns out to - -- be hard to do because it would introduce difference in handling of - -- discriminant references depending on their location. - - procedure Add_Private_Declarations - (Decls : List_Id; - Typ : Entity_Id; - Name : Name_Id; - Loc : Source_Ptr); - -- This routine is used to add private declarations to protected bodies. - -- These are analogous to the discriminal declarations added to tasks - -- and protected operations, and consist of a renaming of each private - -- object to a selection from the concurrent object passed as an extra - -- parameter to each such operation: - -- private_name : private_type renames name.private_name; - -- As with discriminals, private references inside the protected - -- subprogram bodies have already been replaced by references to the - -- corresponding privals. - procedure Build_Activation_Chain_Entity (N : Node_Id); -- Given a declaration N of an object that is a task, or contains tasks -- (other than allocators to tasks) this routine ensures that an activation @@ -113,12 +77,12 @@ package Exp_Ch9 is -- declarative part. function Build_Protected_Sub_Specification - (N : Node_Id; - Prottyp : Entity_Id; - Mode : Subprogram_Protection_Mode) return Node_Id; - -- Build specification for protected subprogram. This is called when + (N : Node_Id; + Prot_Typ : Entity_Id; + Mode : Subprogram_Protection_Mode) return Node_Id; + -- Build the specification for protected subprogram. This is called when -- expanding a protected type, and also when expanding the declaration for - -- an Access_To_Protected_Subprogram type. In the latter case, Prottyp is + -- an Access_To_Protected_Subprogram type. In the latter case, Prot_Typ is -- empty, and the first parameter of the signature of the protected op is -- of type System.Address. @@ -242,10 +206,6 @@ package Exp_Ch9 is -- now, within the context of the protected object, to resolve calls to -- other protected functions. - procedure Expand_Entry_Body_Declarations (N : Node_Id); - -- Expand declarations required for the expansion of the - -- statements of the body. - procedure Expand_N_Abort_Statement (N : Node_Id); procedure Expand_N_Accept_Statement (N : Node_Id); procedure Expand_N_Asynchronous_Select (N : Node_Id); @@ -277,11 +237,10 @@ package Exp_Ch9 is procedure Expand_Protected_Body_Declarations (N : Node_Id; Spec_Id : Entity_Id); - -- Expand declarations required for a protected body. See bodies of - -- both Expand_Protected_Body_Declarations and Expand_N_Protected_Body - -- for full details of the nature and use of these declarations. - -- The second argument is the entity for the corresponding - -- protected type declaration. + -- Expand declarations required for a protected body. See bodies of both + -- Expand_Protected_Body_Declarations and Expand_N_Protected_Body for full + -- details of the nature and use of these declarations. The second argument + -- is the entity for the corresponding protected type declaration. function External_Subprogram (E : Entity_Id) return Entity_Id; -- return the external version of a protected operation, which locks @@ -291,43 +250,79 @@ package Exp_Ch9 is -- Given the declarations list for a protected body, find the -- first protected operation body. + procedure Install_Private_Data_Declarations + (Loc : Source_Ptr; + Spec_Id : Entity_Id; + Conc_Typ : Entity_Id; + Body_Nod : Node_Id; + Decls : List_Id; + Barrier : Boolean := False; + Family : Boolean := False); + -- This routines generates several types, objects and object renamings used + -- in the handling of discriminants and private components of protected and + -- task types. It also generates the entry index for entry families. Formal + -- Spec_Id denotes an entry, entry family or a subprogram, Conc_Typ is the + -- concurrent type where Spec_Id resides, Body_Nod is the corresponding + -- body of Spec_Id, Decls are the declarations of the subprogram or entry. + -- Flag Barrier denotes whether the context is an entry barrier function. + -- Flag Family is used in conjunction with Barrier to denote a barrier for + -- an entry family. + -- + -- The generated types, entities and renamings are: + -- + -- * If flag Barrier is set or Spec_Id denotes a protected entry or an + -- entry family, generate: + -- + -- type prot_typVP is access prot_typV; + -- _object : prot_typVP := prot_typV (_O); + -- + -- where prot_typV is the corresponding record of a protected type and + -- _O is a formal parameter representing the concurrent object of either + -- the barrier function or the entry (family). + -- + -- * If Conc_Typ is a protected type, create a renaming for the Protection + -- field _object: + -- + -- conc_typR : protection_typ renames _object._object; + -- + -- * If Conc_Typ has discriminants, create renamings of the form: + -- + -- discr_nameD : discr_typ renames _object.discr_name; + -- or + -- discr_nameD : discr_typ renames _task.discr_name; + -- + -- * If Conc_Typ denotes a protected type and has private components, + -- generate renamings of the form: + -- + -- comp_name : comp_typ renames _object.comp_name; + -- + -- * Finally, is flag Barrier and Family are set or Spec_Id denotes an + -- entry family, generate the entry index constant: + -- + -- subtype Jnn is <Type of Index> range Low .. High; + -- J : constant Jnn := + -- Jnn'Val (_E - <Index expression> + Jnn'Pos (Jnn'First)); + -- + -- All the above declarations are inserted in the order shown to the front + -- of Decls. + function Make_Task_Create_Call (Task_Rec : Entity_Id) return Node_Id; -- Given the entity of the record type created for a task type, build -- the call to Create_Task function Make_Initialize_Protection - (Protect_Rec : Entity_Id) - return List_Id; + (Protect_Rec : Entity_Id) return List_Id; -- Given the entity of the record type created for a protected type, build -- a list of statements needed for proper initialization of the object. function Next_Protected_Operation (N : Node_Id) return Node_Id; - -- Given a protected operation node (a subprogram or entry body), - -- find the following node in the declarations list. + -- Given a protected operation node (a subprogram or entry body), find the + -- following node in the declarations list. procedure Set_Discriminals (Dec : Node_Id); - -- Replace discriminals in a protected type for use by the - -- next protected operation on the type. Each operation needs a - -- new set of discriminals, since it needs a unique renaming of - -- the discriminant fields in the record used to implement the - -- protected type. - - procedure Set_Privals - (Dec : Node_Id; - Op : Node_Id; - Loc : Source_Ptr; - After_Barrier : Boolean := False); - -- Associates a new set of privals (placeholders for later access to - -- private components of protected objects) with the private object - -- declarations of a protected object. These will be used to expand - -- the references to private objects in the next protected - -- subprogram or entry body to be expanded. - -- - -- The flag After_Barrier indicates whether this is called after building - -- the barrier function for an entry body. This flag determines whether - -- the privals should have source names (which simplifies debugging) or - -- internally generated names. Entry barriers contain no debuggable code, - -- and there may be visibility conflicts between an entry index and a - -- a prival, so privals for barrier function have internal names. + -- Replace discriminals in a protected type for use by the next protected + -- operation on the type. Each operation needs a new set of discirminals, + -- since it needs a unique renaming of the discriminant fields in the + -- record used to implement the protected type. end Exp_Ch9; diff --git a/gcc/ada/exp_dbug.adb b/gcc/ada/exp_dbug.adb index 39e5bde8400..0a48868b3e0 100644 --- a/gcc/ada/exp_dbug.adb +++ b/gcc/ada/exp_dbug.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 1996-2007, Free Software Foundation, Inc. -- +-- Copyright (C) 1996-2008, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -535,7 +535,7 @@ package body Exp_Dbug is -- For all these cases, just return the name unchanged then - Name_Buffer (Name_Len + 1) := ASCII.Nul; + Name_Buffer (Name_Len + 1) := ASCII.NUL; return; end if; @@ -751,7 +751,7 @@ package body Exp_Dbug is Get_Qualified_Name_And_Append (E); end if; - Name_Buffer (Name_Len + 1) := ASCII.Nul; + Name_Buffer (Name_Len + 1) := ASCII.NUL; end Get_External_Name; ----------------------------------- @@ -784,7 +784,7 @@ package body Exp_Dbug is if Has_Suffix then Add_Str_To_Name_Buffer ("___"); Add_Str_To_Name_Buffer (Suffix); - Name_Buffer (Name_Len + 1) := ASCII.Nul; + Name_Buffer (Name_Len + 1) := ASCII.NUL; end if; end Get_External_Name_With_Suffix; diff --git a/gcc/ada/exp_disp.adb b/gcc/ada/exp_disp.adb index c14c7348dea..b4efbf87cc7 100644 --- a/gcc/ada/exp_disp.adb +++ b/gcc/ada/exp_disp.adb @@ -99,7 +99,15 @@ package body Exp_Disp is ------------------------ function Building_Static_DT (Typ : Entity_Id) return Boolean is + Root_Typ : Entity_Id := Root_Type (Typ); + begin + -- Handle private types + + if Present (Full_View (Root_Typ)) then + Root_Typ := Full_View (Root_Typ); + end if; + return Static_Dispatch_Tables and then Is_Library_Level_Tagged_Type (Typ) @@ -107,7 +115,7 @@ package body Exp_Disp is -- build the dispatch tables because we must inherit primitives -- from the CPP side. - and then not Is_CPP_Class (Root_Type (Typ)); + and then not Is_CPP_Class (Root_Typ); end Building_Static_DT; ---------------------------------- @@ -548,7 +556,6 @@ package body Exp_Disp is Subp_Typ := Create_Itype (E_Subprogram_Type, Call_Node); Subp_Ptr_Typ := Create_Itype (E_Access_Subprogram_Type, Call_Node); Set_Etype (Subp_Typ, Res_Typ); - Init_Size_Align (Subp_Ptr_Typ); Set_Returns_By_Ref (Subp_Typ, Returns_By_Ref (Subp)); -- Create a new list of parameters which is a copy of the old formal @@ -575,18 +582,11 @@ package body Exp_Disp is Set_Etype (New_Formal, Etype (Param)); end if; - if Is_Itype (Etype (New_Formal)) then - Extra := New_Copy (Etype (New_Formal)); - - if Ekind (Extra) = E_Record_Subtype - or else Ekind (Extra) = E_Class_Wide_Subtype - then - Set_Cloned_Subtype (Extra, Etype (New_Formal)); - end if; - - Set_Etype (New_Formal, Extra); - Set_Scope (Etype (New_Formal), Subp_Typ); - end if; + -- If the type of the formal is an itype, there was code here + -- introduced in 1998 in revision 1.46, to create a new itype + -- by copy. This seems useless, and in fact leads to semantic + -- errors when the itype is the completion of a type derived + -- from a private type. Extra := New_Formal; Next_Formal (Old_Formal); @@ -780,7 +780,7 @@ package body Exp_Disp is -- Give error if configurable run time and Displace not available if not RTE_Available (RE_Displace) then - Error_Msg_CRT ("abstract interface types", N); + Error_Msg_CRT ("dynamic interface conversion", N); return; end if; @@ -839,9 +839,7 @@ package body Exp_Disp is begin New_Itype := Create_Itype (E_Anonymous_Access_Type, N); - Set_Etype (New_Itype, New_Itype); - Init_Esize (New_Itype); - Init_Size_Align (New_Itype); + Set_Etype (New_Itype, New_Itype); Set_Directly_Designated_Type (New_Itype, Etyp); Rewrite (N, @@ -1205,6 +1203,8 @@ package body Exp_Disp is Decl_1 : Node_Id; Decl_2 : Node_Id; Formal : Node_Id; + New_Arg : Node_Id; + Offset_To_Top : Node_Id; Target : Entity_Id; Target_Formal : Entity_Id; @@ -1212,13 +1212,6 @@ package body Exp_Disp is Thunk_Id := Empty; Thunk_Code := Empty; - -- Give message if configurable run-time and Offset_To_Top unavailable - - if not RTE_Available (RE_Offset_To_Top) then - Error_Msg_CRT ("abstract interface types", Prim); - return; - end if; - -- Traverse the list of alias to find the final target Target := Prim; @@ -1284,6 +1277,20 @@ package body Exp_Disp is (Directly_Designated_Type (Etype (Target_Formal)), Loc))); + New_Arg := + Unchecked_Convert_To (RTE (RE_Address), + New_Reference_To (Defining_Identifier (Formal), Loc)); + + if not RTE_Available (RE_Offset_To_Top) then + Offset_To_Top := + Build_Offset_To_Top (Loc, New_Arg); + else + Offset_To_Top := + Make_Function_Call (Loc, + Name => New_Reference_To (RTE (RE_Offset_To_Top), Loc), + Parameter_Associations => New_List (New_Arg)); + end if; + Decl_1 := Make_Object_Declaration (Loc, Defining_Identifier => @@ -1299,14 +1306,7 @@ package body Exp_Disp is (RTE (RE_Storage_Offset), New_Reference_To (Defining_Identifier (Formal), Loc)), Right_Opnd => - Make_Function_Call (Loc, - Name => - New_Reference_To (RTE (RE_Offset_To_Top), Loc), - Parameter_Associations => New_List ( - Unchecked_Convert_To - (RTE (RE_Address), - New_Reference_To - (Defining_Identifier (Formal), Loc)))))); + Offset_To_Top)); Append_To (Decl, Decl_2); Append_To (Decl, Decl_1); @@ -1326,6 +1326,23 @@ package body Exp_Disp is -- - Offset_To_Top (Formal'Address) -- S2 : Addr_Ptr := Addr_Ptr!(S1) + New_Arg := + Make_Attribute_Reference (Loc, + Prefix => + New_Reference_To (Defining_Identifier (Formal), Loc), + Attribute_Name => + Name_Address); + + if not RTE_Available (RE_Offset_To_Top) then + Offset_To_Top := + Build_Offset_To_Top (Loc, New_Arg); + else + Offset_To_Top := + Make_Function_Call (Loc, + Name => New_Reference_To (RTE (RE_Offset_To_Top), Loc), + Parameter_Associations => New_List (New_Arg)); + end if; + Decl_1 := Make_Object_Declaration (Loc, Defining_Identifier => @@ -1344,15 +1361,7 @@ package body Exp_Disp is (Defining_Identifier (Formal), Loc), Attribute_Name => Name_Address)), Right_Opnd => - Make_Function_Call (Loc, - Name => - New_Reference_To (RTE (RE_Offset_To_Top), Loc), - Parameter_Associations => New_List ( - Make_Attribute_Reference (Loc, - Prefix => - New_Reference_To - (Defining_Identifier (Formal), Loc), - Attribute_Name => Name_Address))))); + Offset_To_Top)); Decl_2 := Make_Object_Declaration (Loc, @@ -3042,6 +3051,10 @@ package body Exp_Disp is (Expression (Parent (RTE (RE_Max_Predef_Prims))))); + DT_Decl : constant Elist_Id := New_Elmt_List; + DT_Aggr : constant Elist_Id := New_Elmt_List; + -- Entities marked with attribute Is_Dispatch_Table_Entity + procedure Check_Premature_Freezing (Subp : Entity_Id; Typ : Entity_Id); -- Verify that all non-tagged types in the profile of a subprogram -- are frozen at the point the subprogram is frozen. This enforces @@ -3229,6 +3242,7 @@ package body Exp_Disp is declare Prim_Table : array (Nat range 1 .. Nb_Predef_Prims) of Entity_Id; + Decl : Node_Id; Thunk_Id : Entity_Id; Thunk_Code : Node_Id; @@ -3272,27 +3286,43 @@ package body Exp_Disp is for J in Prim_Table'Range loop if Present (Prim_Table (J)) then New_Node := - Unchecked_Convert_To (RTE (RE_Address), + Unchecked_Convert_To (RTE (RE_Prim_Ptr), Make_Attribute_Reference (Loc, Prefix => New_Reference_To (Prim_Table (J), Loc), Attribute_Name => Name_Unrestricted_Access)); else - New_Node := - New_Reference_To (RTE (RE_Null_Address), Loc); + New_Node := Make_Null (Loc); end if; Append_To (Prim_Ops_Aggr_List, New_Node); end loop; + New_Node := + Make_Aggregate (Loc, + Expressions => Prim_Ops_Aggr_List); + + -- Remember aggregates initializing dispatch tables + + Append_Elmt (New_Node, DT_Aggr); + + Decl := + Make_Subtype_Declaration (Loc, + Defining_Identifier => + Make_Defining_Identifier (Loc, + New_Internal_Name ('S')), + Subtype_Indication => + New_Reference_To (RTE (RE_Address_Array), Loc)); + + Append_To (Result, Decl); + Append_To (Result, Make_Object_Declaration (Loc, Defining_Identifier => Predef_Prims, Constant_Present => Building_Static_DT (Typ), Aliased_Present => True, - Object_Definition => - New_Reference_To (RTE (RE_Address_Array), Loc), - Expression => Make_Aggregate (Loc, - Expressions => Prim_Ops_Aggr_List))); + Object_Definition => New_Reference_To + (Defining_Identifier (Decl), Loc), + Expression => New_Node)); Append_To (Result, Make_Attribute_Definition_Clause (Loc, @@ -3492,15 +3522,13 @@ package body Exp_Disp is Prim_Ops_Aggr_List := New_List; if Empty_DT then - Append_To (Prim_Ops_Aggr_List, - New_Reference_To (RTE (RE_Null_Address), Loc)); + Append_To (Prim_Ops_Aggr_List, Make_Null (Loc)); elsif Is_Abstract_Type (Typ) or else not Building_Static_DT (Typ) then for J in 1 .. Nb_Prim loop - Append_To (Prim_Ops_Aggr_List, - New_Reference_To (RTE (RE_Null_Address), Loc)); + Append_To (Prim_Ops_Aggr_List, Make_Null (Loc)); end loop; else @@ -3556,13 +3584,12 @@ package body Exp_Disp is for J in Prim_Table'Range loop if Present (Prim_Table (J)) then New_Node := - Unchecked_Convert_To (RTE (RE_Address), + Unchecked_Convert_To (RTE (RE_Prim_Ptr), Make_Attribute_Reference (Loc, Prefix => New_Reference_To (Prim_Table (J), Loc), Attribute_Name => Name_Unrestricted_Access)); else - New_Node := - New_Reference_To (RTE (RE_Null_Address), Loc); + New_Node := Make_Null (Loc); end if; Append_To (Prim_Ops_Aggr_List, New_Node); @@ -3570,9 +3597,15 @@ package body Exp_Disp is end; end if; - Append_To (DT_Aggr_List, + New_Node := Make_Aggregate (Loc, - Expressions => Prim_Ops_Aggr_List)); + Expressions => Prim_Ops_Aggr_List); + + Append_To (DT_Aggr_List, New_Node); + + -- Remember aggregates initializing dispatch tables + + Append_Elmt (New_Node, DT_Aggr); Append_To (Result, Make_Object_Declaration (Loc, @@ -3635,14 +3668,10 @@ package body Exp_Disp is (RTE_Record_Component (RE_Predef_Prims), Loc)), Attribute_Name => Name_Address))); - -- Mark entities containing library level static dispatch tables. - -- This attribute is later propagated to all the access-to-subprogram - -- itypes generated to fill the dispatch table slots (see exp_attr). + -- Remember entities containing dispatch tables - if Building_Static_DT (Typ) then - Set_Is_Static_Dispatch_Table_Entity (Predef_Prims); - Set_Is_Static_Dispatch_Table_Entity (Iface_DT); - end if; + Append_Elmt (Predef_Prims, DT_Decl); + Append_Elmt (Iface_DT, DT_Decl); end Make_Secondary_DT; -- Local variables @@ -3666,6 +3695,7 @@ package body Exp_Disp is New_Node : Node_Id; No_Reg : Node_Id; Num_Ifaces : Nat := 0; + Parent_Typ : Entity_Id; Prim : Entity_Id; Prim_Elmt : Elmt_Id; Prim_Ops_Aggr_List : List_Id; @@ -3761,6 +3791,14 @@ package body Exp_Disp is end if; end if; + -- Initialize Parent_Typ handling private types + + Parent_Typ := Etype (Typ); + + if Present (Full_View (Parent_Typ)) then + Parent_Typ := Full_View (Parent_Typ); + end if; + -- Ensure that all the primitives are frozen. This is only required when -- building static dispatch tables --- the primitives must be frozen to -- be referenced (otherwise we have problems with the backend). It is @@ -4045,6 +4083,7 @@ package body Exp_Disp is -- HT_Link => HT_Link'Address, -- Transportable => <<boolean-value>>, -- RC_Offset => <<integer-value>>, + -- [ Size_Func => Size_Prim'Access ] -- [ Interfaces_Table => <<access-value>> ] -- [ SSD => SSD_Table'Address ] -- Tags_Table => (0 => null, @@ -4204,23 +4243,28 @@ package body Exp_Disp is -- External tag of a library-level tagged type: Check for a definition -- of External_Tag. The clause is considered only if it applies to this -- specific tagged type, as opposed to one of its ancestors. + -- If the type is an unconstrained type extension, we are building the + -- dispatch table of its anonymous base type, so the external tag, if + -- any was specified, must be retrieved from the first subtype. else declare - Def : constant Node_Id := Get_Attribute_Definition_Clause (Typ, - Attribute_External_Tag); + Def : constant Node_Id := Get_Attribute_Definition_Clause + (First_Subtype (Typ), + Attribute_External_Tag); + Old_Val : String_Id; New_Val : String_Id; E : Entity_Id; begin if not Present (Def) - or else Entity (Name (Def)) /= Typ + or else Entity (Name (Def)) /= First_Subtype (Typ) then New_Node := Unchecked_Convert_To (RTE (RE_Cstring_Ptr), Make_Attribute_Reference (Loc, - Prefix => New_Reference_To (Exname, Loc), + Prefix => New_Reference_To (Exname, Loc), Attribute_Name => Name_Address)); else Old_Val := Strval (Expr_Value_S (Expression (Def))); @@ -4320,15 +4364,8 @@ package body Exp_Disp is declare RC_Offset_Node : Node_Id; - Parent_Typ : Entity_Id; begin - if Present (Full_View (Etype (Typ))) then - Parent_Typ := Full_View (Etype (Typ)); - else - Parent_Typ := Etype (Typ); - end if; - if not Has_Controlled_Component (Typ) then RC_Offset_Node := Make_Integer_Literal (Loc, 0); @@ -4368,6 +4405,52 @@ package body Exp_Disp is Append_To (TSD_Aggr_List, RC_Offset_Node); end; + -- Size_Func + + if RTE_Record_Component_Available (RE_Size_Func) then + if not Building_Static_DT (Typ) + or else Is_Interface (Typ) + then + Append_To (TSD_Aggr_List, + Unchecked_Convert_To (RTE (RE_Size_Ptr), + New_Reference_To (RTE (RE_Null_Address), Loc))); + + else + declare + Prim_Elmt : Elmt_Id; + Prim : Entity_Id; + + begin + Prim_Elmt := First_Elmt (Primitive_Operations (Typ)); + while Present (Prim_Elmt) loop + Prim := Node (Prim_Elmt); + + if Chars (Prim) = Name_uSize then + while Present (Alias (Prim)) loop + Prim := Alias (Prim); + end loop; + + if Is_Abstract_Subprogram (Prim) then + Append_To (TSD_Aggr_List, + Unchecked_Convert_To (RTE (RE_Size_Ptr), + New_Reference_To (RTE (RE_Null_Address), Loc))); + else + Append_To (TSD_Aggr_List, + Unchecked_Convert_To (RTE (RE_Size_Ptr), + Make_Attribute_Reference (Loc, + Prefix => New_Reference_To (Prim, Loc), + Attribute_Name => Name_Unrestricted_Access))); + end if; + + exit; + end if; + + Next_Elmt (Prim_Elmt); + end loop; + end; + end if; + end if; + -- Interfaces_Table (required for AI-405) if RTE_Record_Component_Available (RE_Interfaces_Table) then @@ -4561,34 +4644,34 @@ package body Exp_Disp is -- Initialize the table of ancestor tags. In case of interface types -- this table is not needed. - declare - Current_Typ : Entity_Id; - Parent_Typ : Entity_Id; - Pos : Nat; + TSD_Tags_List := New_List; - begin - TSD_Tags_List := New_List; + -- If we are not statically allocating the dispatch table then we must + -- fill position 0 with null because we still have not generated the + -- tag of Typ. - -- If we are not statically allocating the dispatch table then we - -- must fill position 0 with null because we still have not - -- generated the tag of Typ. + if not Building_Static_DT (Typ) + or else Is_Interface (Typ) + then + Append_To (TSD_Tags_List, + Unchecked_Convert_To (RTE (RE_Tag), + New_Reference_To (RTE (RE_Null_Address), Loc))); - if not Building_Static_DT (Typ) - or else Is_Interface (Typ) - then - Append_To (TSD_Tags_List, - Unchecked_Convert_To (RTE (RE_Tag), - New_Reference_To (RTE (RE_Null_Address), Loc))); + -- Otherwise we can safely reference the tag - -- Otherwise we can safely reference the tag + else + Append_To (TSD_Tags_List, + New_Reference_To (DT_Ptr, Loc)); + end if; - else - Append_To (TSD_Tags_List, - New_Reference_To (DT_Ptr, Loc)); - end if; + -- Fill the rest of the table with the tags of the ancestors - -- Fill the rest of the table with the tags of the ancestors + declare + Current_Typ : Entity_Id; + Parent_Typ : Entity_Id; + Pos : Nat; + begin Pos := 1; Current_Typ := Typ; @@ -4775,6 +4858,7 @@ package body Exp_Disp is declare Prim_Table : array (Nat range 1 .. Nb_Predef_Prims) of Entity_Id; + Decl : Node_Id; E : Entity_Id; begin @@ -4808,26 +4892,43 @@ package body Exp_Disp is for J in Prim_Table'Range loop if Present (Prim_Table (J)) then New_Node := - Unchecked_Convert_To (RTE (RE_Address), + Unchecked_Convert_To (RTE (RE_Prim_Ptr), Make_Attribute_Reference (Loc, Prefix => New_Reference_To (Prim_Table (J), Loc), Attribute_Name => Name_Unrestricted_Access)); else - New_Node := New_Reference_To (RTE (RE_Null_Address), Loc); + New_Node := Make_Null (Loc); end if; Append_To (Prim_Ops_Aggr_List, New_Node); end loop; + New_Node := + Make_Aggregate (Loc, + Expressions => Prim_Ops_Aggr_List); + + Decl := + Make_Subtype_Declaration (Loc, + Defining_Identifier => + Make_Defining_Identifier (Loc, + New_Internal_Name ('S')), + Subtype_Indication => + New_Reference_To (RTE (RE_Address_Array), Loc)); + + Append_To (Result, Decl); + Append_To (Result, Make_Object_Declaration (Loc, Defining_Identifier => Predef_Prims, Aliased_Present => True, Constant_Present => Building_Static_DT (Typ), - Object_Definition => - New_Reference_To (RTE (RE_Address_Array), Loc), - Expression => Make_Aggregate (Loc, - Expressions => Prim_Ops_Aggr_List))); + Object_Definition => New_Reference_To + (Defining_Identifier (Decl), Loc), + Expression => New_Node)); + + -- Remember aggregates initializing dispatch tables + + Append_Elmt (New_Node, DT_Aggr); Append_To (Result, Make_Attribute_Definition_Clause (Loc, @@ -4880,9 +4981,7 @@ package body Exp_Disp is -- Offset_To_Top - if RTE_Record_Component_Available (RE_Offset_To_Top) then - Append_To (DT_Aggr_List, Make_Integer_Literal (Loc, 0)); - end if; + Append_To (DT_Aggr_List, Make_Integer_Literal (Loc, 0)); -- Typeinfo @@ -4896,13 +4995,11 @@ package body Exp_Disp is Prim_Ops_Aggr_List := New_List; if Nb_Prim = 0 then - Append_To (Prim_Ops_Aggr_List, - New_Reference_To (RTE (RE_Null_Address), Loc)); + Append_To (Prim_Ops_Aggr_List, Make_Null (Loc)); elsif not Building_Static_DT (Typ) then for J in 1 .. Nb_Prim loop - Append_To (Prim_Ops_Aggr_List, - New_Reference_To (RTE (RE_Null_Address), Loc)); + Append_To (Prim_Ops_Aggr_List, Make_Null (Loc)); end loop; else @@ -4951,12 +5048,12 @@ package body Exp_Disp is for J in Prim_Table'Range loop if Present (Prim_Table (J)) then New_Node := - Unchecked_Convert_To (RTE (RE_Address), + Unchecked_Convert_To (RTE (RE_Prim_Ptr), Make_Attribute_Reference (Loc, Prefix => New_Reference_To (Prim_Table (J), Loc), Attribute_Name => Name_Unrestricted_Access)); else - New_Node := New_Reference_To (RTE (RE_Null_Address), Loc); + New_Node := Make_Null (Loc); end if; Append_To (Prim_Ops_Aggr_List, New_Node); @@ -4964,9 +5061,15 @@ package body Exp_Disp is end; end if; - Append_To (DT_Aggr_List, + New_Node := Make_Aggregate (Loc, - Expressions => Prim_Ops_Aggr_List)); + Expressions => Prim_Ops_Aggr_List); + + Append_To (DT_Aggr_List, New_Node); + + -- Remember aggregates initializing dispatch tables + + Append_Elmt (New_Node, DT_Aggr); -- In case of locally defined tagged types we have already declared -- and uninitialized object for the dispatch table, which is now @@ -5048,26 +5151,27 @@ package body Exp_Disp is -- If the ancestor is a CPP_Class type we inherit the dispatch tables -- in the init proc, and we don't need to fill them in here. - elsif Is_CPP_Class (Etype (Typ)) then + elsif Is_CPP_Class (Parent_Typ) then null; -- Otherwise we fill in the dispatch tables here else - if Typ /= Etype (Typ) + if Typ /= Parent_Typ and then not Is_Interface (Typ) and then not Restriction_Active (No_Dispatching_Calls) then -- Inherit the dispatch table if not Is_Interface (Typ) - and then not Is_Interface (Etype (Typ)) - and then not Is_CPP_Class (Etype (Typ)) + and then not Is_Interface (Parent_Typ) + and then not Is_CPP_Class (Parent_Typ) then declare Nb_Prims : constant Int := UI_To_Int (DT_Entry_Count - (First_Tag_Component (Etype (Typ)))); + (First_Tag_Component (Parent_Typ))); + begin Append_To (Elab_Code, Build_Inherit_Predefined_Prims (Loc, @@ -5076,7 +5180,7 @@ package body Exp_Disp is (Node (Next_Elmt (First_Elmt - (Access_Disp_Table (Etype (Typ))))), Loc), + (Access_Disp_Table (Parent_Typ)))), Loc), New_Tag_Node => New_Reference_To (Node @@ -5092,7 +5196,7 @@ package body Exp_Disp is New_Reference_To (Node (First_Elmt - (Access_Disp_Table (Etype (Typ)))), Loc), + (Access_Disp_Table (Parent_Typ))), Loc), New_Tag_Node => New_Reference_To (DT_Ptr, Loc), Num_Prims => Nb_Prims)); end if; @@ -5101,13 +5205,13 @@ package body Exp_Disp is -- Inherit the secondary dispatch tables of the ancestor - if not Is_CPP_Class (Etype (Typ)) then + if not Is_CPP_Class (Parent_Typ) then declare Sec_DT_Ancestor : Elmt_Id := Next_Elmt (Next_Elmt (First_Elmt - (Access_Disp_Table (Etype (Typ))))); + (Access_Disp_Table (Parent_Typ)))); Sec_DT_Typ : Elmt_Id := Next_Elmt (Next_Elmt @@ -5327,18 +5431,49 @@ package body Exp_Disp is Make_Select_Specific_Data_Table (Typ)); end if; - -- Mark entities containing library level static dispatch tables. This - -- attribute is later propagated to all the access-to-subprogram itypes - -- generated to fill the dispatch table slots (see exp_attr). + -- Remember entities containing dispatch tables - if Building_Static_DT (Typ) then - Set_Is_Static_Dispatch_Table_Entity (Predef_Prims); - Set_Is_Static_Dispatch_Table_Entity (DT); - end if; + Append_Elmt (Predef_Prims, DT_Decl); + Append_Elmt (DT, DT_Decl); Analyze_List (Result, Suppress => All_Checks); Set_Has_Dispatch_Table (Typ); + -- Mark entities containing dispatch tables. Required by the + -- backend to handle them properly. + + if not Is_Interface (Typ) then + declare + Elmt : Elmt_Id; + + begin + -- Ensure that entities Prim_Ptr and Predef_Prims_Table_Ptr have + -- the decoration required by the backend + + Set_Is_Dispatch_Table_Entity (RTE (RE_Prim_Ptr)); + Set_Is_Dispatch_Table_Entity (RTE (RE_Predef_Prims_Table_Ptr)); + + -- Object declarations + + Elmt := First_Elmt (DT_Decl); + while Present (Elmt) loop + Set_Is_Dispatch_Table_Entity (Node (Elmt)); + pragma Assert (Ekind (Etype (Node (Elmt))) = E_Array_Subtype + or else Ekind (Etype (Node (Elmt))) = E_Record_Subtype); + Set_Is_Dispatch_Table_Entity (Etype (Node (Elmt))); + Next_Elmt (Elmt); + end loop; + + -- Aggregates initializing dispatch tables + + Elmt := First_Elmt (DT_Aggr); + while Present (Elmt) loop + Set_Is_Dispatch_Table_Entity (Etype (Node (Elmt))); + Next_Elmt (Elmt); + end loop; + end; + end if; + return Result; end Make_DT; @@ -5763,7 +5898,7 @@ package body Exp_Disp is -- expand dispatching calls through the primary dispatch table. -- Generate: - -- type Typ_DT is array (1 .. Nb_Prims) of Address; + -- type Typ_DT is array (1 .. Nb_Prims) of Prim_Ptr; -- type Typ_DT_Acc is access Typ_DT; declare @@ -5791,7 +5926,7 @@ package body Exp_Disp is Component_Definition => Make_Component_Definition (Loc, Subtype_Indication => - New_Reference_To (RTE (RE_Address), Loc))))); + New_Reference_To (RTE (RE_Prim_Ptr), Loc))))); Append_To (Result, Make_Full_Type_Declaration (Loc, @@ -5810,6 +5945,11 @@ package body Exp_Disp is Analyze_List (Result); Set_Suppress_Init_Proc (Base_Type (DT_Prims)); + + -- Mark entity of dispatch table. Required by the backend to handle + -- the properly. + + Set_Is_Dispatch_Table_Entity (DT_Prims); end; Set_Ekind (DT_Ptr, E_Constant); @@ -5949,9 +6089,9 @@ package body Exp_Disp is L : List_Id; Pos : Uint; Tag : Entity_Id; + Tag_Typ : Entity_Id; Thunk_Id : Entity_Id; Thunk_Code : Node_Id; - Typ : Entity_Id; begin pragma Assert (not Restriction_Active (No_Dispatching_Calls)); @@ -5961,35 +6101,49 @@ package body Exp_Disp is end if; if not Present (Abstract_Interface_Alias (Prim)) then - Typ := Scope (DTC_Entity (Prim)); + Tag_Typ := Scope (DTC_Entity (Prim)); Pos := DT_Position (Prim); - Tag := First_Tag_Component (Typ); + Tag := First_Tag_Component (Tag_Typ); if Is_Predefined_Dispatching_Operation (Prim) or else Is_Predefined_Dispatching_Alias (Prim) then - DT_Ptr := Node (Next_Elmt (First_Elmt (Access_Disp_Table (Typ)))); + DT_Ptr := + Node (Next_Elmt (First_Elmt (Access_Disp_Table (Tag_Typ)))); + Insert_After (Ins_Nod, Build_Set_Predefined_Prim_Op_Address (Loc, Tag_Node => New_Reference_To (DT_Ptr, Loc), Position => Pos, Address_Node => - Unchecked_Convert_To (RTE (RE_Address), + Unchecked_Convert_To (RTE (RE_Prim_Ptr), Make_Attribute_Reference (Loc, Prefix => New_Reference_To (Prim, Loc), Attribute_Name => Name_Unrestricted_Access)))); + -- Register copy of the pointer to the 'size primitive in the TSD. + + if Chars (Prim) = Name_uSize + and then RTE_Record_Component_Available (RE_Size_Func) + then + DT_Ptr := Node (First_Elmt (Access_Disp_Table (Tag_Typ))); + Insert_After (Ins_Nod, + Build_Set_Size_Function (Loc, + Tag_Node => New_Reference_To (DT_Ptr, Loc), + Size_Func => Prim)); + end if; + else pragma Assert (Pos /= Uint_0 and then Pos <= DT_Entry_Count (Tag)); - DT_Ptr := Node (First_Elmt (Access_Disp_Table (Typ))); + DT_Ptr := Node (First_Elmt (Access_Disp_Table (Tag_Typ))); Insert_After (Ins_Nod, Build_Set_Prim_Op_Address (Loc, - Typ => Typ, + Typ => Tag_Typ, Tag_Node => New_Reference_To (DT_Ptr, Loc), Position => Pos, Address_Node => - Unchecked_Convert_To (RTE (RE_Address), + Unchecked_Convert_To (RTE (RE_Prim_Ptr), Make_Attribute_Reference (Loc, Prefix => New_Reference_To (Prim, Loc), Attribute_Name => Name_Unrestricted_Access)))); @@ -6002,14 +6156,14 @@ package body Exp_Disp is -- else to do here. else - Typ := Find_Dispatching_Type (Alias (Prim)); + Tag_Typ := Find_Dispatching_Type (Alias (Prim)); Iface_Typ := Find_Dispatching_Type (Abstract_Interface_Alias (Prim)); pragma Assert (Is_Interface (Iface_Typ)); Expand_Interface_Thunk (Prim, Thunk_Id, Thunk_Code); - if not Is_Parent (Iface_Typ, Typ) + if not Is_Parent (Iface_Typ, Tag_Typ) and then Present (Thunk_Code) then -- Comment needed on why checks are suppressed. This is not just @@ -6022,7 +6176,7 @@ package body Exp_Disp is -- the secondary dispatch table of Prim's controlling type with -- Thunk_Id's address. - Iface_DT_Elmt := Find_Interface_ADT (Typ, Iface_Typ); + Iface_DT_Elmt := Find_Interface_ADT (Tag_Typ, Iface_Typ); Iface_DT_Ptr := Node (Iface_DT_Elmt); pragma Assert (Has_Thunks (Iface_DT_Ptr)); @@ -6040,7 +6194,7 @@ package body Exp_Disp is New_Reference_To (Node (Next_Elmt (Iface_DT_Elmt)), Loc), Position => Pos, Address_Node => - Unchecked_Convert_To (RTE (RE_Address), + Unchecked_Convert_To (RTE (RE_Prim_Ptr), Make_Attribute_Reference (Loc, Prefix => New_Reference_To (Thunk_Id, Loc), Attribute_Name => Name_Unrestricted_Access)))); @@ -6056,7 +6210,7 @@ package body Exp_Disp is New_Reference_To (Node (Next_Elmt (Iface_DT_Elmt)), Loc), Position => Pos, Address_Node => - Unchecked_Convert_To (RTE (RE_Address), + Unchecked_Convert_To (RTE (RE_Prim_Ptr), Make_Attribute_Reference (Loc, Prefix => New_Reference_To (Alias (Prim), Loc), Attribute_Name => Name_Unrestricted_Access)))); @@ -6073,7 +6227,7 @@ package body Exp_Disp is Tag_Node => New_Reference_To (Iface_DT_Ptr, Loc), Position => Pos, Address_Node => - Unchecked_Convert_To (RTE (RE_Address), + Unchecked_Convert_To (RTE (RE_Prim_Ptr), Make_Attribute_Reference (Loc, Prefix => New_Reference_To (Thunk_Id, Loc), Attribute_Name => Name_Unrestricted_Access)))); @@ -6089,7 +6243,7 @@ package body Exp_Disp is Tag_Node => New_Reference_To (Iface_DT_Ptr, Loc), Position => Pos, Address_Node => - Unchecked_Convert_To (RTE (RE_Address), + Unchecked_Convert_To (RTE (RE_Prim_Ptr), Make_Attribute_Reference (Loc, Prefix => New_Reference_To (Alias (Prim), Loc), Attribute_Name => Name_Unrestricted_Access)))); diff --git a/gcc/ada/exp_dist.adb b/gcc/ada/exp_dist.adb index 5b71249eac3..435afc5c51c 100644 --- a/gcc/ada/exp_dist.adb +++ b/gcc/ada/exp_dist.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 1992-2007, Free Software Foundation, Inc. -- +-- Copyright (C) 1992-2008, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -216,6 +216,11 @@ package body Exp_Dist is -- the controlling formal of the equivalent RACW operation for a RAS -- type is always left in first position. + function Transmit_As_Unconstrained (Typ : Entity_Id) return Boolean; + -- True when Typ is an unconstrained type, or a null-excluding access type. + -- In either case, this means stubs cannot contain a default-initialized + -- object declaration of such type. + procedure Add_Calling_Stubs_To_Declarations (Pkg_Spec : Node_Id; Decls : List_Id); @@ -471,9 +476,10 @@ package body Exp_Dist is RPC_Receiver_Decl : Node_Id; Body_Decls : List_Id); -- Add declaration for TSSs for a given RACW type. The declarations are - -- added just after the declaration of the RACW type itself, while the - -- bodies are inserted at the end of Body_Decls. Runtime-specific ancillary - -- subprogram for Add_RACW_Features. + -- added just after the declaration of the RACW type itself. If the RACW + -- appears in the main unit, Body_Decls is a list of declarations to which + -- the bodies are appended. Else Body_Decls is No_List. + -- PCS-specific ancillary subprogram for Add_RACW_Features. procedure Specific_Add_RAST_Features (Vis_Decl : Node_Id; @@ -1139,6 +1145,13 @@ package body Exp_Dist is Body_Decls => Body_Decls, Existing => Existing); + -- If this RACW is not in the main unit, do not generate primitive or + -- TSS bodies. + + if not Entity_Is_In_Main_Unit (RACW_Type) then + Body_Decls := No_List; + end if; + Add_RACW_Asynchronous_Flag (Declarations => Decls, RACW_Type => RACW_Type); @@ -2121,6 +2134,7 @@ package body Exp_Dist is Constrained_List : List_Id; Unconstrained_List : List_Id; Current_Parameter : Node_Id; + Ptyp : Node_Id; First_Parameter : Node_Id; For_RAS : Boolean := False; @@ -2140,15 +2154,17 @@ package body Exp_Dist is For_RAS := True; end if; - -- Loop through the parameters and add them to the right list + -- Loop through the parameters and add them to the right list. Note that + -- we treat a parameter of a null-excluding access type as unconstrained + -- because we can't declare an object of such a type with default + -- initialization. Current_Parameter := First_Parameter; while Present (Current_Parameter) loop - if (Nkind (Parameter_Type (Current_Parameter)) = N_Access_Definition - or else - Is_Constrained (Etype (Parameter_Type (Current_Parameter))) - or else - Is_Elementary_Type (Etype (Parameter_Type (Current_Parameter)))) + Ptyp := Parameter_Type (Current_Parameter); + + if (Nkind (Ptyp) = N_Access_Definition + or else not Transmit_As_Unconstrained (Etype (Ptyp))) and then not (For_RAS and then Current_Parameter = First_Parameter) then Append_To (Constrained_List, New_Copy (Current_Parameter)); @@ -2828,7 +2844,8 @@ package body Exp_Dist is Body_Decls : List_Id); -- Add Read attribute for the RACW type. The declaration and attribute -- definition clauses are inserted right after the declaration of - -- RACW_Type, while the subprogram body is appended to Body_Decls. + -- RACW_Type. If Body_Decls is not No_List, the subprogram body is + -- appended to it (case where the RACW declaration is in the main unit). procedure Add_RACW_Write_Attribute (RACW_Type : Entity_Id; @@ -2941,36 +2958,66 @@ package body Exp_Dist is Body_Node : Node_Id; + Statements : constant List_Id := New_List; Decls : List_Id; - Statements : List_Id; Local_Statements : List_Id; Remote_Statements : List_Id; -- Various parts of the procedure - Procedure_Name : constant Name_Id := - New_Internal_Name ('R'); - Source_Partition : constant Entity_Id := - Make_Defining_Identifier - (Loc, New_Internal_Name ('P')); - Source_Receiver : constant Entity_Id := - Make_Defining_Identifier - (Loc, New_Internal_Name ('S')); - Source_Address : constant Entity_Id := - Make_Defining_Identifier - (Loc, New_Internal_Name ('P')); - Local_Stub : constant Entity_Id := + Pnam : constant Entity_Id := Make_Defining_Identifier - (Loc, New_Internal_Name ('L')); - Stubbed_Result : constant Entity_Id := - Make_Defining_Identifier - (Loc, New_Internal_Name ('S')); + (Loc, New_Internal_Name ('R')); Asynchronous_Flag : constant Entity_Id := Asynchronous_Flags_Table.Get (RACW_Type); pragma Assert (Present (Asynchronous_Flag)); + -- Prepare local identifiers + + Source_Partition : Entity_Id; + Source_Receiver : Entity_Id; + Source_Address : Entity_Id; + Local_Stub : Entity_Id; + Stubbed_Result : Entity_Id; + -- Start of processing for Add_RACW_Read_Attribute begin + Build_Stream_Procedure (Loc, + RACW_Type, Body_Node, Pnam, Statements, Outp => True); + Proc_Decl := Make_Subprogram_Declaration (Loc, + Copy_Specification (Loc, Specification (Body_Node))); + + Attr_Decl := + Make_Attribute_Definition_Clause (Loc, + Name => New_Occurrence_Of (RACW_Type, Loc), + Chars => Name_Read, + Expression => + New_Occurrence_Of ( + Defining_Unit_Name (Specification (Proc_Decl)), Loc)); + + Insert_After (Declaration_Node (RACW_Type), Proc_Decl); + Insert_After (Proc_Decl, Attr_Decl); + + if No (Body_Decls) then + -- Case of processing an RACW type from another unit than the + -- main one: do not generate a body. + + return; + end if; + + -- Prepare local identifiers + + Source_Partition := + Make_Defining_Identifier (Loc, New_Internal_Name ('P')); + Source_Receiver := + Make_Defining_Identifier (Loc, New_Internal_Name ('S')); + Source_Address := + Make_Defining_Identifier (Loc, New_Internal_Name ('P')); + Local_Stub := + Make_Defining_Identifier (Loc, New_Internal_Name ('L')); + Stubbed_Result := + Make_Defining_Identifier (Loc, New_Internal_Name ('S')); + -- Generate object declarations Decls := New_List ( @@ -3007,7 +3054,7 @@ package body Exp_Dist is -- Read the source Partition_ID and RPC_Receiver from incoming stream - Statements := New_List ( + Append_List_To (Statements, New_List ( Make_Attribute_Reference (Loc, Prefix => New_Occurrence_Of (RTE (RE_Partition_ID), Loc), @@ -3032,7 +3079,7 @@ package body Exp_Dist is Name_Read, Expressions => New_List ( Stream_Parameter, - New_Occurrence_Of (Source_Address, Loc)))); + New_Occurrence_Of (Source_Address, Loc))))); -- Build_Get_Unique_RP_Call needs the type of Stubbed_Result @@ -3131,25 +3178,7 @@ package body Exp_Dist is Then_Statements => Local_Statements, Else_Statements => Remote_Statements)); - Build_Stream_Procedure - (Loc, RACW_Type, Body_Node, - Make_Defining_Identifier (Loc, Procedure_Name), - Statements, Outp => True); Set_Declarations (Body_Node, Decls); - - Proc_Decl := Make_Subprogram_Declaration (Loc, - Copy_Specification (Loc, Specification (Body_Node))); - - Attr_Decl := - Make_Attribute_Definition_Clause (Loc, - Name => New_Occurrence_Of (RACW_Type, Loc), - Chars => Name_Read, - Expression => - New_Occurrence_Of ( - Defining_Unit_Name (Specification (Proc_Decl)), Loc)); - - Insert_After (Declaration_Node (RACW_Type), Proc_Decl); - Insert_After (Proc_Decl, Attr_Decl); Append_To (Body_Decls, Body_Node); end Add_RACW_Read_Attribute; @@ -3168,14 +3197,36 @@ package body Exp_Dist is Proc_Decl : Node_Id; Attr_Decl : Node_Id; - Statements : List_Id; + Statements : constant List_Id := New_List; Local_Statements : List_Id; Remote_Statements : List_Id; Null_Statements : List_Id; - Procedure_Name : constant Name_Id := New_Internal_Name ('R'); + Pnam : constant Entity_Id := + Make_Defining_Identifier (Loc, New_Internal_Name ('R')); begin + Build_Stream_Procedure + (Loc, RACW_Type, Body_Node, Pnam, Statements, Outp => False); + + Proc_Decl := Make_Subprogram_Declaration (Loc, + Copy_Specification (Loc, Specification (Body_Node))); + + Attr_Decl := + Make_Attribute_Definition_Clause (Loc, + Name => New_Occurrence_Of (RACW_Type, Loc), + Chars => Name_Write, + Expression => + New_Occurrence_Of ( + Defining_Unit_Name (Specification (Proc_Decl)), Loc)); + + Insert_After (Declaration_Node (RACW_Type), Proc_Decl); + Insert_After (Proc_Decl, Attr_Decl); + + if No (Body_Decls) then + return; + end if; + -- Build the code fragment corresponding to the marshalling of a -- local object. @@ -3253,7 +3304,7 @@ package body Exp_Dist is Object => Make_Integer_Literal (Loc, Uint_0), Etyp => RTE (RE_Unsigned_64))); - Statements := New_List ( + Append_To (Statements, Make_Implicit_If_Statement (RACW_Type, Condition => Make_Op_Eq (Loc, @@ -3275,24 +3326,6 @@ package body Exp_Dist is Then_Statements => Remote_Statements)), Else_Statements => Local_Statements)); - Build_Stream_Procedure - (Loc, RACW_Type, Body_Node, - Make_Defining_Identifier (Loc, Procedure_Name), - Statements, Outp => False); - - Proc_Decl := Make_Subprogram_Declaration (Loc, - Copy_Specification (Loc, Specification (Body_Node))); - - Attr_Decl := - Make_Attribute_Definition_Clause (Loc, - Name => New_Occurrence_Of (RACW_Type, Loc), - Chars => Name_Write, - Expression => - New_Occurrence_Of ( - Defining_Unit_Name (Specification (Proc_Decl)), Loc)); - - Insert_After (Declaration_Node (RACW_Type), Proc_Decl); - Insert_After (Proc_Decl, Attr_Decl); Append_To (Body_Decls, Body_Node); end Add_RACW_Write_Attribute; @@ -4193,8 +4226,7 @@ package body Exp_Dist is Etyp := Etype (Typ); end if; - Constrained := - Is_Constrained (Etyp) or else Is_Elementary_Type (Etyp); + Constrained := not Transmit_As_Unconstrained (Etyp); -- Any parameter but unconstrained out parameters are -- transmitted to the peer. @@ -4786,8 +4818,7 @@ package body Exp_Dist is Etyp := Etype (Parameter_Type (Current_Parameter)); end if; - Constrained := - Is_Constrained (Etyp) or else Is_Elementary_Type (Etyp); + Constrained := not Transmit_As_Unconstrained (Etyp); if In_Present (Current_Parameter) or else not Out_Present (Current_Parameter) @@ -5441,7 +5472,8 @@ package body Exp_Dist is Body_Decls : List_Id); -- Add Read attribute for the RACW type. The declaration and attribute -- definition clauses are inserted right after the declaration of - -- RACW_Type, while the subprogram body is appended to Body_Decls. + -- RACW_Type. If Body_Decls is not No_List, the subprogram body is + -- appended to it (case where the RACW declaration is in the main unit). procedure Add_RACW_Write_Attribute (RACW_Type : Entity_Id; @@ -5595,7 +5627,8 @@ package body Exp_Dist is Is_RAS : constant Boolean := not Comes_From_Source (RACW_Type); Fnam : constant Entity_Id := - Make_Defining_Identifier (Loc, New_Internal_Name ('F')); + Make_Defining_Identifier (Loc, + Chars => New_External_Name (Chars (RACW_Type), 'F')); Func_Spec : Node_Id; Func_Decl : Node_Id; @@ -5609,21 +5642,12 @@ package body Exp_Dist is Any_Parameter : constant Entity_Id := Make_Defining_Identifier (Loc, Name_A); - Reference : constant Entity_Id := - Make_Defining_Identifier - (Loc, New_Internal_Name ('R')); - Is_Local : constant Entity_Id := - Make_Defining_Identifier - (Loc, New_Internal_Name ('L')); - Addr : constant Entity_Id := - Make_Defining_Identifier - (Loc, New_Internal_Name ('A')); - Local_Stub : constant Entity_Id := - Make_Defining_Identifier - (Loc, New_Internal_Name ('L')); - Stubbed_Result : constant Entity_Id := - Make_Defining_Identifier - (Loc, New_Internal_Name ('S')); + + Reference : Entity_Id; + Is_Local : Entity_Id; + Addr : Entity_Id; + Local_Stub : Entity_Id; + Stubbed_Result : Entity_Id; Stub_Condition : Node_Id; -- An expression that determines whether we create a stub for the @@ -5637,9 +5661,42 @@ package body Exp_Dist is -- The flag object declared in Add_RACW_Asynchronous_Flag begin + Func_Spec := + Make_Function_Specification (Loc, + Defining_Unit_Name => + Fnam, + Parameter_Specifications => New_List ( + Make_Parameter_Specification (Loc, + Defining_Identifier => + Any_Parameter, + Parameter_Type => + New_Occurrence_Of (RTE (RE_Any), Loc))), + Result_Definition => New_Occurrence_Of (RACW_Type, Loc)); + + -- NOTE: The usage occurrences of RACW_Parameter must refer to the + -- entity in the declaration spec, not those of the body spec. + + Func_Decl := Make_Subprogram_Declaration (Loc, Func_Spec); + Insert_After (Declaration_Node (RACW_Type), Func_Decl); + Set_Renaming_TSS (RACW_Type, Fnam, TSS_From_Any); + + if No (Body_Decls) then + return; + end if; -- Object declarations + Reference := + Make_Defining_Identifier (Loc, New_Internal_Name ('R')); + Is_Local := + Make_Defining_Identifier (Loc, New_Internal_Name ('L')); + Addr := + Make_Defining_Identifier (Loc, New_Internal_Name ('A')); + Local_Stub := + Make_Defining_Identifier (Loc, New_Internal_Name ('L')); + Stubbed_Result := + Make_Defining_Identifier (Loc, New_Internal_Name ('S')); + Decls := New_List ( Make_Object_Declaration (Loc, Defining_Identifier => @@ -5791,23 +5848,6 @@ package body Exp_Dist is Expression => Unchecked_Convert_To (RACW_Type, New_Occurrence_Of (Stubbed_Result, Loc)))); - Func_Spec := - Make_Function_Specification (Loc, - Defining_Unit_Name => - Fnam, - Parameter_Specifications => New_List ( - Make_Parameter_Specification (Loc, - Defining_Identifier => - Any_Parameter, - Parameter_Type => - New_Occurrence_Of (RTE (RE_Any), Loc))), - Result_Definition => New_Occurrence_Of (RACW_Type, Loc)); - - -- NOTE: The usage occurrences of RACW_Parameter must refer to the - -- entity in the declaration spec, not those of the body spec. - - Func_Decl := Make_Subprogram_Declaration (Loc, Func_Spec); - Func_Body := Make_Subprogram_Body (Loc, Specification => @@ -5817,10 +5857,7 @@ package body Exp_Dist is Make_Handled_Sequence_Of_Statements (Loc, Statements => Statements)); - Insert_After (Declaration_Node (RACW_Type), Func_Decl); Append_To (Body_Decls, Func_Body); - - Set_Renaming_TSS (RACW_Type, Fnam, TSS_From_Any); end Add_RACW_From_Any; ----------------------------- @@ -5844,14 +5881,14 @@ package body Exp_Dist is Body_Node : Node_Id; Decls : List_Id; - Statements : List_Id; + Statements : constant List_Id := New_List; -- Various parts of the procedure - Procedure_Name : constant Name_Id := - New_Internal_Name ('R'); - Source_Ref : constant Entity_Id := - Make_Defining_Identifier - (Loc, New_Internal_Name ('R')); + Pnam : constant Entity_Id := + Make_Defining_Identifier (Loc, + New_Internal_Name ('R')); + + Source_Ref : Entity_Id; Asynchronous_Flag : constant Entity_Id := Asynchronous_Flags_Table.Get (RACW_Type); pragma Assert (Present (Asynchronous_Flag)); @@ -5881,6 +5918,30 @@ package body Exp_Dist is -- Start of processing for Add_RACW_Read_Attribute begin + Build_Stream_Procedure + (Loc, RACW_Type, Body_Node, Pnam, Statements, Outp => True); + + Proc_Decl := Make_Subprogram_Declaration (Loc, + Copy_Specification (Loc, Specification (Body_Node))); + + Attr_Decl := + Make_Attribute_Definition_Clause (Loc, + Name => New_Occurrence_Of (RACW_Type, Loc), + Chars => Name_Read, + Expression => + New_Occurrence_Of ( + Defining_Unit_Name (Specification (Proc_Decl)), Loc)); + + Insert_After (Declaration_Node (RACW_Type), Proc_Decl); + Insert_After (Proc_Decl, Attr_Decl); + + if No (Body_Decls) then + return; + end if; + + Source_Ref := Make_Defining_Identifier + (Loc, New_Internal_Name ('R')); + -- Generate object declarations Decls := New_List ( @@ -5889,7 +5950,7 @@ package body Exp_Dist is Object_Definition => New_Occurrence_Of (RTE (RE_Object_Ref), Loc))); - Statements := New_List ( + Append_List_To (Statements, New_List ( Make_Attribute_Reference (Loc, Prefix => New_Occurrence_Of (RTE (RE_Object_Ref), Loc), @@ -5908,27 +5969,9 @@ package body Exp_Dist is New_Occurrence_Of (RTE (RE_TA_ObjRef), Loc), Parameter_Associations => New_List ( New_Occurrence_Of (Source_Ref, Loc))), - Decls))); + Decls)))); - Build_Stream_Procedure - (Loc, RACW_Type, Body_Node, - Make_Defining_Identifier (Loc, Procedure_Name), - Statements, Outp => True); Set_Declarations (Body_Node, Decls); - - Proc_Decl := Make_Subprogram_Declaration (Loc, - Copy_Specification (Loc, Specification (Body_Node))); - - Attr_Decl := - Make_Attribute_Definition_Clause (Loc, - Name => New_Occurrence_Of (RACW_Type, Loc), - Chars => Name_Read, - Expression => - New_Occurrence_Of ( - Defining_Unit_Name (Specification (Proc_Decl)), Loc)); - - Insert_After (Declaration_Node (RACW_Type), Proc_Decl); - Insert_After (Proc_Decl, Attr_Decl); Append_To (Body_Decls, Body_Node); end Add_RACW_Read_Attribute; @@ -5947,7 +5990,9 @@ package body Exp_Dist is Is_RAS : constant Boolean := not Comes_From_Source (RACW_Type); - Fnam : Entity_Id; + Fnam : constant Entity_Id := + Make_Defining_Identifier (Loc, + Chars => New_External_Name (Chars (RACW_Type), 'T')); Stub_Elements : constant Stub_Structure := Stubs_Table.Get (Designated_Type); @@ -5965,8 +6010,8 @@ package body Exp_Dist is If_Node : Node_Id; -- Various parts of the subprogram - RACW_Parameter : constant Entity_Id - := Make_Defining_Identifier (Loc, Name_R); + RACW_Parameter : constant Entity_Id := + Make_Defining_Identifier (Loc, Name_R); Reference : constant Entity_Id := Make_Defining_Identifier @@ -5976,6 +6021,29 @@ package body Exp_Dist is (Loc, New_Internal_Name ('A')); begin + Func_Spec := + Make_Function_Specification (Loc, + Defining_Unit_Name => + Fnam, + Parameter_Specifications => New_List ( + Make_Parameter_Specification (Loc, + Defining_Identifier => + RACW_Parameter, + Parameter_Type => + New_Occurrence_Of (RACW_Type, Loc))), + Result_Definition => New_Occurrence_Of (RTE (RE_Any), Loc)); + + -- NOTE: The usage occurrences of RACW_Parameter must refer to the + -- entity in the declaration spec, not in the body spec. + + Func_Decl := Make_Subprogram_Declaration (Loc, Func_Spec); + + Insert_After (Declaration_Node (RACW_Type), Func_Decl); + Set_Renaming_TSS (RACW_Type, Fnam, TSS_To_Any); + + if No (Body_Decls) then + return; + end if; -- Object declarations @@ -6102,26 +6170,6 @@ package body Exp_Dist is Expression => New_Occurrence_Of (Any, Loc))); - Fnam := Make_Defining_Identifier ( - Loc, New_Internal_Name ('T')); - - Func_Spec := - Make_Function_Specification (Loc, - Defining_Unit_Name => - Fnam, - Parameter_Specifications => New_List ( - Make_Parameter_Specification (Loc, - Defining_Identifier => - RACW_Parameter, - Parameter_Type => - New_Occurrence_Of (RACW_Type, Loc))), - Result_Definition => New_Occurrence_Of (RTE (RE_Any), Loc)); - - -- NOTE: The usage occurrences of RACW_Parameter must refer to the - -- entity in the declaration spec, not in the body spec. - - Func_Decl := Make_Subprogram_Declaration (Loc, Func_Spec); - Func_Body := Make_Subprogram_Body (Loc, Specification => @@ -6130,11 +6178,7 @@ package body Exp_Dist is Handled_Statement_Sequence => Make_Handled_Sequence_Of_Statements (Loc, Statements => Statements)); - - Insert_After (Declaration_Node (RACW_Type), Func_Decl); Append_To (Body_Decls, Func_Body); - - Set_Renaming_TSS (RACW_Type, Fnam, TSS_To_Any); end Add_RACW_To_Any; ----------------------- @@ -6148,7 +6192,9 @@ package body Exp_Dist is is Loc : constant Source_Ptr := Sloc (RACW_Type); - Fnam : Entity_Id; + Fnam : constant Entity_Id := + Make_Defining_Identifier (Loc, + Chars => New_External_Name (Chars (RACW_Type), 'Y')); Stub_Elements : constant Stub_Structure := Stubs_Table.Get (Designated_Type); @@ -6159,9 +6205,6 @@ package body Exp_Dist is Func_Body : Node_Id; begin - Fnam := - Make_Defining_Identifier (Loc, - Chars => New_Internal_Name ('T')); -- The spec for this subprogram has a dummy 'access RACW' argument, -- which serves only for overloading purposes. @@ -6176,6 +6219,12 @@ package body Exp_Dist is -- entity in the declaration spec, not those of the body spec. Func_Decl := Make_Subprogram_Declaration (Loc, Func_Spec); + Insert_After (Declaration_Node (RACW_Type), Func_Decl); + Set_Renaming_TSS (RACW_Type, Fnam, TSS_TypeCode); + + if No (Body_Decls) then + return; + end if; Func_Body := Make_Subprogram_Body (Loc, @@ -6193,10 +6242,7 @@ package body Exp_Dist is Stub_Elements.RPC_Receiver_Decl), Selector_Name => Name_Obj_TypeCode))))); - Insert_After (Declaration_Node (RACW_Type), Func_Decl); Append_To (Body_Decls, Func_Body); - - Set_Renaming_TSS (RACW_Type, Fnam, TSS_TypeCode); end Add_RACW_TypeCode; ------------------------------ @@ -6219,8 +6265,9 @@ package body Exp_Dist is Proc_Decl : Node_Id; Attr_Decl : Node_Id; - Statements : List_Id; - Procedure_Name : constant Name_Id := New_Internal_Name ('R'); + Statements : constant List_Id := New_List; + Pnam : constant Entity_Id := + Make_Defining_Identifier (Loc, New_Internal_Name ('R')); function Stream_Parameter return Node_Id; function Object return Node_Id; @@ -6254,22 +6301,8 @@ package body Exp_Dist is -- Start of processing for Add_RACW_Write_Attribute begin - Statements := New_List ( - Pack_Node_Into_Stream_Access (Loc, - Stream => Stream_Parameter, - Object => - Make_Function_Call (Loc, - Name => - New_Occurrence_Of (RTE (RE_FA_ObjRef), Loc), - Parameter_Associations => New_List ( - PolyORB_Support.Helpers.Build_To_Any_Call - (Object, Body_Decls))), - Etyp => RTE (RE_Object_Ref))); - Build_Stream_Procedure - (Loc, RACW_Type, Body_Node, - Make_Defining_Identifier (Loc, Procedure_Name), - Statements, Outp => False); + (Loc, RACW_Type, Body_Node, Pnam, Statements, Outp => False); Proc_Decl := Make_Subprogram_Declaration (Loc, @@ -6285,6 +6318,23 @@ package body Exp_Dist is Insert_After (Declaration_Node (RACW_Type), Proc_Decl); Insert_After (Proc_Decl, Attr_Decl); + + if No (Body_Decls) then + return; + end if; + + Append_To (Statements, + Pack_Node_Into_Stream_Access (Loc, + Stream => Stream_Parameter, + Object => + Make_Function_Call (Loc, + Name => + New_Occurrence_Of (RTE (RE_FA_ObjRef), Loc), + Parameter_Associations => New_List ( + PolyORB_Support.Helpers.Build_To_Any_Call + (Object, Body_Decls))), + Etyp => RTE (RE_Object_Ref))); + Append_To (Body_Decls, Body_Node); end Add_RACW_Write_Attribute; @@ -8440,8 +8490,8 @@ package body Exp_Dist is Any : Entity_Id; TC : Node_Id; Idx : Node_Id) return Node_Id; - -- Build a call to Get_Aggregate_Element on Any - -- for typecode TC, returning the Idx'th element. + -- Build a call to Get_Aggregate_Element on Any for typecode TC, + -- returning the Idx'th element. generic Subprogram : Entity_Id; @@ -8795,7 +8845,7 @@ package body Exp_Dist is Build_From_Any_Call (Etype (Field), Build_Get_Aggregate_Element (Loc, Any => Any, - Tc => Build_TypeCode_Call (Loc, + TC => Build_TypeCode_Call (Loc, Etype (Field), Decls), Idx => Make_Integer_Literal (Loc, Counter)), @@ -8835,16 +8885,18 @@ package body Exp_Dist is Parameter_Associations => New_List ( Build_Get_Aggregate_Element (Loc, Any => Any, - Tc => Make_Function_Call (Loc, - Name => New_Occurrence_Of ( - RTE (RE_Any_Member_Type), Loc), - Parameter_Associations => - New_List ( - New_Occurrence_Of (Any, Loc), - Make_Integer_Literal (Loc, - Counter))), - Idx => Make_Integer_Literal (Loc, - Counter)))))); + TC => + Make_Function_Call (Loc, + Name => New_Occurrence_Of ( + RTE (RE_Any_Member_Type), Loc), + Parameter_Associations => + New_List ( + New_Occurrence_Of (Any, Loc), + Make_Integer_Literal (Loc, + Intval => Counter))), + Idx => + Make_Integer_Literal (Loc, + Intval => Counter)))))); Append_To (Stmts, Make_Block_Statement (Loc, @@ -8924,10 +8976,10 @@ package body Exp_Dist is Build_From_Any_Call (Disc_Type, Build_Get_Aggregate_Element (Loc, Any => Any_Parameter, - Tc => Build_TypeCode_Call + TC => Build_TypeCode_Call (Loc, Disc_Type, Decls), - Idx => Make_Integer_Literal - (Loc, Component_Counter)), + Idx => Make_Integer_Literal (Loc, + Intval => Component_Counter)), Decls))); Component_Counter := Component_Counter + 1; @@ -9039,7 +9091,7 @@ package body Exp_Dist is Element_Any := Build_Get_Aggregate_Element (Loc, Any => Any, - Tc => Element_TC, + TC => Element_TC, Idx => New_Occurrence_Of (Counter, Loc)); end; @@ -9132,7 +9184,7 @@ package body Exp_Dist is Indt, Build_Get_Aggregate_Element (Loc, Any => Any_Parameter, - Tc => Build_TypeCode_Call (Loc, + TC => Build_TypeCode_Call (Loc, Indt, Decls), Idx => Make_Integer_Literal (Loc, J - 1)), Decls))); @@ -9161,7 +9213,8 @@ package body Exp_Dist is OK_Convert_To ( Standard_Long_Integer, Make_Function_Call (Loc, - Name => New_Occurrence_Of (RTE ( + Name => + New_Occurrence_Of (RTE ( RE_Get_Nested_Sequence_Length ), Loc), Parameter_Associations => @@ -11532,6 +11585,17 @@ package body Exp_Dist is end case; end Specific_Build_Subprogram_Receiving_Stubs; + ------------------------------- + -- Transmit_As_Unconstrained -- + ------------------------------- + + function Transmit_As_Unconstrained (Typ : Entity_Id) return Boolean is + begin + return + not (Is_Elementary_Type (Typ) or else Is_Constrained (Typ)) + or else (Is_Access_Type (Typ) and then Can_Never_Be_Null (Typ)); + end Transmit_As_Unconstrained; + -------------------------- -- Underlying_RACW_Type -- -------------------------- diff --git a/gcc/ada/exp_dist.ads b/gcc/ada/exp_dist.ads index d307fbc04e0..cc2323f26c0 100644 --- a/gcc/ada/exp_dist.ads +++ b/gcc/ada/exp_dist.ads @@ -6,7 +6,7 @@ -- -- -- S p e c -- -- -- --- Copyright (C) 1992-2007, Free Software Foundation, Inc. -- +-- Copyright (C) 1992-2008, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -53,7 +53,7 @@ package Exp_Dist is Insertion_Node : Node_Id; Body_Decls : List_Id); -- Add primitive for the stub type, and the RPC receiver. The declarations - -- are inserted after insertion_Node, while the bodies are appended at the + -- are inserted after Insertion_Node, while the bodies are appended at the -- end of Decls. procedure Remote_Types_Tagged_Full_View_Encountered diff --git a/gcc/ada/exp_fixd.adb b/gcc/ada/exp_fixd.adb index 66c413e3f27..162e5d2ee40 100644 --- a/gcc/ada/exp_fixd.adb +++ b/gcc/ada/exp_fixd.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 1992-2007, Free Software Foundation, Inc. -- +-- Copyright (C) 1992-2008, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -2123,7 +2123,7 @@ package body Exp_Fixd is if Etype (Left) = Universal_Real then if Nkind (Left) = N_Real_Literal then - Do_Multiply_Fixed_Universal (N, Right, Left); + Do_Multiply_Fixed_Universal (N, Left => Right, Right => Left); elsif Nkind (Left) = N_Type_Conversion then Rewrite_Non_Static_Universal (Left); @@ -2214,7 +2214,7 @@ package body Exp_Fixd is Right : constant Node_Id := Right_Opnd (N); begin if Etype (Left) = Universal_Real then - Do_Multiply_Fixed_Universal (N, Right, Left); + Do_Multiply_Fixed_Universal (N, Left => Right, Right => Left); elsif Etype (Right) = Universal_Real then Do_Multiply_Fixed_Universal (N, Left, Right); else diff --git a/gcc/ada/exp_intr.adb b/gcc/ada/exp_intr.adb index 49cdfe028f0..6f29b37b3ba 100644 --- a/gcc/ada/exp_intr.adb +++ b/gcc/ada/exp_intr.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 1992-2007, Free Software Foundation, Inc. -- +-- Copyright (C) 1992-2008, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -659,6 +659,8 @@ package body Exp_Intr is -- String cases else + Name_Len := 0; + case Nam is when Name_File => Get_Decoded_Name_String @@ -668,12 +670,10 @@ package body Exp_Intr is Build_Location_String (Loc); when Name_Enclosing_Entity => - Name_Len := 0; - - Ent := Current_Scope; -- Skip enclosing blocks to reach enclosing unit + Ent := Current_Scope; while Present (Ent) loop exit when Ekind (Ent) /= E_Block and then Ekind (Ent) /= E_Loop; @@ -682,7 +682,6 @@ package body Exp_Intr is -- Ent now points to the relevant defining entity - Name_Len := 0; Write_Entity_Name (Ent); when others => @@ -690,7 +689,8 @@ package body Exp_Intr is end case; Rewrite (N, - Make_String_Literal (Loc, Strval => String_From_Name_Buffer)); + Make_String_Literal (Loc, + Strval => String_From_Name_Buffer)); Analyze_And_Resolve (N, Standard_String); end if; diff --git a/gcc/ada/exp_pakd.adb b/gcc/ada/exp_pakd.adb index 21a78ac80a4..8f191be3a36 100644 --- a/gcc/ada/exp_pakd.adb +++ b/gcc/ada/exp_pakd.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 1992-2007, Free Software Foundation, Inc. -- +-- Copyright (C) 1992-2008, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -1092,7 +1092,7 @@ package body Exp_Pakd is -- discriminants, so we treat it as a default/per-object expression. Set_Parent (Len_Expr, Typ); - Analyze_Per_Use_Expression (Len_Expr, Standard_Long_Long_Integer); + Preanalyze_Spec_Expression (Len_Expr, Standard_Long_Long_Integer); -- Use a modular type if possible. We can do this if we have -- static bounds, and the length is small enough, and the length @@ -1774,47 +1774,11 @@ package body Exp_Pakd is Ltyp := Etype (L); Rtyp := Etype (R); - -- First an odd and silly test. We explicitly check for the XOR - -- case where the component type is True .. True, since this will - -- raise constraint error. A special check is required since CE - -- will not be required other wise (cf Expand_Packed_Not). - - -- No such check is required for AND and OR, since for both these - -- cases False op False = False, and True op True = True. + -- Deeal with silly case of XOR where the subcomponent has a range + -- True .. True where an exception must be raised. if Nkind (N) = N_Op_Xor then - declare - CT : constant Entity_Id := Component_Type (Rtyp); - BT : constant Entity_Id := Base_Type (CT); - - begin - Insert_Action (N, - Make_Raise_Constraint_Error (Loc, - Condition => - Make_Op_And (Loc, - Left_Opnd => - Make_Op_Eq (Loc, - Left_Opnd => - Make_Attribute_Reference (Loc, - Prefix => New_Occurrence_Of (CT, Loc), - Attribute_Name => Name_First), - - Right_Opnd => - Convert_To (BT, - New_Occurrence_Of (Standard_True, Loc))), - - Right_Opnd => - Make_Op_Eq (Loc, - Left_Opnd => - Make_Attribute_Reference (Loc, - Prefix => New_Occurrence_Of (CT, Loc), - Attribute_Name => Name_Last), - - Right_Opnd => - Convert_To (BT, - New_Occurrence_Of (Standard_True, Loc)))), - Reason => CE_Range_Check_Failed)); - end; + Silly_Boolean_Array_Xor_Test (N, Rtyp); end if; -- Now that that silliness is taken care of, get packed array type @@ -2186,37 +2150,11 @@ package body Exp_Pakd is Convert_To_Actual_Subtype (Opnd); Rtyp := Etype (Opnd); - -- First an odd and silly test. We explicitly check for the case - -- where the 'First of the component type is equal to the 'Last of - -- this component type, and if this is the case, we make sure that - -- constraint error is raised. The reason is that the NOT is bound - -- to cause CE in this case, and we will not otherwise catch it. + -- Deal with silly False..False and True..True subtype case - -- Believe it or not, this was reported as a bug. Note that nearly - -- always, the test will evaluate statically to False, so the code - -- will be statically removed, and no extra overhead caused. + Silly_Boolean_Array_Not_Test (N, Rtyp); - declare - CT : constant Entity_Id := Component_Type (Rtyp); - - begin - Insert_Action (N, - Make_Raise_Constraint_Error (Loc, - Condition => - Make_Op_Eq (Loc, - Left_Opnd => - Make_Attribute_Reference (Loc, - Prefix => New_Occurrence_Of (CT, Loc), - Attribute_Name => Name_First), - - Right_Opnd => - Make_Attribute_Reference (Loc, - Prefix => New_Occurrence_Of (CT, Loc), - Attribute_Name => Name_Last)), - Reason => CE_Range_Check_Failed)); - end; - - -- Now that that silliness is taken care of, get packed array type + -- Now that the silliness is taken care of, get packed array type Convert_To_PAT_Type (Opnd); PAT := Etype (Opnd); diff --git a/gcc/ada/exp_prag.adb b/gcc/ada/exp_prag.adb index 3da72eb2bf1..3cb421b4bd3 100644 --- a/gcc/ada/exp_prag.adb +++ b/gcc/ada/exp_prag.adb @@ -40,7 +40,6 @@ with Restrict; use Restrict; with Rident; use Rident; with Rtsfind; use Rtsfind; with Sem; use Sem; -with Sem_Eval; use Sem_Eval; with Sem_Res; use Sem_Res; with Sem_Util; use Sem_Util; with Sinfo; use Sinfo; @@ -60,16 +59,18 @@ package body Exp_Prag is function Arg1 (N : Node_Id) return Node_Id; function Arg2 (N : Node_Id) return Node_Id; + function Arg3 (N : Node_Id) return Node_Id; -- Obtain specified pragma argument expression procedure Expand_Pragma_Abort_Defer (N : Node_Id); - procedure Expand_Pragma_Assert (N : Node_Id); + procedure Expand_Pragma_Check (N : Node_Id); procedure Expand_Pragma_Common_Object (N : Node_Id); procedure Expand_Pragma_Import_Or_Interface (N : Node_Id); procedure Expand_Pragma_Import_Export_Exception (N : Node_Id); procedure Expand_Pragma_Inspection_Point (N : Node_Id); procedure Expand_Pragma_Interrupt_Priority (N : Node_Id); procedure Expand_Pragma_Psect_Object (N : Node_Id); + procedure Expand_Pragma_Relative_Deadline (N : Node_Id); ---------- -- Arg1 -- @@ -93,9 +94,11 @@ package body Exp_Prag is function Arg2 (N : Node_Id) return Node_Id is Arg1 : constant Node_Id := First (Pragma_Argument_Associations (N)); + begin if No (Arg1) then return Empty; + else declare Arg : constant Node_Id := Next (Arg1); @@ -111,6 +114,39 @@ package body Exp_Prag is end if; end Arg2; + ---------- + -- Arg3 -- + ---------- + + function Arg3 (N : Node_Id) return Node_Id is + Arg1 : constant Node_Id := First (Pragma_Argument_Associations (N)); + + begin + if No (Arg1) then + return Empty; + + else + declare + Arg : Node_Id := Next (Arg1); + begin + if No (Arg) then + return Empty; + + else + Next (Arg); + + if Present (Arg) + and then Nkind (Arg) = N_Pragma_Argument_Association + then + return Expression (Arg); + else + return Arg; + end if; + end if; + end; + end if; + end Arg3; + --------------------- -- Expand_N_Pragma -- --------------------- @@ -130,8 +166,8 @@ package body Exp_Prag is when Pragma_Abort_Defer => Expand_Pragma_Abort_Defer (N); - when Pragma_Assert => - Expand_Pragma_Assert (N); + when Pragma_Check => + Expand_Pragma_Check (N); when Pragma_Common_Object => Expand_Pragma_Common_Object (N); @@ -157,6 +193,9 @@ package body Exp_Prag is when Pragma_Psect_Object => Expand_Pragma_Psect_Object (N); + when Pragma_Relative_Deadline => + Expand_Pragma_Relative_Deadline (N); + -- All other pragmas need no expander action when others => null; @@ -227,25 +266,25 @@ package body Exp_Prag is end Expand_Pragma_Abort_Defer; -------------------------- - -- Expand_Pragma_Assert -- + -- Expand_Pragma_Check -- -------------------------- - procedure Expand_Pragma_Assert (N : Node_Id) is + procedure Expand_Pragma_Check (N : Node_Id) is Loc : constant Source_Ptr := Sloc (N); - Cond : constant Node_Id := Arg1 (N); - Msg : String_Id; + Cond : constant Node_Id := Arg2 (N); + Nam : constant Name_Id := Chars (Arg1 (N)); + Msg : Node_Id; begin - -- We already know that assertions are enabled, because otherwise - -- the semantic pass dealt with rewriting the assertion (see Sem_Prag) - - pragma Assert (Assertions_Enabled); + -- We already know that this check is enabled, because otherwise the + -- semantic pass dealt with rewriting the assertion (see Sem_Prag) - -- Since assertions are on, we rewrite the pragma with its + -- Since this check is enabled, we rewrite the pragma into a -- corresponding if statement, and then analyze the statement + -- The normal case expansion transforms: - -- pragma Assert (condition [,message]); + -- pragma Check (name, condition [,message]); -- into @@ -254,7 +293,9 @@ package body Exp_Prag is -- end if; -- where Str is the message if one is present, or the default of - -- file:line if no message is given. + -- name failed at file:line if no message is given (the "name failed + -- at" is omitted for name = Assertion, since it is redundant, given + -- that the name of the exception is Assert_Failure. -- An alternative expansion is used when the No_Exception_Propagation -- restriction is active and there is a local Assert_Failure handler. @@ -281,7 +322,7 @@ package body Exp_Prag is -- Case where we generate a direct raise if (Debug_Flag_Dot_G - or else Restriction_Active (No_Exception_Propagation)) + or else Restriction_Active (No_Exception_Propagation)) and then Present (Find_Local_Handler (RTE (RE_Assert_Failure), N)) then Rewrite (N, @@ -297,13 +338,29 @@ package body Exp_Prag is -- Case where we call the procedure else - -- First, we need to prepare the string literal + -- First, we need to prepare the string argument + + -- If we have a message given, use it + + if Present (Arg3 (N)) then + Msg := Arg3 (N); + + -- Otherwise string is "name failed at location" except in the case + -- of Assertion where "name failed at" is omitted. - if Present (Arg2 (N)) then - Msg := Strval (Expr_Value_S (Arg2 (N))); else + if Nam = Name_Assertion then + Name_Len := 0; + else + Get_Name_String (Nam); + Set_Casing (Identifier_Casing (Current_Source_File)); + Add_Str_To_Name_Buffer (" failed at "); + end if; + Build_Location_String (Loc); - Msg := String_From_Name_Buffer; + Msg := + Make_String_Literal (Loc, + Strval => String_From_Name_Buffer); end if; -- Now rewrite as an if statement @@ -317,8 +374,7 @@ package body Exp_Prag is Make_Procedure_Call_Statement (Loc, Name => New_Reference_To (RTE (RE_Raise_Assert_Failure), Loc), - Parameter_Associations => New_List ( - Make_String_Literal (Loc, Msg)))))); + Parameter_Associations => New_List (Msg))))); end if; Analyze (N); @@ -336,11 +392,13 @@ package body Exp_Prag is and then Entity (Original_Node (Cond)) = Standard_False then return; - else + elsif Nam = Name_Assertion then Error_Msg_N ("?assertion will fail at run-time", N); + else + Error_Msg_N ("?check will fail at run time", N); end if; end if; - end Expand_Pragma_Assert; + end Expand_Pragma_Check; --------------------------------- -- Expand_Pragma_Common_Object -- @@ -737,4 +795,39 @@ package body Exp_Prag is procedure Expand_Pragma_Psect_Object (N : Node_Id) renames Expand_Pragma_Common_Object; + ------------------------------------- + -- Expand_Pragma_Relative_Deadline -- + ------------------------------------- + + procedure Expand_Pragma_Relative_Deadline (N : Node_Id) is + P : constant Node_Id := Parent (N); + Loc : constant Source_Ptr := Sloc (N); + + begin + -- Expand the pragma only in the case of the main subprogram. For tasks + -- the expansion is done in exp_ch9. Generate a call to Set_Deadline + -- at Clock plus the relative deadline specified in the pragma. Time + -- values are translated into Duration to allow for non-private + -- addition operation. + + if Nkind (P) = N_Subprogram_Body then + Rewrite + (N, + Make_Procedure_Call_Statement (Loc, + Name => New_Reference_To (RTE (RE_Set_Deadline), Loc), + Parameter_Associations => New_List ( + Unchecked_Convert_To (RTE (RO_RT_Time), + Make_Op_Add (Loc, + Left_Opnd => + Make_Function_Call (Loc, + New_Reference_To (RTE (RO_RT_To_Duration), Loc), + New_List (Make_Function_Call (Loc, + New_Reference_To (RTE (RE_Clock), Loc)))), + Right_Opnd => + Unchecked_Convert_To (Standard_Duration, Arg1 (N))))))); + + Analyze (N); + end if; + end Expand_Pragma_Relative_Deadline; + end Exp_Prag; diff --git a/gcc/ada/exp_strm.adb b/gcc/ada/exp_strm.adb index b2974dc2765..2ffa26a4cf9 100644 --- a/gcc/ada/exp_strm.adb +++ b/gcc/ada/exp_strm.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 1992-2007, Free Software Foundation, Inc. -- +-- Copyright (C) 1992-2008, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -373,7 +373,7 @@ package body Exp_Strm is -- array may be user-defined, and be frozen after the type for which -- we are generating the stream subprogram. In that case, freeze the -- stream attribute of the component type, whose declaration could not - -- generate any additional freezing actions in any case. See 5509-003. + -- generate any additional freezing actions in any case. if Nam = Name_Read then RW := TSS (Base_Type (Ctyp), TSS_Stream_Read); @@ -1092,13 +1092,14 @@ package body Exp_Strm is Decl : out Node_Id; Fnam : out Entity_Id) is - Cn : Name_Id; - J : Pos; - Decls : List_Id; - Constr : List_Id; - Stms : List_Id; - Discr : Entity_Id; - Odef : Node_Id; + Cn : Name_Id; + J : Pos; + Decls : List_Id; + Constr : List_Id; + Obj_Decl : Node_Id; + Stms : List_Id; + Discr : Entity_Id; + Odef : Node_Id; begin Decls := New_List; @@ -1152,14 +1153,23 @@ package body Exp_Strm is -- Perhaps we should just generate an extended return in all cases??? + Obj_Decl := + Make_Object_Declaration (Loc, + Defining_Identifier => Make_Defining_Identifier (Loc, Name_V), + Object_Definition => Odef); + + -- If the type is an access type, do not perform default initialization. + -- The object is about to get its value from Read, and if the type is + -- null excluding we do not want spurious warnings on an initial null. + + if Is_Access_Type (Typ) then + Set_No_Initialization (Obj_Decl); + end if; + if Ada_Version >= Ada_05 then Stms := New_List ( Make_Extended_Return_Statement (Loc, - Return_Object_Declarations => - New_List (Make_Object_Declaration (Loc, - Defining_Identifier => - Make_Defining_Identifier (Loc, Name_V), - Object_Definition => Odef)), + Return_Object_Declarations => New_List (Obj_Decl), Handled_Statement_Sequence => Make_Handled_Sequence_Of_Statements (Loc, New_List (Make_Attribute_Reference (Loc, @@ -1170,10 +1180,7 @@ package body Exp_Strm is Make_Identifier (Loc, Name_V))))))); else - Append_To (Decls, - Make_Object_Declaration (Loc, - Defining_Identifier => Make_Defining_Identifier (Loc, Name_V), - Object_Definition => Odef)); + Append_To (Decls, Obj_Decl); Stms := New_List ( Make_Attribute_Reference (Loc, diff --git a/gcc/ada/exp_tss.adb b/gcc/ada/exp_tss.adb index e3a7c292c25..f9b9e33374e 100644 --- a/gcc/ada/exp_tss.adb +++ b/gcc/ada/exp_tss.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 1992-2007, Free Software Foundation, Inc. -- +-- Copyright (C) 1992-2008, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -28,6 +28,8 @@ with Einfo; use Einfo; with Elists; use Elists; with Exp_Util; use Exp_Util; with Lib; use Lib; +with Restrict; use Restrict; +with Rident; use Rident; with Sem_Util; use Sem_Util; with Sinfo; use Sinfo; @@ -159,11 +161,16 @@ package body Exp_Tss is -- Has_Non_Null_Base_Init_Proc -- --------------------------------- + -- Note: if a base Init_Proc is present, and No_Default_Initialization is + -- present, then we must avoid testing for a null init proc, since there + -- is no init proc present in this case. + function Has_Non_Null_Base_Init_Proc (Typ : Entity_Id) return Boolean is BIP : constant Entity_Id := Base_Init_Proc (Typ); - begin - return Present (BIP) and then not Is_Null_Init_Proc (BIP); + return Present (BIP) + and then (Restriction_Active (No_Default_Initialization) + or else not Is_Null_Init_Proc (BIP)); end Has_Non_Null_Base_Init_Proc; --------------- @@ -306,20 +313,31 @@ package body Exp_Tss is ------------- procedure Set_TSS (Typ : Entity_Id; TSS : Entity_Id) is - Subprog_Body : constant Node_Id := Unit_Declaration_Node (TSS); - begin - -- Case of insertion location is in unit defining the type + -- Make sure body of subprogram is frozen - if In_Same_Code_Unit (Typ, TSS) then - Append_Freeze_Action (Typ, Subprog_Body); + -- Skip this for Init_Proc with No_Default_Initialization, since the + -- Init proc is a dummy void entity in this case to be ignored. - -- Otherwise, we are using an already existing TSS in another unit + if Is_Init_Proc (TSS) + and then Restriction_Active (No_Default_Initialization) + then + null; - else + -- Skip this if not in the same code unit (since it means we are using + -- an already existing TSS in another unit) + + elsif not In_Same_Code_Unit (Typ, TSS) then null; + + -- Otherwise make sure body is frozen + + else + Append_Freeze_Action (Typ, Unit_Declaration_Node (TSS)); end if; + -- Set TSS entry + Copy_TSS (TSS, Typ); end Set_TSS; diff --git a/gcc/ada/exp_tss.ads b/gcc/ada/exp_tss.ads index 2473d4a69f3..e72e38cc2c0 100644 --- a/gcc/ada/exp_tss.ads +++ b/gcc/ada/exp_tss.ads @@ -6,7 +6,7 @@ -- -- -- S p e c -- -- -- --- Copyright (C) 1992-2007, Free Software Foundation, Inc. -- +-- Copyright (C) 1992-2008, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -215,7 +215,7 @@ package Exp_Tss is function Has_Non_Null_Base_Init_Proc (Typ : Entity_Id) return Boolean; -- Returns true if the given type has a defined Base_Init_Proc and -- this init proc is not a null init proc (null init procs occur as - -- a result of the processing for Initialize_Scalars. This function + -- a result of the processing for Initialize_Scalars). This function -- is used to test for the presence of an init proc in cases where -- a null init proc is considered equivalent to no init proc. diff --git a/gcc/ada/exp_util.adb b/gcc/ada/exp_util.adb index 82f3fcfc201..12fea51a197 100644 --- a/gcc/ada/exp_util.adb +++ b/gcc/ada/exp_util.adb @@ -336,7 +336,7 @@ package body Exp_Util is -- component, whose prefix is the outer variable of the array type. -- The n-dimensional array type has known indices Index, Index2... -- Id_Ref is an indexed component form created by the enclosing init proc. - -- Its successive indices are Val1, Val2,.. which are the loop variables + -- Its successive indices are Val1, Val2, ... which are the loop variables -- in the loops that call the individual task init proc on each component. -- The generated function has the following structure: @@ -962,9 +962,16 @@ package body Exp_Util is if Has_Entries (Typ) or else Has_Interrupt_Handler (Typ) or else (Has_Attach_Handler (Typ) - and then not Restricted_Profile) - or else (Ada_Version >= Ada_05 - and then Present (Interface_List (Parent (Typ)))) + and then not Restricted_Profile) + + -- A protected type without entries that covers an interface and + -- overrides the abstract routines with protected procedures is + -- considered equivalent to a protected type with entries in the + -- context of dispatching select statements. It is sufficent to + -- check for the presence of an interface list in the declaration + -- node to recognize this case. + + or else Present (Interface_List (Parent (Typ))) then if Abort_Allowed or else Restriction_Active (No_Entry_Queue) = False @@ -1814,6 +1821,34 @@ package body Exp_Util is return Node (Prim); end Find_Prim_Op; + ---------------------------- + -- Find_Protection_Object -- + ---------------------------- + + function Find_Protection_Object (Scop : Entity_Id) return Entity_Id is + S : Entity_Id; + + begin + S := Scop; + while Present (S) loop + if (Ekind (S) = E_Entry + or else Ekind (S) = E_Entry_Family + or else Ekind (S) = E_Function + or else Ekind (S) = E_Procedure) + and then Present (Protection_Object (S)) + then + return Protection_Object (S); + end if; + + S := Scope (S); + end loop; + + -- If we do not find a Protection object in the scope chain, then + -- something has gone wrong, most likely the object was never created. + + raise Program_Error; + end Find_Protection_Object; + ---------------------- -- Force_Evaluation -- ---------------------- @@ -2292,13 +2327,14 @@ package body Exp_Util is return; end if; - -- Ignore insert of actions from inside default expression in the - -- special preliminary analyze mode. Any insertions at this point - -- have no relevance, since we are only doing the analyze to freeze - -- the types of any static expressions. See section "Handling of - -- Default Expressions" in the spec of package Sem for further details. + -- Ignore insert of actions from inside default expression (or other + -- similar "spec expression") in the special spec-expression analyze + -- mode. Any insertions at this point have no relevance, since we are + -- only doing the analyze to freeze the types of any static expressions. + -- See section "Handling of Default Expressions" in the spec of package + -- Sem for further details. - if In_Default_Expression then + if In_Spec_Expression then return; end if; @@ -3028,6 +3064,10 @@ package body Exp_Util is Get_Name_String (Chars (E)); + -- Most predefined primitives have internally generated names. Equality + -- must be treated differently; the predefined operation is recognized + -- as a homgeneous binary operator that returns Boolean. + if Name_Len > TSS_Name_Type'Last then TSS_Name := TSS_Name_Type (Name_Buffer (Name_Len - TSS_Name'Length + 1 .. Name_Len)); @@ -3441,6 +3481,40 @@ package body Exp_Util is and then Etype (Full_View (T)) /= T); end Is_Untagged_Derivation; + --------------------------- + -- Is_Volatile_Reference -- + --------------------------- + + function Is_Volatile_Reference (N : Node_Id) return Boolean is + begin + if Nkind (N) in N_Has_Etype + and then Present (Etype (N)) + and then Treat_As_Volatile (Etype (N)) + then + return True; + + elsif Is_Entity_Name (N) then + return Treat_As_Volatile (Entity (N)); + + elsif Nkind (N) = N_Slice then + return Is_Volatile_Reference (Prefix (N)); + + elsif Nkind_In (N, N_Indexed_Component, N_Selected_Component) then + if (Is_Entity_Name (Prefix (N)) + and then Has_Volatile_Components (Entity (Prefix (N)))) + or else (Present (Etype (Prefix (N))) + and then Has_Volatile_Components (Etype (Prefix (N)))) + then + return True; + else + return Is_Volatile_Reference (Prefix (N)); + end if; + + else + return False; + end if; + end Is_Volatile_Reference; + -------------------- -- Kill_Dead_Code -- -------------------- @@ -4257,9 +4331,15 @@ package body Exp_Util is end if; end; - -- If we have neither a record nor array component, it means that we - -- have fallen off the top testing prefixes recursively, and we now - -- have a stand alone object, where we don't have a problem. + -- For a slice, test the prefix, if that is possibly misaligned, + -- then for sure the slice is! + + when N_Slice => + return Possible_Bit_Aligned_Component (Prefix (N)); + + -- If we have none of the above, it means that we have fallen off the + -- top testing prefixes recursively, and we now have a stand alone + -- object, where we don't have a problem. when others => return False; @@ -4375,7 +4455,7 @@ package body Exp_Util is -- hand, if we do not consider them to be side effect free, then -- we get some awkward expansions in -gnato mode, resulting in -- code insertions at a point where we do not have a clear model - -- for performing the insertions. See 4908-002/comment for details. + -- for performing the insertions. -- Special handling for entity names @@ -4399,14 +4479,13 @@ package body Exp_Util is return False; -- Variables are considered to be a side effect if Variable_Ref - -- is set or if we have a volatile variable and Name_Req is off. + -- is set or if we have a volatile reference and Name_Req is off. -- If Name_Req is True then we can't help returning a name which -- effectively allows multiple references in any case. elsif Is_Variable (N) then return not Variable_Ref - and then (not Treat_As_Volatile (Entity (N)) - or else Name_Req); + and then (not Is_Volatile_Reference (N) or else Name_Req); -- Any other entity (e.g. a subtype name) is definitely side -- effect free. @@ -4631,17 +4710,16 @@ package body Exp_Util is Scope_Suppress := (others => True); -- If it is a scalar type and we need to capture the value, just make - -- a copy. Likewise for a function or operator call. And if we have a - -- volatile variable and Nam_Req is not set (see comments above for - -- Side_Effect_Free). + -- a copy. Likewise for a function call, an attribute reference or an + -- operator. And if we have a volatile reference and Name_Req is not + -- set (see comments above for Side_Effect_Free). if Is_Elementary_Type (Exp_Type) and then (Variable_Ref or else Nkind (Exp) = N_Function_Call + or else Nkind (Exp) = N_Attribute_Reference or else Nkind (Exp) in N_Op - or else (not Name_Req - and then Is_Entity_Name (Exp) - and then Treat_As_Volatile (Entity (Exp)))) + or else (not Name_Req and then Is_Volatile_Reference (Exp))) then Def_Id := Make_Defining_Identifier (Loc, New_Internal_Name ('R')); Set_Etype (Def_Id, Exp_Type); @@ -4686,9 +4764,9 @@ package body Exp_Util is -- If this is a type conversion, leave the type conversion and remove -- the side effects in the expression. This is important in several - -- circumstances: for change of representations, and also when this - -- is a view conversion to a smaller object, where gigi can end up - -- creating its own temporary of the wrong size. + -- circumstances: for change of representations, and also when this is + -- a view conversion to a smaller object, where gigi can end up creating + -- its own temporary of the wrong size. elsif Nkind (Exp) = N_Type_Conversion then Remove_Side_Effects (Expression (Exp), Name_Req, Variable_Ref); @@ -4732,14 +4810,12 @@ package body Exp_Util is end if; -- For expressions that denote objects, we can use a renaming scheme. - -- We skip using this if we have a volatile variable and we do not - -- have Nam_Req set true (see comments above for Side_Effect_Free). + -- We skip using this if we have a volatile reference and we do not + -- have Name_Req set true (see comments above for Side_Effect_Free). elsif Is_Object_Reference (Exp) and then Nkind (Exp) /= N_Function_Call - and then (Name_Req - or else not Is_Entity_Name (Exp) - or else not Treat_As_Volatile (Entity (Exp))) + and then (Name_Req or else not Is_Volatile_Reference (Exp)) then Def_Id := Make_Defining_Identifier (Loc, New_Internal_Name ('R')); @@ -4778,7 +4854,7 @@ package body Exp_Util is -- If this is a packed reference, or a selected component with a -- non-standard representation, a reference to the temporary will -- be replaced by a copy of the original expression (see - -- exp_ch2.Expand_Renaming). Otherwise the temporary must be + -- Exp_Ch2.Expand_Renaming). Otherwise the temporary must be -- elaborated by gigi, and is of course not to be replaced in-line -- by the expression it renames, which would defeat the purpose of -- removing the side-effect. @@ -4795,6 +4871,36 @@ package body Exp_Util is -- Otherwise we generate a reference to the value else + -- Special processing for function calls that return a task. We need + -- to build a declaration that will enable build-in-place expansion + -- of the call. + + -- This is relevant only in Ada 2005 mode. In Ada 95 programs we have + -- to accommodate functions returning limited objects by reference. + + if Nkind (Exp) = N_Function_Call + and then Is_Task_Type (Etype (Exp)) + and then Ada_Version >= Ada_05 + then + declare + Obj : constant Entity_Id := + Make_Defining_Identifier (Loc, + Chars => New_Internal_Name ('F')); + Decl : Node_Id; + + begin + Decl := + Make_Object_Declaration (Loc, + Defining_Identifier => Obj, + Object_Definition => New_Occurrence_Of (Exp_Type, Loc), + Expression => Relocate_Node (Exp)); + Insert_Action (Exp, Decl); + Set_Etype (Obj, Exp_Type); + Rewrite (Exp, New_Occurrence_Of (Obj, Loc)); + return; + end; + end if; + Ref_Type := Make_Defining_Identifier (Loc, New_Internal_Name ('A')); Ptr_Typ_Decl := @@ -5202,9 +5308,9 @@ package body Exp_Util is Analyze (Asn); - -- Kill current value indication. This is necessary because - -- the tests of this flag are inserted out of sequence and must - -- not pick up bogus indications of the wrong constant value. + -- Kill current value indication. This is necessary because the + -- tests of this flag are inserted out of sequence and must not + -- pick up bogus indications of the wrong constant value. Set_Current_Value (Ent, Empty); end if; @@ -5237,6 +5343,87 @@ package body Exp_Util is end if; end Set_Renamed_Subprogram; + ---------------------------------- + -- Silly_Boolean_Array_Not_Test -- + ---------------------------------- + + -- This procedure implements an odd and silly test. We explicitly check + -- for the case where the 'First of the component type is equal to the + -- 'Last of this component type, and if this is the case, we make sure + -- that constraint error is raised. The reason is that the NOT is bound + -- to cause CE in this case, and we will not otherwise catch it. + + -- Believe it or not, this was reported as a bug. Note that nearly + -- always, the test will evaluate statically to False, so the code will + -- be statically removed, and no extra overhead caused. + + procedure Silly_Boolean_Array_Not_Test (N : Node_Id; T : Entity_Id) is + Loc : constant Source_Ptr := Sloc (N); + CT : constant Entity_Id := Component_Type (T); + + begin + Insert_Action (N, + Make_Raise_Constraint_Error (Loc, + Condition => + Make_Op_Eq (Loc, + Left_Opnd => + Make_Attribute_Reference (Loc, + Prefix => New_Occurrence_Of (CT, Loc), + Attribute_Name => Name_First), + + Right_Opnd => + Make_Attribute_Reference (Loc, + Prefix => New_Occurrence_Of (CT, Loc), + Attribute_Name => Name_Last)), + Reason => CE_Range_Check_Failed)); + end Silly_Boolean_Array_Not_Test; + + ---------------------------------- + -- Silly_Boolean_Array_Xor_Test -- + ---------------------------------- + + -- This procedure implements an odd and silly test. We explicitly check + -- for the XOR case where the component type is True .. True, since this + -- will raise constraint error. A special check is required since CE + -- will not be required otherwise (cf Expand_Packed_Not). + + -- No such check is required for AND and OR, since for both these cases + -- False op False = False, and True op True = True. + + procedure Silly_Boolean_Array_Xor_Test (N : Node_Id; T : Entity_Id) is + Loc : constant Source_Ptr := Sloc (N); + CT : constant Entity_Id := Component_Type (T); + BT : constant Entity_Id := Base_Type (CT); + + begin + Insert_Action (N, + Make_Raise_Constraint_Error (Loc, + Condition => + Make_Op_And (Loc, + Left_Opnd => + Make_Op_Eq (Loc, + Left_Opnd => + Make_Attribute_Reference (Loc, + Prefix => New_Occurrence_Of (CT, Loc), + Attribute_Name => Name_First), + + Right_Opnd => + Convert_To (BT, + New_Occurrence_Of (Standard_True, Loc))), + + Right_Opnd => + Make_Op_Eq (Loc, + Left_Opnd => + Make_Attribute_Reference (Loc, + Prefix => New_Occurrence_Of (CT, Loc), + Attribute_Name => Name_Last), + + Right_Opnd => + Convert_To (BT, + New_Occurrence_Of (Standard_True, Loc)))), + Reason => CE_Range_Check_Failed)); + end Silly_Boolean_Array_Xor_Test; + -------------------------- -- Target_Has_Fixed_Ops -- -------------------------- diff --git a/gcc/ada/exp_util.ads b/gcc/ada/exp_util.ads index 9c99323e8e4..73277afe16b 100644 --- a/gcc/ada/exp_util.ads +++ b/gcc/ada/exp_util.ads @@ -372,6 +372,13 @@ package Exp_Util is -- operation which is not directly visible. If T is a class wide type, -- then the reference is to an operation of the corresponding root type. + function Find_Protection_Object (Scop : Entity_Id) return Entity_Id; + -- Traverse the scope stack starting from Scop and look for an entry, + -- entry family, or a subprogram that has a Protection_Object and return + -- it. Raises Program_Error if no such entity is found since the context + -- in which this routine is invoked should always have a protection + -- object. + procedure Force_Evaluation (Exp : Node_Id; Name_Req : Boolean := False); @@ -491,6 +498,13 @@ package Exp_Util is -- Returns true if type T is not tagged and is a derived type, -- or is a private type whose completion is such a type. + function Is_Volatile_Reference (N : Node_Id) return Boolean; + -- Checks if the node N represents a volatile reference, which can be + -- either a direct reference to a variable treated as volatile, or an + -- indexed/selected component where the prefix is treated as volatile, + -- or has Volatile_Components set. A slice of a volatile variable is + -- also volatile. + procedure Kill_Dead_Code (N : Node_Id; Warn : Boolean := False); -- N represents a node for a section of code that is known to be dead. Any -- exception handler references and warning messages relating to this code @@ -613,6 +627,18 @@ package Exp_Util is -- renamed subprogram. The node is rewritten to be an identifier that -- refers directly to the renamed subprogram, given by entity E. + procedure Silly_Boolean_Array_Not_Test (N : Node_Id; T : Entity_Id); + -- N is the node for a boolean array NOT operation, and T is the type of + -- the array. This routine deals with the silly case where the subtype of + -- the boolean array is False..False or True..True, where it is required + -- that a Constraint_Error exception be raised (RM 4.5.6(6)). + + procedure Silly_Boolean_Array_Xor_Test (N : Node_Id; T : Entity_Id); + -- N is the node for a boolean array XOR operation, and T is the type of + -- the array. This routine deals with the silly case where the subtype of + -- the boolean array is True..True, where a raise of a Constraint_Error + -- exception is required (RM 4.5.6(6)). + function Target_Has_Fixed_Ops (Left_Typ : Entity_Id; Right_Typ : Entity_Id; diff --git a/gcc/ada/expander.adb b/gcc/ada/expander.adb index a6164fb5f9b..674137df1da 100644 --- a/gcc/ada/expander.adb +++ b/gcc/ada/expander.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 1992-2007, Free Software Foundation, Inc. -- +-- Copyright (C) 1992-2008, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -73,12 +73,13 @@ package body Expander is procedure Expand (N : Node_Id) is begin - -- If we were analyzing a default expression the Full_Analysis flag must - -- be off. If we are in expansion mode then we must be performing a full - -- analysis. If we are analyzing a generic then Expansion must be off. + -- If we were analyzing a default expression (or other spec expression) + -- the Full_Analysis flag must be off. If we are in expansion mode then + -- we must be performing a full analysis. If we are analyzing a generic + -- then Expansion must be off. pragma Assert - (not (Full_Analysis and then In_Default_Expression) + (not (Full_Analysis and then In_Spec_Expression) and then (Full_Analysis or else not Expander_Active) and then not (Inside_A_Generic and then Expander_Active)); diff --git a/gcc/ada/expander.ads b/gcc/ada/expander.ads index 7c5c619d867..df59442186a 100644 --- a/gcc/ada/expander.ads +++ b/gcc/ada/expander.ads @@ -6,7 +6,7 @@ -- -- -- S p e c -- -- -- --- Copyright (C) 1992-2007, Free Software Foundation, Inc. -- +-- Copyright (C) 1992-2008, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -138,7 +138,7 @@ package Expander is -- (b) when starting/completing the pre-analysis of an expression -- (see the spec of package Sem for more info on pre-analysis.) -- - -- Note that when processing a default expression (In_Default_Expression + -- Note that when processing a spec expression (In_Spec_Expression -- is True) or performing semantic analysis of a generic spec or body -- (Inside_A_Generic) or when performing pre-analysis (Full_Analysis is -- False) the Expander_Active flag is False. diff --git a/gcc/ada/fe.h b/gcc/ada/fe.h index 09dd2792063..2a038d58ffe 100644 --- a/gcc/ada/fe.h +++ b/gcc/ada/fe.h @@ -6,7 +6,7 @@ * * * C Header File * * * - * Copyright (C) 1992-2007, Free Software Foundation, Inc. * + * Copyright (C) 1992-2008, Free Software Foundation, Inc. * * * * GNAT is free software; you can redistribute it and/or modify it under * * terms of the GNU General Public License as published by the Free Soft- * @@ -46,11 +46,11 @@ extern char Fold_Lower[], Fold_Upper[]; /* debug: */ -#define Debug_Flag_XX debug__debug_flag_xx #define Debug_Flag_NN debug__debug_flag_nn +#define Debug_Flag_Dot_A debug__debug_flag_dot_a -extern Boolean Debug_Flag_XX; extern Boolean Debug_Flag_NN; +extern Boolean Debug_Flag_Dot_A; /* einfo: We will be setting Esize for types, Component_Bit_Offset for fields, Alignment for types and objects, Component_Size for array types, and diff --git a/gcc/ada/fmap.adb b/gcc/ada/fmap.adb index 8f286b3b6f7..b09a5248b88 100644 --- a/gcc/ada/fmap.adb +++ b/gcc/ada/fmap.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 2001-2007, Free Software Foundation, Inc. -- +-- Copyright (C) 2001-2008, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -37,8 +37,10 @@ with GNAT.HTable; package body Fmap is - subtype Big_String is String (Positive); - type Big_String_Ptr is access all Big_String; + No_Mapping_File : Boolean := False; + -- Set to True when the specified mapping file cannot be read in + -- procedure Initialize, so that no attempt is made to oopen the mapping + -- file in procedure Update_Mapping_File. function To_Big_String_Ptr is new Unchecked_Conversion (Source_Buffer_Ptr, Big_String_Ptr); @@ -301,6 +303,7 @@ package body Fmap is Write_Str ("warning: could not read mapping file """); Write_Str (File_Name); Write_Line (""""); + No_Mapping_File := True; else BS := To_Big_String_Ptr (Src); @@ -479,27 +482,17 @@ package body Fmap is -- Start of Update_Mapping_File begin + -- If the mapping file could not be read, then it will not be possible + -- to update it. + if No_Mapping_File then + return; + end if; -- Only Update if there are new entries in the mappings if Last_In_Table < File_Mapping.Last then - -- If the tables have been emptied, recreate the file. - -- Otherwise, append to it. - - if Last_In_Table = 0 then - declare - Discard : Boolean; - pragma Warnings (Off, Discard); - begin - Delete_File (File_Name, Discard); - end; - - File := Create_File (File_Name, Binary); - - else - File := Open_Read_Write (Name => File_Name, Fmode => Binary); - end if; + File := Open_Read_Write (Name => File_Name, Fmode => Binary); if File /= Invalid_FD then if Last_In_Table > 0 then diff --git a/gcc/ada/fname-sf.adb b/gcc/ada/fname-sf.adb index c5ed3060e5a..f967c1658b9 100644 --- a/gcc/ada/fname-sf.adb +++ b/gcc/ada/fname-sf.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 1992-2007, Free Software Foundation, Inc. -- +-- Copyright (C) 1992-2008, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -34,9 +34,6 @@ with Unchecked_Conversion; package body Fname.SF is - subtype Big_String is String (Positive); - type Big_String_Ptr is access all Big_String; - function To_Big_String_Ptr is new Unchecked_Conversion (Source_Buffer_Ptr, Big_String_Ptr); diff --git a/gcc/ada/freeze.adb b/gcc/ada/freeze.adb index d1d72d71d05..f2bd7b13b67 100644 --- a/gcc/ada/freeze.adb +++ b/gcc/ada/freeze.adb @@ -617,17 +617,29 @@ package body Freeze is if Size_Known_At_Compile_Time (T) then return True; + -- Always True for scalar types. This is true even for generic formal + -- scalar types. We used to return False in the latter case, but the + -- size is known at compile time, even in the template, we just do + -- not know the exact size but that's not the point of this routine. + elsif Is_Scalar_Type (T) or else Is_Task_Type (T) then - return not Is_Generic_Type (T); + return True; + + -- Array types elsif Is_Array_Type (T) then + + -- String literals always have known size, and we can set it + if Ekind (T) = E_String_Literal_Subtype then Set_Small_Size (T, Component_Size (T) * String_Literal_Length (T)); return True; + -- Unconstrained types never have known at compile time size + elsif not Is_Constrained (T) then return False; @@ -637,6 +649,8 @@ package body Freeze is elsif Error_Posted (T) then return False; + -- Otherwise if component size unknown, then array size unknown + elsif not Size_Known (Component_Type (T)) then return False; end if; @@ -685,9 +699,13 @@ package body Freeze is return True; end; + -- Access types always have known at compile time sizes + elsif Is_Access_Type (T) then return True; + -- For non-generic private types, go to underlying type if present + elsif Is_Private_Type (T) and then not Is_Generic_Type (T) and then Present (Underlying_Type (T)) @@ -701,6 +719,8 @@ package body Freeze is return Size_Known (Underlying_Type (T)); end if; + -- Record types + elsif Is_Record_Type (T) then -- A class-wide type is never considered to have a known size @@ -906,6 +926,8 @@ package body Freeze is return True; end; + -- All other cases, size not known at compile time + else return False; end if; @@ -1100,8 +1122,8 @@ package body Freeze is New_N := Make_Object_Declaration (Loc, Defining_Identifier => Temp, - Object_definition => New_Occurrence_Of (Typ, Loc), - Expression => Relocate_Node (E)); + Object_Definition => New_Occurrence_Of (Typ, Loc), + Expression => Relocate_Node (E)); Insert_Before (Parent (E), New_N); Analyze (New_N); @@ -1298,7 +1320,7 @@ package body Freeze is -- We also add finalization chains to access types whose designated -- types are controlled. This is normally done when freezing the type, -- but this misses recursive type definitions where the later members - -- of the recursion introduce controlled components (e.g. 5624-001). + -- of the recursion introduce controlled components. -- Loop through entities @@ -3516,9 +3538,23 @@ package body Freeze is if Is_Pure_Unit_Access_Type (E) and then (Ada_Version < Ada_05 - or else not No_Pool_Assigned (E)) + or else not No_Pool_Assigned (E)) then Error_Msg_N ("named access type not allowed in pure unit", E); + + if Ada_Version >= Ada_05 then + Error_Msg_N + ("\would be legal if Storage_Size of 0 given?", E); + + elsif No_Pool_Assigned (E) then + Error_Msg_N + ("\would be legal in Ada 2005?", E); + + else + Error_Msg_N + ("\would be legal in Ada 2005 if " + & "Storage_Size of 0 given?", E); + end if; end if; end if; @@ -3807,12 +3843,12 @@ package body Freeze is ----------------------- procedure Freeze_Expression (N : Node_Id) is - In_Def_Exp : constant Boolean := In_Default_Expression; - Typ : Entity_Id; - Nam : Entity_Id; - Desig_Typ : Entity_Id; - P : Node_Id; - Parent_P : Node_Id; + In_Spec_Exp : constant Boolean := In_Spec_Expression; + Typ : Entity_Id; + Nam : Entity_Id; + Desig_Typ : Entity_Id; + P : Node_Id; + Parent_P : Node_Id; Freeze_Outside : Boolean := False; -- This flag is set true if the entity must be frozen outside the @@ -3883,7 +3919,7 @@ package body Freeze is -- make sure that we actually have a real expression (if we have -- a subtype indication, we can't test Is_Static_Expression!) - if In_Def_Exp + if In_Spec_Exp and then Nkind (N) in N_Subexpr and then not Is_Static_Expression (N) then @@ -4015,7 +4051,7 @@ package body Freeze is -- For either of these cases, we skip the freezing - if not In_Default_Expression + if not In_Spec_Expression and then Nkind (N) = N_Identifier and then (Present (Entity (N))) then @@ -4202,11 +4238,11 @@ package body Freeze is -- static type, and the freeze scope needs to be the outer scope, not -- the scope of the subprogram with the default parameter. - -- For default expressions in generic units, the Move_Freeze_Nodes - -- mechanism (see sem_ch12.adb) takes care of placing them at the proper - -- place, after the generic unit. + -- For default expressions and other spec expressions in generic units, + -- the Move_Freeze_Nodes mechanism (see sem_ch12.adb) takes care of + -- placing them at the proper place, after the generic unit. - if (In_Def_Exp and not Inside_A_Generic) + if (In_Spec_Exp and not Inside_A_Generic) or else Freeze_Outside or else (Is_Type (Current_Scope) and then (not Is_Concurrent_Type (Current_Scope) @@ -4254,15 +4290,15 @@ package body Freeze is end if; -- Now we have the right place to do the freezing. First, a special - -- adjustment, if we are in default expression analysis mode, these - -- freeze actions must not be thrown away (normally all inserted actions - -- are thrown away in this mode. However, the freeze actions are from - -- static expressions and one of the important reasons we are doing this + -- adjustment, if we are in spec-expression analysis mode, these freeze + -- actions must not be thrown away (normally all inserted actions are + -- thrown away in this mode. However, the freeze actions are from static + -- expressions and one of the important reasons we are doing this -- special analysis is to get these freeze actions. Therefore we turn - -- off the In_Default_Expression mode to propagate these freeze actions. + -- off the In_Spec_Expression mode to propagate these freeze actions. -- This also means they get properly analyzed and expanded. - In_Default_Expression := False; + In_Spec_Expression := False; -- Freeze the designated type of an allocator (RM 13.14(13)) @@ -4283,7 +4319,9 @@ package body Freeze is Freeze_Before (P, Nam); end if; - In_Default_Expression := In_Def_Exp; + -- Restore In_Spec_Expression flag + + In_Spec_Expression := In_Spec_Exp; end Freeze_Expression; ----------------------------- @@ -5080,6 +5118,19 @@ package body Freeze is Error_Msg_N ("pragma Inline_Always not allowed for dispatching subprograms", E); end if; + + -- Because of the implicit representation of inherited predefined + -- operators in the front-end, the overriding status of the operation + -- may be affected when a full view of a type is analyzed, and this is + -- not captured by the analysis of the corresponding type declaration. + -- Therefore the correctness of a not-overriding indicator must be + -- rechecked when the subprogram is frozen. + + if Nkind (E) = N_Defining_Operator_Symbol + and then not Error_Posted (Parent (E)) + then + Check_Overriding_Indicator (E, Empty, Is_Primitive (E)); + end if; end Freeze_Subprogram; ---------------------- diff --git a/gcc/ada/frontend.adb b/gcc/ada/frontend.adb index b6fde4352cc..c01e8ef76b3 100644 --- a/gcc/ada/frontend.adb +++ b/gcc/ada/frontend.adb @@ -47,6 +47,7 @@ with Rtsfind; with Sprint; with Scn; use Scn; with Sem; use Sem; +with Sem_Aux; with Sem_Ch8; use Sem_Ch8; with Sem_Elab; use Sem_Elab; with Sem_Prag; use Sem_Prag; @@ -75,7 +76,9 @@ begin Nlists.Initialize; Elists.Initialize; Lib.Load.Initialize; + Sem_Aux.Initialize; Sem_Ch8.Initialize; + Sem_Prag.Initialize; Fname.UF.Initialize; Checks.Initialize; Sem_Warn.Initialize; diff --git a/gcc/ada/g-comlin.adb b/gcc/ada/g-comlin.adb index e90af875eae..c9cb4dbad25 100644 --- a/gcc/ada/g-comlin.adb +++ b/gcc/ada/g-comlin.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 1999-2007, Free Software Foundation, Inc. -- +-- Copyright (C) 1999-2008, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -264,8 +264,6 @@ package body GNAT.Command_Line is end; end if; end loop; - - return String'(1 .. 0 => ' '); end Expansion; ----------------- @@ -1110,13 +1108,23 @@ package body GNAT.Command_Line is ----------------------- procedure Set_Configuration - (Cmd : in out Command_Line; - Config : Command_Line_Configuration) + (Cmd : in out Command_Line; + Config : Command_Line_Configuration) is begin Cmd.Config := Config; end Set_Configuration; + ----------------------- + -- Get_Configuration -- + ----------------------- + + function Get_Configuration + (Cmd : Command_Line) return Command_Line_Configuration is + begin + return Cmd.Config; + end Get_Configuration; + ---------------------- -- Set_Command_Line -- ---------------------- diff --git a/gcc/ada/g-comlin.ads b/gcc/ada/g-comlin.ads index 9c8ebc7fa0a..6c63b2d6222 100644 --- a/gcc/ada/g-comlin.ads +++ b/gcc/ada/g-comlin.ads @@ -6,7 +6,7 @@ -- -- -- S p e c -- -- -- --- Copyright (C) 1999-2007, AdaCore -- +-- Copyright (C) 1999-2008, AdaCore -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -523,10 +523,14 @@ package GNAT.Command_Line is type Command_Line is private; procedure Set_Configuration - (Cmd : in out Command_Line; - Config : Command_Line_Configuration); + (Cmd : in out Command_Line; + Config : Command_Line_Configuration); -- Set the configuration for this command line + function Get_Configuration + (Cmd : Command_Line) return Command_Line_Configuration; + -- Return the configuration used for that command line + procedure Set_Command_Line (Cmd : in out Command_Line; Switches : String; diff --git a/gcc/ada/g-decstr.adb b/gcc/ada/g-decstr.adb index 564703802c8..e7c8a2612f4 100755 --- a/gcc/ada/g-decstr.adb +++ b/gcc/ada/g-decstr.adb @@ -6,7 +6,7 @@ -- -- -- S p e c -- -- -- --- Copyright (C) 2007, AdaCore -- +-- Copyright (C) 2007-2008, AdaCore -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -923,7 +923,7 @@ package body GNAT.Decode_String is end loop; exception - when Constraint_Error => + when Constraint_Error => Bad; end Non_UTF8_Brackets; end if; diff --git a/gcc/ada/g-dirope.ads b/gcc/ada/g-dirope.ads index 3820a8c5743..7ef84726dc3 100644 --- a/gcc/ada/g-dirope.ads +++ b/gcc/ada/g-dirope.ads @@ -6,7 +6,7 @@ -- -- -- S p e c -- -- -- --- Copyright (C) 1998-2007, AdaCore -- +-- Copyright (C) 1998-2008, AdaCore -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -132,7 +132,7 @@ package GNAT.Directory_Operations is -- is equivalent to the UNIX basename command. The following rule is -- always true: -- - -- 'Path' and 'Dir_Name (Path) & Directory_Separator & Base_Name (Path)' + -- 'Path' and 'Dir_Name (Path) & Dir_Separator & Base_Name (Path)' -- represent the same file. -- -- The comparison of Suffix is case-insensitive on systems such as Windows diff --git a/gcc/ada/g-dyntab.ads b/gcc/ada/g-dyntab.ads index 8c1e112669a..7768c88cd38 100644 --- a/gcc/ada/g-dyntab.ads +++ b/gcc/ada/g-dyntab.ads @@ -6,7 +6,7 @@ -- -- -- S p e c -- -- -- --- Copyright (C) 2000-2006, AdaCore -- +-- Copyright (C) 2000-2008, AdaCore -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -91,17 +91,19 @@ package GNAT.Dynamic_Tables is type Table_Type is array (Table_Index_Type range <>) of Table_Component_Type; - subtype Big_Table_Type is Table_Type (Table_Low_Bound .. Table_Index_Type'Last); - -- We work with pointers to a bogus array type that is constrained - -- with the maximum possible range bound. This means that the pointer - -- is a thin pointer, which is more efficient. Since subscript checks - -- in any case must be on the logical, rather than physical bounds, - -- safety is not compromised by this approach. + -- We work with pointers to a bogus array type that is constrained with + -- the maximum possible range bound. This means that the pointer is a thin + -- pointer, which is more efficient. Since subscript checks in any case + -- must be on the logical, rather than physical bounds, safety is not + -- compromised by this approach. These types should not be used by the + -- client. type Table_Ptr is access all Big_Table_Type; - -- The table is actually represented as a pointer to allow reallocation + for Table_Ptr'Storage_Size use 0; + -- The table is actually represented as a pointer to allow reallocation. + -- This type should not be used by the client. type Table_Private is private; -- Table private data that is not exported in Instance diff --git a/gcc/ada/g-enblsp-vms-alpha.adb b/gcc/ada/g-enblsp-vms-alpha.adb index 97af39864c7..4b703263f59 100644 --- a/gcc/ada/g-enblsp-vms-alpha.adb +++ b/gcc/ada/g-enblsp-vms-alpha.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 2005, AdaCore -- +-- Copyright (C) 2005-2008, AdaCore -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -91,13 +91,13 @@ begin Arg := new String (1 .. Command_With_Path'Length + 1); Arg (1 .. Command_With_Path'Length) := Command_With_Path.all; - Arg (Arg'Last) := ASCII.Nul; + Arg (Arg'Last) := ASCII.NUL; Arg_List (1) := Arg.all'Address; for J in Args'Range loop Arg := new String (1 .. Args (J)'Length + 1); Arg (1 .. Args (J)'Length) := Args (J).all; - Arg (Arg'Last) := ASCII.Nul; + Arg (Arg'Last) := ASCII.NUL; Arg_List (J + 2 - Args'First) := Arg.all'Address; end loop; diff --git a/gcc/ada/g-enblsp-vms-ia64.adb b/gcc/ada/g-enblsp-vms-ia64.adb index 2a1fee8ffbd..b7a9d340072 100644 --- a/gcc/ada/g-enblsp-vms-ia64.adb +++ b/gcc/ada/g-enblsp-vms-ia64.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 2005, AdaCore -- +-- Copyright (C) 2005-2008, AdaCore -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -89,13 +89,13 @@ begin Arg := new String (1 .. Command_With_Path'Length + 1); Arg (1 .. Command_With_Path'Length) := Command_With_Path.all; - Arg (Arg'Last) := ASCII.Nul; + Arg (Arg'Last) := ASCII.NUL; Arg_List (1) := Arg.all'Address; for J in Args'Range loop Arg := new String (1 .. Args (J)'Length + 1); Arg (1 .. Args (J)'Length) := Args (J).all; - Arg (Arg'Last) := ASCII.Nul; + Arg (Arg'Last) := ASCII.NUL; Arg_List (J + 2 - Args'First) := Arg.all'Address; end loop; diff --git a/gcc/ada/g-exctra.ads b/gcc/ada/g-exctra.ads index eb0d5a6c428..00b474538d9 100644 --- a/gcc/ada/g-exctra.ads +++ b/gcc/ada/g-exctra.ads @@ -6,7 +6,7 @@ -- -- -- S p e c -- -- -- --- Copyright (C) 2000-2005, AdaCore -- +-- Copyright (C) 2000-2008, AdaCore -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -48,6 +48,7 @@ -- The backtrace output can also be customized by way of a "decorator" which -- may return any string output in association with a provided call chain. +-- The decorator replaces the default backtrace mentioned above. with GNAT.Traceback; use GNAT.Traceback; @@ -89,5 +90,9 @@ package GNAT.Exception_Traces is -- Set the decorator to be used for future automatic outputs. Restore -- the default behavior (output of raw addresses) if the provided -- access value is null. + -- + -- Note: GNAT.Traceback.Symbolic.Symbolic_Traceback may be used as the + -- Decorator, to get a symbolic traceback. This will cause a significant + -- cpu and memory overhead. end GNAT.Exception_Traces; diff --git a/gcc/ada/g-expect-vms.adb b/gcc/ada/g-expect-vms.adb index d3d9eb6109e..bc74a5d261e 100644 --- a/gcc/ada/g-expect-vms.adb +++ b/gcc/ada/g-expect-vms.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 2002-2007, AdaCore -- +-- Copyright (C) 2002-2008, AdaCore -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -1109,7 +1109,7 @@ package body GNAT.Expect is Dup2 (Pipe2.Output, GNAT.OS_Lib.Standout); Dup2 (Pipe3.Output, GNAT.OS_Lib.Standerr); - Portable_Execvp (Pid.Pid'Access, Cmd & ASCII.Nul, Args); + Portable_Execvp (Pid.Pid'Access, Cmd & ASCII.NUL, Args); end Set_Up_Child_Communications; --------------------------- diff --git a/gcc/ada/g-expect.adb b/gcc/ada/g-expect.adb index 99e6f638af4..124d43983a5 100644 --- a/gcc/ada/g-expect.adb +++ b/gcc/ada/g-expect.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 2000-2007, AdaCore -- +-- Copyright (C) 2000-2008, AdaCore -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -1220,7 +1220,7 @@ package body GNAT.Expect is Dup2 (Pipe2.Output, GNAT.OS_Lib.Standout); Dup2 (Pipe3.Output, GNAT.OS_Lib.Standerr); - Portable_Execvp (Pid.Pid'Access, Cmd & ASCII.Nul, Args); + Portable_Execvp (Pid.Pid'Access, Cmd & ASCII.NUL, Args); -- The following commands are not executed on Unix systems, and are -- only required for Windows systems. We are now in the parent process. diff --git a/gcc/ada/g-locfil.adb b/gcc/ada/g-locfil.adb index cfd8c33839b..d00c7ec3db7 100644 --- a/gcc/ada/g-locfil.adb +++ b/gcc/ada/g-locfil.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 1998-2001 Free Software Foundation, Inc. -- +-- Copyright (C) 1998-2008, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -61,7 +61,7 @@ package body GNAT.Lock_Files is if Directory (Directory'Last) = Dir_Separator or else Directory (Directory'Last) = '/' then - Dir (Dir'Last - 1) := ASCII.Nul; + Dir (Dir'Last - 1) := ASCII.NUL; end if; -- Try to lock the file Retries times diff --git a/gcc/ada/g-regist.adb b/gcc/ada/g-regist.adb index 8eaa4081bbc..0319ff6e725 100644 --- a/gcc/ada/g-regist.adb +++ b/gcc/ada/g-regist.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 2001-2007, Free Software Foundation, Inc. -- +-- Copyright (C) 2001-2008, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -184,8 +184,8 @@ package body GNAT.Registry is REG_OPTION_NON_VOLATILE : constant := 16#0#; - C_Sub_Key : constant String := Sub_Key & ASCII.Nul; - C_Class : constant String := "" & ASCII.Nul; + C_Sub_Key : constant String := Sub_Key & ASCII.NUL; + C_Class : constant String := "" & ASCII.NUL; C_Mode : constant REGSAM := To_C_Mode (Mode); New_Key : aliased HKEY; @@ -214,7 +214,7 @@ package body GNAT.Registry is ---------------- procedure Delete_Key (From_Key : HKEY; Sub_Key : String) is - C_Sub_Key : constant String := Sub_Key & ASCII.Nul; + C_Sub_Key : constant String := Sub_Key & ASCII.NUL; Result : LONG; begin Result := RegDeleteKey (From_Key, C_Sub_Key (C_Sub_Key'First)'Address); @@ -226,7 +226,7 @@ package body GNAT.Registry is ------------------ procedure Delete_Value (From_Key : HKEY; Sub_Key : String) is - C_Sub_Key : constant String := Sub_Key & ASCII.Nul; + C_Sub_Key : constant String := Sub_Key & ASCII.NUL; Result : LONG; begin Result := RegDeleteValue (From_Key, C_Sub_Key (C_Sub_Key'First)'Address); @@ -339,7 +339,7 @@ package body GNAT.Registry is is use type REGSAM; - C_Sub_Key : constant String := Sub_Key & ASCII.Nul; + C_Sub_Key : constant String := Sub_Key & ASCII.NUL; C_Mode : constant REGSAM := To_C_Mode (Mode); New_Key : aliased HKEY; @@ -377,7 +377,7 @@ package body GNAT.Registry is Size_Value : aliased ULONG; Type_Value : aliased DWORD; - C_Sub_Key : constant String := Sub_Key & ASCII.Nul; + C_Sub_Key : constant String := Sub_Key & ASCII.NUL; Result : LONG; begin @@ -412,8 +412,8 @@ package body GNAT.Registry is Value : String; Expand : Boolean := False) is - C_Sub_Key : constant String := Sub_Key & ASCII.Nul; - C_Value : constant String := Value & ASCII.Nul; + C_Sub_Key : constant String := Sub_Key & ASCII.NUL; + C_Value : constant String := Value & ASCII.NUL; Value_Type : DWORD; Result : LONG; diff --git a/gcc/ada/g-sercom-linux.adb b/gcc/ada/g-sercom-linux.adb index bcb5952f529..cf8f805eb74 100644 --- a/gcc/ada/g-sercom-linux.adb +++ b/gcc/ada/g-sercom-linux.adb @@ -43,6 +43,8 @@ with GNAT.OS_Lib; use GNAT.OS_Lib; package body GNAT.Serial_Communications is + use type Interfaces.C.unsigned; + type Port_Data is new int; subtype unsigned is Interfaces.C.unsigned; @@ -63,6 +65,8 @@ package body GNAT.Serial_Communications is CREAD : constant := 8#0200#; CSTOPB : constant := 8#0100#; CRTSCTS : constant := 8#020000000000#; + PARENB : constant := 8#00400#; + PARODD : constant := 8#01000#; -- c_cc indexes @@ -70,16 +74,23 @@ package body GNAT.Serial_Communications is VMIN : constant := 6; C_Data_Rate : constant array (Data_Rate) of unsigned := - (B1200 => 8#000011#, - B2400 => 8#000013#, - B4800 => 8#000014#, - B9600 => 8#000015#, - B19200 => 8#000016#, - B38400 => 8#000017#, - B57600 => 8#010001#); + (B1200 => 8#000011#, + B2400 => 8#000013#, + B4800 => 8#000014#, + B9600 => 8#000015#, + B19200 => 8#000016#, + B38400 => 8#000017#, + B57600 => 8#010001#, + B115200 => 8#010002#); + + C_Bits : constant array (Data_Bits) of unsigned := + (B7 => 8#040#, B8 => 8#060#); - C_Bits : constant array (Data_Bits) of unsigned := - (B7 => 8#040#, B8 => 8#060#); + C_Stop_Bits : constant array (Stop_Bits_Number) of unsigned := + (One => 0, Two => CSTOPB); + + C_Parity : constant array (Parity_Check) of unsigned := + (None => 0, Odd => PARENB or PARODD, Even => PARENB); procedure Raise_Error (Message : String; Error : Integer := Errno); pragma No_Return (Raise_Error); @@ -168,14 +179,14 @@ package body GNAT.Serial_Communications is --------- procedure Set - (Port : Serial_Port; - Rate : Data_Rate := B9600; - Bits : Data_Bits := B8; - Block : Boolean := True; - Timeout : Integer := 10) + (Port : Serial_Port; + Rate : Data_Rate := B9600; + Bits : Data_Bits := B8; + Stop_Bits : Stop_Bits_Number := One; + Parity : Parity_Check := None; + Block : Boolean := True; + Timeout : Duration := 10.0) is - use type unsigned; - type termios is record c_iflag : unsigned; c_oflag : unsigned; @@ -214,9 +225,10 @@ package body GNAT.Serial_Communications is Current.c_cflag := C_Data_Rate (Rate) or C_Bits (Bits) + or C_Stop_Bits (Stop_Bits) + or C_Parity (Parity) or CLOCAL or CREAD - or CSTOPB or CRTSCTS; Current.c_lflag := 0; Current.c_iflag := 0; @@ -224,7 +236,7 @@ package body GNAT.Serial_Communications is Current.c_ispeed := Data_Rate_Value (Rate); Current.c_ospeed := Data_Rate_Value (Rate); Current.c_cc (VMIN) := char'Val (0); - Current.c_cc (VTIME) := char'Val (Timeout); + Current.c_cc (VTIME) := char'Val (Natural (Timeout * 10)); -- Set port settings diff --git a/gcc/ada/g-sercom-mingw.adb b/gcc/ada/g-sercom-mingw.adb index 5cb6e455cfc..76f0aa08954 100644 --- a/gcc/ada/g-sercom-mingw.adb +++ b/gcc/ada/g-sercom-mingw.adb @@ -35,176 +35,24 @@ with Ada.Unchecked_Deallocation; use Ada; with Ada.Streams; use Ada.Streams; -with System; use System; +with System.Win32.Ext; use System, System.Win32, System.Win32.Ext; package body GNAT.Serial_Communications is -- Common types - type HANDLE is new Interfaces.C.long; - type DWORD is new Interfaces.C.unsigned_long; - type WORD is new Interfaces.C.unsigned_short; - subtype PVOID is System.Address; - type BOOL is new Boolean; - for BOOL'Size use Interfaces.C.unsigned_long'Size; - type BYTE is new Interfaces.C.unsigned_char; - subtype CHAR is Interfaces.C.char; - type Port_Data is new HANDLE; - type Bits1 is range 0 .. 2 ** 1 - 1; - type Bits2 is range 0 .. 2 ** 2 - 1; - type Bits17 is range 0 .. 2 ** 17 - 1; - for Bits1'Size use 1; - for Bits2'Size use 2; - for Bits17'Size use 17; + C_Bits : constant array (Data_Bits) of Interfaces.C.unsigned := (8, 7); + C_Parity : constant array (Parity_Check) of Interfaces.C.unsigned := + (None => NOPARITY, Odd => ODDPARITY, Even => EVENPARITY); + C_Stop_Bits : constant array (Stop_Bits_Number) of Interfaces.C.unsigned := + (One => ONESTOPBIT, Two => TWOSTOPBITS); ----------- -- Files -- ----------- - function GetLastError return DWORD; - pragma Import (Stdcall, GetLastError, "GetLastError"); - - GENERIC_READ : constant := 16#80000000#; - GENERIC_WRITE : constant := 16#40000000#; - OPEN_EXISTING : constant := 3; - - type OVERLAPPED is record - Internal : DWORD; - InternalHigh : DWORD; - Offset : DWORD; - OffsetHigh : DWORD; - hEvent : HANDLE; - end record; - - type SECURITY_ATTRIBUTES is record - nLength : DWORD; - pSecurityDescriptor : PVOID; - bInheritHandle : BOOL; - end record; - - function CreateFile - (lpFileName : Address; - dwDesiredAccess : DWORD; - dwShareMode : DWORD; - lpSecurityAttributes : access SECURITY_ATTRIBUTES; - dwCreationDisposition : DWORD; - dwFlagsAndAttributes : DWORD; - hTemplateFile : HANDLE) return HANDLE; - pragma Import (Stdcall, CreateFile, "CreateFileA"); - - function WriteFile - (hFile : HANDLE; - lpBuffer : Address; - nNumberOfBytesToWrite : DWORD; - lpNumberOfBytesWritten : access DWORD; - lpOverlapped : access OVERLAPPED) return BOOL; - pragma Import (Stdcall, WriteFile, "WriteFile"); - - function ReadFile - (hFile : HANDLE; - lpBuffer : Address; - nNumberOfBytesToRead : DWORD; - lpNumberOfBytesRead : access DWORD; - lpOverlapped : access OVERLAPPED) return BOOL; - pragma Import (Stdcall, ReadFile, "ReadFile"); - - function CloseHandle (hObject : HANDLE) return BOOL; - pragma Import (Stdcall, CloseHandle, "CloseHandle"); - - DTR_CONTROL_DISABLE : constant := 16#0#; - RTS_CONTROL_DISABLE : constant := 16#0#; - ODDPARITY : constant := 1; - ONESTOPBIT : constant := 0; - - type DCB is record - DCBLENGTH : DWORD; - BaudRate : DWORD; - fBinary : Bits1; - fParity : Bits1; - fOutxCtsFlow : Bits1; - fOutxDsrFlow : Bits1; - fDtrControl : Bits2; - fDsrSensitivity : Bits1; - fTXContinueOnXoff : Bits1; - fOutX : Bits1; - fInX : Bits1; - fErrorChar : Bits1; - fNull : Bits1; - fRtsControl : Bits2; - fAbortOnError : Bits1; - fDummy2 : Bits17; - wReserved : WORD; - XonLim : WORD; - XoffLim : WORD; - ByteSize : BYTE; - Parity : BYTE; - StopBits : BYTE; - XonChar : CHAR; - XoffChar : CHAR; - ErrorChar : CHAR; - EofChar : CHAR; - EvtChar : CHAR; - wReserved1 : WORD; - end record; - pragma Convention (C, DCB); - - for DCB use record - DCBLENGTH at 0 range 0 .. 31; - BaudRate at 4 range 0 .. 31; - fBinary at 8 range 0 .. 0; - fParity at 8 range 1 .. 1; - fOutxCtsFlow at 8 range 2 .. 2; - fOutxDsrFlow at 8 range 3 .. 3; - fDtrControl at 8 range 4 .. 5; - fDsrSensitivity at 8 range 6 .. 6; - fTXContinueOnXoff at 8 range 7 .. 7; - fOutX at 9 range 0 .. 0; - fInX at 9 range 1 .. 1; - fErrorChar at 9 range 2 .. 2; - fNull at 9 range 3 .. 3; - fRtsControl at 9 range 4 .. 5; - fAbortOnError at 9 range 6 .. 6; - fDummy2 at 9 range 7 .. 23; - wReserved at 12 range 0 .. 15; - XonLim at 14 range 0 .. 15; - XoffLim at 16 range 0 .. 15; - ByteSize at 18 range 0 .. 7; - Parity at 19 range 0 .. 7; - StopBits at 20 range 0 .. 7; - XonChar at 21 range 0 .. 7; - XoffChar at 22 range 0 .. 7; - ErrorChar at 23 range 0 .. 7; - EofChar at 24 range 0 .. 7; - EvtChar at 25 range 0 .. 7; - wReserved1 at 26 range 0 .. 15; - end record; - - type COMMTIMEOUTS is record - ReadIntervalTimeout : DWORD; - ReadTotalTimeoutMultiplier : DWORD; - ReadTotalTimeoutConstant : DWORD; - WriteTotalTimeoutMultiplier : DWORD; - WriteTotalTimeoutConstant : DWORD; - end record; - pragma Convention (C, COMMTIMEOUTS); - - function GetCommState - (hFile : HANDLE; - lpDCB : access DCB) return BOOL; - pragma Import (Stdcall, GetCommState, "GetCommState"); - - function SetCommState - (hFile : HANDLE; - lpDCB : access DCB) return BOOL; - pragma Import (Stdcall, SetCommState, "SetCommState"); - - function SetCommTimeouts - (hFile : HANDLE; - lpCommTimeouts : access COMMTIMEOUTS) return BOOL; - pragma Import (Stdcall, SetCommTimeouts, "SetCommTimeouts"); - procedure Raise_Error (Message : String; Error : DWORD := GetLastError); pragma No_Return (Raise_Error); @@ -222,7 +70,8 @@ package body GNAT.Serial_Communications is if Port.H /= null then Success := CloseHandle (HANDLE (Port.H.all)); Unchecked_Free (Port.H); - if not Success then + + if Success = Win32.FALSE then Raise_Error ("error closing the port"); end if; end if; @@ -257,14 +106,14 @@ package body GNAT.Serial_Communications is Success := CloseHandle (HANDLE (Port.H.all)); end if; - Port.H.all := Port_Data (CreateFile + Port.H.all := CreateFile (lpFileName => C_Name (C_Name'First)'Address, dwDesiredAccess => GENERIC_READ or GENERIC_WRITE, dwShareMode => 0, lpSecurityAttributes => null, - DwCreationDisposition => OPEN_EXISTING, + dwCreationDisposition => OPEN_EXISTING, dwFlagsAndAttributes => 0, - HTemplateFile => 0)); + hTemplateFile => 0); if Port.H.all = 0 then Raise_Error ("cannot open com port"); @@ -297,14 +146,15 @@ package body GNAT.Serial_Communications is Raise_Error ("read: port not opened", 0); end if; - Success := ReadFile - (hFile => HANDLE (Port.H.all), - lpBuffer => Buffer (Buffer'First)'Address, - nNumberOfBytesToRead => DWORD (Buffer'Length), - lpNumberOfBytesRead => Read_Last'Access, - lpOverlapped => null); + Success := + ReadFile + (hFile => HANDLE (Port.H.all), + lpBuffer => Buffer (Buffer'First)'Address, + nNumberOfBytesToRead => DWORD (Buffer'Length), + lpNumberOfBytesRead => Read_Last'Access, + lpOverlapped => null); - if not Success then + if Success = Win32.FALSE then Raise_Error ("read error"); end if; @@ -316,11 +166,13 @@ package body GNAT.Serial_Communications is --------- procedure Set - (Port : Serial_Port; - Rate : Data_Rate := B9600; - Bits : Data_Bits := B8; - Block : Boolean := True; - Timeout : Integer := 10) + (Port : Serial_Port; + Rate : Data_Rate := B9600; + Bits : Data_Bits := B8; + Stop_Bits : Stop_Bits_Number := One; + Parity : Parity_Check := None; + Block : Boolean := True; + Timeout : Duration := 10.0) is Success : BOOL; Com_Time_Out : aliased COMMTIMEOUTS; @@ -333,7 +185,7 @@ package body GNAT.Serial_Communications is Success := GetCommState (HANDLE (Port.H.all), Com_Settings'Access); - if not Success then + if Success = Win32.FALSE then Success := CloseHandle (HANDLE (Port.H.all)); Port.H.all := 0; Raise_Error ("set: cannot get comm state"); @@ -341,6 +193,7 @@ package body GNAT.Serial_Communications is Com_Settings.BaudRate := DWORD (Data_Rate_Value (Rate)); Com_Settings.fParity := 1; + Com_Settings.fBinary := Bits1 (System.Win32.TRUE); Com_Settings.fOutxCtsFlow := 0; Com_Settings.fOutxDsrFlow := 0; Com_Settings.fDsrSensitivity := 0; @@ -349,13 +202,13 @@ package body GNAT.Serial_Communications is Com_Settings.fInX := 0; Com_Settings.fRtsControl := RTS_CONTROL_DISABLE; Com_Settings.fAbortOnError := 0; - Com_Settings.ByteSize := BYTE (Bit_Value (Bits)); - Com_Settings.Parity := ODDPARITY; - Com_Settings.StopBits := ONESTOPBIT; + Com_Settings.ByteSize := BYTE (C_Bits (Bits)); + Com_Settings.Parity := BYTE (C_Parity (Parity)); + Com_Settings.StopBits := BYTE (C_Stop_Bits (Stop_Bits)); Success := SetCommState (HANDLE (Port.H.all), Com_Settings'Access); - if not Success then + if Success = Win32.FALSE then Success := CloseHandle (HANDLE (Port.H.all)); Port.H.all := 0; Raise_Error ("cannot set comm state"); @@ -371,11 +224,12 @@ package body GNAT.Serial_Communications is others => 0); end if; - Success := SetCommTimeouts - (hFile => HANDLE (Port.H.all), - lpCommTimeouts => Com_Time_Out'Access); + Success := + SetCommTimeouts + (hFile => HANDLE (Port.H.all), + lpCommTimeouts => Com_Time_Out'Access); - if not Success then + if Success = Win32.FALSE then Raise_Error ("cannot set the timeout"); end if; end Set; @@ -396,14 +250,15 @@ package body GNAT.Serial_Communications is Raise_Error ("write: port not opened", 0); end if; - Success := WriteFile - (hFile => HANDLE (Port.H.all), - lpBuffer => Buffer'Address, - nNumberOfBytesToWrite => DWORD (Buffer'Length), - lpNumberOfBytesWritten => Temp_Last'Access, - lpOverlapped => null); + Success := + WriteFile + (hFile => HANDLE (Port.H.all), + lpBuffer => Buffer'Address, + nNumberOfBytesToWrite => DWORD (Buffer'Length), + lpNumberOfBytesWritten => Temp_Last'Access, + lpOverlapped => null); - if not Boolean (Success) + if Success = Win32.FALSE or else Stream_Element_Offset (Temp_Last) /= Buffer'Length then Raise_Error ("failed to write data"); diff --git a/gcc/ada/g-sercom.adb b/gcc/ada/g-sercom.adb index 920557b2643..ead5c868c6e 100644 --- a/gcc/ada/g-sercom.adb +++ b/gcc/ada/g-sercom.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 2007, AdaCore -- +-- Copyright (C) 2007-2008, AdaCore -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -77,11 +77,13 @@ package body GNAT.Serial_Communications is --------- procedure Set - (Port : Serial_Port; - Rate : Data_Rate := B9600; - Bits : Data_Bits := B8; - Block : Boolean := True; - Timeout : Integer := 10) is + (Port : Serial_Port; + Rate : Data_Rate := B9600; + Bits : Data_Bits := B8; + Stop_Bits : Stop_Bits_Number := One; + Parity : Parity_Check := None; + Block : Boolean := True; + Timeout : Duration := 10.0) is begin Unimplemented; end Set; @@ -124,8 +126,7 @@ package body GNAT.Serial_Communications is procedure Unimplemented is begin - raise Program_Error - with "Serial_Communications not implemented"; + raise Program_Error with "Serial_Communications not implemented"; end Unimplemented; end GNAT.Serial_Communications; diff --git a/gcc/ada/g-sercom.ads b/gcc/ada/g-sercom.ads index bbd8f91e331..3d327cec76f 100644 --- a/gcc/ada/g-sercom.ads +++ b/gcc/ada/g-sercom.ads @@ -6,7 +6,7 @@ -- -- -- S p e c -- -- -- --- Copyright (C) 2007, AdaCore -- +-- Copyright (C) 2007-2008, AdaCore -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -47,12 +47,19 @@ package GNAT.Serial_Communications is function Name (Number : Positive) return Port_Name; -- Returns the port name for the given port number - type Data_Rate is (B1200, B2400, B4800, B9600, B19200, B38400, B57600); + type Data_Rate is + (B1200, B2400, B4800, B9600, B19200, B38400, B57600, B115200); -- Speed of the communication type Data_Bits is (B8, B7); -- Communication bits + type Stop_Bits_Number is (One, Two); + -- One or two stop bits + + type Parity_Check is (None, Even, Odd); + -- Either no parity check or an even or odd parity + type Serial_Port is new Ada.Streams.Root_Stream_Type with private; procedure Open @@ -62,14 +69,18 @@ package GNAT.Serial_Communications is -- opened. procedure Set - (Port : Serial_Port; - Rate : Data_Rate := B9600; - Bits : Data_Bits := B8; - Block : Boolean := True; - Timeout : Integer := 10); + (Port : Serial_Port; + Rate : Data_Rate := B9600; + Bits : Data_Bits := B8; + Stop_Bits : Stop_Bits_Number := One; + Parity : Parity_Check := None; + Block : Boolean := True; + Timeout : Duration := 10.0); -- The communication port settings. If Block is set then a read call -- will wait for the whole buffer to be filed. If Block is not set then - -- the given Timeout (in seconds) is used. + -- the given Timeout (in seconds) is used. Note that the timeout precision + -- may be limited on some implementation (e.g. on GNU/Linux the maximum + -- precision is a tenth of seconds). overriding procedure Read (Port : in out Serial_Port; @@ -96,14 +107,13 @@ private end record; Data_Rate_Value : constant array (Data_Rate) of Interfaces.C.unsigned := - (B1200 => 1_200, - B2400 => 2_400, - B4800 => 4_800, - B9600 => 9_600, - B19200 => 19_200, - B38400 => 38_400, - B57600 => 57_600); - - Bit_Value : constant array (Data_Bits) of Interfaces.C.unsigned := (8, 7); + (B1200 => 1_200, + B2400 => 2_400, + B4800 => 4_800, + B9600 => 9_600, + B19200 => 19_200, + B38400 => 38_400, + B57600 => 57_600, + B115200 => 115_200); end GNAT.Serial_Communications; diff --git a/gcc/ada/g-soccon-linux-mips.ads b/gcc/ada/g-soccon-linux-mips.ads new file mode 100644 index 00000000000..8fc50400e24 --- /dev/null +++ b/gcc/ada/g-soccon-linux-mips.ads @@ -0,0 +1,197 @@ +------------------------------------------------------------------------------ +-- -- +-- GNAT COMPILER COMPONENTS -- +-- -- +-- G N A T . S O C K E T S . C O N S T A N T S -- +-- -- +-- S p e c -- +-- -- +-- Copyright (C) 2000-2005, Free Software Foundation, Inc. -- +-- -- +-- GNAT is free software; you can redistribute it and/or modify it under -- +-- terms of the GNU General Public License as published by the Free Soft- -- +-- ware Foundation; either version 2, or (at your option) any later ver- -- +-- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- +-- OUT 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 distributed with GNAT; see file COPYING. If not, write -- +-- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, -- +-- Boston, MA 02110-1301, USA. -- +-- -- +-- As a special exception, if other files instantiate generics from this -- +-- unit, or you link this unit with other files to produce an executable, -- +-- this unit does not by itself cause the resulting executable to be -- +-- covered by the GNU General Public License. This exception does not -- +-- however invalidate any other reasons why the executable file might be -- +-- covered by the GNU Public License. -- +-- -- +-- GNAT was originally developed by the GNAT team at New York University. -- +-- Extensive contributions were provided by Ada Core Technologies Inc. -- +-- -- +------------------------------------------------------------------------------ + +-- This package provides target dependent definitions of constant for use +-- by the GNAT.Sockets package (g-socket.ads). This package should not be +-- directly with'ed by an applications program. + +-- This is the version for mips-linux, manually edited for the first shot +-- no mips hardware at hand +-- using http://www.gelato.unsw.edu.au/lxr/source/include/asm-mips/socket.h +-- in order to find differents values +-- This file is generated automatically, do not modify it by hand! Instead, +-- make changes to gen-soccon.c and re-run it on each target. + +package GNAT.Sockets.Constants is + + -------------- + -- Families -- + -------------- + + AF_INET : constant := 2; -- IPv4 address family + AF_INET6 : constant := 10; -- IPv6 address family + + ----------- + -- Modes -- + ----------- + + SOCK_STREAM : constant := 1; -- Stream socket + SOCK_DGRAM : constant := 2; -- Datagram socket + + ------------------- + -- Socket errors -- + ------------------- + + EACCES : constant := 13; -- Permission denied + EADDRINUSE : constant := 98; -- Address already in use + EADDRNOTAVAIL : constant := 99; -- Cannot assign address + EAFNOSUPPORT : constant := 97; -- Addr family not supported + EALREADY : constant := 114; -- Operation in progress + EBADF : constant := 9; -- Bad file descriptor + ECONNABORTED : constant := 103; -- Connection aborted + ECONNREFUSED : constant := 111; -- Connection refused + ECONNRESET : constant := 104; -- Connection reset by peer + EDESTADDRREQ : constant := 89; -- Destination addr required + EFAULT : constant := 14; -- Bad address + EHOSTDOWN : constant := 112; -- Host is down + EHOSTUNREACH : constant := 113; -- No route to host + EINPROGRESS : constant := 115; -- Operation now in progress + EINTR : constant := 4; -- Interrupted system call + EINVAL : constant := 22; -- Invalid argument + EIO : constant := 5; -- Input output error + EISCONN : constant := 106; -- Socket already connected + ELOOP : constant := 40; -- Too many symbolic lynks + EMFILE : constant := 24; -- Too many open files + EMSGSIZE : constant := 90; -- Message too long + ENAMETOOLONG : constant := 36; -- Name too long + ENETDOWN : constant := 100; -- Network is down + ENETRESET : constant := 102; -- Disconn. on network reset + ENETUNREACH : constant := 101; -- Network is unreachable + ENOBUFS : constant := 105; -- No buffer space available + ENOPROTOOPT : constant := 92; -- Protocol not available + ENOTCONN : constant := 107; -- Socket not connected + ENOTSOCK : constant := 88; -- Operation on non socket + EOPNOTSUPP : constant := 95; -- Operation not supported + EPFNOSUPPORT : constant := 96; -- Unknown protocol family + EPROTONOSUPPORT : constant := 93; -- Unknown protocol + EPROTOTYPE : constant := 91; -- Unknown protocol type + ESHUTDOWN : constant := 108; -- Cannot send once shutdown + ESOCKTNOSUPPORT : constant := 94; -- Socket type not supported + ETIMEDOUT : constant := 110; -- Connection timed out + ETOOMANYREFS : constant := 109; -- Too many references + EWOULDBLOCK : constant := 11; -- Operation would block + + ----------------- + -- Host errors -- + ----------------- + + HOST_NOT_FOUND : constant := 1; -- Unknown host + TRY_AGAIN : constant := 2; -- Host name lookup failure + NO_DATA : constant := 4; -- No data record for name + NO_RECOVERY : constant := 3; -- Non recoverable errors + + ------------------- + -- Control flags -- + ------------------- + + FIONBIO : constant := 16#667e#; -- Set/clear non-blocking io + FIONREAD : constant := 16#467f#; -- How many bytes to read + + -------------------- + -- Shutdown modes -- + -------------------- + + SHUT_RD : constant := 0; -- No more recv + SHUT_WR : constant := 1; -- No more send + SHUT_RDWR : constant := 2; -- No more recv/send + + --------------------- + -- Protocol levels -- + --------------------- + + SOL_SOCKET : constant := 1; -- Options for socket level + IPPROTO_IP : constant := 0; -- Dummy protocol for IP + IPPROTO_UDP : constant := 17; -- UDP + IPPROTO_TCP : constant := 6; -- TCP + + ------------------- + -- Request flags -- + ------------------- + + MSG_OOB : constant := 1; -- Process out-of-band data + MSG_PEEK : constant := 2; -- Peek at incoming data + MSG_EOR : constant := 128; -- Send end of record + MSG_WAITALL : constant := 256; -- Wait for full reception + MSG_NOSIGNAL : constant := 16384; -- No SIGPIPE on send + MSG_Forced_Flags : constant := MSG_NOSIGNAL; + -- Flags set on all send(2) calls + + -------------------- + -- Socket options -- + -------------------- + + TCP_NODELAY : constant := 1; -- Do not coalesce packets + SO_REUSEADDR : constant := 4; -- Bind reuse local address + SO_KEEPALIVE : constant := 8; -- Enable keep-alive msgs + SO_LINGER : constant := 16#80#; -- Defer close to flush data + SO_BROADCAST : constant := 16#20#; -- Can send broadcast msgs + SO_SNDBUF : constant := 16#1001#; -- Set/get send buffer size + SO_RCVBUF : constant := 16#1002#; -- Set/get recv buffer size + SO_SNDTIMEO : constant := 16#1005#; -- Emission timeout + SO_RCVTIMEO : constant := 16#1006#; -- Reception timeout + SO_ERROR : constant := 16#1007#; -- Get/clear error status + IP_MULTICAST_IF : constant := 32; -- Set/get mcast interface + IP_MULTICAST_TTL : constant := 33; -- Set/get multicast TTL + IP_MULTICAST_LOOP : constant := 34; -- Set/get mcast loopback + IP_ADD_MEMBERSHIP : constant := 35; -- Join a multicast group + IP_DROP_MEMBERSHIP : constant := 36; -- Leave a multicast group + + ------------------- + -- System limits -- + ------------------- + + IOV_MAX : constant := 2147483647; -- Maximum writev iovcnt + + ---------------------- + -- Type definitions -- + ---------------------- + + -- Sizes (in bytes) of the components of struct timeval + + SIZEOF_tv_sec : constant := 4; -- tv_sec + SIZEOF_tv_usec : constant := 4; -- tv_usec + + ---------------------------------------- + -- Properties of supported interfaces -- + ---------------------------------------- + + Need_Netdb_Buffer : constant := 1; -- Need buffer for Netdb ops + + ---------------------- + -- Additional flags -- + ---------------------- + + Thread_Blocking_IO : constant Boolean := True; + -- Set False for contexts where socket i/o are process blocking + +end GNAT.Sockets.Constants; diff --git a/gcc/ada/g-soccon-rtems.ads b/gcc/ada/g-soccon-rtems.ads index cc7e56de04c..f2edb1736e3 100644 --- a/gcc/ada/g-soccon-rtems.ads +++ b/gcc/ada/g-soccon-rtems.ads @@ -163,6 +163,7 @@ package GNAT.Sockets.Constants is IP_MULTICAST_LOOP : constant := 11; -- Set/get mcast loopback IP_ADD_MEMBERSHIP : constant := 12; -- Join a multicast group IP_DROP_MEMBERSHIP : constant := 13; -- Leave a multicast group + IP_PKTINFO : constant := -1; -- Get datagram info ------------------- -- System limits -- diff --git a/gcc/ada/g-soccon-vxworks.ads b/gcc/ada/g-soccon-vxworks.ads index 173a591c46e..16cf1feb48e 100644 --- a/gcc/ada/g-soccon-vxworks.ads +++ b/gcc/ada/g-soccon-vxworks.ads @@ -6,7 +6,7 @@ -- -- -- S p e c -- -- -- --- Copyright (C) 2000-2007, Free Software Foundation, Inc. -- +-- Copyright (C) 2000-2008, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -149,6 +149,7 @@ package GNAT.Sockets.Constants is TCP_NODELAY : constant := 1; -- Do not coalesce packets SO_REUSEADDR : constant := 4; -- Bind reuse local address + SO_REUSEPORT : constant := 512; -- Bind reuse port number SO_KEEPALIVE : constant := 8; -- Enable keep-alive msgs SO_LINGER : constant := 128; -- Defer close to flush data SO_BROADCAST : constant := 32; -- Can send broadcast msgs @@ -162,6 +163,7 @@ package GNAT.Sockets.Constants is IP_MULTICAST_LOOP : constant := 11; -- Set/get mcast loopback IP_ADD_MEMBERSHIP : constant := 12; -- Join a multicast group IP_DROP_MEMBERSHIP : constant := 13; -- Leave a multicast group + IP_PKTINFO : constant := -1; -- Get datagram info ------------------- -- System limits -- @@ -184,13 +186,6 @@ package GNAT.Sockets.Constants is Need_Netdb_Buffer : constant := 1; -- Need buffer for Netdb ops - ---------------------- - -- Additional flags -- - ---------------------- - - Thread_Blocking_IO : constant Boolean := True; - -- Set False for contexts where socket i/o are process blocking - -------------------------------- -- VxWorks-specific constants -- -------------------------------- @@ -201,4 +196,11 @@ package GNAT.Sockets.Constants is OK : constant := 0; -- VxWorks generic success ERROR : constant := -1; -- VxWorks generic error + ---------------------- + -- Additional flags -- + ---------------------- + + Thread_Blocking_IO : constant Boolean := True; + -- Set False for contexts where socket i/o are process blocking + end GNAT.Sockets.Constants; diff --git a/gcc/ada/g-socket.adb b/gcc/ada/g-socket.adb index 896a2c45652..016b3fff227 100644 --- a/gcc/ada/g-socket.adb +++ b/gcc/ada/g-socket.adb @@ -574,10 +574,8 @@ package body GNAT.Sockets is procedure Connect_Socket (Socket : Socket_Type; - Server : in out Sock_Addr_Type) + Server : Sock_Addr_Type) is - pragma Warnings (Off, Server); - Res : C.int; Sin : aliased Sockaddr_In; Len : constant C.int := Sin'Size / 8; diff --git a/gcc/ada/g-socket.ads b/gcc/ada/g-socket.ads index 38b857432b1..0ed1be0124d 100644 --- a/gcc/ada/g-socket.ads +++ b/gcc/ada/g-socket.ads @@ -39,8 +39,7 @@ -- Multicast is available only on systems which provide support for this -- feature, so it is not available if Multicast is not supported, or not --- installed. In particular Multicast is not available with the Windows --- version. +-- installed. -- The VMS implementation was implemented using the DECC RTL Socket API, -- and is thus subject to limitations in the implementation of this API. @@ -58,8 +57,13 @@ with System; package GNAT.Sockets is -- Sockets are designed to provide a consistent communication facility - -- between applications. This package provides an Ada-like interface - -- similar to that proposed as part of the BSD socket layer. + -- between applications. This package provides an Ada binding to the + -- the de-facto standard BSD sockets API. The documentation below covers + -- only the specific binding provided by this package. It assumes that + -- the reader is already familiar with general network programming and + -- sockets usage. A useful reference on this matter is W. Richard Stevens' + -- "UNIX Network Programming: The Sockets Networking API" + -- (ISBN: 0131411551). -- GNAT.Sockets has been designed with several ideas in mind @@ -78,7 +82,7 @@ package GNAT.Sockets is -- notification of an asynchronous connect failure is delivered in the -- write socket set (POSIX) instead of the exception socket set (NT). - -- Here is a typical example of what you can do: + -- The example below demonstrates various features of GNAT.Sockets: -- with GNAT.Sockets; use GNAT.Sockets; @@ -773,9 +777,9 @@ package GNAT.Sockets is procedure Connect_Socket (Socket : Socket_Type; - Server : in out Sock_Addr_Type); - -- Make a connection to another socket which has the address of - -- Server. Raises Socket_Error on error. + Server : Sock_Addr_Type); + -- Make a connection to another socket which has the address of Server. + -- Raises Socket_Error on error. procedure Control_Socket (Socket : Socket_Type; diff --git a/gcc/ada/g-socthi-vms.ads b/gcc/ada/g-socthi-vms.ads index b55a58d3757..b2af2ca020b 100644 --- a/gcc/ada/g-socthi-vms.ads +++ b/gcc/ada/g-socthi-vms.ads @@ -6,7 +6,7 @@ -- -- -- S p e c -- -- -- --- Copyright (C) 2002-2007, AdaCore -- +-- Copyright (C) 2002-2008, AdaCore -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -151,6 +151,7 @@ package GNAT.Sockets.Thin is -- Socket address type Sockaddr_Access is access all Sockaddr; + for Sockaddr_Access'Size use 32; pragma Convention (C, Sockaddr_Access); -- Access to socket address @@ -164,6 +165,7 @@ package GNAT.Sockets.Thin is -- Internet socket address type Sockaddr_In_Access is access all Sockaddr_In; + for Sockaddr_In_Access'Size use 32; pragma Convention (C, Sockaddr_In_Access); -- Access to internet socket address @@ -203,6 +205,7 @@ package GNAT.Sockets.Thin is -- Host entry type Hostent_Access is access all Hostent; + for Hostent_Access'Size use 32; pragma Convention (C, Hostent_Access); -- Access to host entry @@ -216,6 +219,7 @@ package GNAT.Sockets.Thin is -- Service entry type Servent_Access is access all Servent; + for Servent_Access'Size use 32; pragma Convention (C, Servent_Access); -- Access to service entry diff --git a/gcc/ada/g-table.ads b/gcc/ada/g-table.ads index ae64b8589c1..b0aad3d44aa 100644 --- a/gcc/ada/g-table.ads +++ b/gcc/ada/g-table.ads @@ -6,7 +6,7 @@ -- -- -- S p e c -- -- -- --- Copyright (C) 1998-2007, AdaCore -- +-- Copyright (C) 1998-2008, AdaCore -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -105,17 +105,19 @@ package GNAT.Table is type Table_Type is array (Table_Index_Type range <>) of Table_Component_Type; - subtype Big_Table_Type is Table_Type (Table_Low_Bound .. Table_Index_Type'Last); -- We work with pointers to a bogus array type that is constrained -- with the maximum possible range bound. This means that the pointer -- is a thin pointer, which is more efficient. Since subscript checks -- in any case must be on the logical, rather than physical bounds, - -- safety is not compromised by this approach. + -- safety is not compromised by this approach. These types should never + -- be used by the client. type Table_Ptr is access all Big_Table_Type; - -- The table is actually represented as a pointer to allow reallocation + for Table_Ptr'Storage_Size use 0; + -- The table is actually represented as a pointer to allow reallocation. + -- This type should never be used by the client. Table : aliased Table_Ptr := null; -- The table itself. The lower bound is the value of Low_Bound. diff --git a/gcc/ada/g-timsta.adb b/gcc/ada/g-timsta.adb new file mode 100644 index 00000000000..9b643f7cf61 --- /dev/null +++ b/gcc/ada/g-timsta.adb @@ -0,0 +1,61 @@ +------------------------------------------------------------------------------ +-- -- +-- GNAT RUN-TIME COMPONENTS -- +-- -- +-- G N A T . T I M E _ S T A M P -- +-- -- +-- B o d y -- +-- -- +-- Copyright (C) 2008, Free Software Foundation, Inc. -- +-- -- +-- GNAT is free software; you can redistribute it and/or modify it under -- +-- terms of the GNU General Public License as published by the Free Soft- -- +-- ware Foundation; either version 2, or (at your option) any later ver- -- +-- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- +-- OUT 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 distributed with GNAT; see file COPYING. If not, write -- +-- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, -- +-- Boston, MA 02110-1301, USA. -- +-- -- +-- As a special exception, if other files instantiate generics from this -- +-- unit, or you link this unit with other files to produce an executable, -- +-- this unit does not by itself cause the resulting executable to be -- +-- covered by the GNU General Public License. This exception does not -- +-- however invalidate any other reasons why the executable file might be -- +-- covered by the GNU Public License. -- +-- -- +-- GNAT was originally developed by the GNAT team at New York University. -- +-- Extensive contributions were provided by Ada Core Technologies Inc. -- +-- -- +------------------------------------------------------------------------------ + +with Interfaces.C; use Interfaces.C; + +package body GNAT.Time_Stamp is + + subtype time_stamp is char_array (0 .. 22); + type time_stamp_ptr is access all time_stamp; + -- The desired ISO 8601 string format has exactly 22 characters. We add + -- one additional character for '\0'. The indexing starts from zero to + -- accomodate the C layout. + + procedure gnat_current_time_string (Value : time_stamp_ptr); + pragma Import (C, gnat_current_time_string, "__gnat_current_time_string"); + + ------------------ + -- Current_Time -- + ------------------ + + function Current_Time return String is + Result : aliased time_stamp; + + begin + gnat_current_time_string (Result'Unchecked_Access); + Result (22) := nul; + + return To_Ada (Result); + end Current_Time; + +end GNAT.Time_Stamp; diff --git a/gcc/ada/g-timsta.ads b/gcc/ada/g-timsta.ads new file mode 100644 index 00000000000..87a07f89394 --- /dev/null +++ b/gcc/ada/g-timsta.ads @@ -0,0 +1,42 @@ +------------------------------------------------------------------------------ +-- -- +-- GNAT RUN-TIME COMPONENTS -- +-- -- +-- G N A T . T I M E _ S T A M P -- +-- -- +-- S p e c -- +-- -- +-- Copyright (C) 2008, Free Software Foundation, Inc. -- +-- -- +-- GNAT is free software; you can redistribute it and/or modify it under -- +-- terms of the GNU General Public License as published by the Free Soft- -- +-- ware Foundation; either version 2, or (at your option) any later ver- -- +-- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- +-- OUT 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 distributed with GNAT; see file COPYING. If not, write -- +-- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, -- +-- Boston, MA 02110-1301, USA. -- +-- -- +-- As a special exception, if other files instantiate generics from this -- +-- unit, or you link this unit with other files to produce an executable, -- +-- this unit does not by itself cause the resulting executable to be -- +-- covered by the GNU General Public License. This exception does not -- +-- however invalidate any other reasons why the executable file might be -- +-- covered by the GNU Public License. -- +-- -- +-- GNAT was originally developed by the GNAT team at New York University. -- +-- Extensive contributions were provided by Ada Core Technologies Inc. -- +-- -- +------------------------------------------------------------------------------ + +-- This package provides a lighweight mechanism for obtaining time stamps + +package GNAT.Time_Stamp is + + function Current_Time return String; + -- Return the current local time in the following ISO 8601 string format: + -- YYYY-MM-DD HH:MM:SS.SS + +end GNAT.Time_Stamp; diff --git a/gcc/ada/g-trasym.adb b/gcc/ada/g-trasym.adb index 70e9c538c44..1d1fd3d9095 100644 --- a/gcc/ada/g-trasym.adb +++ b/gcc/ada/g-trasym.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 1999-2006, AdaCore -- +-- Copyright (C) 1999-2008, AdaCore -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- diff --git a/gcc/ada/g-trasym.ads b/gcc/ada/g-trasym.ads index 8b358aac4bc..fbcf9ca4a65 100644 --- a/gcc/ada/g-trasym.ads +++ b/gcc/ada/g-trasym.ads @@ -6,7 +6,7 @@ -- -- -- S p e c -- -- -- --- Copyright (C) 1999-2007, AdaCore -- +-- Copyright (C) 1999-2008, AdaCore -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -86,6 +86,9 @@ package GNAT.Traceback.Symbolic is function Symbolic_Traceback (Traceback : Tracebacks_Array) return String; -- Build a string containing a symbolic traceback of the given call chain + -- + -- Note: This procedure may be installed by Set_Trace_Decorator, to get a + -- symbolic traceback on all exceptions raised (see GNAT.Exception_Traces). function Symbolic_Traceback (E : Exception_Occurrence) return String; -- Build string containing symbolic traceback of given exception occurrence diff --git a/gcc/ada/gen-soccon.c b/gcc/ada/gen-soccon.c index a4dd957d67c..9067a146b0b 100644 --- a/gcc/ada/gen-soccon.c +++ b/gcc/ada/gen-soccon.c @@ -4,7 +4,7 @@ * * * G E N - S O C C O N * * * - * Copyright (C) 2004-2007, Free Software Foundation, Inc. * + * Copyright (C) 2004-2008, Free Software Foundation, Inc. * * * * GNAT is free software; you can redistribute it and/or modify it under * * terms of the GNU General Public License as published by the Free Soft- * @@ -104,7 +104,7 @@ TXT("-- G N A T . S O C K E T S . C O N S T A N T S TXT("-- --") TXT("-- S p e c --") TXT("-- --") -TXT("-- Copyright (C) 2000-2007, Free Software Foundation, Inc. --") +TXT("-- Copyright (C) 2000-2008, Free Software Foundation, Inc. --") TXT("-- --") TXT("-- GNAT is free software; you can redistribute it and/or modify it under --") TXT("-- terms of the GNU General Public License as published by the Free Soft- --") diff --git a/gcc/ada/gigi.h b/gcc/ada/gigi.h index c57cd80e30e..4ca53df7530 100644 --- a/gcc/ada/gigi.h +++ b/gcc/ada/gigi.h @@ -373,9 +373,17 @@ enum standard_datatypes /* Type declaration node <==> typedef void *T() */ ADT_ptr_void_ftype, - /* A function declaration node for a run-time function for allocating memory. - Ada allocators cause calls to this function to be generated. */ + /* Type declaration node <==> typedef virtual void *T() */ + ADT_fdesc_type, + + /* Null pointer for above type */ + ADT_null_fdesc, + + /* Function declaration nodes for run-time functions for allocating memory. + Ada allocators cause calls to these functions to be generated. Malloc32 + is used only on 64bit systems needing to allocate 32bit memory. */ ADT_malloc_decl, + ADT_malloc32_decl, /* Likewise for freeing memory. */ ADT_free_decl, @@ -406,7 +414,10 @@ extern GTY(()) tree gnat_raise_decls[(int) LAST_REASON_CODE + 1]; #define ptr_void_type_node gnat_std_decls[(int) ADT_ptr_void_type] #define void_ftype gnat_std_decls[(int) ADT_void_ftype] #define ptr_void_ftype gnat_std_decls[(int) ADT_ptr_void_ftype] +#define fdesc_type_node gnat_std_decls[(int) ADT_fdesc_type] +#define null_fdesc_node gnat_std_decls[(int) ADT_null_fdesc] #define malloc_decl gnat_std_decls[(int) ADT_malloc_decl] +#define malloc32_decl gnat_std_decls[(int) ADT_malloc32_decl] #define free_decl gnat_std_decls[(int) ADT_free_decl] #define jmpbuf_type gnat_std_decls[(int) ADT_jmpbuf_type] #define jmpbuf_ptr_type gnat_std_decls[(int) ADT_jmpbuf_ptr_type] @@ -468,6 +479,10 @@ extern tree gnat_unsigned_type (tree type_node); /* Return the signed version of a TYPE_NODE, a scalar type. */ extern tree gnat_signed_type (tree type_node); +/* Return 1 if the types T1 and T2 are compatible, i.e. if they can be + transparently converted to each other. */ +extern int gnat_types_compatible_p (tree t1, tree t2); + /* Create an expression whose value is that of EXPR, converted to type TYPE. The TREE_TYPE of the value is always TYPE. This function implements all reasonable @@ -522,13 +537,11 @@ extern void rest_of_record_type_compilation (tree record_type); copy-in/copy-out list to be stored into TYPE_CI_CO_LIST. RETURNS_UNCONSTRAINED is true if the function returns an unconstrained object. RETURNS_BY_REF is true if the function returns by reference. - RETURNS_WITH_DSP is true if the function is to return with a - depressed stack pointer. RETURNS_BY_TARGET_PTR is true if the function - is to be passed (as its first parameter) the address of the place to copy - its result. */ + RETURNS_BY_TARGET_PTR is true if the function is to be passed (as its + first parameter) the address of the place to copy its result. */ extern tree create_subprog_type (tree return_type, tree param_decl_list, tree cico_list, bool returns_unconstrained, - bool returns_by_ref, bool returns_with_dsp, + bool returns_by_ref, bool returns_by_target_ptr); /* Return a copy of TYPE, but safe to modify in any way. */ diff --git a/gcc/ada/gmem.c b/gcc/ada/gmem.c index b319993ea5a..f19f77fca0b 100644 --- a/gcc/ada/gmem.c +++ b/gcc/ada/gmem.c @@ -6,7 +6,7 @@ * * * C Implementation File * * * - * Copyright (C) 2000-2007, Free Software Foundation, Inc. * + * Copyright (C) 2000-2008, Free Software Foundation, Inc. * * * * GNAT is free software; you can redistribute it and/or modify it under * * terms of the GNU General Public License as published by the Free Soft- * @@ -50,6 +50,13 @@ */ +#ifdef VMS +#include <string.h> +#define xstrdup32(S) strcpy ((__char_ptr32) _malloc32 (strlen (S) + 1), S) +#else +#define xstrdup32(S) S +#endif + #include <stdio.h> static FILE *gmemfile; @@ -141,8 +148,10 @@ long long __gnat_gmem_initialize (char *dumpname) void __gnat_gmem_a2l_initialize (char *exearg) { /* Resolve the executable filename to use in later invocations of - the libaddr2line symbolization service. */ - exename = __gnat_locate_exec_on_path (exearg); + the libaddr2line symbolization service. Ensure that on VMS + exename is allocated in 32 bit memory for compatibility + with libaddr2line. */ + exename = xstrdup32 (__gnat_locate_exec_on_path (exearg)); } /* Read next allocation of deallocation information from the GMEM file and diff --git a/gcc/ada/gnat1drv.adb b/gcc/ada/gnat1drv.adb index dda21ce8e98..a1552dcb3fa 100644 --- a/gcc/ada/gnat1drv.adb +++ b/gcc/ada/gnat1drv.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 1992-2007, Free Software Foundation, Inc. -- +-- Copyright (C) 1992-2008, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -241,11 +241,13 @@ procedure Gnat1drv is if List_Representation_Info /= 0 or else List_Representation_Info_Mechanisms then + Set_Standard_Error; Write_Eol; Write_Str ("cannot generate representation information, no code generated"); Write_Eol; Write_Eol; + Set_Standard_Output; end if; end Check_Rep_Info; @@ -584,6 +586,7 @@ begin -- generate code). if Back_End_Mode = Skip then + Set_Standard_Error; Write_Str ("cannot generate code for "); Write_Str ("file "); Write_Name (Unit_File_Name (Main_Unit)); @@ -627,6 +630,7 @@ begin end if; Write_Eol; + Set_Standard_Output; Sem_Ch13.Validate_Unchecked_Conversions; Sem_Ch13.Validate_Address_Clauses; diff --git a/gcc/ada/gnat_rm.texi b/gcc/ada/gnat_rm.texi index e85bff7d712..8e3247d274d 100644 --- a/gcc/ada/gnat_rm.texi +++ b/gcc/ada/gnat_rm.texi @@ -8,7 +8,7 @@ @c o @c G N A T _ RM o @c o -@c Copyright (C) 1995-2007, Free Software Foundation o +@c Copyright (C) 1995-2008, Free Software Foundation o @c o @c o @c GNAT is maintained by Ada Core Technologies Inc (http://www.gnat.com). o @@ -34,7 +34,7 @@ @end direntry @copying -Copyright @copyright{} 1995-2007, 2008 Free Software Foundation, Inc. +Copyright @copyright{} 1995-2008, Free Software Foundation, Inc. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 @@ -108,7 +108,9 @@ Implementation Defined Pragmas * Pragma Assert:: * Pragma Ast_Entry:: * Pragma C_Pass_By_Copy:: +* Pragma Check:: * Pragma Check_Name:: +* Pragma Check_Policy:: * Pragma Comment:: * Pragma Common_Object:: * Pragma Compile_Time_Error:: @@ -174,6 +176,8 @@ Implementation Defined Pragmas * Pragma Passive:: * Pragma Persistent_BSS:: * Pragma Polling:: +* Pragma Postcondition:: +* Pragma Precondition:: * Pragma Profile (Ravenscar):: * Pragma Profile (Restricted):: * Pragma Psect_Object:: @@ -228,12 +232,14 @@ Implementation Defined Attributes * Emax:: * Enabled:: * Enum_Rep:: +* Enum_Val:: * Epsilon:: * Fixed_Value:: * Has_Access_Values:: * Has_Discriminants:: * Img:: * Integer_Value:: +* Invalid_Value:: * Large:: * Machine_Size:: * Mantissa:: @@ -380,6 +386,7 @@ The GNAT Library * GNAT.Table (g-table.ads):: * GNAT.Task_Lock (g-tasloc.ads):: * GNAT.Threads (g-thread.ads):: +* GNAT.Time_Stamp (g-timsta.ads):: * GNAT.Traceback (g-traceb.ads):: * GNAT.Traceback.Symbolic (g-trasym.ads):: * GNAT.UTF_32 (g-utf_32.ads):: @@ -702,7 +709,9 @@ consideration, the use of these pragmas should be minimized. * Pragma Assert:: * Pragma Ast_Entry:: * Pragma C_Pass_By_Copy:: +* Pragma Check:: * Pragma Check_Name:: +* Pragma Check_Policy:: * Pragma Comment:: * Pragma Common_Object:: * Pragma Compile_Time_Error:: @@ -768,6 +777,8 @@ consideration, the use of these pragmas should be minimized. * Pragma Passive:: * Pragma Persistent_BSS:: * Pragma Polling:: +* Pragma Postcondition:: +* Pragma Precondition:: * Pragma Profile (Ravenscar):: * Pragma Profile (Restricted):: * Pragma Psect_Object:: @@ -933,7 +944,7 @@ Syntax: @smallexample @c ada pragma Assert ( boolean_EXPRESSION - [, static_string_EXPRESSION]); + [, string_EXPRESSION]); @end smallexample @noindent @@ -1050,6 +1061,34 @@ You can also pass records by copy by specifying the convention @code{Import} and @code{Export} pragmas, which allow specification of passing mechanisms on a parameter by parameter basis. +@node Pragma Check +@unnumberedsec Pragma Check +@cindex Assertions +@cindex Named assertions +@findex Check +@noindent +Syntax: +@smallexample @c ada +pragma Check ( + [Name =>] Identifier, + [Check =>] Boolean_EXPRESSION + [, [Message =>] string_EXPRESSION] ); +@end smallexample + +@noindent +This pragma is similar to the predefined pragma @code{Assert} except that an +extra identifier argument is present. In conjunction with pragma +@code{Check_Policy}, this can be used to define groups of assertions that can +be independently controlled. The identifier @code{Assertion} is special, it +refers to the normal set of pragma @code{Assert} statements. The identifiers +@code{Precondition} and @code{Postcondition} correspond to the pragmas of these +names, so these three names would normally not be used directly in a pragma +@code{Check}. + +Checks introduced by this pragma are normally deactivated by default. They can +be activated either by the command line option @option{-gnata}, which turns on +all checks, or individually controlled using pragma @code{Check_Policy}. + @node Pragma Check_Name @unnumberedsec Pragma Check_Name @cindex Defining check names @@ -1065,7 +1104,7 @@ pragma Check_Name (check_name_IDENTIFIER); This is a configuration pragma that defines a new implementation defined check name (unless IDENTIFIER matches one of the predefined check names, in which case the pragma has no effect). Check names -are global to a partition, so if two more more configuration pragmas +are global to a partition, so if two or more configuration pragmas are present in a partition mentioning the same name, only one new check name is introduced. @@ -1079,6 +1118,60 @@ the current unit, or if it appears at the start of any unit that is part of the dependency set of the current unit (e.g., units that are mentioned in @code{with} clauses). +@node Pragma Check_Policy +@unnumberedsec Pragma Check_Policy +@cindex Controlling assertions +@cindex Assertions, control +@cindex Check pragma control +@cindex Named assertions +@findex Check +@noindent +Syntax: +@smallexample @c ada +pragma Check_Policy ([Name =>] Identifier, POLICY_IDENTIFIER); + +POLICY_IDENTIFIER ::= On | Off | Check | Ignore +@end smallexample + +@noindent +This pragma is similar to the predefined pragma @code{Assertion_Policy}, +except that it controls sets of named assertions introduced using the +@code{Check} pragmas. It can be used as a configuration pragma or (unlike +@code{Assertion_Policy}) can be used within a declarative part, in which case +it controls the status to the end of the corresponding construct (in a manner +identical to pragma @code{Suppress)}. + +The identifier given as the first argument corresponds to a name used in +associated @code{Check} pragmas. For example, if the pragma: + +@smallexample @c ada +pragma Check_Policy (Critical_Error, Off); +@end smallexample + +@noindent +is given, then subsequent @code{Check} pragmas whose first argument is also +@code{Critical_Error} will be disabled. The special identifier @code{Assertion} +controls the behavior of normal @code{Assert} pragmas (thus a pragma +@code{Check_Policy} with this identifier is similar to the normal +@code{Assertion_Policy} pragma except that it can appear within a +declarative part). + +The special identifiers @code{Precondition} and @code{Postcondition} control +the status of preconditions and postconditions. If a @code{Precondition} pragma +is encountered, it is ignored if turned off by a @code{Check_Policy} specifying +that @code{Precondition} checks are @code{Off} or @code{Ignored}. Similarly use +of the name @code{Postcondition} controls whether @code{Postcondition} pragmas +are recognized. + +The check policy is @code{Off} to turn off corresponding checks, and @code{On} +to turn on corresponding checks. The default for a set of checks for which no +@code{Check_Policy} is given is @code{Off} unless the compiler switch +@option{-gnata} is given, which turns on all checks by default. + +The check policy settings @code{Check} and @code{Ignore} are also recognized +as synonyms for @code{On} and @code{Off}. These synonyms are provided for +compatibility with the standard @code{Assertion_Policy} pragma. + @node Pragma Comment @unnumberedsec Pragma Comment @findex Comment @@ -2767,7 +2860,7 @@ a handler. Note that certain signals on many operating systems cannot be caught and handled by applications. In such cases, the pragma is ignored. See the operating system documentation, or the value of the array @code{Reserved} -declared in the specification of package @code{System.OS_Interface}. +declared in the spec of package @code{System.OS_Interface}. Overriding the default state of signals used by the Ada runtime may interfere with an application's runtime behavior in the cases of the synchronous signals, @@ -3456,9 +3549,10 @@ As noted above, this is a configuration pragma, and there is a requirement that all units in a partition be compiled with a consistent setting of the optimization setting. This would normally be achieved by use of a configuration pragma file containing the appropriate setting. The exception to this rule is -that predefined units in the GNAT library (that is, members of the Ada, System, -Interfaces, GNAT hierarchies) ignore the setting of this pragma, and thus the -consistency requirement does not apply to them. +that units with an explicit configuration pragma in the same file as the source +unit are excluded from the consistency check, as are all predefined units. The +latter are commpiled by default in pragma Optimize_Alignment (Off) mode if no +pragma appears at the start of the file. @node Pragma Passive @unnumberedsec Pragma Passive @@ -3555,6 +3649,194 @@ Note that polling can also be enabled by use of the @option{-gnatP} switch. @xref{Switches for gcc,,, gnat_ugn, @value{EDITION} User's Guide}, for details. +@node Pragma Postcondition +@unnumberedsec Pragma Postcondition +@cindex Postconditions +@cindex Checks, postconditions +@findex Postconditions +@noindent +Syntax: + +@smallexample @c ada +pragma Postcondition ( + [Check =>] Boolean_Expression + [,[Message =>] String_Expression]); +@end smallexample + +@noindent +The @code{Postcondition} pragma allows specification of automatic +postcondition checks for subprograms. These checks are similar to +assertions, but are automatically inserted just prior to the return +statements of the subprogram with which they are associated. +Furthermore, the boolean expression which is the condition which +must be true may contain references to function'Result in the case +of a function to refer to the returned value. + +@code{Postcondition} pragmas may appear either immediate following the +(separate) declaration of a subprogram, or at the start of the +declarations of a subprogram body. Only other pragmas may intervene +(that is appear between the subprogram declaration and its +postconditions, or appear before the postcondition in the +declaration sequence in a subprogram body). In the case of a +postcondition appearing after a subprogram declaration, the +formal arguments of the subprogram are visible, and can be +referenced in the postcondition expressions. + +The postconditions are collected and automatically tested just +before any return (implicit or explicit) in the subprogram body. +A postcondition is only recognized if postconditions are active +at the time the pragma is encountered. The compiler switch @option{gnata} +turns on all postconditions by default, and pragma @code{Check_Policy} +with an identifier of @code{Postcondition} can also be used to +control whether postconditions are active. + +The general approach is that postconditions are placed in the spec +if they represent functional aspects which make sense to the client. +For example we might have: + +@smallexample @c ada + function Direction return Integer; + pragma Postcondition + (Direction'Result = +1 + or else + Direction'Result = -1); +@end smallexample + +@noindent +which serves to document that the result must be +1 or -1, and +will test that this is the case at run time if postcondition +checking is active. + +Postconditions within the subprogram body can be used to +check that some internal aspect of the implementation, +not visible to the client, is operating as expected. +For instance if a square root routine keeps an internal +counter of the number of times it is called, then we +might have the following postcondition: + +@smallexample @c ada + Sqrt_Calls : Natural := 0; + + function Sqrt (Arg : Float) return Float is + pragma Postcondition + (Sqrt_Calls = Sqrt_Calls'Old + 1); + ... + end Sqrt +@end smallexample + +@noindent +As this example, shows, the use of the @code{Old} attribute +is often useful in postconditions to refer to the state on +entry to the subprogram. + +Note that postconditions are only checked on normal returns +from the subprogram. If an abnormal return results from +raising an exception, then the postconditions are not checked. + +If a postcondition fails, then the exception +@code{System.Assertions.Assert_Failure} is raised. If +a message argument was supplied, then the given string +will be used as the exception message. If no message +argument was supplied, then the default message has +the form "Postcondition failed at file:line". The +exception is raised in the context of the subprogram +body, so it is posssible to catch postcondition failures +within the subprogram body itself. + +Within a package spec, normal visibility rules +in Ada would prevent forward references within a +postcondition pragma to functions defined later in +the same package. This would introduce undesirable +ordering constraints. To avoid this problem, all +postcondition pragmas are analyzed at the end of +the package spec, allowing forward references. + +The following example shows that this even allows +mutually recursive postconditions as in: + +@smallexample @c ada +package Parity_Functions is + function Odd (X : Natural) return Boolean; + pragma Postcondition + (Odd'Result = + (x = 1 + or else + (x /= 0 and then Even (X - 1)))); + + function Even (X : Natural) return Boolean; + pragma Postcondition + (Even'Result = + (x = 0 + or else + (x /= 1 and then Odd (X - 1)))); + +end Parity_Functions; +@end smallexample + +@noindent +There are no restrictions on the complexity or form of +conditions used within @code{Postcondition} pragmas. +The following example shows that it is even possible +to verify performance behavior. + +@smallexample @c ada +package Sort is + + Performance : constant Float; + -- Performance constant set by implementation + -- to match target architecture behavior. + + procedure Treesort (Arg : String); + -- Sorts characters of argument using N*logN sort + pragma Postcondition + (Float (Clock - Clock'Old) <= + Float (Arg'Length) * + log (Float (Arg'Length)) * + Performance); +end Sort; +@end smallexample + +@node Pragma Precondition +@unnumberedsec Pragma Precondition +@cindex Preconditions +@cindex Checks, preconditions +@findex Preconditions +@noindent +Syntax: + +@smallexample @c ada +pragma Precondition ( + [Check =>] Boolean_Expression + [,[Message =>] String_Expression]); +@end smallexample + +@noindent +The @code{Precondition} pragma is similar to @code{Postcondition} +except that the corresponding checks take place immediately upon +entry to the subprogram, and if a precondition fails, the exception +is raised in the context of the caller, and the attribute 'Result +cannot be used within the precondition expression. + +Otherwise, the placement and visibility rules are identical to those +described for postconditions. The following is an example of use +within a package spec: + +@smallexample @c ada +package Math_Functions is + ... + function Sqrt (Arg : Float) return Float; + pragma Precondition (Arg >= 0.0) + ... +end Math_Functions; +@end smallexample + +@code{Postcondition} pragmas may appear either immediate following the +(separate) declaration of a subprogram, or at the start of the +declarations of a subprogram body. Only other pragmas may intervene +(that is appear between the subprogram declaration and its +postconditions, or appear before the postcondition in the +declaration sequence in a subprogram body). + @node Pragma Profile (Ravenscar) @unnumberedsec Pragma Profile (Ravenscar) @findex Ravenscar @@ -4196,7 +4478,7 @@ The @code{Task_Info} pragma provides system dependent control over aspects of tasking implementation, for example, the ability to map tasks to specific processors. For details on the facilities available for the version of GNAT that you are using, see the documentation -in the specification of package System.Task_Info in the runtime +in the spec of package System.Task_Info in the runtime library. @node Pragma Task_Name @@ -4524,7 +4806,7 @@ functions. For example, if this pragma is used, then pressing a program can then handle the @code{SIGINT} interrupt as it chooses. For a full list of the interrupts handled in a specific implementation, -see the source code for the specification of @code{Ada.Interrupts.Names} in +see the source code for the spec of @code{Ada.Interrupts.Names} in file @file{a-intnam.ads}. This is a target dependent file that contains the list of interrupts recognized for a given target. The documentation in this file also specifies what interrupts are affected by the use of @@ -4765,12 +5047,10 @@ control individual messages, based on their text. The string argument is a pattern that is used to match against the text of individual warning messages (not including the initial "warnings: " tag). -The pattern may start with an asterisk, which matches otherwise unmatched -characters at the start of the message, and it may also end with an asterisk -which matches otherwise unmatched characters at the end of the message. For -example, the string "*alignment*" could be used to match any warnings about -alignment problems. Within the string, the sequence "*" can be used to match -any sequence of characters enclosed in quotation marks. No other regular +The pattern may contain asterisks which match zero or more characters in +the message. For example, you can use +@code{pragma Warnings (Off, "*bits of*unused")} to suppress the warning +message @code{warning: 960 bits of "a" unused}. No other regular expression notations are permitted. All characters other than asterisk in these three specific cases are treated as literal characters in the match. @@ -4904,12 +5184,14 @@ consideration, you should minimize the use of these attributes. * Emax:: * Enabled:: * Enum_Rep:: +* Enum_Val:: * Epsilon:: * Fixed_Value:: * Has_Access_Values:: * Has_Discriminants:: * Img:: * Integer_Value:: +* Invalid_Value:: * Large:: * Machine_Size:: * Mantissa:: @@ -5128,7 +5410,7 @@ error. @noindent This attribute can only be applied to a program unit name. It returns the entity for the corresponding elaboration procedure for elaborating -the specification of the referenced unit. This is used in the main +the spec of the referenced unit. This is used in the main generated elaboration procedure by the binder and is not normally used in any other context. However, there may be specialized situations in which it is useful to be able to call this elaboration procedure from @@ -5200,6 +5482,27 @@ integer type, and the argument is a variable, so that the universal integer calculation is done at run time, then the call to @code{Enum_Rep} may raise @code{Constraint_Error}. +@node Enum_Val +@unnumberedsec Enum_Val +@cindex Representation of enums +@findex Enum_Val +@noindent +For every enumeration subtype @var{S}, @code{@var{S}'Enum_Rep} denotes a +function with the following spec: + +@smallexample @c ada +function @var{S}'Enum_Rep (Arg : @i{Universal_Integer) + return @var{S}'Base}; +@end smallexample + +@noindent +The function returns the enumeration value whose representation matches the +argument, or raises Constraint_Error if no enumeration literal of the type +has the matching value. +This will be equal to value of the @code{Val} attribute in the +absence of an enumeration representation clause. This is a static +attribute (i.e.@: the result is static if the argument is static). + @node Epsilon @unnumberedsec Epsilon @cindex Ada 83 attributes @@ -5311,6 +5614,17 @@ that there are full range checks, to ensure that the result is in range. This attribute is primarily intended for use in implementation of the standard input-output functions for fixed-point values. +@node Invalid_Value +@unnumberedsec Invalid_Value +@findex Invalid_Value +@noindent +For every scalar type S, S'Invalid_Value returns an undefined value of the +type. If possible this value is an invalid representation for the type. The +value returned is identical to the value used to initialize an otherwise +uninitialized value of the type if pragma Initialize_Scalars is used, +including the ability to modify the value with the binder -Sxx flag and +relevant environment variables at run time. + @node Large @unnumberedsec Large @cindex Ada 83 attributes @@ -7910,6 +8224,18 @@ is made to queue more than the specified number of tasks on such an entry. This restriction ensures at compile time that there is no implicit or explicit dependence on the package @code{Ada.Calendar}. +@item No_Default_Initialization +@findex No_Default_Initialization + +This restriction prohibits any instance of default initialization of variables. +The binder implements a consistency rule which prevents any unit compiled +without the restriction from with'ing a unit with the restriction (this allows +the generation of initialization procedures to be skipped, since you can be +sure that no call is ever generated to an initialization procedure in a unit +with the restriction active). If used in conjunction with Initialize_Scalars or +Normalize_Scalars, the effect is to prohibit all cases of variables declared +without a specific initializer (including the case of OUT scalar parameters). + @item No_Direct_Boolean_Operators @findex No_Direct_Boolean_Operators This restriction ensures that no logical (and/or/xor) or comparison @@ -8485,11 +8811,11 @@ letters. @end cartouche @noindent The string passed to @code{Linker_Options} is presented uninterpreted as -an argument to the link command, unless it contains Ascii.NUL characters. +an argument to the link command, unless it contains ASCII.NUL characters. NUL characters if they appear act as argument separators, so for example @smallexample @c ada -pragma Linker_Options ("-labc" & ASCII.Nul & "-ldef"); +pragma Linker_Options ("-labc" & ASCII.NUL & "-ldef"); @end smallexample @noindent @@ -9435,9 +9761,10 @@ will be as described for primitive types, e.g.@: a packed array of length @item @emph{Records}. For the normal non-packed case, the alignment of a record is equal to the maximum alignment of any of its components. For tagged records, this -includes the implicit access type used for the tag. If a pragma @code{Pack} is -used and all fields are packable (see separate section on pragma @code{Pack}), -then the resulting alignment is 1. +includes the implicit access type used for the tag. If a pragma @code{Pack} +is used and all components are packable (see separate section on pragma +@code{Pack}), then the resulting alignment is 1, unless the layout of the +record makes it profitable to increase it. A special case is when: @itemize @bullet @@ -9470,7 +9797,8 @@ strict alignment. An alignment clause may specify a larger alignment than the default value up to some maximum value dependent on the target (obtainable by using the attribute reference @code{Standard'Maximum_Alignment}). It may also specify -a smaller alignment than the default value, for example +a smaller alignment than the default value for enumeration, integer and +fixed point types, as well as for record types, for example @smallexample @c ada type V is record @@ -9993,11 +10321,10 @@ In other words, the value specified must be at least equal to the size of this subtype, and must be a multiple of the alignment value. In addition, component size clauses are allowed which cause the array -to be packed, by specifying a smaller value. The cases in which this -is allowed are for component size values in the range 1 through 63. The value -specified must not be smaller than the Size of the subtype. GNAT will -accurately honor all packing requests in this range. For example, if -we have: +to be packed, by specifying a smaller value. A first case is for +component size values in the range 1 through 63. The value specified +must not be smaller than the Size of the subtype. GNAT will accurately +honor all packing requests in this range. For example, if we have: @smallexample @c ada type r is array (1 .. 8) of Natural; @@ -10008,6 +10335,23 @@ for r'Component_Size use 31; then the resulting array has a length of 31 bytes (248 bits = 8 * 31). Of course access to the components of such an array is considerably less efficient than if the natural component size of 32 is used. +A second case is when the subtype of the component is a record type +padded because of its default alignment. For example, if we have: + +@smallexample @c ada +type r is record + i : Integer; + j : Integer; + b : Boolean; +end record; + +type a is array (1 .. 8) of r; +for a'Component_Size use 72; +@end smallexample + +@noindent +then the resulting array has a length of 72 bytes, instead of 96 bytes +if the alignment of the record (4) was obeyed. Note that there is no point in giving both a component size clause and a pragma Pack for the same array type. if such duplicate @@ -10389,6 +10733,8 @@ Any scalar type Any type whose size is specified with a size clause @item Any packed array type with a static size +@item +Any record type padded because of its default alignment @end itemize @noindent @@ -12973,6 +13319,7 @@ of GNAT, and will generate a warning message. * GNAT.Table (g-table.ads):: * GNAT.Task_Lock (g-tasloc.ads):: * GNAT.Threads (g-thread.ads):: +* GNAT.Time_Stamp (g-timsta.ads):: * GNAT.Traceback (g-traceb.ads):: * GNAT.Traceback.Symbolic (g-trasym.ads):: * GNAT.UTF_32 (g-utf_32.ads):: @@ -14072,6 +14419,17 @@ A very simple facility for locking and unlocking sections of code using a single global task lock. Appropriate for use in situations where contention between tasks is very rarely expected. +@node GNAT.Time_Stamp (g-timsta.ads) +@section @code{GNAT.Time_Stamp} (@file{g-timsta.ads}) +@cindex @code{GNAT.Time_Stamp} (@file{g-timsta.ads}) +@cindex Time stamp +@cindex Current time + +@noindent +Provides a simple function that returns a string YYYY-MM-DD HH:MM:SS.SS that +represents the current date and time in ISO 8601 format. This is a very simple +routine with minimal code and there are no dependencies on any other unit. + @node GNAT.Threads (g-thread.ads) @section @code{GNAT.Threads} (@file{g-thread.ads}) @cindex @code{GNAT.Threads} (@file{g-thread.ads}) @@ -15727,9 +16085,9 @@ Syntax: @smallexample package_declaration ::= - package_specification | package_renaming + package_spec | package_renaming -package_specification ::= +package_spec ::= @b{package} package_identifier @b{is} @{simple_declarative_item@} @b{end} package_identifier ; diff --git a/gcc/ada/gnat_ugn.texi b/gcc/ada/gnat_ugn.texi index 69a2a3dd66e..6654f5d16fe 100644 --- a/gcc/ada/gnat_ugn.texi +++ b/gcc/ada/gnat_ugn.texi @@ -325,6 +325,7 @@ The GNAT Make Program gnatmake Improving Performance * Performance Considerations:: +* Text_IO Suggestions:: * Reducing Size of Ada Executables with gnatelim:: * Reducing Size of Executables with unused subprogram/data elimination:: @@ -417,6 +418,7 @@ File Name Krunching Using gnatkr * Examples of gnatkr Usage:: Preprocessing Using gnatprep +* Preprocessing Symbols:: * Using gnatprep:: * Switches for gnatprep:: * Form of Definitions File:: @@ -3777,6 +3779,16 @@ Any occurrences of pragma @code{Inline} or @code{Inline_Always} are ignored, and @option{-gnatn} and @option{-gnatN} have no effect if this switch is present. +@item -fno-inline-functions +@cindex @option{-fno-inline-functions} (@command{gcc}) +Suppresses automatic inlining of small subprograms, which is enabled +if @option{-O3} is used. + +@item -fno-inline-functions-called-once +@cindex @option{-fno-inline-functions-called-once} (@command{gcc}) +Suppresses inlining of subprograms local to the unit and called once +from within it, which is enabled if @option{-O1} is used. + @item -fno-strict-aliasing @cindex @option{-fno-strict-aliasing} (@command{gcc}) Causes the compiler to avoid assumptions regarding non-aliasing @@ -3823,6 +3835,9 @@ Allow full Ada 2005 features. Assertions enabled. @code{Pragma Assert} and @code{pragma Debug} to be activated. Note that these pragmas can also be controlled using the configuration pragmas @code{Assertion_Policy} and @code{Debug_Policy}. +It also activates pragmas @code{Check}, @code{Precondition}, and +@code{Postcondition}. Note that these pragmas can also be controlled +using the configuration pragma @code{Check_Policy}. @item -gnatA @cindex @option{-gnatA} (@command{gcc}) @@ -4240,7 +4255,7 @@ version, not the GNAT version. Turn off warnings generated by the back end of the compiler. Use of this switch also causes the default for front end warnings to be set to suppress (as though @option{-gnatws} had appeared at the start of -the options. +the options). @end table @@ -4874,6 +4889,13 @@ This switch causes warning messages to be treated as errors. The warning string still appears, but the warning messages are counted as errors, and prevent the generation of an object file. +@item -gnatw.e +@emph{Activate every optional warning} +@cindex @option{-gnatw.e} (@command{gcc}) +@cindex Warnings, activate every optional warning +This switch activates all optional warnings, including those which +are not activated by @code{-gnatwa}. + @item -gnatwf @emph{Activate warnings on unreferenced formals.} @cindex @option{-gnatwf} (@command{gcc}) @@ -4989,20 +5011,32 @@ This warning can also be turned on using @option{-gnatwa}. This switch disables warnings on variables that could be declared constants. @item -gnatwl -@emph{Activate warnings for missing elaboration pragmas.} +@emph{Activate warnings for elaboration pragmas.} @cindex @option{-gnatwl} (@command{gcc}) @cindex Elaboration, warnings This switch activates warnings on missing @code{Elaborate_All} and @code{Elaborate} pragmas. See the section in this guide on elaboration checking for details on -when such pragmas should be used. Warnings are also generated if you +when such pragmas should be used. In dynamic elaboration mode, this switch +generations warnings about the need to add elaboration pragmas. Note however, +that if you blindly follow these warnings, and add @code{Elaborate_All} +warnings wherever they are recommended, you basically end up with the +equivalent of the static elaboration model, which may not be what you want for +legacy code for which the static model does not work. + +For the static model, the messages generated are labeled "info:" (for +information messages). They are not warnings to add elaboration pragmas, +merely informational messages showing what implicit elaboration pragmas +have been added, for use in analyzing elaboration circularity problems. + +Warnings are also generated if you are using the static mode of elaboration, and a @code{pragma Elaborate} is encountered. The default is that such warnings are not generated. This warning is not automatically turned on by the use of @option{-gnatwa}. @item -gnatwL -@emph{Suppress warnings for missing elaboration pragmas.} +@emph{Suppress warnings for elaboration pragmas.} @cindex @option{-gnatwL} (@command{gcc}) This switch suppresses warnings on missing Elaborate and Elaborate_All pragmas. See the section in this guide on elaboration checking for details on @@ -5093,6 +5127,26 @@ This switch suppresses warnings on ineffective pragma Inlines. If the inlining mechanism cannot inline a call, it will simply ignore the request silently. +@item -gnatw.p +@emph{Activate warnings on parameter ordering.} +@cindex @option{-gnatw.p} (@command{gcc}) +@cindex Parameter order, warnings +This switch activates warnings for cases of suspicious parameter +ordering when the list of arguments are all simple identifiers that +match the names of the formals, but are in a different order. The +warning is suppressed if any use of named parameter notation is used, +so this is the appropriate way to suppress a false positive (and +serves to emphasize that the "misordering" is deliberate). The +default is +that such warnings are not given. +This warning can also be turned on using @option{-gnatwa}. + +@item -gnatw.P +@emph{Suppress warnings on parameter ordering.} +@cindex @option{-gnatw.P} (@command{gcc}) +This switch suppresses warnings on cases of suspicious parameter +ordering. + @item -gnatwq @emph{Activate warnings on questionable missing parentheses.} @cindex @option{-gnatwq} (@command{gcc}) @@ -5343,21 +5397,31 @@ This switch suppresses warnings for unchecked conversions where the types are known at compile time to have different sizes or conventions. +@item ^-Wunused^WARNINGS=UNUSED^ +@cindex @option{-Wunused} +The warnings controlled by the @option{-gnatw} switch are generated by +the front end of the compiler. The @option{GCC} back end can provide +additional warnings and they are controlled by the @option{-W} switch. +For example, @option{^-Wunused^WARNINGS=UNUSED^} activates back end +warnings for entities that are declared but not referenced. + @item ^-Wuninitialized^WARNINGS=UNINITIALIZED^ @cindex @option{-Wuninitialized} -The warnings controlled by the @option{-gnatw} switch are generated by the -front end of the compiler. In some cases, the @option{^gcc^GCC^} back end -can provide additional warnings. One such useful warning is provided by -@option{^-Wuninitialized^WARNINGS=UNINITIALIZED^}. This must be used in -conjunction with turning on optimization mode. This causes the flow -analysis circuits of the back end optimizer to output additional -warnings about uninitialized variables. +Similarly, @option{^-Wuninitialized^WARNINGS=UNINITIALIZED^} activates +the back end warning for uninitialized variables. This switch must be +used in conjunction with an optimization level greater than zero. + +@item ^-Wall^/ALL_BACK_END_WARNINGS^ +@cindex @option{-Wall} +This switch enables all the above warnings from the @option{GCC} back end. +The code generator detects a number of warning situations that are missed +by the @option{GNAT} front end, and this switch can be used to activate them. +The use of this switch also sets the default front end warning mode to +@option{-gnatwa}, that is, most front end warnings activated as well. @item ^-w^/NO_BACK_END_WARNINGS^ @cindex @option{-w} -This switch suppresses warnings from the @option{^gcc^GCC^} back end. The -code generator detects a number of warning situations that are missed -by the @option{GNAT} front end, and this switch can be used to suppress them. +Conversely, this switch suppresses warnings from the @option{GCC} back end. The use of this switch also sets the default front end warning mode to @option{-gnatws}, that is, front end warnings suppressed as well. @@ -5694,12 +5758,12 @@ checks to be performed. The following checks are defined: @table @option @c !sort! -@item 1-9 +@item 0-9 @emph{Specify indentation level.} If a digit from 1-9 appears ^in the string after @option{-gnaty}^as an option for /STYLE_CHECKS^ then proper indentation is checked, with the digit indicating the -indentation level required. +indentation level required. A value of zero turns off this style check. The general style of required indentation is as specified by the examples in the Ada Reference Manual. Full line comments must be aligned with the @code{--} starting on a column that is a multiple of @@ -5709,30 +5773,26 @@ of a statement. @item ^a^ATTRIBUTE^ @emph{Check attribute casing.} -If the ^letter a^word ATTRIBUTE^ appears in the string after @option{-gnaty} -then attribute names, including the case of keywords such as @code{digits} +Attribute names, including the case of keywords such as @code{digits} used as attributes names, must be written in mixed case, that is, the initial letter and any letter following an underscore must be uppercase. All other letters must be lowercase. @item ^A^ARRAY_INDEXES^ @emph{Use of array index numbers in array attributes.} -If the ^letter A^word ARRAY_INDEXES^ appears in the string after -@option{-gnaty} then when using the array attributes First, Last, Range, +When using the array attributes First, Last, Range, or Length, the index number must be omitted for one-dimensional arrays and is required for multi-dimensional arrays. @item ^b^BLANKS^ @emph{Blanks not allowed at statement end.} -If the ^letter b^word BLANKS^ appears in the string after @option{-gnaty} then -trailing blanks are not allowed at the end of statements. The purpose of this +Trailing blanks are not allowed at the end of statements. The purpose of this rule, together with h (no horizontal tabs), is to enforce a canonical format for the use of blanks to separate source tokens. @item ^c^COMMENTS^ @emph{Check comments.} -If the ^letter c^word COMMENTS^ appears in the string after @option{-gnaty} -then comments must meet the following set of rules: +Comments must meet the following set of rules: @itemize @bullet @@ -5784,64 +5844,55 @@ example: @item ^d^DOS_LINE_ENDINGS^ @emph{Check no DOS line terminators present.} -If the ^letter d^word DOS_LINE_ENDINGS^ appears in the string after -@option{-gnaty} then all lines must be terminated by a single ASCII.LF +All lines must be terminated by a single ASCII.LF character (in particular the DOS line terminator sequence CR/LF is not allowed). @item ^e^END^ @emph{Check end/exit labels.} -If the ^letter e^word END^ appears in the string after @option{-gnaty} then -optional labels on @code{end} statements ending subprograms and on +Optional labels on @code{end} statements ending subprograms and on @code{exit} statements exiting named loops, are required to be present. @item ^f^VTABS^ @emph{No form feeds or vertical tabs.} -If the ^letter f^word VTABS^ appears in the string after @option{-gnaty} then -neither form feeds nor vertical tab characters are permitted +Neither form feeds nor vertical tab characters are permitted in the source text. @item ^g^GNAT^ @emph{GNAT style mode} -If the ^letter g^word GNAT^ appears in the string after @option{-gnaty} then -the set of style check switches is set to match that used by the GNAT sources. +The set of style check switches is set to match that used by the GNAT sources. This may be useful when developing code that is eventually intended to be incorporated into GNAT. For further details, see GNAT sources. @item ^h^HTABS^ @emph{No horizontal tabs.} -If the ^letter h^word HTABS^ appears in the string after @option{-gnaty} then -horizontal tab characters are not permitted in the source text. +Horizontal tab characters are not permitted in the source text. Together with the b (no blanks at end of line) check, this enforces a canonical form for the use of blanks to separate source tokens. @item ^i^IF_THEN^ @emph{Check if-then layout.} -If the ^letter i^word IF_THEN^ appears in the string after @option{-gnaty}, -then the keyword @code{then} must appear either on the same +The keyword @code{then} must appear either on the same line as corresponding @code{if}, or on a line on its own, lined up under the @code{if} with at least one non-blank line in between containing all or part of the condition to be tested. @item ^I^IN_MODE^ @emph{check mode IN keywords} -If the ^letter I (upper case)^word IN_MODE^ appears in the string -after @option{-gnaty} then mode @code{in} (the default mode) is not +Mode @code{in} (the default mode) is not allowed to be given explicitly. @code{in out} is fine, but not @code{in} on its own. @item ^k^KEYWORD^ @emph{Check keyword casing.} -If the ^letter k^word KEYWORD^ appears in the string after @option{-gnaty} then -all keywords must be in lower case (with the exception of keywords +All keywords must be in lower case (with the exception of keywords such as @code{digits} used as attribute names to which this check does not apply). @item ^l^LAYOUT^ @emph{Check layout.} -If the ^letter l^word LAYOUT^ appears in the string after @option{-gnaty} then -layout of statement and declaration constructs must follow the +Layout of statement and declaration constructs must follow the recommendations in the Ada Reference Manual, as indicated by the form of the syntax rules. For example an @code{else} keyword must be lined up with the corresponding @code{if} keyword. @@ -5918,16 +5969,13 @@ Clear : @item ^Lnnn^MAX_NESTING=nnn^ @emph{Set maximum nesting level} -If the sequence ^Lnnn^MAX_NESTING=nnn^, where nnn is a decimal number in -the range 0-999, appears in the string after @option{-gnaty} then the -maximum level of nesting of constructs (including subprograms, loops, -blocks, packages, and conditionals) may not exceed the given value. A -value of zero disconnects this style check. +The maximum level of nesting of constructs (including subprograms, loops, +blocks, packages, and conditionals) may not exceed the given value +@option{nnn}. A value of zero disconnects this style check. @item ^m^LINE_LENGTH^ @emph{Check maximum line length.} -If the ^letter m^word LINE_LENGTH^ appears in the string after @option{-gnaty} -then the length of source lines must not exceed 79 characters, including +The length of source lines must not exceed 79 characters, including any trailing blanks. The value of 79 allows convenient display on an 80 character wide device or window, allowing for possible special treatment of 80 character lines. Note that this count is of @@ -5937,21 +5985,22 @@ a single character (however many bytes are needed in the encoding). @item ^Mnnn^MAX_LENGTH=nnn^ @emph{Set maximum line length.} -If the sequence ^M^MAX_LENGTH=^nnn, where nnn is a decimal number, appears in -the string after @option{-gnaty} then the length of lines must not exceed the -given value. The maximum value that can be specified is 32767. +The length of lines must not exceed the +given value @option{nnn}. The maximum value that can be specified is 32767. @item ^n^STANDARD_CASING^ @emph{Check casing of entities in Standard.} -If the ^letter n^word STANDARD_CASING^ appears in the string -after @option{-gnaty} then any identifier from Standard must be cased +Any identifier from Standard must be cased to match the presentation in the Ada Reference Manual (for example, @code{Integer} and @code{ASCII.NUL}). +@item ^N^NONE^ +@emph{Turn off all style checks} +All style check options are turned off. + @item ^o^ORDERED_SUBPROGRAMS^ @emph{Check order of subprogram bodies.} -If the ^letter o^word ORDERED_SUBPROGRAMS^ appears in the string -after @option{-gnaty} then all subprogram bodies in a given scope +All subprogram bodies in a given scope (e.g.@: a package body) must be in alphabetical order. The ordering rule uses normal Ada rules for comparing strings, ignoring casing of letters, except that if there is a trailing numeric suffix, then @@ -5960,31 +6009,27 @@ before Junk10). @item ^p^PRAGMA^ @emph{Check pragma casing.} -If the ^letter p^word PRAGMA^ appears in the string after @option{-gnaty} then -pragma names must be written in mixed case, that is, the +Pragma names must be written in mixed case, that is, the initial letter and any letter following an underscore must be uppercase. All other letters must be lowercase. @item ^r^REFERENCES^ @emph{Check references.} -If the ^letter r^word REFERENCES^ appears in the string after @option{-gnaty} -then all identifier references must be cased in the same way as the +All identifier references must be cased in the same way as the corresponding declaration. No specific casing style is imposed on identifiers. The only requirement is for consistency of references with declarations. @item ^S^STATEMENTS_AFTER_THEN_ELSE^ @emph{Check no statements after THEN/ELSE.} -If the ^letter S^word STATEMENTS_AFTER_THEN_ELSE^ appears in the -string after @option{-gnaty} then it is not permitted to write any -statements on the same line as a THEN OR ELSE keyword following the +No statements are allowed +on the same line as a THEN OR ELSE keyword following the keyword in an IF statement. OR ELSE and AND THEN are not affected, and a special exception allows a pragma to appear after ELSE. @item ^s^SPECS^ @emph{Check separate specs.} -If the ^letter s^word SPECS^ appears in the string after @option{-gnaty} then -separate declarations (``specs'') are required for subprograms (a +Separate declarations (``specs'') are required for subprograms (a body is not allowed to serve as its own declaration). The only exception is that parameterless library level procedures are not required to have a separate declaration. This exception covers @@ -5992,8 +6037,7 @@ the most frequent form of main program procedures. @item ^t^TOKEN^ @emph{Check token spacing.} -If the ^letter t^word TOKEN^ appears in the string after @option{-gnaty} then -the following token spacing rules are enforced: +The following token spacing rules are enforced: @itemize @bullet @@ -6042,16 +6086,41 @@ A vertical bar must be surrounded by spaces. @item ^u^UNNECESSARY_BLANK_LINES^ @emph{Check unnecessary blank lines.} -Check for unnecessary blank lines. A blank line is considered +Unnecessary blank lines are not allowed. A blank line is considered unnecessary if it appears at the end of the file, or if more than one blank line occurs in sequence. @item ^x^XTRA_PARENS^ @emph{Check extra parentheses.} -Check for the use of an unnecessary extra level of parentheses (C-style) +Unnecessary extra level of parentheses (C-style) are not allowed around conditions in @code{if} statements, @code{while} statements and @code{exit} statements. +@item ^y^ALL_BUILTIN^ +@emph{Set all standard style check options} +This is equivalent to @code{gnaty3aAbcefhiklmnprst}, that is all checking +options enabled with the exception of @option{-gnatyo}, +@option{-gnatyd}, @option{-gnatyu}, and @option{-gnatyx}. + +@ifclear vms +@item - +@emph{Remove style check options} +This causes any subsequent options in the string to act as canceling the +corresponding style check option. + +@item + +This causes any subsequent options in the string to enable the corresponding +style check option. It only has an effect if a previous ^-^REMOVE^ has been +encountered. +@end ifclear + +@ifset vms +@item NOxxx +@emph{Removing style check options} +If the name of a style check is preceded by @option{NO} then the corresponding +style check is turned off. For example @option{NOCOMMENTS} turns off style +checking for comments. +@end ifset @end table @noindent @@ -6074,10 +6143,10 @@ including style messages, as fatal errors. The switch @ifclear vms @option{-gnaty} on its own (that is not -followed by any letters or digits), -is equivalent to @code{gnaty3aAbcefhiklmnprst}, that is all checking -options enabled with the exception of @option{-gnatyo}, -@option{-gnatyd}, @option{-gnatyu}, and @option{-gnatyx}. +followed by any letters or digits), then the effect is equivalent +to the use of @option{-gnatyy}, as described above, that is all +built-in standard style check options are enabled. + @end ifclear @ifset vms /STYLE_CHECKS=ALL_BUILTIN enables all checking options with @@ -6197,12 +6266,12 @@ generate IEEE NaN and infinite values on overflow or invalid operations (such as dividing 0.0 by 0.0). The reason that we distinguish overflow checking from other kinds of -range constraint checking is that a failure of an overflow check can -generate an incorrect value, but cannot cause erroneous behavior. This -is unlike the situation with a constraint check on an array subscript, -where failure to perform the check can result in random memory description, -or the range check on a case statement, where failure to perform the check -can cause a wild jump. +range constraint checking is that a failure of an overflow check, unlike +for example the failure of a range check, can result in an incorrect +value, but cannot cause random memory destruction (like an out of range +subscript), or a wild jump (from an out of range case value). Overflow +checking is also quite expensive in time and space, since in general it +requires the use of double length arithmetic. Note again that @option{-gnato} is off by default, so overflow checking is not performed in default mode. This means that out of the box, with the @@ -6646,7 +6715,7 @@ The format of the output is very similar to standard Ada source, and is easily understood by an Ada programmer. The following special syntactic additions correspond to low level features used in the generated code that do not have any exact analogies in pure Ada source form. The following -is a partial list of these special constructions. See the specification +is a partial list of these special constructions. See the spec of package @code{Sprint} in file @file{sprint.ads} for a full list. If the switch @option{-gnatL} is used in conjunction with @@ -6916,7 +6985,7 @@ for completeness and for possible use by other tools. A mapping file is a sequence of sets of three lines. In each set, the first line is the unit name, in lower case, with ``@code{%s}'' appended for -specifications and ``@code{%b}'' appended for bodies; the second line is the +specs and ``@code{%b}'' appended for bodies; the second line is the file name; and the third line is the path name. Example: @@ -8387,10 +8456,10 @@ $ ^gnatlink my_prog -Wl,-Map,MAPFILE^GNAT LINK my_prog.ali /MAP^ Using @var{linker options} it is possible to set the program stack and heap size. -@ifclear vms +@ifset unw See @ref{Setting Stack Size from gnatlink} and @ref{Setting Heap Size from gnatlink}. -@end ifclear +@end ifset @command{gnatlink} determines the list of objects required by the Ada program and prepends them to the list of objects passed to the linker. @@ -8994,7 +9063,9 @@ Normally, when using Project Files, only sources that are part of a Project File may be compile. When this switch is used, a source outside of all Project Files may be compiled. The ALI file and the object file will be put in the object directory of the main Project. The compilation switches used will only -be those specified on the command line. +be those specified on the command line. Even when +@option{^-x^/NON_PROJECT_UNIT_COMPILATION^} is used, mains specified on the +command line need to be sources of a project file. @item ^-X^/EXTERNAL_REFERENCE=^@var{name=value} Indicate that external variable @var{name} has the value @var{value}. @@ -9325,6 +9396,7 @@ driver (see @ref{The GNAT Driver and Project Files}). @ifnottex @menu * Performance Considerations:: +* Text_IO Suggestions:: * Reducing Size of Ada Executables with gnatelim:: * Reducing Size of Executables with unused subprogram/data elimination:: @end menu @@ -9471,6 +9543,23 @@ possibility of an immediate abort at any point. @cindex @option{^-O^/OPTIMIZE^} (@command{gcc}) @noindent +Without any optimization ^option,^qualifier,^ +the compiler's goal is to reduce the cost of +compilation and to make debugging produce the expected results. +Statements are independent: if you stop the program with a breakpoint between +statements, you can then assign a new value to any variable or change +the program counter to any other statement in the subprogram and get exactly +the results you would expect from the source code. + +Turning on optimization makes the compiler attempt to improve the +performance and/or code size at the expense of compilation time and +possibly the ability to debug the program. + +If you use multiple +^-O options, with or without level numbers,^/OPTIMIZE qualifiers,^ +the last such option is the one that is effective. + +@noindent The default is optimization off. This results in the fastest compile times, but GNAT makes absolutely no attempt to optimize, and the generated programs are considerably larger and slower than when @@ -9491,7 +9580,7 @@ generates unoptimized code but has the fastest compilation time. Note that many other compilers do fairly extensive optimization -even if "no optimization" is specified. When using gcc, it is +even if ``no optimization'' is specified. With gcc, it is very unusual to use ^-O0^/OPTIMIZE=NONE^ for production if execution time is of any concern, since ^-O0^/OPTIMIZE=NONE^ really does mean no optimization at all. This difference between @@ -9528,10 +9617,6 @@ resulting improvement in execution time, both depend on the particular application and the hardware environment. You should experiment to find the best level for your application. -The @option{^-Os^/OPTIMIZE=SPACE^} switch is independent of the time -optimizations, so you can specify both @option{^-Os^/OPTIMIZE=SPACE^} -and a time optimization on the same compile command. - Since the precise set of optimizations done at each level will vary from release to release (and sometime from target to target), it is best to think of the optimization settings in general terms. @@ -9694,18 +9779,15 @@ The optimization level is at least @option{-O1}. @item The called subprogram is suitable for inlining: It must be small enough -and not contain nested subprograms or anything else that @command{gcc} -cannot support in inlined subprograms. - -@item -The call occurs after the definition of the body of the subprogram. +and not contain something that @command{gcc} cannot support in inlined +subprograms. @item @cindex pragma Inline @findex Inline -Either @code{pragma Inline} applies to the subprogram or it is -small and automatic inlining (optimization level @option{-O3}) is -specified. +Either @code{pragma Inline} applies to the subprogram, or it is local +to the unit and called once from within it, or it is small and automatic +inlining (optimization level @option{-O3}) is specified. @end itemize @noindent @@ -9719,8 +9801,8 @@ The optimization level is at least @option{-O1}. @item The called subprogram is suitable for inlining: It must be small enough -and not contain nested subprograms or anything else @command{gcc} cannot -support in inlined subprograms. +and not contain something that @command{gcc} cannot support in inlined +subprograms. @item The call appears in a body (not in a package spec). @@ -9787,6 +9869,15 @@ that no inlining occurs. The extra dependences resulting from @option{-gnatn} will still be active, even if this switch is used to suppress the resulting inlining actions. +@cindex @option{-fno-inline-functions} (@command{gcc}) +Note: The @option{-fno-inline-functions} switch can be used to prevent +automatic inlining of small subprograms if @option{-O3} is used. + +@cindex @option{-fno-inline-functions-called-once} (@command{gcc}) +Note: The @option{-fno-inline-functions-called-once} switch +can be used to prevent inlining of subprograms local to the unit +and called once from within it if @option{-O1} is used. + Note regarding the use of @option{-O3}: There is no difference in inlining behavior between @option{-O2} and @option{-O3} for subprograms with an explicit pragma @code{Inline} assuming the use of @option{-gnatn} @@ -10041,6 +10132,30 @@ the user to determine the distribution of execution time across a program, @pxref{Profiling} for details of usage. @end ifset + +@node Text_IO Suggestions +@section @code{Text_IO} Suggestions +@cindex @code{Text_IO} and performance + +@noindent +The @code{Ada.Text_IO} package has fairly high overheads due in part to +the requirement of maintaining page and line counts. If performance +is critical, a recommendation is to use @code{Stream_IO} instead of +@code{Text_IO} for volume output, since this package has less overhead. + +If @code{Text_IO} must be used, note that by default output to the standard +output and standard error files is unbuffered (this provides better +behavior when output statements are used for debugging, or if the +progress of a program is observed by tracking the output, e.g. by +using the Unix @command{tail -f} command to watch redirected output. + +If you are generating large volumes of output with @code{Text_IO} and +performance is an important factor, use a designated file instead +of the standard output file, or change the standard output file to +be buffered using @code{Interfaces.C_Streams.setvbuf}. + + + @node Reducing Size of Ada Executables with gnatelim @section Reducing Size of Ada Executables with @code{gnatelim} @findex gnatelim @@ -10753,23 +10868,38 @@ recognized by GNAT: Ada_83 Ada_95 Ada_05 + Ada_2005 + Assertion_Policy C_Pass_By_Copy + Check_Name + Check_Policy + Compile_Time_Error + Compile_Time_Warning + Compiler_Unit Component_Alignment + Debug_Policy Detect_Blocking Discard_Names Elaboration_Checks Eliminate Extend_System External_Name_Casing + Fast_Math + Favor_Top_Level Float_Representation + Implicit_Packing Initialize_Scalars Interrupt_State License Locking_Policy Long_Float + No_Run_Time + No_Strict_Aliasing Normalize_Scalars + Optimize_Alignment Persistent_BSS Polling + Priority_Specific_Dispatching Profile Profile_Warnings Propagate_Exceptions @@ -10780,14 +10910,18 @@ recognized by GNAT: Restrictions_Warnings Reviewable Source_File_Name + Source_File_Name_Project Style_Checks Suppress + Suppress_Exception_Locations Task_Dispatching_Policy Universal_Data Unsuppress Use_VADS_Size - Warnings Validity_Checks + Warnings + Wide_Character_Encoding + @end smallexample @menu @@ -11793,7 +11927,7 @@ relaxed in a future release. @noindent In large software systems it is common to have multiple implementations of a common interface; in Ada terms, multiple versions of a -package body for the same specification. For example, one implementation +package body for the same spec. For example, one implementation might be safe for use in tasking programs, while another might only be used in sequential applications. This can be modeled in GNAT using the concept of @emph{project extension}. If one project (the ``child'') @emph{extends} @@ -12874,11 +13008,11 @@ of the child project; see @ref{Project File Syntax}. An inherited source file retains any switches specified in the parent project. -For example if the project @code{Utilities} contains the specification and the +For example if the project @code{Utilities} contains the spec and the body of an Ada package @code{Util_IO}, then the project @code{Modified_Utilities} can contain a new body for package @code{Util_IO}. The original body of @code{Util_IO} will not be considered in program builds. -However, the package specification will still be found in the project +However, the package spec will still be found in the project @code{Utilities}. A child project can have only one parent but it may import any number of other @@ -13525,7 +13659,7 @@ The following switches are used by GNAT tools that support project files: @table @option @item ^-P^/PROJECT_FILE=^@var{project} -@cindex @option{^-P^/PROJECT_FILE^} (any tool supporting project files) +@cindex @option{^-P^/PROJECT_FILE^} (any project-aware tool) Indicates the name of a project file. This project file will be parsed with the verbosity indicated by @option{^-vP^MESSAGE_PROJECT_FILES=^@emph{x}}, if any, and using the external references indicated @@ -13545,7 +13679,7 @@ on the command line are checked, the order of the switches or @option{^-X^/EXTERNAL_REFERENCE^} is not significant. @item ^-X^/EXTERNAL_REFERENCE=^@var{name=value} -@cindex @option{^-X^/EXTERNAL_REFERENCE^} (any tool supporting project files) +@cindex @option{^-X^/EXTERNAL_REFERENCE^} (any project-aware tool) Indicates that external variable @var{name} has the value @var{value}. The Project Manager will use this value for occurrences of @code{external(name)} when parsing the project file. @@ -13570,8 +13704,7 @@ An external variable specified with a @option{^-X^/EXTERNAL_REFERENCE^} switch takes precedence over the value of the same name in the environment. @item ^-vP^/MESSAGES_PROJECT_FILE=^@emph{x} -@cindex @code{^-vP^/MESSAGES_PROJECT_FILE^} (any tool supporting project files) -@c Previous line uses code vs option command, to stay less than 80 chars +@cindex @option{^-vP^/MESSAGES_PROJECT_FILE^} (any project-aware tool) Indicates the verbosity of the parsing of GNAT project files. @ifclear vms @@ -13592,6 +13725,25 @@ project files. If several @option{^-vP^/MESSAGES_PROJECT_FILE=^@emph{x}} switches are present, only the last one is used. +@item ^-aP^/ADD_PROJECT_SEARCH_DIR=^<dir> +@cindex @option{^-aP^/ADD_PROJECT_SEARCH_DIR=^} (any project-aware tool) +Add directory <dir> at the beginning of the project search path, in order, +after the current working directory. + +@ifclear vms +@item -eL +@cindex @option{-eL} (any project-aware tool) +Follow all symbolic links when processing project files. +@end ifclear + +@item ^--subdirs^/SUBDIRS^=<subdir> +@cindex @option{^--subdirs^/SUBDIRS^=} (gnatmake and gnatclean) +This switch is recognized by gnatmake and gnatclean. It indicate that the real +directories (except the source directories) are the subdirectories <subdir> +of the directories specified in the project files. This applies in particular +to object directories, library directories and exec directories. If the +subdirectories do not exist, they are created automatically. + @end table @c ********************************** @@ -14500,9 +14652,9 @@ declarative_item ::= other_declarative_item package_declaration ::= - package_specification | package_renaming + package_spec | package_renaming -package_specification ::= +package_spec ::= @b{package} package_identifier @b{is} @{simple_declarative_item@} @b{end} package_identifier ; @@ -15617,7 +15769,7 @@ stops. @cindex @option{^--no-separate-is^/NO_SEPARATE_IS^} (@command{gnatpp}) @item ^--no-separate-is^/NO_SEPARATE_IS^ Do not place the keyword @code{is} on a separate line in a subprogram body in -case if the specification occupies more then one line. +case if the spec occupies more then one line. @cindex @option{^--separate-loop-then^/SEPARATE_LOOP_THEN^} (@command{gnatpp}) @item ^--separate-loop-then^/SEPARATE_LOOP_THEN^ @@ -15792,8 +15944,8 @@ reading or processing the input file. Like @option{^-r^/REPLACE^} except that if the file with the specified name already exists, it is overwritten. -@item ^-rnb^/NO_BACKUP^ -@cindex @option{^-rnb^/NO_BACKUP^} (@code{gnatpp}) +@item ^-rnb^/REPLACE_NO_BACKUP^ +@cindex @option{^-rnb^/REPLACE_NO_BACKUP^} (@code{gnatpp}) Replace the input source file with the reformatted output without creating any backup copy of the input source. @@ -16579,7 +16731,7 @@ kinds of locally declared program units: subprogram (and generic subprogram) bodies; @item -package (and generic package) specifications and bodies; +package (and generic package) specs and bodies; @item task object and type specifications and bodies; @@ -16625,6 +16777,7 @@ explicitly specified metrics are reported. * Line Metrics Control:: * Syntax Metrics Control:: * Complexity Metrics Control:: +* Object-Oriented Metrics Control:: @end menu @node Line Metrics Control @@ -16766,7 +16919,7 @@ the following metrics: @table @emph @item Public subprograms -This metric is computed for package specifications. It is the +This metric is computed for package specs. It is the number of subprograms and generic subprograms declared in the visible part (including the visible part of nested packages, protected objects, and protected types). @@ -16781,7 +16934,7 @@ level and enclosing constructs. Generic bodies and bodies of protected subprograms are counted in the same way as ``usual'' subprogram bodies. @item Public types -This metric is computed for package specifications and +This metric is computed for package specs and generic package declarations. It is the total number of types that can be referenced from outside this compilation unit, plus the number of types from all the visible parts of all the visible generic @@ -16831,7 +16984,7 @@ following switches to select specific syntax metrics. @cindex @option{^--syntax@var{x}^/SYNTAX_METRICS^} (@command{gnatmetric}) @ifclear vms -@cindex @option{--no-syntax@var{x}} +@cindex @option{--no-syntax@var{x}} (@command{gnatmetric}) @end ifclear @item ^--syntax-all^/SYNTAX_METRICS=ALL_ON^ @@ -16989,6 +17142,107 @@ computing Essential Complexity @end table + +@node Object-Oriented Metrics Control +@subsubsection Object-Oriented Metrics Control +@cindex Object-Oriented metrics control in @command{gnatmetric} + +@noindent +@cindex Coupling metrics (in in @command{gnatmetric}) +Coupling metrics are object-oriented metrics that measure the +dependencies between a given class (or a group of classes) and the +``external world'' (that is, the other classes in the program). In this +subsection the term ``class'' is used in its +traditional object-oriented programming sense +(an instantiable module that contains data and/or method members). +A @emph{category} (of classes) +is a group of closely related classes that are reused and/or +modified together. + +A class @code{K}'s @emph{efferent coupling} is the number of classes +that @code{K} depends upon. +A category's efferent coupling is the number of classes outside the +category that the classes inside the category depend upon. + +A class @code{K}'s @emph{afferent coupling} is the number of classes +that depend upon @code{K}. +A category's afferent coupling is the number of classes outside the +category that depend on classes belonging to the category. + +Ada's implementation of the object-oriented paradigm does not use the +traditional class notion, so the definition of the coupling +metrics for Ada maps the class and class category notions +onto Ada constructs. + +For the coupling metrics, several kinds of modules -- a library package, +a library generic package, and a library generic package instantiation -- +that define a tagged type or an interface type are +considered to be a class. A category consists of a library package (or +a library generic package) that defines a tagged or an interface type, +together with all its descendant (generic) packages that define tagged +or interface types. For any package counted as a class, +its body (if any) is considered +together with its spec when counting the dependencies. For dependencies +between classes, the Ada semantic dependencies are considered. +For coupling metrics, only dependencies on units that are considered as +classes, are considered. + +When computing coupling metrics, @command{gnatmetric} counts only +dependencies between units that are arguments of the gnatmetric call. +Coupling metrics are program-wide (or project-wide) metrics, so to +get a valid result, you should call @command{gnatmetric} for +the whole set of sources that make up your program. It can be done +by calling @command{gnatmetric} from the GNAT driver with @option{-U} +option (see See @ref{The GNAT Driver and Project Files} for details. + +By default, all the coupling metrics are disabled. You can use the following +switches to specify the coupling metrics to be computed and reported: + +@table @option + +@ifclear vms +@cindex @option{--package@var{x}} (@command{gnatmetric}) +@cindex @option{--no-package@var{x}} (@command{gnatmetric}) +@cindex @option{--category@var{x}} (@command{gnatmetric}) +@cindex @option{--no-category@var{x}} (@command{gnatmetric}) +@end ifclear + +@ifset vms +@cindex @option{/COUPLING_METRICS} (@command{gnatmetric}) +@end ifset + +@item ^--coupling-all^/COUPLING_METRICS=ALL_ON^ +Report all the coupling metrics + +@item ^--no-coupling-all^/COUPLING_METRICS=ALL_OFF^ +Do not report any of metrics + +@item ^--package-efferent-coupling^/COUPLING_METRICS=PACKAGE_EFFERENT_ON^ +Report package efferent coupling + +@item ^--no-package-efferent-coupling^/COUPLING_METRICS=PACKAGE_EFFERENT_OFF^ +Do not report package efferent coupling + +@item ^--package-afferent-coupling^/COUPLING_METRICS=PACKAGE_AFFERENT_ON^ +Report package afferent coupling + +@item ^--no-package-afferent-coupling^/COUPLING_METRICS=PACKAGE_AFFERENT_OFF^ +Do not report package afferent coupling + +@item ^--category-efferent-coupling^/COUPLING_METRICS=CATEGORY_EFFERENT_ON^ +Report category efferent coupling + +@item ^--no-category-efferent-coupling^/COUPLING_METRICS=CATEGORY_EFFERENT_OFF^ +Do not report category efferent coupling + +@item ^--category-afferent-coupling^/COUPLING_METRICS=CATEGORY_AFFERENT_ON^ +Report category afferent coupling + +@item ^--no-category-afferent-coupling^/COUPLING_METRICS=CATEGORY_AFFERENT_OFF^ +Do not report category afferent coupling + +@end table + @node Other gnatmetric Switches @subsection Other @code{gnatmetric} Switches @@ -17160,7 +17414,7 @@ for all letters, except that a hyphen in the second character position is replaced by a ^tilde^dollar sign^ if the first character is ^@samp{a}, @samp{i}, @samp{g}, or @samp{s}^@samp{A}, @samp{I}, @samp{G}, or @samp{S}^. The extension is @code{.ads} for a -specification and @code{.adb} for a body. +spec and @code{.adb} for a body. Krunching does not affect the extension, but the file name is shortened to the specified length by following these rules: @@ -17275,12 +17529,21 @@ For further discussion of conditional compilation in general, see @ref{Conditional Compilation}. @menu +* Preprocessing Symbols:: * Using gnatprep:: * Switches for gnatprep:: * Form of Definitions File:: * Form of Input Text for gnatprep:: @end menu +@node Preprocessing Symbols +@section Preprocessing Symbols + +@noindent +Preprocessing symbols are defined in definition files and referred to in +sources to be preprocessed. A Preprocessing symbol is an identifier, following +normal Ada (case-insensitive) rules for its syntax, with the restriction that +all characters need to be in the ASCII set (no accented letters). @node Using gnatprep @section Using @code{gnatprep} @@ -17309,7 +17572,7 @@ normally have an ads or adb suffix. @item deffile is the full name of a text file containing definitions of -symbols to be referenced by the preprocessor. This argument is +preprocessing symbols to be referenced by the preprocessor. This argument is optional, and can be replaced by the use of the @option{-D} switch. @end table @@ -17345,8 +17608,8 @@ since comments are ignored by the compiler in any case). @item ^-Dsymbol=value^/ASSOCIATE="symbol=value"^ @cindex @option{^-D^/ASSOCIATE^} (@command{gnatprep}) -Defines a new symbol, associated with value. If no value is given on the -command line, then symbol is considered to be @code{True}. This switch +Defines a new preprocessing symbol, associated with value. If no value is given +on the command line, then symbol is considered to be @code{True}. This switch can be used in place of a definition file. @ifset vms @@ -17406,8 +17669,7 @@ symbol := value @end smallexample @noindent -where symbol is an identifier, following normal Ada (case-insensitive) -rules for its syntax, and value is one of the following: +where symbol is a preprocessing symbol, and value is one of the following: @itemize @bullet @item @@ -20110,6 +20372,7 @@ used as a parameter of the @option{+R} or @option{-R} options. @ignore * Improperly_Called_Protected_Entries:: @end ignore +* Metrics_Violation:: * Misnamed_Identifiers:: * Multiple_Entries_In_Protected_Definitions:: * Name_Clashes:: @@ -20550,7 +20813,7 @@ This rule has no parameters. @cindex @code{Improperly_Located_Instantiations} rule (for @command{gnatcheck}) @noindent -Flag all generic instantiations in library-level package specifications +Flag all generic instantiations in library-level package specs (including library generic packages) and in all subprogram bodies. Instantiations in task and entry bodies are not flagged. Instantiations in the @@ -20593,7 +20856,7 @@ This rule has no parameters. @noindent Flag all local packages declared in package and generic package -specifications. +specs. Local packages in bodies are not flagged. This rule has no parameters. @@ -20609,6 +20872,88 @@ Flag each protected entry that can be called from more than one task. This rule has no parameters. @end ignore +@node Metrics_Violation +@subsection @code{Metrics_Violation} +@cindex @code{Metrics} rule (for @command{gnatcheck}) + +@noindent +This is an umbrella rule for a set of metrics-based checks. The parameters of +the rule specify which metrics should be checked, and a bound (upper or lower, +depending on the metric) for each specified metric. A construct is +flagged if a specified metric can be computed for it, and the resulting value +is higher then the upper bound (or less than the lower bound) specified. + +This rule has the following parameters: + +@itemize @bullet +@item +For the @option{+R} option: +@table @code +@item @i{Metric_Check_Name} < @i{LowerBound} +Turns the check for the specified metric ON and specifies the lower bound +for a given metric check + +@item @i{Metric_Check_Name} > @i{UpperBound} + +Turns the check for the specified metric ON and specifies the upper bound +for a given metric check +@end table + +@item +For the @option{-R} option: +@table @code +@item @i{Metric_Check_Name} +Turns the check for the specified metric OFF +@end table +@end itemize + +@noindent +Parameters are not case-sensitive. @i{Metric_Check_Name} must be +the name of a metric supported by the @code{Metrics_Violation} rule +(see the table below), +otherwise the parameter is ignored. Whether the upper or lower bound +is specified for a given check, depends on the metric. If a +parameter for the @option{+R} option specifies an invalid limit, a +warning is issued and the parameter is ignored. + +The @option{-R} option without parameters turns OFF all the previously enabled +metric checks. the @option{+R} option without parameters turns ON all the +metric checks that have been defined by previous @option{+R} options with +valid parameters. @option{+R} option with a valid +parameter also turns ON all the other metric checks that have been defined +by previous @option{+R} options with valid parameters if they have been +disabled by @option{-R} option without parameters. + +By default no metrics checks are ON, so the @option{+R} option without +parameters actually does not specify any check. + +The following table shows the available metrics-based checks, +including the constraint that must be satisfied by the bound that +is specified for the check. + +@multitable {@code{Cyclomatic_Complexity}}{Cyclomatic complexity}{Positive integer} +@ifnothtml +@headitem Check Name @tab Description @tab Bounds Value +@end ifnothtml +@ifhtml +@item @b{Check Name} @tab @b{Description} @tab @b{Bounds Value} +@end ifhtml +@c Above conditional code is workaround to bug in texi2html (Feb 2008) +@item @code{Essential_Complexity} @tab Essential complexity @tab Positive integer +@item @code{Cyclomatic_Complexity} @tab Cyclomatic complexity @tab Positive integer +@item @code{LSLOC} @tab Logical Source Lines of Code @tab Positive integer +@end multitable + +@noindent +The meaning and the computed values for all these metrics are exactly +the same as for the corresponding metrics in @command{gnatmetric}. + +@emph{Example:} the rule +@smallexample ++RMetrics_Violation: Cyclomatic_Complexity > 7 +@end smallexample +@noindent +means that all bodies with cyclomatic complexity exceeding 7 will be flagged. @node Misnamed_Identifiers @subsection @code{Misnamed_Identifiers} @@ -22007,10 +22352,10 @@ same location as the @file{.gcno} files. The following executions will update those files, so that a cumulative result of the covered portions of the program is generated. -Finaly, you need to call the @code{gcov} tool. The different options of +Finally, you need to call the @code{gcov} tool. The different options of @code{gcov} are available in the GCC User's Guide, section 'Invoking gcov'. -This will create anotated source files with a @file{.gcov} extension: +This will create annotated source files with a @file{.gcov} extension: @file{my_main.adb} file will be analysed in @file{my_main.adb.gcov}. @node Gnat specifics @@ -22045,7 +22390,7 @@ most often, and are therefore the most time-consuming. @code{gprof} is the standard GNU profiling tool; it has been enhanced to better handle Ada programs and multitasking. -It is currently supported on the following platoforms +It is currently supported on the following platforms @itemize @bullet @item linux x86/x86_64 @@ -22841,7 +23186,7 @@ both language-defined children and GNAT run-time routines. @item @findex GNAT Files with prefix @file{^g-^G-^} are children of @code{GNAT}. These are useful -general-purpose packages, fully documented in their specifications. All +general-purpose packages, fully documented in their specs. All the other @file{.c} files are modifications of common @command{gcc} files. @end itemize @@ -23391,7 +23736,7 @@ package @code{System.Aux_DEC}. @cindex @code{Aux_DEC} package (child of @code{System}) These definitions are incorporated directly into package @code{System}, as though they had been declared there. For a -list of the declarations added, see the specification of this package, +list of the declarations added, see the spec of this package, which can be found in the file @file{s-auxdec.ads} in the GNAT library. @cindex @file{s-auxdec.ads} file The pragma @code{Extend_System} is a configuration pragma, which means that @@ -23707,7 +24052,7 @@ pragmas. See @ref{Floating-Point Types and Representations}, for details. @noindent HP Ada provides a specific version of the package @code{SYSTEM} for each platform on which the language is implemented. -For the complete specification of the package @code{SYSTEM}, see +For the complete spec of the package @code{SYSTEM}, see Appendix F of the @cite{HP Ada Language Reference Manual}. On HP Ada, the package @code{SYSTEM} includes the following conversion @@ -24252,7 +24597,7 @@ clauses to obey Ada 95 (and thus Ada 2005) rules @item Adding the proper notation to generic formal parameters that take unconstrained types in instantiation -@item Adding pragma @code{ELABORATE_BODY} to package specifications +@item Adding pragma @code{ELABORATE_BODY} to package specs that have package bodies not otherwise allowed @item Replacing occurrences of the identifier ``@code{PROTECTED}'' by @@ -24563,7 +24908,7 @@ program library. @item @command{ACS ENTER FOREIGN} @tab Copy (*)@* Allows the import of a foreign body as an Ada library -specification and enters a reference to a pointer. +spec and enters a reference to a pointer. @item @command{ACS ENTER UNIT} @tab Copy (*)@* @@ -29003,7 +29348,7 @@ end Increment_2; @end smallexample Compile the program with both optimization (@option{-O2}) and inlining -enabled (@option{-gnatpn} instead of @option{-gnatp}). +(@option{-gnatn}) enabled. The @code{Incr} function is still compiled as usual, but at the point in @code{Increment} where our function used to be called: @@ -29471,11 +29816,11 @@ code uses vendor-specific libraries then there are several ways to manage this in Ada 95 or Ada 2005: @enumerate @item -If the source code for the libraries (specifications and bodies) are +If the source code for the libraries (specs and bodies) are available, then the libraries can be migrated in the same way as the application. @item -If the source code for the specifications but not the bodies are +If the source code for the specs but not the bodies are available, then you can reimplement the bodies. @item Some features introduced by Ada 95 obviate the need for library support. For @@ -30111,7 +30456,7 @@ Using general access types ensures maximum compatibility with both All code that comes as part of GNAT is 64-bit clean, but the restrictions given in @ref{Restrictions on use of 64 bit objects}, still apply. Look at the package -specifications to see in which contexts objects allocated +specs to see in which contexts objects allocated in 64-bit address space are acceptable. @node Technical details diff --git a/gcc/ada/gnatbind.adb b/gcc/ada/gnatbind.adb index 6581c6fc62e..48eceb0ff77 100644 --- a/gcc/ada/gnatbind.adb +++ b/gcc/ada/gnatbind.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 1992-2007, Free Software Foundation, Inc. -- +-- Copyright (C) 1992-2008, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -164,48 +164,96 @@ procedure Gnatbind is Additional_Restrictions_Listed : Boolean := False; -- Set True if we have listed header for restrictions - begin - -- Loop through restrictions + function Restriction_Could_Be_Set (R : Restriction_Id) return Boolean; + -- Returns True if the given restriction can be listed as an additional + -- restriction that could be set. - for R in All_Restrictions loop - if not No_Restriction_List (R) then + ------------------------------ + -- Restriction_Could_Be_Set -- + ------------------------------ - -- We list a restriction if it is not violated, or if - -- it is violated but the violation count is exactly known. + function Restriction_Could_Be_Set (R : Restriction_Id) return Boolean is + CR : Restrictions_Info renames Cumulative_Restrictions; - if Cumulative_Restrictions.Violated (R) = False - or else (R in All_Parameter_Restrictions - and then - Cumulative_Restrictions.Unknown (R) = False) - then - if not Additional_Restrictions_Listed then - Write_Eol; - Write_Line - ("The following additional restrictions may be" & - " applied to this partition:"); - Additional_Restrictions_Listed := True; - end if; + begin + case R is + + -- Boolean restriction + + when All_Boolean_Restrictions => - Write_Str ("pragma Restrictions ("); + -- The condition for listing a boolean restriction as an + -- additional restriction that could be set is that it is + -- not violated by any unit, and not already set. - declare - S : constant String := Restriction_Id'Image (R); - begin - Name_Len := S'Length; - Name_Buffer (1 .. Name_Len) := S; - end; + return CR.Violated (R) = False and then CR.Set (R) = False; - Set_Casing (Mixed_Case); - Write_Str (Name_Buffer (1 .. Name_Len)); + -- Parameter restriction - if R in All_Parameter_Restrictions then - Write_Str (" => "); - Write_Int (Int (Cumulative_Restrictions.Count (R))); + when All_Parameter_Restrictions => + + -- If the restriction is violated and the level of violation is + -- unknown, the restriction can definitely not be listed. + + if CR.Violated (R) and then CR.Unknown (R) then + return False; + + -- We can list the restriction if it is not set + + elsif not CR.Set (R) then + return True; + + -- We can list the restriction if is set to a greater value + -- than the maximum value known for the violation. + + else + return CR.Value (R) > CR.Count (R); end if; - Write_Str (");"); + -- No other values for R possible + + when others => + raise Program_Error; + + end case; + end Restriction_Could_Be_Set; + + -- Start of processing for List_Applicable_Restrictions + + begin + -- Loop through restrictions + + for R in All_Restrictions loop + if not No_Restriction_List (R) + and then Restriction_Could_Be_Set (R) + then + if not Additional_Restrictions_Listed then Write_Eol; + Write_Line + ("The following additional restrictions may be" & + " applied to this partition:"); + Additional_Restrictions_Listed := True; + end if; + + Write_Str ("pragma Restrictions ("); + + declare + S : constant String := Restriction_Id'Image (R); + begin + Name_Len := S'Length; + Name_Buffer (1 .. Name_Len) := S; + end; + + Set_Casing (Mixed_Case); + Write_Str (Name_Buffer (1 .. Name_Len)); + + if R in All_Parameter_Restrictions then + Write_Str (" => "); + Write_Int (Int (Cumulative_Restrictions.Count (R))); end if; + + Write_Str (");"); + Write_Eol; end if; end loop; end List_Applicable_Restrictions; diff --git a/gcc/ada/gnatbl.c b/gcc/ada/gnatbl.c deleted file mode 100644 index 7dde58ea0db..00000000000 --- a/gcc/ada/gnatbl.c +++ /dev/null @@ -1,387 +0,0 @@ -/**************************************************************************** - * * - * GNAT COMPILER TOOLS * - * * - * G N A T B L * - * * - * C Implementation File * - * * - * Copyright (C) 1992-2007, Free Software Foundation, Inc. * - * * - * GNAT is free software; you can redistribute it and/or modify it under * - * terms of the GNU General Public License as published by the Free Soft- * - * ware Foundation; either version 3, or (at your option) any later ver- * - * sion. GNAT is distributed in the hope that it will be useful, but WITH- * - * OUT 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 distributed with GNAT; see file COPYING3. If not, go to * - * http://www.gnu.org/licenses for a complete copy of the license. * - * * - * * - * GNAT was originally developed by the GNAT team at New York University. * - * Extensive contributions were provided by Ada Core Technologies Inc. * - * * - ****************************************************************************/ - -#ifdef VMS -#define _POSIX_EXIT 1 -#endif - -#include "config.h" -#include "system.h" - -#if defined (__EMX__) || defined (MSDOS) -#include <process.h> -#endif -#include "adaint.h" - -/* These can be set by command line arguments */ -char *binder_path = 0; -char *linker_path = 0; -char *exec_file_name = 0; -char *ali_file_name = 0; -#define BIND_ARG_MAX 512 -char *bind_args[BIND_ARG_MAX]; -int bind_arg_index = -1; -#ifdef MSDOS -char *coff2exe_path = 0; -char *coff2exe_args[] = {(char *) 0, (char *) 0}; -char *del_command = 0; -#endif -int verbose = 0; -int o_present = 0; -int g_present = 0; - -int link_arg_max = -1; -char **link_args = (char **) 0; -int link_arg_index = -1; - -char *gcc_B_arg = 0; - -#ifndef DIR_SEPARATOR -#if defined (__EMX__) -#define DIR_SEPARATOR '\\' -#else -#define DIR_SEPARATOR '/' -#endif -#endif - -static int linkonly = 0; - -static void addarg (char *); -static void process_args (int *, char *[]); - -static void -addarg (char *str) -{ - int i; - - if (++link_arg_index >= link_arg_max) - { - char **new_link_args - = (char **) xcalloc (link_arg_max + 1000, sizeof (char *)); - - for (i = 0; i <= link_arg_max; i++) - new_link_args[i] = link_args[i]; - - if (link_args) - free (link_args); - - link_arg_max += 1000; - link_args = new_link_args; - } - - link_args[link_arg_index] = str; -} - -static void -process_args (int *p_argc, char *argv[]) -{ - int i, j; - - for (i = 1; i < *p_argc; i++) - { - /* -I is passed on to gnatbind */ - if (! strncmp( argv[i], "-I", 2)) - { - bind_arg_index += 1; - if (bind_arg_index >= BIND_ARG_MAX) - { - fprintf (stderr, "Too many arguments to gnatbind\n"); - exit (-1); - } - - bind_args[bind_arg_index] = argv[i]; - } - - /* -B is passed on to gcc */ - if (! strncmp (argv[i], "-B", 2)) - gcc_B_arg = argv[i]; - - /* -v turns on verbose option here and is passed on to gcc */ - - if (! strcmp (argv[i], "-v")) - verbose = 1; - - if (! strcmp (argv[i], "-o")) - { - o_present = 1; - exec_file_name = argv[i + 1]; - } - - if (! strcmp (argv[i], "-g")) - g_present = 1; - - if (! strcmp (argv[i], "-gnatbind")) - { - /* Explicit naming of binder. Grab the value then remove the - two arguments from the argument list. */ - if ( i + 1 >= *p_argc ) - { - fprintf (stderr, "Missing argument for -gnatbind\n"); - exit (1); - } - - binder_path = __gnat_locate_exec (argv[i + 1], (char *) "."); - if (!binder_path) - { - fprintf (stderr, "Could not locate binder: %s\n", argv[i + 1]); - exit (1); - } - - for (j = i + 2; j < *p_argc; j++) - argv[j - 2] = argv[j]; - - (*p_argc) -= 2; - i--; - } - - else if (! strcmp (argv[i], "-linkonly")) - { - /* Don't call the binder. Set the flag and then remove the - argument from the argument list. */ - linkonly = 1; - for (j = i + 1; j < *p_argc; j++) - argv[j - 1] = argv[j]; - - *p_argc -= 1; - i--; - } - - else if (! strcmp (argv[i], "-gnatlink")) - { - /* Explicit naming of binder. Grab the value then remove the - two arguments from the argument list. */ - if (i + 1 >= *p_argc) - { - fprintf (stderr, "Missing argument for -gnatlink\n"); - exit (1); - } - - linker_path = __gnat_locate_exec (argv[i + 1], (char *) "."); - if (!linker_path) - { - fprintf (stderr, "Could not locate linker: %s\n", argv[i + 1]); - exit (1); - } - - for (j = i + 2; j < *p_argc; j++) - argv[j - 2] = argv[j]; - *p_argc -= 2; - i--; - } - } -} -extern int main (int, char **); - -int -main (int argc, char **argv) -{ - int i, j; - int done_an_ali = 0; - int retcode; -#ifdef VMS - /* Warning: getenv only retrieves the first directory in VAXC$PATH */ - char *pathval = - xstrdup (__gnat_to_canonical_dir_spec (getenv ("VAXC$PATH"), 0)); -#else - char *pathval = getenv ("PATH"); -#endif - char *spawn_args[5]; - int spawn_index = 0; - -#if defined (__EMX__) || defined(MSDOS) - char *tmppathval = malloc (strlen (pathval) + 3); - strcpy (tmppathval, ".;"); - pathval = strcat (tmppathval, pathval); -#endif - - process_args (&argc , argv); - - if (argc == 1) - { - fprintf - (stdout, - "Usage: %s 'name'.ali\n", argv[0]); - fprintf - (stdout, - " [-o exec_name] -- by default it is 'name'\n"); - fprintf - (stdout, - " [-v] -- verbose mode\n"); - fprintf - (stdout, - " [-linkonly] -- doesn't call binder\n"); - fprintf - (stdout, - " [-gnatbind name] -- full name for gnatbind\n"); - fprintf - (stdout, - " [-gnatlink name] -- full name for linker (gcc)\n"); - fprintf - (stdout, - " [list of objects] -- non Ada binaries\n"); - fprintf - (stdout, - " [linker options] -- other options for linker\n"); - exit (1); - } - - if (!binder_path && !linkonly) - binder_path = __gnat_locate_exec ((char *) "gnatbind", pathval); - - if (!binder_path && !linkonly) - { - fprintf (stderr, "Couldn't locate gnatbind\n"); - exit (1); - } - - if (!linker_path) - linker_path = __gnat_locate_exec ((char *) "gnatlink", pathval); - if (!linker_path) - { - fprintf (stderr, "Couldn't locate gnatlink\n"); - exit (1); - } - -#ifdef MSDOS - coff2exe_path = __gnat_locate_regular_file ("coff2exe.bat", pathval); - if (!coff2exe_path) - { - fprintf (stderr, "Couldn't locate %s\n", "coff2exe.bat"); - exit (1); - } - else - coff2exe_args[0] = coff2exe_path; -#endif - - addarg (linker_path); - - for (i = 1; i < argc; i++) - { - int arg_len = strlen (argv[i]); - - if (arg_len > 4 && ! strcmp (&argv[i][arg_len - 4], ".ali")) - { - if (done_an_ali) - { - fprintf (stderr, - "Sorry - cannot handle more than one ALI file\n"); - exit (1); - } - - done_an_ali = 1; - - if (__gnat_is_regular_file (argv[i])) - { - ali_file_name = argv[i]; - if (!linkonly) - { - /* Run gnatbind */ - spawn_index = 0; - spawn_args[spawn_index++] = binder_path; - spawn_args[spawn_index++] = ali_file_name; - for (j = 0 ; j <= bind_arg_index ; j++ ) - spawn_args[spawn_index++] = bind_args[j]; - spawn_args[spawn_index] = 0; - - if (verbose) - { - int i; - for (i = 0; i < 2; i++) - printf ("%s ", spawn_args[i]); - - putchar ('\n'); - } - - retcode = __gnat_portable_spawn (spawn_args); - if (retcode != 0) - exit (retcode); - } - } - else - addarg (argv[i]); - } -#ifdef MSDOS - else if (!strcmp (argv[i], "-o")) - { - addarg (argv[i]); - if (i < argc) - i++; - - { - char *ptr = strstr (argv[i], ".exe"); - - arg_len = strlen (argv[i]); - coff2exe_args[1] = malloc (arg_len + 1); - strcpy (coff2exe_args[1], argv[i]); - if (ptr != NULL && strlen (ptr) == 4) - coff2exe_args[1][arg_len-4] = 0; - - addarg (coff2exe_args[1]); - } - } -#endif - else - addarg (argv[i]); - } - - if (! done_an_ali) - { - fprintf (stderr, "No \".ali\" file specified\n"); - exit (1); - } - - addarg (ali_file_name); - addarg (NULL); - - if (verbose) - { - int i; - - for (i = 0; i < link_arg_index; i++) - printf ("%s ", link_args[i]); - - putchar ('\n'); - } - - retcode = __gnat_portable_spawn (link_args); - if (retcode != 0) - exit (retcode); - -#ifdef MSDOS - retcode = __gnat_portable_spawn (coff2exe_args); - if (retcode != 0) - exit (retcode); - - if (!g_present) - { - del_command = malloc (strlen (coff2exe_args[1]) + 5); - sprintf (del_command, "del %s", coff2exe_args[1]); - retcode = system (del_command); - } -#endif - - exit(0); -} diff --git a/gcc/ada/gnatchop.adb b/gcc/ada/gnatchop.adb index e38d51bcf53..e7cacadcdd4 100644 --- a/gcc/ada/gnatchop.adb +++ b/gcc/ada/gnatchop.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 1998-2007, Free Software Foundation, Inc. -- +-- Copyright (C) 1998-2008, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -425,7 +425,7 @@ procedure Gnatchop is Info : Unit_Info renames Unit.Table (U); FD : File_Descriptor; Name : aliased constant String := - File.Table (Input).Name.all & ASCII.Nul; + File.Table (Input).Name.all & ASCII.NUL; Length : File_Offset; Buffer : String_Access; Result : String_Access; @@ -1413,7 +1413,7 @@ procedure Gnatchop is function Write_Chopped_Files (Input : File_Num) return Boolean is Name : aliased constant String := - File.Table (Input).Name.all & ASCII.Nul; + File.Table (Input).Name.all & ASCII.NUL; FD : File_Descriptor; Buffer : String_Access; Success : Boolean; @@ -1660,7 +1660,7 @@ procedure Gnatchop is declare E_Name : constant String := OS_Name (1 .. O_Length); - C_Name : aliased constant String := E_Name & ASCII.Nul; + C_Name : aliased constant String := E_Name & ASCII.NUL; OS_Encoding : constant String := Encoding (1 .. E_Length); File : Stream_IO.File_Type; begin diff --git a/gcc/ada/gnatcmd.adb b/gcc/ada/gnatcmd.adb index 13ddf63f8d4..8135bfc8a4d 100644 --- a/gcc/ada/gnatcmd.adb +++ b/gcc/ada/gnatcmd.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 1996-2007, Free Software Foundation, Inc. -- +-- Copyright (C) 1996-2008, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -41,6 +41,7 @@ with Prj.Util; use Prj.Util; with Sinput.P; with Snames; use Snames; with Table; +with Targparm; with Tempdir; with Types; use Types; with Hostparm; use Hostparm; @@ -233,7 +234,8 @@ procedure GNATCmd is -- METRIC). procedure Delete_Temp_Config_Files; - -- Delete all temporary config files + -- Delete all temporary config files. The caller is responsible for + -- ensuring that Keep_Temporary_Files is False. procedure Get_Closure; -- Get the sources in the closure of the ASIS_Main and add them to the @@ -721,38 +723,40 @@ procedure GNATCmd is pragma Warnings (Off, Success); begin - if not Keep_Temporary_Files then - if Project /= No_Project then - for Prj in Project_Table.First .. - Project_Table.Last (Project_Tree.Projects) - loop - if - Project_Tree.Projects.Table (Prj).Config_File_Temp - then - if Verbose_Mode then - Output.Write_Str ("Deleting temp configuration file """); - Output.Write_Str - (Get_Name_String - (Project_Tree.Projects.Table - (Prj).Config_File_Name)); - Output.Write_Line (""""); - end if; + -- This should only be called if Keep_Temporary_Files is False - Delete_File - (Name => Get_Name_String + pragma Assert (not Keep_Temporary_Files); + + if Project /= No_Project then + for Prj in Project_Table.First .. + Project_Table.Last (Project_Tree.Projects) + loop + if + Project_Tree.Projects.Table (Prj).Config_File_Temp + then + if Verbose_Mode then + Output.Write_Str ("Deleting temp configuration file """); + Output.Write_Str + (Get_Name_String (Project_Tree.Projects.Table - (Prj).Config_File_Name), - Success => Success); + (Prj).Config_File_Name)); + Output.Write_Line (""""); end if; - end loop; - end if; - -- If a temporary text file that contains a list of files for a tool - -- has been created, delete this temporary file. + Delete_File + (Name => + Get_Name_String + (Project_Tree.Projects.Table (Prj).Config_File_Name), + Success => Success); + end if; + end loop; + end if; - if Temp_File_Name /= null then - Delete_File (Temp_File_Name.all, Success); - end if; + -- If a temporary text file that contains a list of files for a tool + -- has been created, delete this temporary file. + + if Temp_File_Name /= null then + Delete_File (Temp_File_Name.all, Success); end if; end Delete_Temp_Config_Files; @@ -770,7 +774,8 @@ procedure GNATCmd is 6 => new String'("-bargs"), 7 => new String'("-R"), 8 => new String'("-Z")); - -- Arguments of the invocation of gnatmake to get the list of + -- Arguments for the invocation of gnatmake which are added to the + -- Last_Arguments list by this procedure. FD : File_Descriptor; -- File descriptor for the temp file that will get the output of the @@ -793,6 +798,8 @@ procedure GNATCmd is File : Ada.Text_IO.File_Type; Line : String (1 .. 250); Last : Natural; + -- Used to read file if there is an error, it is good enough to display + -- just 250 characters if the first line of the file is very long. Udata : Unit_Data; Path : Path_Name_Type; @@ -890,7 +897,6 @@ procedure GNATCmd is if not Keep_Temporary_Files then Delete (File); - else Close (File); end if; @@ -1322,9 +1328,15 @@ procedure GNATCmd is for C in Command_List'Range loop if not Command_List (C).VMS_Only then - Put ("gnat " & To_Lower (Command_List (C).Cname.all)); + if Targparm.AAMP_On_Target then + Put ("gnaampcmd "); + else + Put ("gnat "); + end if; + + Put (To_Lower (Command_List (C).Cname.all)); Set_Col (25); - Put (Command_List (C).Unixcmd.all); + Put (Program_Name (Command_List (C).Unixcmd.all).all); declare Sws : Argument_List_Access renames Command_List (C).Unixsws; @@ -1375,6 +1387,16 @@ begin Set_Mode (Ada_Only); + -- Add the default search directories, to be able to find system.ads in the + -- subsequent call to Targparm.Get_Target_Parameters. + + Add_Default_Search_Dirs; + + -- Get target parameters so that AAMP_On_Target will be set, for testing in + -- Osint.Program_Name to handle the mapping of GNAAMP tool names. + + Targparm.Get_Target_Parameters; + -- Add the directory where the GNAT driver is invoked in front of the path, -- if the GNAT driver is invoked with directory information. Do not do this -- for VMS, where the notion of path does not really exist. @@ -1666,9 +1688,23 @@ begin end if; end if; + -- --subdirs=... Specify Subdirs + + if Argv'Length > Subdirs_Option'Length and then + Argv + (Argv'First .. Argv'First + Subdirs_Option'Length - 1) = + Subdirs_Option + then + Subdirs := + new String' + (Argv + (Argv'First + Subdirs_Option'Length .. Argv'Last)); + + Remove_Switch (Arg_Num); + -- -aPdir Add dir to the project search path - if Argv'Length > 3 + elsif Argv'Length > 3 and then Argv (Argv'First + 1 .. Argv'First + 2) = "aP" then Add_Search_Project_Directory @@ -1676,6 +1712,13 @@ begin Remove_Switch (Arg_Num); + -- -eL Follow links for files + + elsif Argv.all = "-eL" then + Follow_Links_For_Files := True; + + Remove_Switch (Arg_Num); + -- -vPx Specify verbosity while parsing project files elsif Argv'Length = 4 diff --git a/gcc/ada/gnatdll.adb b/gcc/ada/gnatdll.adb index 7ac560475b7..6917e631d08 100644 --- a/gcc/ada/gnatdll.adb +++ b/gcc/ada/gnatdll.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 1997-2007, Free Software Foundation, Inc. -- +-- Copyright (C) 1997-2008, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -270,7 +270,7 @@ procedure Gnatdll is loop case Getopt ("g h v q k a? b: d: e: l: n m I:") is - when ASCII.Nul => + when ASCII.NUL => exit; when 'h' => @@ -381,7 +381,7 @@ procedure Gnatdll is loop case Getopt ("*") is - when ASCII.Nul => + when ASCII.NUL => exit; when others => @@ -397,7 +397,7 @@ procedure Gnatdll is loop case Getopt ("*") is - when ASCII.Nul => + when ASCII.NUL => exit; when others => diff --git a/gcc/ada/gnatlbr.adb b/gcc/ada/gnatlbr.adb index cbf284547a6..7be1d494baf 100644 --- a/gcc/ada/gnatlbr.adb +++ b/gcc/ada/gnatlbr.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 1997-2007, Free Software Foundation, Inc. -- +-- Copyright (C) 1997-2008, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -156,8 +156,8 @@ begin Create_Block : declare Success : Boolean; Make_Args : Argument_List (1 .. 9); - C_Lib_Dir : String := Lib_Dir.all & ASCII.Nul; - C_ADC_File : String := ADC_File.all & ASCII.Nul; + C_Lib_Dir : String := Lib_Dir.all & ASCII.NUL; + C_ADC_File : String := ADC_File.all & ASCII.NUL; F_ADC_File : String (1 .. max_path_len); F_ADC_File_Len : Integer := max_path_len; Include_Dirs : Integer; @@ -177,7 +177,7 @@ begin full_name (C_ADC_File'Address, F_ADC_File'Address); for I in 1 .. max_path_len loop - if F_ADC_File (I) = ASCII.Nul then + if F_ADC_File (I) = ASCII.NUL then F_ADC_File_Len := I - 1; exit; end if; diff --git a/gcc/ada/gnatlink.adb b/gcc/ada/gnatlink.adb index d3d10edcf52..906a61abd91 100644 --- a/gcc/ada/gnatlink.adb +++ b/gcc/ada/gnatlink.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 1996-2007, Free Software Foundation, Inc. -- +-- Copyright (C) 1996-2008, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -139,7 +139,7 @@ procedure Gnatlink is Gcc : String_Access := Program_Name ("gcc"); - Read_Mode : constant String := "r" & ASCII.Nul; + Read_Mode : constant String := "r" & ASCII.NUL; Begin_Info : String := "-- BEGIN Object file/option list"; End_Info : String := "-- END Object file/option list "; @@ -147,7 +147,6 @@ procedure Gnatlink is Gcc_Path : String_Access; Linker_Path : String_Access; - Output_File_Name : String_Access; Ali_File_Name : String_Access; Binder_Spec_Src_File : String_Access; @@ -160,6 +159,10 @@ procedure Gnatlink is -- Temporary file used by linker to pass list of object files on -- certain systems with limitations on size of arguments. + Lname : String_Access := null; + -- File used by linker for CLI target, used to concatenate all .il files + -- when the command line passed to ilasm is too long + Debug_Flag_Present : Boolean := False; Verbose_Mode : Boolean := False; Very_Verbose_Mode : Boolean := False; @@ -167,7 +170,7 @@ procedure Gnatlink is Ada_Bind_File : Boolean := True; -- Set to True if bind file is generated in Ada - Standard_Gcc : Boolean := True; + Standard_Gcc : Boolean := True; Compile_Bind_File : Boolean := True; -- Set to False if bind file is not to be compiled @@ -953,7 +956,42 @@ procedure Gnatlink is -- to read from a file instead of the command line is only triggered if -- a conservative threshold is passed. - if Object_List_File_Required + if VM_Target = CLI_Target + and then Link_Bytes > Link_Max + then + Lname := new String'("l~" & Base_Name (Ali_File_Name.all) & ".il"); + + for J in Objs_Begin .. Objs_End loop + Copy_File (Linker_Objects.Table (J).all, Lname.all, + Success => Closing_Status, + Mode => Append); + end loop; + + -- Add the special objects list file option together with the name + -- of the temporary file to the objects file table. + + Linker_Objects.Table (Objs_Begin) := + new String'(Value (Object_File_Option_Ptr) & Lname.all); + + -- The slots containing these object file names are then removed + -- from the objects table so they do not appear in the link. They + -- are removed by moving up the linker options and non-Ada object + -- files appearing after the Ada object list in the table. + + declare + N : Integer; + + begin + N := Objs_End - Objs_Begin + 1; + + for J in Objs_End + 1 .. Linker_Objects.Last loop + Linker_Objects.Table (J - N + 1) := Linker_Objects.Table (J); + end loop; + + Linker_Objects.Set_Last (Linker_Objects.Last - N + 1); + end; + + elsif Object_List_File_Required or else (Object_List_File_Supported and then Link_Bytes > Link_Max) then @@ -2015,6 +2053,10 @@ begin Delete (Tname); end if; + if Lname /= null then + Delete (Lname.all & ASCII.NUL); + end if; + if not Success then Error_Msg ("error when calling " & Linker_Path.all); Exit_Program (E_Fatal); diff --git a/gcc/ada/gnatmem.adb b/gcc/ada/gnatmem.adb index a279ca3c8d3..d6ac07834a9 100644 --- a/gcc/ada/gnatmem.adb +++ b/gcc/ada/gnatmem.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 1997-2007, AdaCore -- +-- Copyright (C) 1997-2008, AdaCore -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -307,7 +307,7 @@ procedure Gnatmem is loop case Getopt ("b: dd m: i: q s:") is - when ASCII.Nul => exit; + when ASCII.NUL => exit; when 'b' => begin diff --git a/gcc/ada/gnatname.adb b/gcc/ada/gnatname.adb index 06ef1f27e98..299e682bdc5 100644 --- a/gcc/ada/gnatname.adb +++ b/gcc/ada/gnatname.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 2001-2007, Free Software Foundation, Inc. -- +-- Copyright (C) 2001-2008, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -27,6 +27,7 @@ with Hostparm; with Opt; with Osint; use Osint; with Output; use Output; +with Prj; use Prj; with Prj.Makr; with Switch; use Switch; with Table; @@ -194,10 +195,15 @@ procedure Gnatname is -- Scan options first loop - case Getopt ("c: d: gnatep=! gnatep! gnateD! D: h P: v x: f:") is + case Getopt + ("-subdirs=! c: d: gnatep=! gnatep! gnateD! eL D: h P: v x: f:") + is when ASCII.NUL => exit; + when '-' => + Subdirs := new String'(Parameter); + when 'c' => if File_Set then Fail ("only one -P or -c switch may be specified"); @@ -213,6 +219,9 @@ procedure Gnatname is when 'D' => Get_Directories (Parameter); + when 'e' => + Opt.Follow_Links_For_Files := True; + when 'f' => Foreign_Patterns.Increment_Last; Foreign_Patterns.Table (Foreign_Patterns.Last) := @@ -286,10 +295,15 @@ procedure Gnatname is Write_Eol; Write_Line ("switches:"); + Write_Line (" --subdirs=dir real obj/lib/exec dirs are subdirs"); + Write_Eol; + Write_Line (" -cfile create configuration pragmas file"); Write_Line (" -ddir use dir as one of the source " & "directories"); Write_Line (" -Dfile get source directories from file"); + Write_Line (" -eL follow symbolic links when processing " & + "project files"); Write_Line (" -fpat foreign pattern"); Write_Line (" -gnateDsym=v preprocess with symbol definition"); Write_Line (" -gnatep=data preprocess files with data file"); diff --git a/gcc/ada/gsocket.h b/gcc/ada/gsocket.h index bfdf1233cee..ce4d47801d6 100644 --- a/gcc/ada/gsocket.h +++ b/gcc/ada/gsocket.h @@ -175,7 +175,7 @@ #if defined (_AIX) || defined (__FreeBSD__) || defined (__hpux__) || defined (__osf__) || defined (_WIN32) || defined (__APPLE__) # define HAVE_THREAD_SAFE_GETxxxBYyyy 1 -#elif defined (sgi) || defined (linux) || (defined (sun) && defined (__SVR4) && !defined (__vxworks)) +#elif defined (sgi) || defined (linux) || defined (__GLIBC__) || (defined (sun) && defined (__SVR4) && !defined (__vxworks)) # define HAVE_GETxxxBYyyy_R 1 #endif diff --git a/gcc/ada/i-cstrin.adb b/gcc/ada/i-cstrin.adb index c7ec0ceb62f..dbd4cb4c207 100644 --- a/gcc/ada/i-cstrin.adb +++ b/gcc/ada/i-cstrin.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 1992-2007, Free Software Foundation, Inc. -- +-- Copyright (C) 1992-2008, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -130,7 +130,7 @@ package body Interfaces.C.Strings is Offset => 0, Chars => Chars, Check => False); - Poke (nul, into => Pointer + size_t'(Chars'Length)); + Poke (nul, Into => Pointer + size_t'(Chars'Length)); end if; return Pointer; diff --git a/gcc/ada/i-vxwork-x86.ads b/gcc/ada/i-vxwork-x86.ads index 25d12a52199..506966e13e7 100644 --- a/gcc/ada/i-vxwork-x86.ads +++ b/gcc/ada/i-vxwork-x86.ads @@ -6,7 +6,7 @@ -- -- -- S p e c -- -- -- --- Copyright (C) 1999-2007, AdaCore -- +-- Copyright (C) 1999-2008, AdaCore -- -- -- -- GNARL is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -76,7 +76,7 @@ package Interfaces.VxWorks is -- procedure Handler (Parameter : System.Address) is -- begin -- Count := Count + 1; - -- logMsg ("received an interrupt" & ASCII.LF & ASCII.Nul); + -- logMsg ("received an interrupt" & ASCII.LF & ASCII.NUL); -- end Handler; -- end P; -- diff --git a/gcc/ada/i-vxwork.ads b/gcc/ada/i-vxwork.ads index ffb28ae8211..902f9e7ea35 100644 --- a/gcc/ada/i-vxwork.ads +++ b/gcc/ada/i-vxwork.ads @@ -6,7 +6,7 @@ -- -- -- S p e c -- -- -- --- Copyright (C) 1999-2007, AdaCore -- +-- Copyright (C) 1999-2008, AdaCore -- -- -- -- GNARL is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -80,7 +80,7 @@ package Interfaces.VxWorks is -- S : STATUS; -- begin -- Count := Count + 1; - -- logMsg ("received an interrupt" & ASCII.LF & ASCII.Nul); + -- logMsg ("received an interrupt" & ASCII.LF & ASCII.NUL); -- -- -- Acknowledge VME interrupt -- S := sysBusIntAck (intLevel => Level); diff --git a/gcc/ada/impunit.adb b/gcc/ada/impunit.adb index 0b17ec2a8b5..0b8cdd5b9c0 100644 --- a/gcc/ada/impunit.adb +++ b/gcc/ada/impunit.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 2000-2007, Free Software Foundation, Inc. -- +-- Copyright (C) 2000-2008, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -147,6 +147,7 @@ package body Impunit is -- GNAT Defined Additions to Ada -- ----------------------------------- + "a-calcon", -- Ada.Calendar.Conversions "a-chlat9", -- Ada.Characters.Latin_9 "a-clrefi", -- Ada.Command_Line.Response_File "a-colien", -- Ada.Command_Line.Environment @@ -276,6 +277,7 @@ package body Impunit is "g-table ", -- GNAT.Table "g-tasloc", -- GNAT.Task_Lock "g-thread", -- GNAT.Threads + "g-timsta", -- GNAT.Time_Stamp "g-traceb", -- GNAT.Traceback "g-trasym", -- GNAT.Traceback.Symbolic "g-utf_32", -- GNAT.UTF_32 @@ -301,6 +303,7 @@ package body Impunit is "i-cpp ", -- Interfaces.CPP "i-cstrea", -- Interfaces.C.Streams "i-java ", -- Interfaces.Java + "i-javjni", -- Interfaces.Java.JNI "i-pacdec", -- Interfaces.Packed_Decimal "i-vxwoio", -- Interfaces.VxWorks.IO "i-vxwork", -- Interfaces.VxWorks @@ -328,6 +331,7 @@ package body Impunit is "s-pooloc", -- System.Pool_Local "s-restri", -- System.Restrictions "s-rident", -- System.Rident + "s-ststop", -- System.Strings.Stream_Ops "s-tasinf", -- System.Task_Info "s-wchcnv", -- System.Wch_Cnv "s-wchcon"); -- System.Wch_Con @@ -367,6 +371,7 @@ package body Impunit is "a-coteio", -- Ada.Complex_Text_IO "a-direct", -- Ada.Directories "a-diroro", -- Ada.Dispatching.Round_Robin + "a-disedf", -- Ada.Dispatching.EDF "a-dispat", -- Ada.Dispatching "a-envvar", -- Ada.Environment_Variables "a-exetim", -- Ada.Execution_Time diff --git a/gcc/ada/init.c b/gcc/ada/init.c index 2210ec89559..5dd78155688 100644 --- a/gcc/ada/init.c +++ b/gcc/ada/init.c @@ -6,7 +6,7 @@ * * * C Implementation File * * * - * Copyright (C) 1992-2007, Free Software Foundation, Inc. * + * Copyright (C) 1992-2008, Free Software Foundation, Inc. * * * * GNAT is free software; you can redistribute it and/or modify it under * * terms of the GNU General Public License as published by the Free Soft- * @@ -30,21 +30,21 @@ * * ****************************************************************************/ -/* This unit contains initialization circuits that are system dependent. A - major part of the functionality involved involves stack overflow checking. +/* This unit contains initialization circuits that are system dependent. + A major part of the functionality involves stack overflow checking. The GCC backend generates probe instructions to test for stack overflow. For details on the exact approach used to generate these probes, see the "Using and Porting GCC" manual, in particular the "Stack Checking" section - and the subsection "Specifying How Stack Checking is Done". The handlers - installed by this file are used to handle resulting signals that come - from these probes failing (i.e. touching protected pages) */ + and the subsection "Specifying How Stack Checking is Done". The handlers + installed by this file are used to catch the resulting signals that come + from these probes failing (i.e. touching protected pages). */ /* This file should be kept synchronized with 2sinit.ads, 2sinit.adb, - s-init-ae653-cert.adb and s-init-xi-sparc.adb. All these files implement - the required functionality for different targets. */ + s-init-ae653-cert.adb and s-init-xi-sparc.adb. All these files implement + the required functionality for different targets. */ /* The following include is here to meet the published VxWorks requirement - that the __vxworks header appear before any other include. */ + that the __vxworks header appear before any other include. */ #ifdef __vxworks #include "vxWorks.h" #endif @@ -66,15 +66,15 @@ extern void __gnat_raise_program_error (const char *, int); -/* Addresses of exception data blocks for predefined exceptions. Tasking_Error - is not used in this unit, and the abort signal is only used on IRIX. */ +/* Addresses of exception data blocks for predefined exceptions. Tasking_Error + is not used in this unit, and the abort signal is only used on IRIX. */ extern struct Exception_Data constraint_error; extern struct Exception_Data numeric_error; extern struct Exception_Data program_error; extern struct Exception_Data storage_error; /* For the Cert run time we use the regular raise exception routine because - Raise_From_Signal_Handler is not available. */ + Raise_From_Signal_Handler is not available. */ #ifdef CERT #define Raise_From_Signal_Handler \ __gnat_raise_exception @@ -85,7 +85,7 @@ extern void Raise_From_Signal_Handler (struct Exception_Data *, const char *); extern void Raise_From_Signal_Handler (struct Exception_Data *, const char *); #endif -/* Global values computed by the binder */ +/* Global values computed by the binder. */ int __gl_main_priority = -1; int __gl_time_slice_val = -1; char __gl_wc_encoding = 'n'; @@ -104,18 +104,18 @@ int __gl_default_stack_size = -1; int __gl_leap_seconds_support = 0; /* Indication of whether synchronous signal handler has already been - installed by a previous call to adainit */ + installed by a previous call to adainit. */ int __gnat_handler_installed = 0; #ifndef IN_RTS int __gnat_inside_elab_final_code = 0; /* ??? This variable is obsolete since 2001-08-29 but is kept to allow - bootstrap from old GNAT versions (< 3.15). */ + bootstrap from old GNAT versions (< 3.15). */ #endif /* HAVE_GNAT_INIT_FLOAT must be set on every targets where a __gnat_init_float - is defined. If this is not set them a void implementation will be defined - at the end of this unit. */ + is defined. If this is not set then a void implementation will be defined + at the end of this unit. */ #undef HAVE_GNAT_INIT_FLOAT /******************************/ @@ -126,13 +126,13 @@ char __gnat_get_interrupt_state (int); /* This routine is called from the runtime as needed to determine the state of an interrupt, as set by an Interrupt_State pragma appearing anywhere - in the current partition. The input argument is the interrupt number, + in the current partition. The input argument is the interrupt number, and the result is one of the following: 'n' this interrupt not set by any Interrupt_State pragma 'u' Interrupt_State pragma set state to User 'r' Interrupt_State pragma set state to Runtime - 's' Interrupt_State pragma set state to System */ + 's' Interrupt_State pragma set state to System */ char __gnat_get_interrupt_state (int intrup) @@ -149,13 +149,13 @@ __gnat_get_interrupt_state (int intrup) char __gnat_get_specific_dispatching (int); -/* This routine is called from the run time as needed to determine the +/* This routine is called from the runtime as needed to determine the priority specific dispatching policy, as set by a Priority_Specific_Dispatching pragma appearing anywhere in the current - partition. The input argument is the priority number, and the result is - the upper case first character of the policy name, e.g. 'F' for + partition. The input argument is the priority number, and the result + is the upper case first character of the policy name, e.g. 'F' for FIFO_Within_Priorities. A space ' ' is returned if no - Priority_Specific_Dispatching pragma is used in the partition. */ + Priority_Specific_Dispatching pragma is used in the partition. */ char __gnat_get_specific_dispatching (int priority) @@ -175,7 +175,7 @@ __gnat_get_specific_dispatching (int priority) /**********************/ /* This routine is kept for bootstrapping purposes, since the binder generated - file now sets the __gl_* variables directly. */ + file now sets the __gl_* variables directly. */ void __gnat_set_globals () @@ -193,14 +193,14 @@ __gnat_set_globals () #include <signal.h> #include <sys/time.h> -/* Some versions of AIX don't define SA_NODEFER. */ +/* Some versions of AIX don't define SA_NODEFER. */ #ifndef SA_NODEFER #define SA_NODEFER 0 #endif /* SA_NODEFER */ /* Versions of AIX before 4.3 don't have nanosleep but provide - nsleep instead. */ + nsleep instead. */ #ifndef _AIXVERSION_430 @@ -241,7 +241,7 @@ __gnat_error_handler (int sig, siginfo_t * si, void * uc) switch (sig) { case SIGSEGV: - /* FIXME: we need to detect the case of a *real* SIGSEGV */ + /* FIXME: we need to detect the case of a *real* SIGSEGV. */ exception = &storage_error; msg = "stack overflow or erroneous memory access"; break; @@ -272,13 +272,13 @@ __gnat_install_handler (void) /* Set up signal handler to map synchronous signals to appropriate exceptions. Make sure that the handler isn't interrupted by another - signal that might cause a scheduling event! */ + signal that might cause a scheduling event! */ act.sa_flags = SA_NODEFER | SA_RESTART | SA_SIGINFO; act.sa_sigaction = __gnat_error_handler; sigemptyset (&act.sa_mask); - /* Do not install handlers if interrupt state is "System" */ + /* Do not install handlers if interrupt state is "System". */ if (__gnat_get_interrupt_state (SIGABRT) != 's') sigaction (SIGABRT, &act, NULL); if (__gnat_get_interrupt_state (SIGFPE) != 's') @@ -408,13 +408,13 @@ __gnat_install_handler (void) /* Setup signal handler to map synchronous signals to appropriate exceptions. Make sure that the handler isn't interrupted by another - signal that might cause a scheduling event! */ + signal that might cause a scheduling event! */ act.sa_handler = (void (*) (int)) __gnat_error_handler; act.sa_flags = SA_RESTART | SA_NODEFER | SA_SIGINFO; sigemptyset (&act.sa_mask); - /* Do not install handlers if interrupt state is "System" */ + /* Do not install handlers if interrupt state is "System". */ if (__gnat_get_interrupt_state (SIGABRT) != 's') sigaction (SIGABRT, &act, NULL); if (__gnat_get_interrupt_state (SIGFPE) != 's') @@ -493,7 +493,7 @@ __gnat_error_handler switch (sig) { case SIGSEGV: - /* FIXME: we need to detect the case of a *real* SIGSEGV */ + /* FIXME: we need to detect the case of a *real* SIGSEGV. */ exception = &storage_error; msg = "stack overflow or erroneous memory access"; break; @@ -518,6 +518,13 @@ __gnat_error_handler Raise_From_Signal_Handler (exception, msg); } +/* This must be in keeping with System.OS_Interface.Alternate_Stack_Size. */ +#if defined (__hppa__) +char __gnat_alternate_stack[16 * 1024]; /* 2 * SIGSTKSZ */ +#else +char __gnat_alternate_stack[128 * 1024]; /* MINSIGSTKSZ */ +#endif + void __gnat_install_handler (void) { @@ -525,38 +532,33 @@ __gnat_install_handler (void) /* Set up signal handler to map synchronous signals to appropriate exceptions. Make sure that the handler isn't interrupted by another - signal that might cause a scheduling event! Also setup an alternate + signal that might cause a scheduling event! Also setup an alternate stack region for the handler execution so that stack overflows can be handled properly, avoiding a SEGV generation from stack usage by the - handler itself. */ - - static char handler_stack[SIGSTKSZ*2]; - /* SIGSTKSZ appeared to be "short" for the needs in some contexts - (e.g. experiments with GCC ZCX exceptions). */ + handler itself. */ stack_t stack; - - stack.ss_sp = handler_stack; - stack.ss_size = sizeof (handler_stack); + stack.ss_sp = __gnat_alternate_stack; + stack.ss_size = sizeof (__gnat_alternate_stack); stack.ss_flags = 0; - sigaltstack (&stack, NULL); act.sa_sigaction = __gnat_error_handler; - act.sa_flags = SA_NODEFER | SA_RESTART | SA_ONSTACK | SA_SIGINFO; + act.sa_flags = SA_NODEFER | SA_RESTART | SA_SIGINFO; sigemptyset (&act.sa_mask); - /* Do not install handlers if interrupt state is "System" */ + /* Do not install handlers if interrupt state is "System". */ if (__gnat_get_interrupt_state (SIGABRT) != 's') sigaction (SIGABRT, &act, NULL); if (__gnat_get_interrupt_state (SIGFPE) != 's') sigaction (SIGFPE, &act, NULL); if (__gnat_get_interrupt_state (SIGILL) != 's') sigaction (SIGILL, &act, NULL); - if (__gnat_get_interrupt_state (SIGSEGV) != 's') - sigaction (SIGSEGV, &act, NULL); if (__gnat_get_interrupt_state (SIGBUS) != 's') sigaction (SIGBUS, &act, NULL); + act.sa_flags |= SA_ONSTACK; + if (__gnat_get_interrupt_state (SIGSEGV) != 's') + sigaction (SIGSEGV, &act, NULL); __gnat_handler_installed = 1; } @@ -574,7 +576,7 @@ __gnat_install_handler (void) #include <sys/ucontext.h> /* GNU/Linux, which uses glibc, does not define NULL in included - header files */ + header files. */ #if !defined (NULL) #define NULL ((void *) 0) @@ -583,13 +585,13 @@ __gnat_install_handler (void) #if defined (MaRTE) /* MaRTE OS provides its own version of sigaction, sigfillset, and - sigemptyset (overriding these symbol names). We want to make sure that + sigemptyset (overriding these symbol names). We want to make sure that the versions provided by the underlying C library are used here (these versions are renamed by MaRTE to linux_sigaction, fake_linux_sigfillset, - and fake_linux_sigemptyset, respectively). The MaRTE library will not + and fake_linux_sigemptyset, respectively). The MaRTE library will not always be present (it will not be linked if no tasking constructs are used), so we use the weak symbol mechanism to point always to the symbols - defined within the C library. */ + defined within the C library. */ #pragma weak linux_sigaction int linux_sigaction (int signum, const struct sigaction *act, @@ -624,9 +626,34 @@ __gnat_adjust_context_for_raise (int signo ATTRIBUTE_UNUSED, void *ucontext) { mcontext_t *mcontext = &((ucontext_t *) ucontext)->uc_mcontext; + /* On the i386 and x86-64 architectures, stack checking is performed by + means of probes with moving stack pointer, that is to say the probed + address is always the value of the stack pointer. Upon hitting the + guard page, the stack pointer therefore points to an inaccessible + address and an alternate signal stack is needed to run the handler. + But there is an additional twist: on these architectures, the EH + return code writes the address of the handler at the target CFA's + value on the stack before doing the jump. As a consequence, if + there is an active handler in the frame whose stack has overflowed, + the stack pointer must nevertheless point to an accessible address + by the time the EH return is executed. + + We therefore adjust the saved value of the stack pointer by the size + of one page, in order to make sure that it points to an accessible + address in case it's used as the target CFA. The stack checking code + guarantees that this page is unused by the time this happens. */ + #if defined (i386) + unsigned long pattern = *(unsigned long *)mcontext->gregs[REG_EIP]; + /* The pattern is "orl $0x0,(%esp)" for a probe in 32-bit mode. */ + if (signo == SIGSEGV && pattern == 0x00240c83) + mcontext->gregs[REG_ESP] += 4096; mcontext->gregs[REG_EIP]++; #elif defined (__x86_64__) + unsigned long pattern = *(unsigned long *)mcontext->gregs[REG_RIP]; + /* The pattern is "orq $0x0,(%rsp)" for a probe in 64-bit mode. */ + if (signo == SIGSEGV && (pattern & 0xffffffffff) == 0x00240c8348) + mcontext->gregs[REG_RSP] += 4096; mcontext->gregs[REG_RIP]++; #elif defined (__ia64__) mcontext->sc_ip++; @@ -676,7 +703,7 @@ __gnat_error_handler (int sig, For now we simply do not attempt any discrimination at all. Note that this is quite acceptable, since a "real" SIGSEGV can only - occur as the result of an erroneous program */ + occur as the result of an erroneous program. */ msg = "stack overflow (or erroneous memory access)"; exception = &storage_error; @@ -701,14 +728,19 @@ __gnat_error_handler (int sig, /* We adjust the interrupted context here (and not in the MD_FALLBACK_FRAME_STATE_FOR macro) because recent versions of the Native - POSIX Thread Library (NPTL) are compiled with DWARF 2 unwind information, - and hence the later macro is never executed for signal frames. */ + POSIX Thread Library (NPTL) are compiled with DWARF-2 unwind information, + and hence the later macro is never executed for signal frames. */ __gnat_adjust_context_for_raise (sig, ucontext); Raise_From_Signal_Handler (exception, msg); } +#if defined (i386) || defined (__x86_64__) +/* This must be in keeping with System.OS_Interface.Alternate_Stack_Size. */ +char __gnat_alternate_stack[16 * 1024]; /* 2 * SIGSTKSZ */ +#endif + void __gnat_install_handler (void) { @@ -716,23 +748,37 @@ __gnat_install_handler (void) /* Set up signal handler to map synchronous signals to appropriate exceptions. Make sure that the handler isn't interrupted by another - signal that might cause a scheduling event! */ + signal that might cause a scheduling event! Also setup an alternate + stack region for the handler execution so that stack overflows can be + handled properly, avoiding a SEGV generation from stack usage by the + handler itself. */ + +#if defined (i386) || defined (__x86_64__) + stack_t stack; + stack.ss_sp = __gnat_alternate_stack; + stack.ss_size = sizeof (__gnat_alternate_stack); + stack.ss_flags = 0; + sigaltstack (&stack, NULL); +#endif act.sa_sigaction = __gnat_error_handler; act.sa_flags = SA_NODEFER | SA_RESTART | SA_SIGINFO; sigemptyset (&act.sa_mask); - /* Do not install handlers if interrupt state is "System" */ + /* Do not install handlers if interrupt state is "System". */ if (__gnat_get_interrupt_state (SIGABRT) != 's') sigaction (SIGABRT, &act, NULL); if (__gnat_get_interrupt_state (SIGFPE) != 's') sigaction (SIGFPE, &act, NULL); if (__gnat_get_interrupt_state (SIGILL) != 's') sigaction (SIGILL, &act, NULL); - if (__gnat_get_interrupt_state (SIGSEGV) != 's') - sigaction (SIGSEGV, &act, NULL); if (__gnat_get_interrupt_state (SIGBUS) != 's') sigaction (SIGBUS, &act, NULL); +#if defined (i386) || defined (__x86_64__) + act.sa_flags |= SA_ONSTACK; +#endif + if (__gnat_get_interrupt_state (SIGSEGV) != 's') + sigaction (SIGSEGV, &act, NULL); __gnat_handler_installed = 1; } @@ -771,8 +817,7 @@ static void __gnat_error_handler (int, int, sigcontext_t *); also the signal number but the second argument is the signal code identifying the cause of the signal. The third argument points to a sigcontext_t structure containing the receiving - process's context when the signal was delivered. -*/ + process's context when the signal was delivered. */ static void __gnat_error_handler (int sig, int code, sigcontext_t *sc ATTRIBUTE_UNUSED) @@ -807,7 +852,7 @@ __gnat_error_handler (int sig, int code, sigcontext_t *sc ATTRIBUTE_UNUSED) /* ??? Re-add smarts to further verify that we launched the stack into a guard page, not an attempt to - write to .text or something */ + write to .text or something. */ exception = &storage_error; msg = "SIGSEGV: (stack overflow or erroneous memory access)"; } @@ -816,7 +861,7 @@ __gnat_error_handler (int sig, int code, sigcontext_t *sc ATTRIBUTE_UNUSED) /* Just in case the OS guys did it to us again. Sometimes they fail to document all of the valid codes that are passed to signal handlers, just in case someone depends - on knowing all the codes */ + on knowing all the codes. */ exception = &program_error; msg = "SIGSEGV: (Undocumented reason)"; } @@ -846,7 +891,7 @@ __gnat_error_handler (int sig, int code, sigcontext_t *sc ATTRIBUTE_UNUSED) break; default: - /* Everything else is a Program_Error. */ + /* Everything else is a Program_Error. */ exception = &program_error; msg = "unhandled signal"; } @@ -861,14 +906,14 @@ __gnat_install_handler (void) /* Setup signal handler to map synchronous signals to appropriate exceptions. Make sure that the handler isn't interrupted by another - signal that might cause a scheduling event! */ + signal that might cause a scheduling event! */ act.sa_handler = __gnat_error_handler; act.sa_flags = SA_NODEFER + SA_RESTART; sigfillset (&act.sa_mask); sigemptyset (&act.sa_mask); - /* Do not install handlers if interrupt state is "System" */ + /* Do not install handlers if interrupt state is "System". */ if (__gnat_get_interrupt_state (SIGABRT) != 's') sigaction (SIGABRT, &act, NULL); if (__gnat_get_interrupt_state (SIGFPE) != 's') @@ -886,6 +931,69 @@ __gnat_install_handler (void) } /*******************/ +/* LynxOS Section */ +/*******************/ + +#elif defined (__Lynx__) + +#include <signal.h> +#include <unistd.h> + +static void +__gnat_error_handler (int sig) +{ + struct Exception_Data *exception; + const char *msg; + + switch(sig) + { + case SIGFPE: + exception = &constraint_error; + msg = "SIGFPE"; + break; + case SIGILL: + exception = &constraint_error; + msg = "SIGILL"; + break; + case SIGSEGV: + exception = &storage_error; + msg = "stack overflow or erroneous memory access"; + break; + case SIGBUS: + exception = &constraint_error; + msg = "SIGBUS"; + break; + default: + exception = &program_error; + msg = "unhandled signal"; + } + + Raise_From_Signal_Handler(exception, msg); +} + +void +__gnat_install_handler(void) +{ + struct sigaction act; + + act.sa_handler = __gnat_error_handler; + act.sa_flags = 0x0; + sigemptyset (&act.sa_mask); + + /* Do not install handlers if interrupt state is "System". */ + if (__gnat_get_interrupt_state (SIGFPE) != 's') + sigaction (SIGFPE, &act, NULL); + if (__gnat_get_interrupt_state (SIGILL) != 's') + sigaction (SIGILL, &act, NULL); + if (__gnat_get_interrupt_state (SIGSEGV) != 's') + sigaction (SIGSEGV, &act, NULL); + if (__gnat_get_interrupt_state (SIGBUS) != 's') + sigaction (SIGBUS, &act, NULL); + + __gnat_handler_installed = 1; +} + +/*******************/ /* Solaris Section */ /*******************/ @@ -896,7 +1004,7 @@ __gnat_install_handler (void) #include <sys/ucontext.h> #include <sys/regset.h> -/* The code below is common to sparc and x86. Beware of the delay slot +/* The code below is common to SPARC and x86. Beware of the delay slot differences for signal context adjustments. */ #if defined (__sparc) @@ -907,7 +1015,7 @@ __gnat_install_handler (void) /* Likewise regarding how the "instruction pointer" register slot can be identified in signal machine contexts. We have either "REG_PC" - or "PC" at hand, depending on the target CPU and solaris version. */ + or "PC" at hand, depending on the target CPU and Solaris version. */ #if !defined (REG_PC) #define REG_PC PC @@ -1005,13 +1113,13 @@ __gnat_install_handler (void) /* Set up signal handler to map synchronous signals to appropriate exceptions. Make sure that the handler isn't interrupted by another - signal that might cause a scheduling event! */ + signal that might cause a scheduling event! */ act.sa_handler = __gnat_error_handler; act.sa_flags = SA_NODEFER | SA_RESTART | SA_SIGINFO; sigemptyset (&act.sa_mask); - /* Do not install handlers if interrupt state is "System" */ + /* Do not install handlers if interrupt state is "System". */ if (__gnat_get_interrupt_state (SIGABRT) != 's') sigaction (SIGABRT, &act, NULL); if (__gnat_get_interrupt_state (SIGFPE) != 's') @@ -1044,8 +1152,8 @@ long __gnat_error_handler (int *, void *); #if defined (IN_RTS) && !defined (__IA64) -/* The prehandler actually gets control first on a condition. It swaps the - stack pointer and calls the handler (__gnat_error_handler). */ +/* The prehandler actually gets control first on a condition. It swaps the + stack pointer and calls the handler (__gnat_error_handler). */ extern long __gnat_error_prehandler (void); extern char *__gnat_error_prehandler_stack; /* Alternate signal stack */ @@ -1053,16 +1161,16 @@ extern char *__gnat_error_prehandler_stack; /* Alternate signal stack */ /* Define macro symbols for the VMS conditions that become Ada exceptions. Most of these are also defined in the header file ssdef.h which has not - yet been converted to be recognized by Gnu C. */ + yet been converted to be recognized by GNU C. */ /* Defining these as macros, as opposed to external addresses, allows - them to be used in a case statement (below */ + them to be used in a case statement below. */ #define SS$_ACCVIO 12 #define SS$_HPARITH 1284 #define SS$_STKOVF 1364 #define SS$_RESIGNAL 2328 -/* These codes are in standard message libraries */ +/* These codes are in standard message libraries. */ extern int CMA$_EXIT_THREAD; extern int SS$_DEBUG; extern int SS$_INTDIV; @@ -1072,7 +1180,7 @@ extern int MTH$_FLOOVEMAT; /* Some ACVC_21 CXA tests */ /* These codes are non standard, which is to say the author is not sure if they are defined in the standard message libraries - so keep them as macros for now. */ + so keep them as macros for now. */ #define RDB$_STREAM_EOF 20480426 #define FDL$_UNPRIKW 11829410 @@ -1085,8 +1193,8 @@ struct descriptor_s {unsigned short len, mbz; __char_ptr32 adr; }; /* Conditions that don't have an Ada exception counterpart must raise Non_Ada_Error. Since this is defined in s-auxdec, it should only be - referenced by user programs, not the compiler or tools. Hence the - #ifdef IN_RTS. */ + referenced by user programs, not the compiler or tools. Hence the + #ifdef IN_RTS. */ #ifdef IN_RTS @@ -1124,7 +1232,7 @@ extern struct Exception_Data *Coded_Exception (Exception_Code); extern Exception_Code Base_Code_In (Exception_Code); /* DEC Ada exceptions are not defined in a header file, so they - must be declared as external addresses */ + must be declared as external addresses. */ extern int ADA$_PROGRAM_ERROR; extern int ADA$_LOCK_ERROR; @@ -1156,7 +1264,7 @@ extern int ADA$_KEY_MISMATCH; extern int ADA$_MAXLINEXC; extern int ADA$_LINEXCMRS; -/* DEC Ada specific conditions */ +/* DEC Ada specific conditions. */ static const struct cond_except dec_ada_cond_except_table [] = { {&ADA$_PROGRAM_ERROR, &program_error}, {&ADA$_USE_ERROR, &Use_Error}, @@ -1198,8 +1306,8 @@ static const struct cond_except dec_ada_cond_except_table [] = { #endif /* IN_RTS */ -/* Non DEC Ada specific conditions. We could probably also put - SS$_HPARITH here and possibly SS$_ACCVIO, SS$_STKOVF. */ +/* Non-DEC Ada specific conditions. We could probably also put + SS$_HPARITH here and possibly SS$_ACCVIO, SS$_STKOVF. */ static const struct cond_except cond_except_table [] = { {&MTH$_FLOOVEMAT, &constraint_error}, {&SS$_INTDIV, &constraint_error}, @@ -1212,7 +1320,7 @@ static const struct cond_except cond_except_table [] = { still need to be handled by such handlers, however, in which case __gnat_error_handler needs to return SS$_RESIGNAL. Consider for instance the use of a third party library compiled with DECAda and - performing it's own exception handling internally. + performing its own exception handling internally. To allow some user-level flexibility, which conditions should be resignaled is controlled by a predicate function, provided with the @@ -1290,12 +1398,12 @@ __gnat_set_resignal_predicate (resignal_predicate * predicate) __gnat_resignal_p = predicate; } -/* Should match System.Parameters.Default_Exception_Msg_Max_Length */ +/* Should match System.Parameters.Default_Exception_Msg_Max_Length. */ #define Default_Exception_Msg_Max_Length 512 -/* Action routine for SYS$PUTMSG. There may be - multiple conditions, each with text to be appended to - MESSAGE and separated by line termination. */ +/* Action routine for SYS$PUTMSG. There may be multiple + conditions, each with text to be appended to MESSAGE + and separated by line termination. */ static int copy_msg (msgdesc, message) @@ -1305,14 +1413,14 @@ copy_msg (msgdesc, message) int len = strlen (message); int copy_len; - /* Check for buffer overflow and skip */ + /* Check for buffer overflow and skip. */ if (len > 0 && len <= Default_Exception_Msg_Max_Length - 3) { strcat (message, "\r\n"); len += 2; } - /* Check for buffer overflow and truncate if necessary */ + /* Check for buffer overflow and truncate if necessary. */ copy_len = (len + msgdesc->len <= Default_Exception_Msg_Max_Length - 1 ? msgdesc->len : Default_Exception_Msg_Max_Length - 1 - len); @@ -1338,7 +1446,7 @@ __gnat_handle_vms_condition (int *sigargs, void *mechargs) return SS$_RESIGNAL; #ifdef IN_RTS - /* See if it's an imported exception. Beware that registered exceptions + /* See if it's an imported exception. Beware that registered exceptions are bound to their base code, with the severity bits masked off. */ base_code = Base_Code_In ((Exception_Code) sigargs [1]); exception = Coded_Exception (base_code); @@ -1347,14 +1455,14 @@ __gnat_handle_vms_condition (int *sigargs, void *mechargs) { message [0] = 0; - /* Subtract PC & PSL fields which messes with PUTMSG */ + /* Subtract PC & PSL fields which messes with PUTMSG. */ sigargs [0] -= 2; SYS$PUTMSG (sigargs, copy_msg, &gnat_facility, message); sigargs [0] += 2; msg = message; exception->Name_Length = 19; - /* The full name really should be get sys$getmsg returns. ??? */ + /* ??? The full name really should be get sys$getmsg returns. */ exception->Full_Name = "IMPORTED_EXCEPTION"; exception->Import_Code = base_code; @@ -1396,7 +1504,7 @@ __gnat_handle_vms_condition (int *sigargs, void *mechargs) exception = &constraint_error; msg = "arithmetic error"; #ifndef __alpha__ - /* No need to adjust pc on alpha: the pc is already on the instruction + /* No need to adjust pc on Alpha: the pc is already on the instruction after the trapping one. */ __gnat_adjust_context_for_raise (0, (void *)mechargs); #endif @@ -1409,7 +1517,7 @@ __gnat_handle_vms_condition (int *sigargs, void *mechargs) int i; /* Scan the DEC Ada exception condition table for a match and fetch - the associated GNAT exception pointer */ + the associated GNAT exception pointer. */ for (i = 0; dec_ada_cond_except_table [i].cond && !LIB$MATCH_COND (&sigargs [1], @@ -1421,7 +1529,7 @@ __gnat_handle_vms_condition (int *sigargs, void *mechargs) if (!exception) { /* Scan the VMS standard condition table for a match and fetch - the associated GNAT exception pointer */ + the associated GNAT exception pointer. */ for (i = 0; cond_except_table [i].cond && !LIB$MATCH_COND (&sigargs [1], &cond_except_table [i].cond); @@ -1431,7 +1539,7 @@ __gnat_handle_vms_condition (int *sigargs, void *mechargs) if (!exception) /* User programs expect Non_Ada_Error to be raised, reference - DEC Ada test CXCONDHAN. */ + DEC Ada test CXCONDHAN. */ exception = &Non_Ada_Error; } } @@ -1439,7 +1547,7 @@ __gnat_handle_vms_condition (int *sigargs, void *mechargs) exception = &program_error; #endif message [0] = 0; - /* Subtract PC & PSL fields which messes with PUTMSG */ + /* Subtract PC & PSL fields which messes with PUTMSG. */ sigargs [0] -= 2; SYS$PUTMSG (sigargs, copy_msg, &gnat_facility, message); sigargs [0] += 2; @@ -1483,7 +1591,7 @@ __gnat_install_handler (void) __gnat_handler_installed = 1; } -/* __gnat_adjust_context_for_raise for alpha - see comments along with the +/* __gnat_adjust_context_for_raise for Alpha - see comments along with the default version later in this file. */ #if defined (IN_RTS) && defined (__alpha__) @@ -1613,7 +1721,7 @@ __gnat_install_handler () /* Set up signal handler to map synchronous signals to appropriate exceptions. Make sure that the handler isn't interrupted by another - signal that might cause a scheduling event! */ + signal that might cause a scheduling event! */ act.sa_sigaction = (void (*)(int, struct __siginfo *, void*)) __gnat_error_handler; @@ -1646,16 +1754,15 @@ __gnat_install_handler () #include "private/vThreadsP.h" #endif -static void __gnat_error_handler (int, int, struct sigcontext *); -void __gnat_map_signal (int); +void __gnat_error_handler (int, void *, struct sigcontext *); #ifndef __RTP__ -/* Directly vectored Interrupt routines are not supported when using RTPs */ +/* Directly vectored Interrupt routines are not supported when using RTPs. */ extern int __gnat_inum_to_ivec (int); -/* This is needed by the GNAT run time to handle Vxworks interrupts */ +/* This is needed by the GNAT run time to handle Vxworks interrupts. */ int __gnat_inum_to_ivec (int num) { @@ -1666,7 +1773,7 @@ __gnat_inum_to_ivec (int num) #if !defined(__alpha_vxworks) && (_WRS_VXWORKS_MAJOR != 6) && !defined(__RTP__) /* getpid is used by s-parint.adb, but is not defined by VxWorks, except - on Alpha VxWorks and VxWorks 6.x (including RTPs). */ + on Alpha VxWorks and VxWorks 6.x (including RTPs). */ extern long getpid (void); @@ -1678,7 +1785,7 @@ getpid (void) #endif /* VxWorks expects the field excCnt to be zeroed when a signal is handled. - The VxWorks version of longjmp does this; gcc's builtin_longjmp does not */ + The VxWorks version of longjmp does this; GCC's builtin_longjmp doesn't. */ void __gnat_clear_exception_count (void) { @@ -1689,9 +1796,37 @@ __gnat_clear_exception_count (void) #endif } -/* Exported to s-intman-vxworks.adb in order to handle different signal - to exception mappings in different VxWorks versions */ + +/* VxWorks context adjustment for targets that need/support it. */ + +void __gnat_adjust_context_for_raise (int, void*); + +#if defined (_ARCH_PPC) && !defined (VTHREADS) && !defined (__RTP__) + +#define HAVE_GNAT_ADJUST_CONTEXT_FOR_RAISE + +/* We need the constant and structure definitions describing the machine + state. Part of this is normally retrieved from the VxWorks "regs.h" but + #including it here gets the GCC internals instance of this file instead. + We need to #include the version we need directly here, and prevent the + possibly indirect inclusion of the GCC one, as its contents is useless to + us and it depends on several other headers that we don't have at hand. */ +#include <arch/ppc/regsPpc.h> +#define GCC_REGS_H +#include <sigLib.h> + void +__gnat_adjust_context_for_raise (int signo ATTRIBUTE_UNUSED, void *sigcontext) +{ + REG_SET * mcontext = ((struct sigcontext *) sigcontext)->sc_pregs; + mcontext->pc++; +} + +#endif + +/* Handle different SIGnal to exception mappings in different VxWorks + versions. */ +static void __gnat_map_signal (int sig) { struct Exception_Data *exception; @@ -1754,22 +1889,25 @@ __gnat_map_signal (int sig) Raise_From_Signal_Handler (exception, msg); } -static void -__gnat_error_handler (int sig, int code, struct sigcontext *sc) +/* Tasking and Non-tasking signal handler. Map SIGnal to Ada exception + propagation after the required low level adjustments. */ + +void +__gnat_error_handler (int sig, void * si ATTRIBUTE_UNUSED, + struct sigcontext * sc) { sigset_t mask; - int result; /* VxWorks will always mask out the signal during the signal handler and will reenable it on a longjmp. GNAT does not generate a longjmp to return from a signal handler so the signal will still be masked unless - we unmask it. */ + we unmask it. */ sigprocmask (SIG_SETMASK, NULL, &mask); sigdelset (&mask, sig); sigprocmask (SIG_SETMASK, &mask, NULL); + __gnat_adjust_context_for_raise (sig, (void *)sc); __gnat_map_signal (sig); - } void @@ -1779,14 +1917,14 @@ __gnat_install_handler (void) /* Setup signal handler to map synchronous signals to appropriate exceptions. Make sure that the handler isn't interrupted by another - signal that might cause a scheduling event! */ + signal that might cause a scheduling event! */ act.sa_handler = __gnat_error_handler; act.sa_flags = SA_SIGINFO | SA_ONSTACK; sigemptyset (&act.sa_mask); /* For VxWorks, install all signal handlers, since pragma Interrupt_State - applies to vectored hardware interrupts, not signals */ + applies to vectored hardware interrupts, not signals. */ sigaction (SIGFPE, &act, NULL); sigaction (SIGILL, &act, NULL); sigaction (SIGSEGV, &act, NULL); @@ -1800,10 +1938,10 @@ __gnat_install_handler (void) void __gnat_init_float (void) { - /* Disable overflow/underflow exceptions on the PPC processor, this is needed + /* Disable overflow/underflow exceptions on the PPC processor, needed to get correct Ada semantics. Note that for AE653 vThreads, the HW overflow settings are an OS configuration issue. The instructions - below have no effect */ + below have no effect. */ #if defined (_ARCH_PPC) && !defined (_SOFT_FLOAT) && !defined (VTHREADS) asm ("mtfsb0 25"); asm ("mtfsb0 26"); @@ -1811,11 +1949,11 @@ __gnat_init_float (void) #if (defined (__i386__) || defined (i386)) && !defined (VTHREADS) /* This is used to properly initialize the FPU on an x86 for each - process thread. */ + process thread. */ asm ("finit"); #endif - /* Similarly for sparc64. Achieved by masking bits in the Trap Enable Mask + /* Similarly for SPARC64. Achieved by masking bits in the Trap Enable Mask field of the Floating-point Status Register (see the SPARC Architecture Manual Version 9, p 48). */ #if defined (sparc64) @@ -1893,7 +2031,7 @@ __gnat_install_handler(void) act.sa_flags = SA_NODEFER | SA_RESTART; sigemptyset (&act.sa_mask); - /* Do not install handlers if interrupt state is "System" */ + /* Do not install handlers if interrupt state is "System". */ if (__gnat_get_interrupt_state (SIGFPE) != 's') sigaction (SIGFPE, &act, NULL); if (__gnat_get_interrupt_state (SIGILL) != 's') @@ -1971,7 +2109,7 @@ __gnat_install_handler(void) #else -/* For all other versions of GNAT, the handler does nothing */ +/* For all other versions of GNAT, the handler does nothing. */ /*******************/ /* Default Section */ @@ -1990,8 +2128,8 @@ __gnat_install_handler (void) /*********************/ /* This routine is called as each process thread is created, for possible - initialization of the FP processor. This version is used under INTERIX, - WIN32 and could be used under OS/2 */ + initialization of the FP processor. This version is used under INTERIX, + WIN32 and could be used under OS/2. */ #if defined (_WIN32) || defined (__INTERIX) || defined (__EMX__) \ || defined (__Lynx__) || defined(__NetBSD__) || defined(__FreeBSD__) \ @@ -2005,7 +2143,7 @@ __gnat_init_float (void) #if defined (__i386__) || defined (i386) /* This is used to properly initialize the FPU on an x86 for each - process thread. */ + process thread. */ asm ("finit"); @@ -2015,7 +2153,7 @@ __gnat_init_float (void) #ifndef HAVE_GNAT_INIT_FLOAT -/* All targets without a specific __gnat_init_float will use an empty one */ +/* All targets without a specific __gnat_init_float will use an empty one. */ void __gnat_init_float (void) { @@ -2028,7 +2166,7 @@ __gnat_init_float (void) #ifndef HAVE_GNAT_ADJUST_CONTEXT_FOR_RAISE -/* All targets without a specific version will use an empty one */ +/* All targets without a specific version will use an empty one. */ /* Given UCONTEXT a pointer to a context structure received by a signal handler for SIGNO, perform the necessary adjustments to let the handler diff --git a/gcc/ada/itypes.adb b/gcc/ada/itypes.adb index cab817dfada..59155dc9d52 100644 --- a/gcc/ada/itypes.adb +++ b/gcc/ada/itypes.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 1992-2007, Free Software Foundation, Inc. -- +-- Copyright (C) 1992-2008, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -29,6 +29,7 @@ with Sem; use Sem; with Sinfo; use Sinfo; with Stand; use Stand; with Targparm; use Targparm; +with Uintp; use Uintp; package body Itypes is @@ -47,17 +48,24 @@ package body Itypes is Typ : Entity_Id; begin + -- Should comment setting of Public_Status here ??? + if Related_Id = Empty then Typ := New_Internal_Entity (Ekind, Scope_Id, Sloc (Related_Nod), 'T'); Set_Public_Status (Typ); else - Typ := New_External_Entity - (Ekind, Scope_Id, Sloc (Related_Nod), Related_Id, Suffix, - Suffix_Index, 'T'); + Typ := + New_External_Entity + (Ekind, Scope_Id, Sloc (Related_Nod), Related_Id, Suffix, + Suffix_Index, 'T'); end if; - Init_Size_Align (Typ); + -- Make sure Esize (Typ) was properly initialized, it should be since + -- New_Internal_Entity/New_External_Entity call Init_Size_Align. + + pragma Assert (Esize (Typ) = Uint_0); + Set_Etype (Typ, Any_Type); Set_Is_Itype (Typ); Set_Associated_Node_For_Itype (Typ, Related_Nod); @@ -95,7 +103,6 @@ package body Itypes is Set_Directly_Designated_Type (I_Typ, Directly_Designated_Type (T)); Set_Etype (I_Typ, T); - Init_Size_Align (I_Typ); Set_Depends_On_Private (I_Typ, Depends_On_Private (T)); Set_Is_Public (I_Typ, Is_Public (T)); Set_From_With_Type (I_Typ, From_With_Type (T)); diff --git a/gcc/ada/itypes.ads b/gcc/ada/itypes.ads index d677bf9f8fd..0d70c1d382d 100644 --- a/gcc/ada/itypes.ads +++ b/gcc/ada/itypes.ads @@ -6,7 +6,7 @@ -- -- -- S p e c -- -- -- --- Copyright (C) 1992-2007, Free Software Foundation, Inc. -- +-- Copyright (C) 1992-2008, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -38,7 +38,8 @@ package Itypes is -- Implicit types (Itypes) are types and subtypes created by the semantic -- phase or the expander to reflect the underlying semantics. These could -- be generated by building trees for corresponding declarations and then - -- analyzing these trees, but there are three reasons for not doing this: + -- analyzing these trees, but there are three reasons for not doing this + -- in some cases: -- 1. The declarations would require more tree nodes @@ -81,6 +82,25 @@ package Itypes is -- and for the array subtype. The associated node of each index subtype -- is the corresponding range expression. + -- Notes on the use of the Parent field of an Itype + + -- In some cases, we do create a declaration node for an itype, and in + -- such cases, the Parent field of the Itype points to this declaration + -- in the normal manner. This case can be detected by checking for a + -- non-empty Parent field referencing a declaration whose Defining_Entity + -- is the Itype in question. + + -- In some other cases, where we don't generate such a declaration, as + -- described above, the Itype is attached to the tree implicitly by being + -- referenced elsewhere, e.g. as the Etype of some object. In this case + -- the Parent field may be Empty. + + -- In other cases where we don't generate a declaration for the Itype, + -- the Itype may be attached to an arbitrary node in the tree, using + -- the Parent field. This Parent field may even reference a declaration + -- for a related different entity (hence the description of the tests + -- needed for the case where a declaration for the Itype is created). + ------------------ -- Create_Itype -- ------------------ @@ -115,8 +135,10 @@ package Itypes is -- The Scope_Id parameter specifies the scope of the created type, and -- is normally the Current_Scope as shown, but can be set otherwise. -- - -- If Ekind is in Access_Subprogram_Type_Kind, Can_Use_Internal_Rep is set - -- True, unless Always_Compatible_Rep_On_Target is True. + -- The size/align fields are initialized to unknown (Uint_0). + -- + -- If Ekind is in Access_Subprogram_Kind, Can_Use_Internal_Rep is set True, + -- unless Always_Compatible_Rep_On_Target is True. --------------------------------- -- Create_Null_Excluding_Itype -- diff --git a/gcc/ada/layout.adb b/gcc/ada/layout.adb index 45cc66247bb..c6dec0aa379 100644 --- a/gcc/ada/layout.adb +++ b/gcc/ada/layout.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 2001-2007, Free Software Foundation, Inc. -- +-- Copyright (C) 2001-2008, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -2807,7 +2807,7 @@ package body Layout is -- have an alignment of 1. But don't do anything for atomic records -- since we may need higher alignment for indivisible access. - if Optimize_Alignment = 'S' + if Optimize_Alignment_Space (E) and then Is_Record_Type (E) and then Is_Packed (E) and then not Is_Atomic (E) @@ -2848,7 +2848,7 @@ package body Layout is -- alignment matches the size, for example, if the size is 17 -- bytes then we want an alignment of 1 for the type. - elsif Optimize_Alignment = 'S' then + elsif Optimize_Alignment_Space (E) then if Siz mod (8 * System_Storage_Unit) = 0 then Align := 8; elsif Siz mod (4 * System_Storage_Unit) = 0 then @@ -2864,7 +2864,7 @@ package body Layout is -- alignment of 4. Note that this matches the old VMS behavior -- in versions of GNAT prior to 6.1.1. - elsif Optimize_Alignment = 'T' + elsif Optimize_Alignment_Time (E) and then Siz > System_Storage_Unit and then Siz <= 8 * System_Storage_Unit then @@ -2902,7 +2902,7 @@ package body Layout is -- since conceivably we may be able to do better. if Align > System_Word_Size / System_Storage_Unit - and then Optimize_Alignment /= 'T' + and then not Optimize_Alignment_Time (E) then Align := System_Word_Size / System_Storage_Unit; end if; @@ -2912,7 +2912,7 @@ package body Layout is -- we have Optimize_Alignment set to Space. Note that that covers -- the case of packed records, where we already set alignment to 1. - if Optimize_Alignment /= 'S' then + if not Optimize_Alignment_Space (E) then declare Comp : Entity_Id; diff --git a/gcc/ada/lib-load.adb b/gcc/ada/lib-load.adb index f439926b4cb..d928b79a3a9 100644 --- a/gcc/ada/lib-load.adb +++ b/gcc/ada/lib-load.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 1992-2007, Free Software Foundation, Inc. -- +-- Copyright (C) 1992-2008, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -224,7 +224,8 @@ package body Lib.Load is Source_Index => No_Source_File, Unit_File_Name => Get_File_Name (Spec_Name, Subunit => False), Unit_Name => Spec_Name, - Version => 0); + Version => 0, + OA_Setting => 'O'); Set_Comes_From_Source_Default (Save_CS); Set_Error_Posted (Cunit_Entity); @@ -327,7 +328,8 @@ package body Lib.Load is Source_Index => Main_Source_File, Unit_File_Name => Fname, Unit_Name => No_Unit_Name, - Version => Version); + Version => Version, + OA_Setting => 'O'); end if; end Load_Main_Source; @@ -647,7 +649,8 @@ package body Lib.Load is Source_Index => Src_Ind, Unit_File_Name => Fname, Unit_Name => Uname_Actual, - Version => Source_Checksum (Src_Ind)); + Version => Source_Checksum (Src_Ind), + OA_Setting => 'O'); -- Parse the new unit diff --git a/gcc/ada/lib-writ.adb b/gcc/ada/lib-writ.adb index 68a5a74c0df..7ebfc7d3d51 100644 --- a/gcc/ada/lib-writ.adb +++ b/gcc/ada/lib-writ.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 1992-2007, Free Software Foundation, Inc. -- +-- Copyright (C) 1992-2008, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -87,7 +87,8 @@ package body Lib.Writ is Munit_Index => 0, Serial_Number => 0, Version => 0, - Error_Location => No_Location); + Error_Location => No_Location, + OA_Setting => 'O'); end Add_Preprocessing_Dependency; ------------------------------ @@ -141,7 +142,8 @@ package body Lib.Writ is Munit_Index => 0, Serial_Number => 0, Version => 0, - Error_Location => No_Location); + Error_Location => No_Location, + OA_Setting => 'O'); -- Parse system.ads so that the checksum is set right -- Style checks are not applied. @@ -236,28 +238,33 @@ package body Lib.Writ is -- Process with clause -- Ada 2005 (AI-50217): limited with_clauses do not create - -- dependencies + -- dependencies, but must be recorded as components of the + -- partition, in case there is no regular with_clause for + -- the unit anywhere else. - if Nkind (Item) = N_With_Clause - and then not (Limited_Present (Item)) - then + if Nkind (Item) = N_With_Clause then Unum := Get_Cunit_Unit_Number (Library_Unit (Item)); With_Flags (Unum) := True; - if Elaborate_Present (Item) then - Elab_Flags (Unum) := True; - end if; + if not Limited_Present (Item) then + if Elaborate_Present (Item) then + Elab_Flags (Unum) := True; + end if; - if Elaborate_All_Present (Item) then - Elab_All_Flags (Unum) := True; - end if; + if Elaborate_All_Present (Item) then + Elab_All_Flags (Unum) := True; + end if; - if Elaborate_All_Desirable (Item) then - Elab_All_Des_Flags (Unum) := True; - end if; + if Elaborate_All_Desirable (Item) then + Elab_All_Des_Flags (Unum) := True; + end if; - if Elaborate_Desirable (Item) then - Elab_Des_Flags (Unum) := True; + if Elaborate_Desirable (Item) then + Elab_Des_Flags (Unum) := True; + end if; + + else + Set_From_With_Type (Cunit_Entity (Unum)); end if; end if; @@ -441,6 +448,9 @@ package body Lib.Writ is Write_Info_Str (" NE"); end if; + Write_Info_Str (" O"); + Write_Info_Char (OA_Setting (Unit_Num)); + if Is_Preelaborated (Uent) then Write_Info_Str (" PR"); end if; @@ -512,7 +522,7 @@ package body Lib.Writ is end case; end if; - if Initialize_Scalars then + if Initialize_Scalars or else Invalid_Value_Used then Write_Info_Str (" IS"); end if; @@ -696,7 +706,14 @@ package body Lib.Writ is Uname := Units.Table (Unum).Unit_Name; Fname := Units.Table (Unum).Unit_File_Name; - Write_Info_Initiate ('W'); + if Ekind (Cunit_Entity (Unum)) = E_Package + and then From_With_Type (Cunit_Entity (Unum)) + then + Write_Info_Initiate ('Y'); + else + Write_Info_Initiate ('W'); + end if; + Write_Info_Char (' '); Write_Info_Name (Uname); @@ -750,20 +767,26 @@ package body Lib.Writ is Write_With_File_Names (Fname, Munit_Index (Unum)); end if; - if Elab_Flags (Unum) then - Write_Info_Str (" E"); - end if; + if Ekind (Cunit_Entity (Unum)) = E_Package + and then From_With_Type (Cunit_Entity (Unum)) + then + null; + else + if Elab_Flags (Unum) then + Write_Info_Str (" E"); + end if; - if Elab_All_Flags (Unum) then - Write_Info_Str (" EA"); - end if; + if Elab_All_Flags (Unum) then + Write_Info_Str (" EA"); + end if; - if Elab_Des_Flags (Unum) then - Write_Info_Str (" ED"); - end if; + if Elab_Des_Flags (Unum) then + Write_Info_Str (" ED"); + end if; - if Elab_All_Des_Flags (Unum) then - Write_Info_Str (" AD"); + if Elab_All_Des_Flags (Unum) then + Write_Info_Str (" AD"); + end if; end if; end if; @@ -971,11 +994,6 @@ package body Lib.Writ is Write_Info_Str (" NS"); end if; - if Optimize_Alignment /= 'O' then - Write_Info_Str (" O"); - Write_Info_Char (Optimize_Alignment); - end if; - if Sec_Stack_Used then Write_Info_Str (" SS"); end if; diff --git a/gcc/ada/lib-writ.ads b/gcc/ada/lib-writ.ads index 316a494185e..f152742bfa7 100644 --- a/gcc/ada/lib-writ.ads +++ b/gcc/ada/lib-writ.ads @@ -6,7 +6,7 @@ -- -- -- S p e c -- -- -- --- Copyright (C) 1992-2007, Free Software Foundation, Inc. -- +-- Copyright (C) 1992-2008, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -167,7 +167,7 @@ package Lib.Writ is -- P <<parameters>> -- Indicates various information that applies to the compilation - -- of the corresponding source unit. Parameters is a sequence of + -- of the corresponding source file. Parameters is a sequence of -- zero or more two letter codes that indicate configuration -- pragmas and other parameters that apply: -- @@ -211,10 +211,6 @@ package Lib.Writ is -- NS Normalize_Scalars pragma in effect for all units in -- this file. -- - -- OS Optimize_Alignment (Space) active for all units in this file - -- - -- OT Optimize_Alignment (Time) active for all units in this file - -- -- Qx A valid Queueing_Policy pragma applies to all the units -- in this file, where x is the first character (upper case) -- of the policy name (e.g. 'P' for Priority_Queueing). @@ -462,7 +458,8 @@ package Lib.Writ is -- case usage is detected, or the compiler cannot determine -- the style, then no I parameter will appear. -- - -- IS Initialize_Scalars pragma applies to this unit + -- IS Initialize_Scalars pragma applies to this unit, or else there + -- is at least one use of the Invalid_Value attribute. -- -- KM Unit source uses a style with keywords in mixed case -- KU (KM) or all upper case (KU). If the standard lower-case @@ -475,6 +472,23 @@ package Lib.Writ is -- elaboration code is required. Set if N_Compilation_Unit -- node has flag Has_No_Elaboration_Code set. -- + -- OL The units in this file are commpiled with a local pragma + -- Optimize_Alignment, so no consistency requirement applies + -- to these units. All internal units have this status since + -- they have an automatic default of Optimize_Alignment (Off). + -- + -- OO Optimize_Alignment (Off) is the default setting for all + -- units in this file. All files in the partition that specify + -- a default must specify the same default. + -- + -- OS Optimize_Alignment (Space) is the default settinng for all + -- units in this file. All files in the partition that specify + -- a default must specify the same default. + -- + -- OT Optimize_Alignment (Time) is the default settinng for all + -- units in this file. All files in the partition that specify + -- a default must specify the same default. + -- -- PK Unit is package, rather than a subprogram -- -- PU Unit has pragma Pure diff --git a/gcc/ada/lib-xref.adb b/gcc/ada/lib-xref.adb index 690cde9eb62..a7cc61a06e1 100644 --- a/gcc/ada/lib-xref.adb +++ b/gcc/ada/lib-xref.adb @@ -309,10 +309,6 @@ package body Lib.Xref is return False; end if; end loop; - - -- Parent (N) is assignment statement, check whether N is its name - - return Name (Parent (N)) = N; end Is_On_LHS; --------------------------- @@ -1579,14 +1575,34 @@ package body Lib.Xref is -------------------------- procedure Output_Overridden_Op (Old_E : Entity_Id) is + Op : Entity_Id; + begin - if Present (Old_E) - and then Sloc (Old_E) /= Standard_Location + -- The overridden operation has an implicit declaration + -- at the point of derivation. What we want to display + -- is the original operation, which has the actual body + -- (or abstract declaration) that is being overridden. + -- The overridden operation is not always set, e.g. when + -- it is a predefined operator. + + if No (Old_E) then + return; + + elsif Present (Alias (Old_E)) then + Op := Alias (Old_E); + + else + Op := Old_E; + end if; + + if Present (Op) + and then Sloc (Op) /= Standard_Location then declare - Loc : constant Source_Ptr := Sloc (Old_E); + Loc : constant Source_Ptr := Sloc (Op); Par_Unit : constant Unit_Number_Type := Get_Source_Unit (Loc); + begin Write_Info_Char ('<'); diff --git a/gcc/ada/lib.adb b/gcc/ada/lib.adb index d39723a85e4..dd0e24552bf 100644 --- a/gcc/ada/lib.adb +++ b/gcc/ada/lib.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 1992-2007, Free Software Foundation, Inc. -- +-- Copyright (C) 1992-2008, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -145,6 +145,11 @@ package body Lib is return Units.Table (U).Munit_Index; end Munit_Index; + function OA_Setting (U : Unit_Number_Type) return Character is + begin + return Units.Table (U).OA_Setting; + end OA_Setting; + function Source_Index (U : Unit_Number_Type) return Source_File_Index is begin return Units.Table (U).Source_Index; @@ -223,6 +228,11 @@ package body Lib is Units.Table (U).Main_Priority := P; end Set_Main_Priority; + procedure Set_OA_Setting (U : Unit_Number_Type; C : Character) is + begin + Units.Table (U).OA_Setting := C; + end Set_OA_Setting; + procedure Set_Unit_Name (U : Unit_Number_Type; N : Unit_Name_Type) is begin Units.Table (U).Unit_Name := N; diff --git a/gcc/ada/lib.ads b/gcc/ada/lib.ads index 746b2c87c7e..672396e52b0 100644 --- a/gcc/ada/lib.ads +++ b/gcc/ada/lib.ads @@ -6,7 +6,7 @@ -- -- -- S p e c -- -- -- --- Copyright (C) 1992-2007, Free Software Foundation, Inc. -- +-- Copyright (C) 1992-2008, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -344,6 +344,10 @@ package Lib is -- that the default priority is to be used (and is also used for -- entries that do not correspond to possible main programs). + -- OA_Setting + -- This is a character field containing L if Optimize_Alignment mode + -- was set locally, and O/T/S for Off/Time/Space default if not. + -- Serial_Number -- This field holds a serial number used by New_Internal_Name to -- generate unique temporary numbers on a unit by unit basis. The @@ -385,6 +389,7 @@ package Lib is function Loading (U : Unit_Number_Type) return Boolean; function Main_Priority (U : Unit_Number_Type) return Int; function Munit_Index (U : Unit_Number_Type) return Nat; + function OA_Setting (U : Unit_Number_Type) return Character; function Source_Index (U : Unit_Number_Type) return Source_File_Index; function Unit_File_Name (U : Unit_Number_Type) return File_Name_Type; function Unit_Name (U : Unit_Number_Type) return Unit_Name_Type; @@ -401,6 +406,7 @@ package Lib is procedure Set_Ident_String (U : Unit_Number_Type; N : Node_Id); procedure Set_Loading (U : Unit_Number_Type; B : Boolean := True); procedure Set_Main_Priority (U : Unit_Number_Type; P : Int); + procedure Set_OA_Setting (U : Unit_Number_Type; C : Character); procedure Set_Unit_Name (U : Unit_Number_Type; N : Unit_Name_Type); -- Set value of named field for given units table entry. Note that we -- do not have an entry for each possible field, since some of the fields @@ -630,6 +636,7 @@ private pragma Inline (Loading); pragma Inline (Main_Priority); pragma Inline (Munit_Index); + pragma Inline (OA_Setting); pragma Inline (Set_Cunit); pragma Inline (Set_Cunit_Entity); pragma Inline (Set_Fatal_Error); @@ -637,6 +644,7 @@ private pragma Inline (Set_Has_RACW); pragma Inline (Set_Loading); pragma Inline (Set_Main_Priority); + pragma Inline (Set_OA_Setting); pragma Inline (Set_Unit_Name); pragma Inline (Source_Index); pragma Inline (Unit_File_Name); @@ -662,6 +670,7 @@ private Is_Compiler_Unit : Boolean; Dynamic_Elab : Boolean; Loading : Boolean; + OA_Setting : Character; end record; -- The following representation clause ensures that the above record @@ -686,11 +695,12 @@ private Generate_Code at 53 range 0 .. 7; Has_RACW at 54 range 0 .. 7; Dynamic_Elab at 55 range 0 .. 7; - Is_Compiler_Unit at 56 range 0 .. 31; - Loading at 60 range 0 .. 31; + Is_Compiler_Unit at 56 range 0 .. 7; + OA_Setting at 57 range 0 .. 7; + Loading at 58 range 0 .. 15; end record; - for Unit_Record'Size use 64 * 8; + for Unit_Record'Size use 60 * 8; -- This ensures that we did not leave out any fields package Units is new Table.Table ( diff --git a/gcc/ada/link.c b/gcc/ada/link.c index 7e941d19cab..1ed24f80588 100644 --- a/gcc/ada/link.c +++ b/gcc/ada/link.c @@ -153,7 +153,7 @@ unsigned char __gnat_objlist_file_supported = 1; unsigned char __gnat_using_gnu_linker = 1; const char *__gnat_object_library_extension = ".a"; -#elif defined (linux) +#elif defined (linux) || defined(__GLIBC__) const char *__gnat_object_file_option = ""; const char *__gnat_run_path_option = "-Wl,-rpath,"; char __gnat_shared_libgnat_default = STATIC; diff --git a/gcc/ada/make.adb b/gcc/ada/make.adb index bf817de158a..304f15556ca 100644 --- a/gcc/ada/make.adb +++ b/gcc/ada/make.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 1992-2007, Free Software Foundation, Inc. -- +-- Copyright (C) 1992-2008, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -589,11 +589,6 @@ package body Make is -- Gnatmake Routines -- ----------------------- - Gnatmake_Called : Boolean := False; - -- Set to True when procedure Gnatmake is called. - -- Attempt to delete temporary files is made only when Gnatmake_Called - -- is True. - subtype Lib_Mark_Type is Byte; -- Used in Mark_Directory @@ -698,7 +693,7 @@ package body Make is Display_Executed_Programs : Boolean := True; -- Set to True if name of commands should be output on stderr (or on stdout - -- if the Commands_To_Stdout flag was set by use of the -S switch). + -- if the Commands_To_Stdout flag was set by use of the -eS switch). Output_File_Name_Seen : Boolean := False; -- Set to True after having scanned the file_name for @@ -824,7 +819,8 @@ package body Make is -- The path name of a mapping file specified by switch -C= procedure Delete_Mapping_Files; - -- Delete all temporary mapping files + -- Delete all temporary mapping files. Called only in Delete_All_Temp_Files + -- which ensures that Debug_Flag_N is False. procedure Init_Mapping_File (Project : Project_Id; @@ -834,10 +830,13 @@ package body Make is -- the index to the name of the file in the array The_Mapping_File_Names. procedure Delete_Temp_Config_Files; - -- Delete all temporary config files + -- Delete all temporary config files. Must not be called if Debug_Flag_N + -- is False. procedure Delete_All_Temp_Files; - -- Delete all temp files (config files, mapping files, path files) + -- Delete all temp files (config files, mapping files, path files), unless + -- Debug_Flag_N is True (in which case all temp files are left for user + -- examination). ------------------------------------------------- -- Subprogram declarations moved from the spec -- @@ -1414,7 +1413,7 @@ package body Make is when Directory_Error => Make_Failed ("unable to change to object directory """ & - Get_Name_String + Path_Or_File_Name (Project_Tree.Projects.Table (Actual_Project).Object_Directory) & """ of project " & @@ -2838,6 +2837,7 @@ package body Make is end loop; if The_Data.Library + and then not The_Data.Externally_Built and then not The_Data.Need_To_Build_Lib then -- Add to the Q all sources of the project that @@ -3487,11 +3487,10 @@ package body Make is -- If we could not read the ALI file that was just generated -- then there could be a problem reading either the ALI or the - -- corresponding object file (if Check_Object_Consistency - -- is set Read_Library_Info checks that the time stamp of the - -- object file is more recent than that of the ALI). For an - -- example of problems caught by this test see [6625-009]. - -- However, we record a failure only if not already done. + -- corresponding object file (if Check_Object_Consistency is + -- set Read_Library_Info checks that the time stamp of the + -- object file is more recent than that of the ALI). However, + -- we record a failure only if not already done. else if Compilation_OK and not Syntax_Only then @@ -3655,8 +3654,9 @@ package body Make is -- Delete any temporary configuration pragma file - Delete_Temp_Config_Files; - + if not Debug.Debug_Flag_N then + Delete_Temp_Config_Files; + end if; end Compile_Sources; ----------------------------------- @@ -3863,8 +3863,15 @@ package body Make is Global_Attribute.Project); begin if not Is_Regular_File (Path) then - Make_Failed - ("cannot find configuration pragmas file ", Path); + if Debug.Debug_Flag_F then + Make_Failed + ("cannot find configuration pragmas file ", + File_Name (Path)); + else + Make_Failed + ("cannot find configuration pragmas file ", + Path); + end if; end if; Last := Last + 1; @@ -3901,8 +3908,15 @@ package body Make is Local_Attribute.Project); begin if not Is_Regular_File (Path) then - Make_Failed - ("cannot find configuration pragmas file ", Path); + if Debug.Debug_Flag_F then + Make_Failed + ("cannot find configuration pragmas file ", + File_Name (Path)); + + else + Make_Failed + ("cannot find configuration pragmas file ", Path); + end if; end if; Last := Last + 1; @@ -3945,7 +3959,7 @@ package body Make is procedure Delete_All_Temp_Files is begin - if Gnatmake_Called and not Debug.Debug_Flag_N then + if not Debug.Debug_Flag_N then Delete_Mapping_Files; Delete_Temp_Config_Files; Prj.Env.Delete_All_Path_Files (Project_Tree); @@ -3959,18 +3973,21 @@ package body Make is procedure Delete_Mapping_Files is Success : Boolean; pragma Warnings (Off, Success); + begin - if not Debug.Debug_Flag_N then - if The_Mapping_File_Names /= null then - for Project in The_Mapping_File_Names'Range (1) loop - for Index in 1 .. Last_Mapping_File_Names (Project) loop - Delete_File - (Name => Get_Name_String - (The_Mapping_File_Names (Project, Index)), - Success => Success); - end loop; + -- The caller is responsible for ensuring that Debug_Flag_N is False + + pragma Assert (not Debug.Debug_Flag_N); + + if The_Mapping_File_Names /= null then + for Project in The_Mapping_File_Names'Range (1) loop + for Index in 1 .. Last_Mapping_File_Names (Project) loop + Delete_File + (Name => Get_Name_String + (The_Mapping_File_Names (Project, Index)), + Success => Success); end loop; - end if; + end loop; end if; end Delete_Mapping_Files; @@ -3983,7 +4000,11 @@ package body Make is pragma Warnings (Off, Success); begin - if (not Debug.Debug_Flag_N) and Main_Project /= No_Project then + -- The caller is responsible for ensuring that Debug_Flag_N is False + + pragma Assert (not Debug.Debug_Flag_N); + + if Main_Project /= No_Project then for Project in Project_Table.First .. Project_Table.Last (Project_Tree.Projects) loop @@ -4004,10 +4025,10 @@ package body Make is (Project).Config_File_Name), Success => Success); - -- Make sure that we don't have a config file for this - -- project, in case when there are several mains. - -- In this case, we will recreate another config file: - -- we cannot reuse the one that we just deleted! + -- Make sure that we don't have a config file for this project, + -- in case there are several mains. In this case, we will + -- recreate another config file: we cannot reuse the one that + -- we just deleted! Project_Tree.Projects.Table (Project). Config_Checked := False; @@ -4069,7 +4090,40 @@ package body Make is Args (J) (Args (J)'First .. Args (J)'First + 2) /= "-F=" then Write_Str (" "); - Write_Str (Args (J).all); + + -- If -df is used, only display file names, not path + -- names. + + if Debug.Debug_Flag_F then + declare + Equal_Pos : Natural; + begin + Equal_Pos := Args (J)'First - 1; + for K in Args (J)'Range loop + if Args (J) (K) = '=' then + Equal_Pos := K; + exit; + end if; + end loop; + + if Is_Absolute_Path + (Args (J) (Equal_Pos + 1 .. Args (J)'Last)) + then + Write_Str + (Args (J) (Args (J)'First .. Equal_Pos)); + Write_Str + (File_Name + (Args (J) + (Equal_Pos + 1 .. Args (J)'Last))); + + else + Write_Str (Args (J).all); + end if; + end; + + else + Write_Str (Args (J).all); + end if; end if; end if; end if; @@ -4583,8 +4637,6 @@ package body Make is -- This body is very long, should be broken down ??? begin - Gnatmake_Called := True; - Install_Int_Handler (Sigint_Intercepted'Access); Do_Compile_Step := True; @@ -4716,16 +4768,12 @@ package body Make is -- If no sources to compile, then there is nothing to do if Osint.Number_Of_Files = 0 then - if not Debug.Debug_Flag_N then - Delete_Mapping_Files; - Prj.Env.Delete_All_Path_Files (Project_Tree); - end if; - if not Quiet_Output then Osint.Write_Program_Name; Write_Line (": no sources to compile"); end if; + Delete_All_Temp_Files; Exit_Program (E_Success); end if; end if; @@ -4875,6 +4923,8 @@ package body Make is Gcc_Path => Gcc_Path, Bind => Bind_Only, Link => Link_Only); + + Delete_All_Temp_Files; Exit_Program (E_Success); else @@ -6490,10 +6540,7 @@ package body Make is -- Delete the temporary mapping file that was created if we are -- using project files. - if not Debug.Debug_Flag_N then - Delete_Mapping_Files; - Prj.Env.Delete_All_Path_Files (Project_Tree); - end if; + Delete_All_Temp_Files; exception when X : others => @@ -6770,6 +6817,14 @@ package body Make is Project_File_Name => Project_File_Name.all, Packages_To_Check => Packages_To_Check_By_Gnatmake); + -- The parsing of project files may have changed the current output + + if Commands_To_Stdout then + Set_Standard_Output; + else + Set_Standard_Error; + end if; + if Main_Project = No_Project then Make_Failed ("""", Project_File_Name.all, """ processing failed"); end if; @@ -6852,6 +6907,7 @@ package body Make is Put_In_Q : Boolean := Into_Q; Unit : Unit_Data; Sfile : File_Name_Type; + Index : Int; Extending : constant Boolean := Project_Tree.Projects.Table @@ -6899,6 +6955,7 @@ package body Make is loop Unit := Project_Tree.Units.Table (Id); Sfile := No_File; + Index := 0; -- If there is a source for the body, and the body has not been -- locally removed, @@ -6937,13 +6994,16 @@ package body Make is if Sinput.P.Source_File_Is_Subunit (Src_Ind) then Sfile := No_File; + Index := 0; else Sfile := Unit.File_Names (Body_Part).Display_Name; + Index := Unit.File_Names (Body_Part).Index; end if; end; else Sfile := Unit.File_Names (Body_Part).Display_Name; + Index := Unit.File_Names (Body_Part).Index; end if; end if; @@ -6956,6 +7016,7 @@ package body Make is -- this one. Sfile := Unit.File_Names (Specification).Display_Name; + Index := Unit.File_Names (Specification).Index; end if; -- If Put_In_Q is True, we insert into the Q @@ -6972,15 +7033,15 @@ package body Make is -- And of course, we only insert in the Q if the source is not -- marked. - if Sfile /= No_File and then not Is_Marked (Sfile) then + if Sfile /= No_File and then not Is_Marked (Sfile, Index) then if Verbose_Mode then Write_Str ("Adding """); Write_Str (Get_Name_String (Sfile)); Write_Line (""" to the queue"); end if; - Insert_Q (Sfile); - Mark (Sfile); + Insert_Q (Sfile, Index => Index); + Mark (Sfile, Index); end if; elsif Sfile /= No_File then @@ -6996,7 +7057,7 @@ package body Make is Write_Line (""" as if on the command line"); end if; - Osint.Add_File (Get_Name_String (Sfile)); + Osint.Add_File (Get_Name_String (Sfile), Index); Put_In_Q := True; -- As we may look into the Q later, ensure the Q has been @@ -7404,11 +7465,7 @@ package body Make is procedure Report_Compilation_Failed is begin - if not Debug.Debug_Flag_N then - Delete_Mapping_Files; - Prj.Env.Delete_All_Path_Files (Project_Tree); - end if; - + Delete_All_Temp_Files; Exit_Program (E_Fatal); end Report_Compilation_Failed; @@ -7421,7 +7478,6 @@ package body Make is begin Set_Standard_Error; Write_Line ("*** Interrupted ***"); - Delete_All_Temp_Files; -- Send SIGINT to all outstanding compilation processes spawned @@ -7429,7 +7485,10 @@ package body Make is Kill (Running_Compile (J).Pid, SIGINT, 1); end loop; + Delete_All_Temp_Files; OS_Exit (1); + -- ??? OS_Exit (1) is equivalent to Exit_Program (E_No_Compile), + -- shouldn't that be Exit_Program (E_Abort) instead? end Sigint_Intercepted; ------------------- diff --git a/gcc/ada/makegpr.adb b/gcc/ada/makegpr.adb index 2d655e148fe..684cae99eb8 100644 --- a/gcc/ada/makegpr.adb +++ b/gcc/ada/makegpr.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 2004-2007, Free Software Foundation, Inc. -- +-- Copyright (C) 2004-2008, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -283,6 +283,8 @@ package body Makegpr is Dash_cargs : constant String_Access := Dash_cargs_String'Access; Dash_d_String : aliased String := "-d"; Dash_d : constant String_Access := Dash_d_String'Access; + Dash_eL_String : aliased String := "-eL"; + Dash_eL : constant String_Access := Dash_eL_String'Access; Dash_f_String : aliased String := "-f"; Dash_f : constant String_Access := Dash_f_String'Access; Dash_k_String : aliased String := "-k"; @@ -2609,6 +2611,12 @@ package body Makegpr is Add_Argument (Dash_d, True); end if; + -- -eL + + if Follow_Links_For_Files then + Add_Argument (Dash_eL, True); + end if; + -- -k if Keep_Going then @@ -3375,8 +3383,8 @@ package body Makegpr is -- Add the directory where gprmake is invoked in front of the path, -- if gprmake is invoked from a bin directory or with directory - -- information. Only do this if the platform is not VMS, - -- where the notion of path does not really exist. + -- information. Only do this if the platform is not VMS, where the + -- notion of path does not really exist. -- Below code shares nasty code duplication with make.adb code??? @@ -4231,6 +4239,9 @@ package body Makegpr is elsif Arg = "-d" then Display_Compilation_Progress := True; + elsif Arg = "-eL" then + Follow_Links_For_Files := True; + elsif Arg = "-f" then Force_Compilations := True; @@ -4370,6 +4381,12 @@ package body Makegpr is Write_Str (" -c Compile only"); Write_Eol; + -- Line for -eL + + Write_Str (" -eL Follow symbolic links when processing " & + "project files"); + Write_Eol; + -- Line for -f Write_Str (" -f Force recompilations"); diff --git a/gcc/ada/makeusg.adb b/gcc/ada/makeusg.adb index 4178b1269ce..ca22dceec9c 100644 --- a/gcc/ada/makeusg.adb +++ b/gcc/ada/makeusg.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 1992-2007, Free Software Foundation, Inc. -- +-- Copyright (C) 1992-2008, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -306,6 +306,11 @@ begin Write_Str (" --RTS=dir specify the default source and object search" & " path"); Write_Eol; + + -- Line for --subdirs= + + Write_Str (" --subdirs=dir real obj/lib/exec dirs are subdirs"); + Write_Eol; Write_Eol; -- General Compiler, Binder, Linker switches diff --git a/gcc/ada/makeutl.adb b/gcc/ada/makeutl.adb index 773256d176e..63b975c36f6 100644 --- a/gcc/ada/makeutl.adb +++ b/gcc/ada/makeutl.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 2004-2007, Free Software Foundation, Inc. -- +-- Copyright (C) 2004-2008, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -23,7 +23,7 @@ -- -- ------------------------------------------------------------------------------ -with Ada.Command_Line; use Ada.Command_Line; +with Debug; with Osint; use Osint; with Output; use Output; with Prj.Ext; @@ -31,6 +31,10 @@ with Prj.Util; with Snames; use Snames; with Table; +with Ada.Command_Line; use Ada.Command_Line; + +with GNAT.Directory_Operations; use GNAT.Directory_Operations; + with System.Case_Util; use System.Case_Util; with System.HTable; @@ -41,7 +45,7 @@ package body Makeutl is Index : Int; end record; -- Identify either a mono-unit source (when Index = 0) or a specific unit - -- in a multi-unit source. + -- (index = 1's origin index of unit) in a multi-unit source. -- There follow many global undocumented declarations, comments needed ??? @@ -271,7 +275,17 @@ package body Makeutl is if N /= No_Name then Write_Str (""""); - Write_Name (N); + + declare + Name : constant String := Get_Name_String (N); + begin + if Debug.Debug_Flag_F and then Is_Absolute_Path (Name) then + Write_Str (File_Name (Name)); + else + Write_Str (Name); + end if; + end; + Write_Str (""" "); end if; @@ -545,6 +559,20 @@ package body Makeutl is Marks.Set (K => (File => Source_File, Index => Index), E => True); end Mark; + ----------------------- + -- Path_Or_File_Name -- + ----------------------- + + function Path_Or_File_Name (Path : Path_Name_Type) return String is + Path_Name : constant String := Get_Name_String (Path); + begin + if Debug.Debug_Flag_F then + return File_Name (Path_Name); + else + return Path_Name; + end if; + end Path_Or_File_Name; + --------------------------- -- Test_If_Relative_Path -- --------------------------- diff --git a/gcc/ada/makeutl.ads b/gcc/ada/makeutl.ads index b03783c73c7..9672744a1ac 100644 --- a/gcc/ada/makeutl.ads +++ b/gcc/ada/makeutl.ads @@ -6,7 +6,7 @@ -- -- -- S p e c -- -- -- --- Copyright (C) 2004-2007, Free Software Foundation, Inc. -- +-- Copyright (C) 2004-2008, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -130,6 +130,9 @@ package Makeutl is -- For gnatbind switches, Including_L_Switch is False, because the -- argument of the -L switch is not a path. + function Path_Or_File_Name (Path : Path_Name_Type) return String; + -- Returns a file name if -df is used, otherwise return a path name + ---------------------- -- Marking Routines -- ---------------------- diff --git a/gcc/ada/misc.c b/gcc/ada/misc.c index 317ec2d6cdc..a4dd99c5c2d 100644 --- a/gcc/ada/misc.c +++ b/gcc/ada/misc.c @@ -151,6 +151,8 @@ static tree gnat_type_max_size (const_tree); #define LANG_HOOKS_TYPE_FOR_MODE gnat_type_for_mode #undef LANG_HOOKS_TYPE_FOR_SIZE #define LANG_HOOKS_TYPE_FOR_SIZE gnat_type_for_size +#undef LANG_HOOKS_TYPES_COMPATIBLE_P +#define LANG_HOOKS_TYPES_COMPATIBLE_P gnat_types_compatible_p #undef LANG_HOOKS_ATTRIBUTE_TABLE #define LANG_HOOKS_ATTRIBUTE_TABLE gnat_internal_attribute_table #undef LANG_HOOKS_BUILTIN_FUNCTION diff --git a/gcc/ada/mlib-prj.adb b/gcc/ada/mlib-prj.adb index 88d33811b1d..193b54ca408 100644 --- a/gcc/ada/mlib-prj.adb +++ b/gcc/ada/mlib-prj.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 2001-2007, AdaCore -- +-- Copyright (C) 2001-2008, AdaCore -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -829,6 +829,12 @@ package body MLib.Prj is Com.Fail ("project """, Project_Name, """ has no library"); end if; + -- Do not attempt to build the library if it is externally built + + if Data.Externally_Built then + return; + end if; + -- If this is the first time Build_Library is called, get the Name_Id -- of "s-osinte.ads". @@ -1399,17 +1405,18 @@ package body MLib.Prj is declare ALI_File : constant String := Ext_To - (Filename (1 .. Last), "ali"); + (C_Filename + (1 .. Last), "ali"); ALI_Path : constant String := - Ext_To (Object_Path, "ali"); + Ext_To (C_Object_Path, "ali"); Add_It : Boolean := There_Are_Foreign_Sources - or else - (Last > 5 - and then - C_Filename - (1 .. B_Start'Length) = - B_Start.all); + or else + (Last > 5 + and then + C_Filename + (1 .. B_Start'Length) = + B_Start.all); Fname : File_Name_Type; Proj : Project_Id; @@ -2348,7 +2355,7 @@ package body MLib.Prj is Fd : FILEs; -- Binder file's descriptor - Read_Mode : constant String := "r" & ASCII.Nul; + Read_Mode : constant String := "r" & ASCII.NUL; -- For fopen Status : Interfaces.C_Streams.int; diff --git a/gcc/ada/mlib-tgt-aix.adb b/gcc/ada/mlib-tgt-specific-aix.adb index 5afd606bc03..9fb8b1593f9 100644 --- a/gcc/ada/mlib-tgt-aix.adb +++ b/gcc/ada/mlib-tgt-specific-aix.adb @@ -7,7 +7,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 2003-2007, AdaCore -- +-- Copyright (C) 2003-2008, AdaCore -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -37,7 +37,11 @@ with Prj.Util; use Prj.Util; package body MLib.Tgt.Specific is - -- Non default subprograms + -- Local subprograms + -- These *ALL* require comments ??? + + function Archive_Indexer return String; + -- What is this??? procedure Build_Dynamic_Library (Ofiles : Argument_List; @@ -82,6 +86,15 @@ package body MLib.Tgt.Specific is -- libgnarl. Depends on the thread library (Native or FSU). Resolved for -- the first library linked against libgnarl. + --------------------- + -- Archive_Indexer -- + --------------------- + + function Archive_Indexer return String is + begin + return ""; + end Archive_Indexer; + --------------------------- -- Build_Dynamic_Library -- --------------------------- @@ -202,6 +215,7 @@ package body MLib.Tgt.Specific is end Support_For_Libraries; begin + Archive_Indexer_Ptr := Archive_Indexer'Access; Build_Dynamic_Library_Ptr := Build_Dynamic_Library'Access; DLL_Ext_Ptr := DLL_Ext'Access; Library_Major_Minor_Id_Supported_Ptr := diff --git a/gcc/ada/mlib-tgt-darwin.adb b/gcc/ada/mlib-tgt-specific-darwin.adb index 7f25b2521d1..5bab21df797 100644 --- a/gcc/ada/mlib-tgt-darwin.adb +++ b/gcc/ada/mlib-tgt-specific-darwin.adb @@ -7,7 +7,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 2001-2007, Free Software Foundation, Inc. -- +-- Copyright (C) 2001-2008, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -113,7 +113,7 @@ package body MLib.Tgt.Specific is if Lib_Version = "" then Utl.Gcc - (Output_File => Lib_File, + (Output_File => Lib_Path, Objects => Ofiles, Options => Options & Shared_Options, Driver_Name => Driver_Name, @@ -131,7 +131,7 @@ package body MLib.Tgt.Specific is Options => Options & Shared_Options, Driver_Name => Driver_Name, Options_2 => No_Argument_List); - Symbolic_Link_Needed := Lib_Version /= Lib_File; + Symbolic_Link_Needed := Lib_Version /= Lib_Path; else Utl.Gcc @@ -141,7 +141,7 @@ package body MLib.Tgt.Specific is Driver_Name => Driver_Name, Options_2 => No_Argument_List); Symbolic_Link_Needed := - Lib_Dir & Directory_Separator & Lib_Version /= Lib_File; + Lib_Dir & Directory_Separator & Lib_Version /= Lib_Path; end if; if Symbolic_Link_Needed then diff --git a/gcc/ada/mlib-tgt-hpux.adb b/gcc/ada/mlib-tgt-specific-hpux.adb index c00bd9b2dc3..720b0860adf 100644 --- a/gcc/ada/mlib-tgt-hpux.adb +++ b/gcc/ada/mlib-tgt-specific-hpux.adb @@ -7,7 +7,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 2003-2007, AdaCore -- +-- Copyright (C) 2003-2008, AdaCore -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- diff --git a/gcc/ada/mlib-tgt-irix.adb b/gcc/ada/mlib-tgt-specific-irix.adb index efdb5f7d731..efdb5f7d731 100644 --- a/gcc/ada/mlib-tgt-irix.adb +++ b/gcc/ada/mlib-tgt-specific-irix.adb diff --git a/gcc/ada/mlib-tgt-linux.adb b/gcc/ada/mlib-tgt-specific-linux.adb index 493d8011187..60557fdf579 100644 --- a/gcc/ada/mlib-tgt-linux.adb +++ b/gcc/ada/mlib-tgt-specific-linux.adb @@ -68,7 +68,7 @@ package body MLib.Tgt.Specific is pragma Unreferenced (Interfaces); pragma Unreferenced (Symbol_Data); pragma Unreferenced (Auto_Init); - -- Initialization is done through the constructor mechanism + -- Initialization is done through the contructor mechanism Lib_File : constant String := "lib" & Fil.Append_To (Lib_Filename, DLL_Ext); diff --git a/gcc/ada/mlib-tgt-lynxos.adb b/gcc/ada/mlib-tgt-specific-lynxos.adb index 83ca4192e16..83ca4192e16 100644 --- a/gcc/ada/mlib-tgt-lynxos.adb +++ b/gcc/ada/mlib-tgt-specific-lynxos.adb diff --git a/gcc/ada/mlib-tgt-mingw.adb b/gcc/ada/mlib-tgt-specific-mingw.adb index 78b1a8322f9..78b1a8322f9 100644 --- a/gcc/ada/mlib-tgt-mingw.adb +++ b/gcc/ada/mlib-tgt-specific-mingw.adb diff --git a/gcc/ada/mlib-tgt-solaris.adb b/gcc/ada/mlib-tgt-specific-solaris.adb index 3b0e49a5e8d..3b0e49a5e8d 100644 --- a/gcc/ada/mlib-tgt-solaris.adb +++ b/gcc/ada/mlib-tgt-specific-solaris.adb diff --git a/gcc/ada/mlib-tgt-tru64.adb b/gcc/ada/mlib-tgt-specific-tru64.adb index 43c1e97972d..7e6bcc20605 100644 --- a/gcc/ada/mlib-tgt-tru64.adb +++ b/gcc/ada/mlib-tgt-specific-tru64.adb @@ -7,7 +7,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 2002-2007, Free Software Foundation, Inc. -- +-- Copyright (C) 2002-2008, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -24,7 +24,7 @@ -- -- ------------------------------------------------------------------------------ --- This is the Tru64 version of the body +-- This is the True64 version of the body with MLib.Fil; with MLib.Utl; diff --git a/gcc/ada/mlib-tgt-vms-alpha.adb b/gcc/ada/mlib-tgt-specific-vms-alpha.adb index 78393894391..291293607f9 100644 --- a/gcc/ada/mlib-tgt-vms-alpha.adb +++ b/gcc/ada/mlib-tgt-specific-vms-alpha.adb @@ -7,7 +7,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 2003-2007, Free Software Foundation, Inc. -- +-- Copyright (C) 2003-2008, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -31,9 +31,9 @@ with Ada.Characters.Handling; use Ada.Characters.Handling; with MLib.Fil; with MLib.Utl; -with MLib.Tgt.VMS; -pragma Warnings (Off, MLib.Tgt.VMS); --- MLib.Tgt.VMS is with'ed only for elaboration purposes +with MLib.Tgt.VMS_Common; +pragma Warnings (Off, MLib.Tgt.VMS_Common); +-- MLib.Tgt.VMS_Common is with'ed only for elaboration purposes with Opt; use Opt; with Output; use Output; diff --git a/gcc/ada/mlib-tgt-vms-ia64.adb b/gcc/ada/mlib-tgt-specific-vms-ia64.adb index a9790cc602e..baa8ce213f1 100644 --- a/gcc/ada/mlib-tgt-vms-ia64.adb +++ b/gcc/ada/mlib-tgt-specific-vms-ia64.adb @@ -7,7 +7,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 2004-2007, Free Software Foundation, Inc. -- +-- Copyright (C) 2004-2008, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -31,9 +31,9 @@ with Ada.Characters.Handling; use Ada.Characters.Handling; with MLib.Fil; with MLib.Utl; -with MLib.Tgt.VMS; -pragma Warnings (Off, MLib.Tgt.VMS); --- MLib.Tgt.VMS is with'ed only for elaboration purposes +with MLib.Tgt.VMS_Common; +pragma Warnings (Off, MLib.Tgt.VMS_Common); +-- MLib.Tgt.VMS_Common is with'ed only for elaboration purposes with Opt; use Opt; with Output; use Output; diff --git a/gcc/ada/mlib-tgt-vxworks.adb b/gcc/ada/mlib-tgt-specific-vxworks.adb index 54967b8bd43..54967b8bd43 100644 --- a/gcc/ada/mlib-tgt-vxworks.adb +++ b/gcc/ada/mlib-tgt-specific-vxworks.adb diff --git a/gcc/ada/mlib-tgt-specific-xi.adb b/gcc/ada/mlib-tgt-specific-xi.adb new file mode 100644 index 00000000000..9d179ff0e6b --- /dev/null +++ b/gcc/ada/mlib-tgt-specific-xi.adb @@ -0,0 +1,210 @@ +------------------------------------------------------------------------------ +-- -- +-- GNAT COMPILER COMPONENTS -- +-- -- +-- M L I B . T G T. S P E C I F I C -- +-- (Bare Board Version) -- +-- -- +-- B o d y -- +-- -- +-- Copyright (C) 2003-2007, Free Software Foundation, Inc. -- +-- -- +-- GNAT is free software; you can redistribute it and/or modify it under -- +-- terms of the GNU General Public License as published by the Free Soft- -- +-- ware Foundation; either version 3, or (at your option) any later ver- -- +-- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- +-- OUT 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 distributed with GNAT; see file COPYING3. If not, go to -- +-- http://www.gnu.org/licenses for a complete copy of the license. -- +-- -- +-- GNAT was originally developed by the GNAT team at New York University. -- +-- Extensive contributions were provided by Ada Core Technologies Inc. -- +-- -- +------------------------------------------------------------------------------ + +-- This is the bare board version of the body + +with Sdefault; +with Types; use Types; + +package body MLib.Tgt.Specific is + + ----------------------- + -- Local Subprograms -- + ----------------------- + + function Get_Target_Prefix return String; + -- Returns the required prefix for some utilities + -- (such as ar and ranlib) that depend on the real target. + + -- Non default subprograms + + function Archive_Builder return String; + + function Archive_Indexer return String; + + procedure Build_Dynamic_Library + (Ofiles : Argument_List; + Options : Argument_List; + Interfaces : Argument_List; + Lib_Filename : String; + Lib_Dir : String; + Symbol_Data : Symbol_Record; + Driver_Name : Name_Id := No_Name; + Lib_Version : String := ""; + Auto_Init : Boolean := False); + + function DLL_Ext return String; + + function Dynamic_Option return String; + + function Library_Major_Minor_Id_Supported return Boolean; + + function PIC_Option return String; + + function Standalone_Library_Auto_Init_Is_Supported return Boolean; + + function Support_For_Libraries return Library_Support; + + --------------------- + -- Archive_Builder -- + --------------------- + + function Archive_Builder return String is + begin + return Get_Target_Prefix & "ar"; + end Archive_Builder; + + --------------------- + -- Archive_Indexer -- + --------------------- + + function Archive_Indexer return String is + begin + return Get_Target_Prefix & "ranlib"; + end Archive_Indexer; + + --------------------------- + -- Build_Dynamic_Library -- + --------------------------- + + procedure Build_Dynamic_Library + (Ofiles : Argument_List; + Options : Argument_List; + Interfaces : Argument_List; + Lib_Filename : String; + Lib_Dir : String; + Symbol_Data : Symbol_Record; + Driver_Name : Name_Id := No_Name; + Lib_Version : String := ""; + Auto_Init : Boolean := False) + is + pragma Unreferenced (Ofiles); + pragma Unreferenced (Options); + pragma Unreferenced (Interfaces); + pragma Unreferenced (Lib_Filename); + pragma Unreferenced (Lib_Dir); + pragma Unreferenced (Symbol_Data); + pragma Unreferenced (Driver_Name); + pragma Unreferenced (Lib_Version); + pragma Unreferenced (Auto_Init); + + begin + null; + end Build_Dynamic_Library; + + ------------- + -- DLL_Ext -- + ------------- + + function DLL_Ext return String is + begin + return ""; + end DLL_Ext; + + -------------------- + -- Dynamic_Option -- + -------------------- + + function Dynamic_Option return String is + begin + return ""; + end Dynamic_Option; + + ----------------------- + -- Get_Target_Prefix -- + ----------------------- + + function Get_Target_Prefix return String is + Target_Name : constant String_Ptr := Sdefault.Target_Name; + Index : Positive := Target_Name'First; + + begin + while Index < Target_Name'Last + and then Target_Name (Index + 1) /= '-' + loop + Index := Index + 1; + end loop; + + if Target_Name (Target_Name'First .. Index) = "erc32" then + return "erc32-elf-"; + elsif Target_Name (Target_Name'First .. Index) = "leon" then + return "leon-elf-"; + elsif Target_Name (Target_Name'First .. Index) = "powerpc" then + return "powerpc-elf-"; + else + return ""; + end if; + end Get_Target_Prefix; + + -------------------------------------- + -- Library_Major_Minor_Id_Supported -- + -------------------------------------- + + function Library_Major_Minor_Id_Supported return Boolean is + begin + return False; + end Library_Major_Minor_Id_Supported; + + ---------------- + -- PIC_Option -- + ---------------- + + function PIC_Option return String is + begin + return ""; + end PIC_Option; + + ----------------------------------------------- + -- Standalone_Library_Auto_Init_Is_Supported -- + ----------------------------------------------- + + function Standalone_Library_Auto_Init_Is_Supported return Boolean is + begin + return False; + end Standalone_Library_Auto_Init_Is_Supported; + + --------------------------- + -- Support_For_Libraries -- + --------------------------- + + function Support_For_Libraries return Library_Support is + begin + return Static_Only; + end Support_For_Libraries; + +begin + Archive_Builder_Ptr := Archive_Builder'Access; + Archive_Indexer_Ptr := Archive_Indexer'Access; + Build_Dynamic_Library_Ptr := Build_Dynamic_Library'Access; + DLL_Ext_Ptr := DLL_Ext'Access; + Dynamic_Option_Ptr := Dynamic_Option'Access; + Library_Major_Minor_Id_Supported_Ptr := + Library_Major_Minor_Id_Supported'Access; + PIC_Option_Ptr := PIC_Option'Access; + Standalone_Library_Auto_Init_Is_Supported_Ptr := + Standalone_Library_Auto_Init_Is_Supported'Access; + Support_For_Libraries_Ptr := Support_For_Libraries'Access; +end MLib.Tgt.Specific; diff --git a/gcc/ada/mlib-tgt-vms.adb b/gcc/ada/mlib-tgt-vms_common.adb index 3d252e06f0a..6d79cd7e947 100644 --- a/gcc/ada/mlib-tgt-vms.adb +++ b/gcc/ada/mlib-tgt-vms_common.adb @@ -2,11 +2,11 @@ -- -- -- GNAT COMPILER COMPONENTS -- -- -- --- M L I B . T G T . V M S -- +-- M L I B . T G T . V M S _ C O M M O N -- -- -- -- B o d y -- -- -- --- Copyright (C) 2003-2007, Free Software Foundation, Inc. -- +-- Copyright (C) 2003-2008, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -25,7 +25,7 @@ -- This is the part of MLib.Tgt.Specific common to both VMS versions -package body MLib.Tgt.VMS is +package body MLib.Tgt.VMS_Common is -- Non default subprograms. See comments in mlib-tgt.ads @@ -152,4 +152,4 @@ begin Library_Major_Minor_Id_Supported_Ptr := Library_Major_Minor_Id_Supported'Access; -end MLib.Tgt.VMS; +end MLib.Tgt.VMS_Common; diff --git a/gcc/ada/mlib-tgt-vms.ads b/gcc/ada/mlib-tgt-vms_common.ads index 942d7253da5..8429b773123 100644 --- a/gcc/ada/mlib-tgt-vms.ads +++ b/gcc/ada/mlib-tgt-vms_common.ads @@ -2,11 +2,11 @@ -- -- -- GNAT COMPILER COMPONENTS -- -- -- --- M L I B . T G T . V M S -- +-- M L I B . T G T . V M S _ C O M M O N -- -- -- -- S p e c -- -- -- --- Copyright (C) 2007, Free Software Foundation, Inc. -- +-- Copyright (C) 2007-2008, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -25,6 +25,6 @@ -- This is the part of MLib.Tgt.Specific common to both VMS versions -package MLib.Tgt.VMS is +package MLib.Tgt.VMS_Common is pragma Elaborate_Body; -end MLib.Tgt.VMS; +end MLib.Tgt.VMS_Common; diff --git a/gcc/ada/mlib-utl.adb b/gcc/ada/mlib-utl.adb index 0381a4155e7..2eceb15db03 100644 --- a/gcc/ada/mlib-utl.adb +++ b/gcc/ada/mlib-utl.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 2002-2007, AdaCore -- +-- Copyright (C) 2002-2008, AdaCore -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -299,7 +299,7 @@ package body MLib.Utl is ----------------- procedure Delete_File (Filename : String) is - File : constant String := Filename & ASCII.Nul; + File : constant String := Filename & ASCII.NUL; Success : Boolean; begin diff --git a/gcc/ada/nlists.adb b/gcc/ada/nlists.adb index 768e130dce5..e809d15ebb6 100644 --- a/gcc/ada/nlists.adb +++ b/gcc/ada/nlists.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 1992-2007, Free Software Foundation, Inc. -- +-- Copyright (C) 1992-2008, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -604,7 +604,7 @@ package body Nlists is function Is_Non_Empty_List (List : List_Id) return Boolean is begin - return List /= No_List and then First (List) /= Empty; + return First (List) /= Empty; end Is_Non_Empty_List; ---------- diff --git a/gcc/ada/nlists.ads b/gcc/ada/nlists.ads index b3f6209ec52..75072e2b8a1 100644 --- a/gcc/ada/nlists.ads +++ b/gcc/ada/nlists.ads @@ -6,7 +6,7 @@ -- -- -- S p e c -- -- -- --- Copyright (C) 1992-2007, Free Software Foundation, Inc. -- +-- Copyright (C) 1992-2008, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -201,7 +201,7 @@ package Nlists is function Is_Empty_List (List : List_Id) return Boolean; pragma Inline (Is_Empty_List); -- This function determines if a given list id references a node list that - -- contains no items. No_List is a not a legitimate argument. + -- contains no items. No_List as an argument returns True. function Is_Non_Empty_List (List : List_Id) return Boolean; pragma Inline (Is_Non_Empty_List); diff --git a/gcc/ada/opt.adb b/gcc/ada/opt.adb index 64460f60ff6..859a4170ead 100644 --- a/gcc/ada/opt.adb +++ b/gcc/ada/opt.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 1992-2007, Free Software Foundation, Inc. -- +-- Copyright (C) 1992-2008, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -49,6 +49,7 @@ package body Opt is Ada_Version_Config := Ada_Version; Ada_Version_Explicit_Config := Ada_Version_Explicit; Assertions_Enabled_Config := Assertions_Enabled; + Check_Policy_List_Config := Check_Policy_List; Debug_Pragmas_Enabled_Config := Debug_Pragmas_Enabled; Dynamic_Elaboration_Checks_Config := Dynamic_Elaboration_Checks; Exception_Locations_Suppressed_Config := Exception_Locations_Suppressed; @@ -60,6 +61,12 @@ package body Opt is Persistent_BSS_Mode_Config := Persistent_BSS_Mode; Polling_Required_Config := Polling_Required; Use_VADS_Size_Config := Use_VADS_Size; + + -- Reset the indication that Optimize_Alignment was set locally, since + -- if we had a pragma in the config file, it would set this flag True, + -- but that's not a local setting. + + Optimize_Alignment_Local := False; end Register_Opt_Config_Switches; --------------------------------- @@ -71,6 +78,7 @@ package body Opt is Ada_Version := Save.Ada_Version; Ada_Version_Explicit := Save.Ada_Version_Explicit; Assertions_Enabled := Save.Assertions_Enabled; + Check_Policy_List := Save.Check_Policy_List; Debug_Pragmas_Enabled := Save.Debug_Pragmas_Enabled; Dynamic_Elaboration_Checks := Save.Dynamic_Elaboration_Checks; Exception_Locations_Suppressed := Save.Exception_Locations_Suppressed; @@ -79,6 +87,7 @@ package body Opt is External_Name_Imp_Casing := Save.External_Name_Imp_Casing; Fast_Math := Save.Fast_Math; Optimize_Alignment := Save.Optimize_Alignment; + Optimize_Alignment_Local := Save.Optimize_Alignment_Local; Persistent_BSS_Mode := Save.Persistent_BSS_Mode; Polling_Required := Save.Polling_Required; Use_VADS_Size := Save.Use_VADS_Size; @@ -93,6 +102,7 @@ package body Opt is Save.Ada_Version := Ada_Version; Save.Ada_Version_Explicit := Ada_Version_Explicit; Save.Assertions_Enabled := Assertions_Enabled; + Save.Check_Policy_List := Check_Policy_List; Save.Debug_Pragmas_Enabled := Debug_Pragmas_Enabled; Save.Dynamic_Elaboration_Checks := Dynamic_Elaboration_Checks; Save.Exception_Locations_Suppressed := Exception_Locations_Suppressed; @@ -101,6 +111,7 @@ package body Opt is Save.External_Name_Imp_Casing := External_Name_Imp_Casing; Save.Fast_Math := Fast_Math; Save.Optimize_Alignment := Optimize_Alignment; + Save.Optimize_Alignment_Local := Optimize_Alignment_Local; Save.Persistent_BSS_Mode := Persistent_BSS_Mode; Save.Polling_Required := Polling_Required; Save.Use_VADS_Size := Use_VADS_Size; @@ -131,6 +142,7 @@ package body Opt is Optimize_Alignment := 'O'; Persistent_BSS_Mode := False; Use_VADS_Size := False; + Optimize_Alignment_Local := True; -- For an internal unit, assertions/debug pragmas are off unless this -- is the main unit and they were explicitly enabled. @@ -138,26 +150,30 @@ package body Opt is if Main_Unit then Assertions_Enabled := Assertions_Enabled_Config; Debug_Pragmas_Enabled := Debug_Pragmas_Enabled_Config; + Check_Policy_List := Check_Policy_List_Config; else Assertions_Enabled := False; Debug_Pragmas_Enabled := False; + Check_Policy_List := Empty; end if; -- Case of non-internal unit else - Ada_Version := Ada_Version_Config; - Ada_Version_Explicit := Ada_Version_Explicit_Config; - Assertions_Enabled := Assertions_Enabled_Config; - Debug_Pragmas_Enabled := Debug_Pragmas_Enabled_Config; - Dynamic_Elaboration_Checks := Dynamic_Elaboration_Checks_Config; - Extensions_Allowed := Extensions_Allowed_Config; - External_Name_Exp_Casing := External_Name_Exp_Casing_Config; - External_Name_Imp_Casing := External_Name_Imp_Casing_Config; - Fast_Math := Fast_Math_Config; - Optimize_Alignment := Optimize_Alignment_Config; - Persistent_BSS_Mode := Persistent_BSS_Mode_Config; - Use_VADS_Size := Use_VADS_Size_Config; + Ada_Version := Ada_Version_Config; + Ada_Version_Explicit := Ada_Version_Explicit_Config; + Assertions_Enabled := Assertions_Enabled_Config; + Check_Policy_List := Check_Policy_List_Config; + Debug_Pragmas_Enabled := Debug_Pragmas_Enabled_Config; + Dynamic_Elaboration_Checks := Dynamic_Elaboration_Checks_Config; + Extensions_Allowed := Extensions_Allowed_Config; + External_Name_Exp_Casing := External_Name_Exp_Casing_Config; + External_Name_Imp_Casing := External_Name_Imp_Casing_Config; + Fast_Math := Fast_Math_Config; + Optimize_Alignment := Optimize_Alignment_Config; + Optimize_Alignment_Local := False; + Persistent_BSS_Mode := Persistent_BSS_Mode_Config; + Use_VADS_Size := Use_VADS_Size_Config; end if; Exception_Locations_Suppressed := Exception_Locations_Suppressed_Config; @@ -192,6 +208,7 @@ package body Opt is Tree_Read_Int (Assertions_Enabled_Config_Val); Tree_Read_Bool (All_Errors_Mode); Tree_Read_Bool (Assertions_Enabled); + Tree_Read_Int (Int (Check_Policy_List)); Tree_Read_Bool (Debug_Pragmas_Enabled); Tree_Read_Bool (Enable_Overflow_Checks); Tree_Read_Bool (Full_List); @@ -256,6 +273,7 @@ package body Opt is Tree_Write_Int (Boolean'Pos (Assertions_Enabled_Config)); Tree_Write_Bool (All_Errors_Mode); Tree_Write_Bool (Assertions_Enabled); + Tree_Write_Int (Int (Check_Policy_List)); Tree_Write_Bool (Debug_Pragmas_Enabled); Tree_Write_Bool (Enable_Overflow_Checks); Tree_Write_Bool (Full_List); diff --git a/gcc/ada/opt.ads b/gcc/ada/opt.ads index 5d28a344d33..65a9bb4bd8d 100644 --- a/gcc/ada/opt.ads +++ b/gcc/ada/opt.ads @@ -214,6 +214,12 @@ package Opt is -- GNATBIND -- Set to True to do checks only, no output of binder file + Check_Policy_List : Node_Id := Empty; + -- GNAT + -- This points to the list of N_Pragma nodes for Check_Policy pragmas + -- that are linked through the Next_Pragma fields, with the list being + -- terminated by Empty. The order is most recently processed first. + Check_Readonly_Files : Boolean := False; -- GNATMAKE -- Set to True to check readonly files during the make process @@ -400,7 +406,7 @@ package Opt is -- message routines generates one line of output as a separate message. -- If it is set to a non-zero value, then continuation lines are folded -- to make a single long message, and then this message is split up into - -- multiple lines not exceeding the specified length. Set by -gnatLnnn. + -- multiple lines not exceeding the specified length. Set by -gnatj=nn. Exception_Locations_Suppressed : Boolean := False; -- GNAT @@ -620,6 +626,10 @@ package Opt is -- generate code even in case of unsupported construct, so that the byte -- code can be used by static analysis tools. + Invalid_Value_Used : Boolean := False; + -- GNAT + -- Set True if a valid Invalid_Value attribute is encountered + Follow_Links_For_Files : Boolean := False; -- PROJECT MANAGER -- Set to True (-eL) to process the project files in trusted mode @@ -862,6 +872,14 @@ package Opt is -- Setting of Optimize_Alignment, set to T/S/O for time/space/off. Can -- be modified by use of pragma Optimize_Alignment. + Optimize_Alignment_Local : Boolean := False; + -- Set True if Optimize_Alignment mode is set by a local configuration + -- pragma that overrides the gnat.adc (or other configuration file) default + -- so that the unit is not dependent on the default setting. Also always + -- set True for internal units, since these always have a default setting + -- of Optimize_Alignment (Off) that is enforced (essentially equivalent to + -- them all having such an explicit pragma in each unit). + Original_Operating_Mode : Operating_Mode_Type := Generate_Code; -- GNAT -- Indicates the original operating mode of the compiler as set by @@ -870,7 +888,7 @@ package Opt is Optimization_Level : Int; pragma Import (C, Optimization_Level, "optimize"); - -- This constant reflects the optimization level (0,1,2 for -O0,-O1,-O2) + -- Constant reflecting the optimization level (0,1,2,3 for -O0,-O1,-O2,-O3) Output_File_Name_Present : Boolean := False; -- GNATBIND, GNAT, GNATMAKE, GPRMAKE @@ -1133,7 +1151,7 @@ package Opt is Upper_Half_Encoding : Boolean := False; -- GNAT, GNATBIND - -- Normally set False, indicating that upper half ASCII characters are + -- Normally set False, indicating that upper half ISO 8859-1 characters are -- used in the normal way to represent themselves. If the wide character -- encoding method uses the upper bit for this encoding, then this flag is -- set True, and upper half characters in the source indicate the start of @@ -1190,6 +1208,12 @@ package Opt is -- including warnings on Ada 2005 obsolescent features used in Ada 2005 -- mode. Set False by -gnatwY. + Warn_On_Parameter_Order : Boolean := False; + -- GNAT + -- Set to True to generate warnings for cases where the argument list for + -- a call is a sequence of identifiers that match the formal identifiers, + -- but are in the wrong order. + Warn_On_Assertion_Failure : Boolean := True; -- GNAT -- Set to True to activate warnings on assertions that can be determined @@ -1374,6 +1398,13 @@ package Opt is -- mode, as possibly set by the command line switch -gnata, and possibly -- modified by the use of the configuration pragma Assertion_Policy. + Check_Policy_List_Config : Node_Id; + -- GNAT + -- This points to the list of N_Pragma nodes for Check_Policy pragmas + -- that are linked through the Next_Pragma fields, with the list being + -- terminated by Empty. The order is most recently processed first. This + -- list includes only those pragmas in configuration pragma files. + Debug_Pragmas_Enabled_Config : Boolean; -- GNAT -- This is the value of the configuration switch for debug pragmas enabled @@ -1485,9 +1516,10 @@ package Opt is -- call to Save_Opt_Switches. procedure Register_Opt_Config_Switches; - -- This procedure is called after processing the gnat.adc file to record - -- the values of the Config switches, as possibly modified by the use of - -- command line switches and configuration pragmas. + -- This procedure is called after processing the gnat.adc file and other + -- configuration pragma files to record the values of the Config switches, + -- as possibly modified by the use of command line switches and pragmas + -- appearing in these files. ------------------------ -- Other Global Flags -- @@ -1564,6 +1596,7 @@ private Ada_Version : Ada_Version_Type; Ada_Version_Explicit : Ada_Version_Type; Assertions_Enabled : Boolean; + Check_Policy_List : Node_Id; Debug_Pragmas_Enabled : Boolean; Dynamic_Elaboration_Checks : Boolean; Exception_Locations_Suppressed : Boolean; @@ -1572,6 +1605,7 @@ private External_Name_Imp_Casing : External_Casing_Type; Fast_Math : Boolean; Optimize_Alignment : Character; + Optimize_Alignment_Local : Boolean; Persistent_BSS_Mode : Boolean; Polling_Required : Boolean; Use_VADS_Size : Boolean; diff --git a/gcc/ada/osint.adb b/gcc/ada/osint.adb index d7272025b94..b226802cf07 100644 --- a/gcc/ada/osint.adb +++ b/gcc/ada/osint.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 1992-2007, Free Software Foundation, Inc. -- +-- Copyright (C) 1992-2008, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -250,7 +250,11 @@ package body Osint is -- -- HKEY_LOCAL_MACHINE\SOFTWARE\Ada Core Technologies\ -- GNAT\Standard Libraries - -- Return an empty string on other systems + -- Return an empty string on other systems. + -- + -- Note that this is an undocumented legacy feature, and that it + -- works only when using the default runtime library (i.e. no --RTS= + -- command line switch). -------------------- -- Add_Search_Dir -- @@ -1874,6 +1878,31 @@ package body Osint is Res : String_Access; begin + -- GNAAMP tool names require special treatment + + if AAMP_On_Target then + + -- The name "gcc" is mapped to "gnaamp" (the compiler driver) + + if Nam = "gcc" then + return new String'("gnaamp"); + + -- Tool names starting with "gnat" are mapped by substituting the + -- string "gnaamp" for "gnat" (for example, "gnatpp" => "gnaamppp"). + + elsif Nam'Length >= 4 + and then Nam (Nam'First .. Nam'First + 3) = "gnat" + then + return new String'("gnaamp" & Nam (Nam'First + 4 .. Nam'Last)); + + -- No other mapping rules, so we continue and handle any other forms + -- of tool names the same as on other targets. + + else + null; + end if; + end if; + -- Get the name of the current program being executed Find_Program_Name; @@ -1976,19 +2005,30 @@ package body Osint is Curr := Curr + Actual_Len; end loop; - -- Process the file, translating line and file ending - -- control characters to a path separator character. + -- Process the file, dealing with path separators Prev_Was_Separator := True; Nb_Relative_Dir := 0; for J in 1 .. Len loop - if S (J) in ASCII.NUL .. ASCII.US or else S (J) = ' ' then + + -- Treat any control character as a path separator. Note that we do + -- not treat space as a path separator (we used to treat space as a + -- path separator in an earlier version). That way space can appear + -- as a legitimate character in a path name. + + -- Why do we treat all control characters as path separators??? + + if S (J) in ASCII.NUL .. ASCII.US then S (J) := Path_Separator; end if; + -- Test for explicit path separator (or control char as above) + if S (J) = Path_Separator then Prev_Was_Separator := True; + -- If not path separator, register use of relative directory + else if Prev_Was_Separator and then Is_Relative (S.all, J) then Nb_Relative_Dir := Nb_Relative_Dir + 1; diff --git a/gcc/ada/osint.ads b/gcc/ada/osint.ads index 80c516ede69..f2aed1ea03f 100644 --- a/gcc/ada/osint.ads +++ b/gcc/ada/osint.ads @@ -6,7 +6,7 @@ -- -- -- S p e c -- -- -- --- Copyright (C) 1992-2007, Free Software Foundation, Inc. -- +-- Copyright (C) 1992-2008, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -110,7 +110,9 @@ package Osint is -- cross compilation case, looks at the prefix of the current program being -- run and prepend it to Nam. For instance if the program being run is -- <target>-gnatmake and Nam is "gcc", the returned value will be a pointer - -- to "<target>-gcc". This function clobbers Name_Buffer and Name_Len. + -- to "<target>-gcc". In the specific case where AAMP_On_Target is set, the + -- name "gcc" is mapped to "gnaamp", and names of the form "gnat*" are + -- mapped to "gnaamp*". This function clobbers Name_Buffer and Name_Len. procedure Write_Program_Name; -- Writes name of program as invoked to the current output diff --git a/gcc/ada/par-ch11.adb b/gcc/ada/par-ch11.adb index 25fbb730b2e..412456e1a7e 100644 --- a/gcc/ada/par-ch11.adb +++ b/gcc/ada/par-ch11.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 1992-2007, Free Software Foundation, Inc. -- +-- Copyright (C) 1992-2008, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -94,6 +94,11 @@ package body Ch11 is begin Handler_Node := New_Node (N_Exception_Handler, Token_Ptr); Set_Local_Raise_Statements (Handler_Node, No_Elist); + + if Style_Check then + Style.Check_Indentation; + end if; + T_When; -- Test for possible choice parameter present diff --git a/gcc/ada/par-ch3.adb b/gcc/ada/par-ch3.adb index 3a6fc111032..8eb0e71975c 100644 --- a/gcc/ada/par-ch3.adb +++ b/gcc/ada/par-ch3.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 1992-2007, Free Software Foundation, Inc. -- +-- Copyright (C) 1992-2008, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -767,6 +767,10 @@ package body Ch3 is -- Interface else + if Token /= Tok_Interface then + Error_Msg_SC ("NEW or INTERFACE expected"); + end if; + Typedef_Node := P_Interface_Type_Definition (Abstract_Present); Abstract_Present := True; diff --git a/gcc/ada/par-prag.adb b/gcc/ada/par-prag.adb index 20375423f7f..5067f029c92 100644 --- a/gcc/ada/par-prag.adb +++ b/gcc/ada/par-prag.adb @@ -1053,7 +1053,9 @@ begin Pragma_Atomic | Pragma_Atomic_Components | Pragma_Attach_Handler | + Pragma_Check | Pragma_Check_Name | + Pragma_Check_Policy | Pragma_CIL_Constructor | Pragma_Compile_Time_Error | Pragma_Compile_Time_Warning | @@ -1141,6 +1143,8 @@ begin Pragma_Preelaborable_Initialization | Pragma_Polling | Pragma_Persistent_BSS | + Pragma_Postcondition | + Pragma_Precondition | Pragma_Preelaborate | Pragma_Preelaborate_05 | Pragma_Priority | @@ -1153,6 +1157,7 @@ begin Pragma_Pure_05 | Pragma_Pure_Function | Pragma_Queuing_Policy | + Pragma_Relative_Deadline | Pragma_Remote_Call_Interface | Pragma_Remote_Types | Pragma_Restricted_Run_Time | diff --git a/gcc/ada/prj-attr.adb b/gcc/ada/prj-attr.adb index c340b293244..d3ff283ada2 100644 --- a/gcc/ada/prj-attr.adb +++ b/gcc/ada/prj-attr.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 2001-2007, Free Software Foundation, Inc. -- +-- Copyright (C) 2001-2008, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -25,10 +25,13 @@ with Osint; with Prj.Com; use Prj.Com; -with System.Case_Util; use System.Case_Util; + +with GNAT.Case_Util; use GNAT.Case_Util; package body Prj.Attr is + use GNAT; + -- Data for predefined attributes and packages -- Names are in lower case and end with '#' @@ -74,6 +77,7 @@ package body Prj.Attr is "SVobject_dir#" & "SVexec_dir#" & "LVsource_dirs#" & + "Lainherit_source_path#" & "LVexcluded_source_dirs#" & -- Source files @@ -114,6 +118,7 @@ package body Prj.Attr is -- Configuration - Archives "LVarchive_builder#" & + "LVarchive_builder_append_option#" & "LVarchive_indexer#" & "SVarchive_suffix#" & "LVlibrary_partial_linker#" & diff --git a/gcc/ada/prj-attr.ads b/gcc/ada/prj-attr.ads index fd615b08604..473ea53dd8c 100644 --- a/gcc/ada/prj-attr.ads +++ b/gcc/ada/prj-attr.ads @@ -6,7 +6,7 @@ -- -- -- S p e c -- -- -- --- Copyright (C) 2001-2007, Free Software Foundation, Inc. -- +-- Copyright (C) 2001-2008, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -28,14 +28,13 @@ -- It is also possible to define new packages with their attributes -with System.Strings; with Table; -package Prj.Attr is +with GNAT.Strings; - use System; +package Prj.Attr is - function Package_Name_List return Strings.String_List; + function Package_Name_List return GNAT.Strings.String_List; -- Returns the list of valid package names, including those added by -- procedures Register_New_Package below. The String_Access components of -- the returned String_List should never be freed. @@ -55,6 +54,7 @@ package Prj.Attr is -- Characteristics of an attribute. Optional_Index indicates that there -- may be an optional index in the index of the associative array, as in -- for Switches ("files.ada" at 2) use ... + -- Above character literals should be documented ??? subtype Defined_Attribute_Kind is Attribute_Kind range Single .. Optional_Index_Case_Insensitive_Associative_Array; diff --git a/gcc/ada/prj-dect.adb b/gcc/ada/prj-dect.adb index 5fb13eaa27f..593874fad02 100644 --- a/gcc/ada/prj-dect.adb +++ b/gcc/ada/prj-dect.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 2001-2007, Free Software Foundation, Inc. -- +-- Copyright (C) 2001-2008, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -37,11 +37,11 @@ with Prj.Tree; use Prj.Tree; with Snames; with Uintp; use Uintp; -with System.Strings; +with GNAT.Strings; package body Prj.Dect is - use System; + use GNAT; type Zone is (In_Project, In_Package, In_Case_Construction); -- Used to indicate if we are parsing a package (In_Package), diff --git a/gcc/ada/prj-ext.adb b/gcc/ada/prj-ext.adb index 384fe104cb2..5a7e9b97896 100644 --- a/gcc/ada/prj-ext.adb +++ b/gcc/ada/prj-ext.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 2000-2007, Free Software Foundation, Inc. -- +-- Copyright (C) 2000-2008, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -260,19 +260,17 @@ package body Prj.Ext is Prefix := new String'(Executable_Prefix_Path); if Prefix.all /= "" then - if Get_Mode = Ada_Only then - Current_Project_Path := - new String'(Name_Buffer (1 .. Name_Len) & - Path_Separator & - Prefix.all & Directory_Separator & "gnat"); - - else - Current_Project_Path := - new String'(Name_Buffer (1 .. Name_Len) & - Path_Separator & - Prefix.all & Directory_Separator & - "share" & Directory_Separator & "gpr"); + if Get_Mode = Multi_Language then + Add_Str_To_Name_Buffer + (Path_Separator & Prefix.all & + Directory_Separator & "share" & + Directory_Separator & "gpr"); end if; + + Add_Str_To_Name_Buffer + (Path_Separator & Prefix.all & + Directory_Separator & "lib" & + Directory_Separator & "gnat"); end if; else diff --git a/gcc/ada/prj-nmsc.adb b/gcc/ada/prj-nmsc.adb index f5ff22b84cc..a3e9806bf17 100644 --- a/gcc/ada/prj-nmsc.adb +++ b/gcc/ada/prj-nmsc.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 2000-2007, Free Software Foundation, Inc. -- +-- Copyright (C) 2000-2008, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -610,7 +610,7 @@ package body Prj.Nmsc is Src_Data : Source_Data := No_Source_Data; begin - -- This is a new source. Create an entry for it in the Sources table. + -- This is a new source so create an entry for it in the Sources table Source_Data_Table.Increment_Last (In_Tree.Sources); Id := Source_Data_Table.Last (In_Tree.Sources); @@ -619,34 +619,41 @@ package body Prj.Nmsc is Write_Str ("Adding source #"); Write_Str (Id'Img); Write_Str (", File : "); + Write_Str (Get_Name_String (File_Name)); if Lang_Kind = Unit_Based then Write_Str (", Unit : "); Write_Str (Get_Name_String (Unit)); end if; - Write_Line (Get_Name_String (File_Name)); + Write_Eol; end if; Src_Data.Project := Project; Src_Data.Language_Name := Lang; Src_Data.Language := Lang_Id; Src_Data.Lang_Kind := Lang_Kind; + Src_Data.Compiled := In_Tree.Languages_Data.Table + (Lang_Id).Config.Compiler_Driver /= + Empty_File_Name; Src_Data.Kind := Kind; Src_Data.Alternate_Languages := Alternate_Languages; Src_Data.Other_Part := Other_Part; Src_Data.Unit := Unit; Src_Data.Index := Index; Src_Data.File := File_Name; - Src_Data.Object := Object_Name (File_Name); Src_Data.Display_File := Display_File; - Src_Data.Dependency := - In_Tree.Languages_Data.Table (Lang_Id).Config.Dependency_Kind; - Src_Data.Dep_Name := - Dependency_Name (File_Name, Src_Data.Dependency); - Src_Data.Switches := Switches_Name (File_Name); + Src_Data.Dependency := In_Tree.Languages_Data.Table + (Lang_Id).Config.Dependency_Kind; Src_Data.Naming_Exception := Naming_Exception; + if Src_Data.Compiled then + Src_Data.Object := Object_Name (File_Name); + Src_Data.Dep_Name := + Dependency_Name (File_Name, Src_Data.Dependency); + Src_Data.Switches := Switches_Name (File_Name); + end if; + if Path /= No_Path then Src_Data.Path := Path; Src_Data.Display_Path := Display_Path; @@ -732,6 +739,15 @@ package body Prj.Nmsc is Check_Programming_Languages (In_Tree, Project, Data); + if Data.Qualifier = Dry and then Data.Source_Dirs /= Nil_String then + Error_Msg + (Project, + In_Tree, + "an abstract project need to have no language, no sources or no " & + "source directories", + Data.Location); + end if; + -- Check configuration in multi language mode if Must_Check_Configuration then @@ -1475,14 +1491,6 @@ package body Prj.Nmsc is Get_Name_String (Element.Value.Value); - if Name_Len = 0 then - Error_Msg - (Project, - In_Tree, - "compiler driver name cannot be empty", - Element.Value.Location); - end if; - In_Tree.Languages_Data.Table (Lang_Index).Config.Compiler_Driver := File_Name_Type (Element.Value.Value); @@ -1893,6 +1901,20 @@ package body Prj.Nmsc is From_List => List, In_Tree => In_Tree); + elsif Attribute.Name = Name_Archive_Builder_Append_Option then + + -- Attribute Archive_Builder: the archive builder + -- (usually "ar") and its minimum options (usually "cr"). + + List := Attribute.Value.Values; + + if List /= Nil_String then + Put + (Into_List => Data.Config.Archive_Builder_Append_Option, + From_List => List, + In_Tree => In_Tree); + end if; + elsif Attribute.Name = Name_Archive_Indexer then -- Attribute Archive_Indexer: the optional archive @@ -2043,9 +2065,9 @@ package body Prj.Nmsc is Error_Msg (Project, In_Tree, - "invalid value """ & - Get_Name_String (Attribute.Value.Value) & - """ for Symbolic_Link_Supported", + "invalid value """ + & Get_Name_String (Attribute.Value.Value) + & """ for Symbolic_Link_Supported", Attribute.Value.Location); end; @@ -2069,29 +2091,24 @@ package body Prj.Nmsc is Attribute.Value.Location); end; - elsif - Attribute.Name = Name_Library_Auto_Init_Supported - then + elsif Attribute.Name = Name_Library_Auto_Init_Supported then declare pragma Unsuppress (All_Checks); begin Data.Config.Auto_Init_Supported := - Boolean'Value (Get_Name_String - (Attribute.Value.Value)); + Boolean'Value (Get_Name_String (Attribute.Value.Value)); exception when Constraint_Error => Error_Msg (Project, In_Tree, - "invalid value """ & - Get_Name_String (Attribute.Value.Value) & - """ for Library_Auto_Init_Supported", + "invalid value """ + & Get_Name_String (Attribute.Value.Value) + & """ for Library_Auto_Init_Supported", Attribute.Value.Location); end; - elsif - Attribute.Name = Name_Shared_Library_Minimum_Switches - then + elsif Attribute.Name = Name_Shared_Library_Minimum_Switches then List := Attribute.Value.Values; if List /= Nil_String then @@ -2100,9 +2117,7 @@ package body Prj.Nmsc is In_Tree => In_Tree); end if; - elsif - Attribute.Name = Name_Library_Version_Switches - then + elsif Attribute.Name = Name_Library_Version_Switches then List := Attribute.Value.Values; if List /= Nil_String then @@ -2126,6 +2141,7 @@ package body Prj.Nmsc is Current_Array : Array_Data; Element_Id : Array_Element_Id; Element : Array_Element; + List : String_List_Id; begin -- Process the associative array attributes at project level @@ -2144,6 +2160,19 @@ package body Prj.Nmsc is if Lang_Index /= No_Language_Index then case Current_Array.Name is + when Name_Inherit_Source_Path => + List := Element.Value.Values; + + if List /= Nil_String then + Put + (Into_List => + In_Tree.Languages_Data.Table (Lang_Index). + Config.Include_Compatible_Languages, + From_List => List, + In_Tree => In_Tree, + Lower_Case => True); + end if; + when Name_Toolchain_Description => -- Attribute Toolchain_Description (<language>) @@ -2613,6 +2642,14 @@ package body Prj.Nmsc is end if; end if; + -- A virtual project extending an externally built project is itself + -- externally built. + + if Data.Virtual and then Data.Extends /= No_Project then + Data.Externally_Built := + In_Tree.Projects.Table (Data.Extends).Externally_Built; + end if; + if Current_Verbosity = High then Write_Str ("Project is "); @@ -2946,12 +2983,12 @@ package body Prj.Nmsc is else Error_Msg_Name_1 := Unit; - + Error_Msg_Name_2 := + In_Tree.Projects.Table (Other_Project).Name; Error_Msg (Project, In_Tree, - "unit%% cannot belong to two projects " & - "simultaneously", + "%% is already a source of project %%", Element.Value.Location); end if; end if; @@ -3534,6 +3571,8 @@ package body Prj.Nmsc is Support_For_Libraries : Library_Support; + Library_Directory_Present : Boolean; + procedure Check_Library (Proj : Project_Id; Extends : Boolean); -- Check if an imported or extended project if also a library project @@ -3543,17 +3582,30 @@ package body Prj.Nmsc is procedure Check_Library (Proj : Project_Id; Extends : Boolean) is Proj_Data : Project_Data; + Src_Id : Source_Id; + Src : Source_Data; begin if Proj /= No_Project then Proj_Data := In_Tree.Projects.Table (Proj); if not Proj_Data.Library then + -- The only not library projects that are OK are those that - -- have no sources. + -- have no sources. However, header files from non-Ada + -- languages are OK, as there is nothing to compile. + + Src_Id := Proj_Data.First_Source; + while Src_Id /= No_Source loop + Src := In_Tree.Sources.Table (Src_Id); + + exit when Src.Lang_Kind /= File_Based + or else Src.Kind /= Spec; - if Proj_Data.Source_Dirs /= Nil_String then + Src_Id := Src.Next_In_Project; + end loop; + if Src_Id /= No_Source then Error_Msg_Name_1 := Data.Name; Error_Msg_Name_2 := Proj_Data.Name; @@ -3608,6 +3660,8 @@ package body Prj.Nmsc is -- Start of processing for Check_Library_Attributes begin + Library_Directory_Present := Lib_Dir.Value /= Empty_String; + -- Special case of extending project if Data.Extends /= No_Project then @@ -3621,17 +3675,34 @@ package body Prj.Nmsc is -- directory is specified. if Extended_Data.Library then - if Lib_Name.Default then - Data.Library_Name := Extended_Data.Library_Name; - end if; + if Data.Qualifier = Standard then + Error_Msg + (Project, In_Tree, + "a standard project cannot extend a library project", + Data.Location); - if Lib_Dir.Default then - if not Data.Virtual then - Error_Msg - (Project, In_Tree, - "a project extending a library project must " & - "specify an attribute Library_Dir", - Data.Location); + else + if Lib_Name.Default then + Data.Library_Name := Extended_Data.Library_Name; + end if; + + if Lib_Dir.Default then + if not Data.Virtual then + Error_Msg + (Project, In_Tree, + "a project extending a library project must " & + "specify an attribute Library_Dir", + Data.Location); + + else + -- For a virtual project extending a library project, + -- inherit library directory. + + Data.Library_Dir := Extended_Data.Library_Dir; + Data.Display_Library_Dir := + Extended_Data.Display_Library_Dir; + Library_Directory_Present := True; + end if; end if; end if; end if; @@ -3662,24 +3733,26 @@ package body Prj.Nmsc is pragma Assert (Lib_Dir.Kind = Single); - if Lib_Dir.Value = Empty_String then + if not Library_Directory_Present then if Current_Verbosity = High then Write_Line ("No library directory"); end if; else - -- Find path name, check that it is a directory + -- Find path name (unless inherited), check that it is a directory - Locate_Directory - (Project, - In_Tree, - File_Name_Type (Lib_Dir.Value), - Data.Display_Directory, - Data.Library_Dir, - Data.Display_Library_Dir, - Create => "library", - Current_Dir => Current_Dir, - Location => Lib_Dir.Location); + if Data.Library_Dir = No_Path then + Locate_Directory + (Project, + In_Tree, + File_Name_Type (Lib_Dir.Value), + Data.Display_Directory, + Data.Library_Dir, + Data.Display_Library_Dir, + Create => "library", + Current_Dir => Current_Dir, + Location => Lib_Dir.Location); + end if; if Data.Library_Dir = No_Path then @@ -3817,6 +3890,30 @@ package body Prj.Nmsc is and then Data.Library_Name /= No_Name; + if Data.Extends = No_Project then + case Data.Qualifier is + when Standard => + if Data.Library then + Error_Msg + (Project, In_Tree, + "a standard project cannot be a library project", + Lib_Name.Location); + end if; + + when Library => + if not Data.Library then + Error_Msg + (Project, In_Tree, + "not a library project", + Data.Location); + end if; + + when others => + null; + + end case; + end if; + if Data.Library then if Get_Mode = Multi_Language then Support_For_Libraries := Data.Config.Lib_Support; @@ -4426,6 +4523,14 @@ package body Prj.Nmsc is if Current = Nil_String then Data.Source_Dirs := Nil_String; + if Data.Qualifier = Standard then + Error_Msg + (Project, + In_Tree, + "a standard project cannot have no language declared", + Languages.Location); + end if; + else -- Look through all the languages specified in attribute -- Languages. @@ -6259,6 +6364,20 @@ package body Prj.Nmsc is end if; end if; end if; + + elsif Subdirs /= null then + Name_Len := 1; + Name_Buffer (1) := '.'; + Locate_Directory + (Project, + In_Tree, + Name_Find, + Data.Display_Directory, + Data.Object_Directory, + Data.Display_Object_Dir, + Create => "object", + Location => Object_Dir.Location, + Current_Dir => Current_Dir); end if; if Current_Verbosity = High then @@ -6291,7 +6410,7 @@ package body Prj.Nmsc is Exec_Dir.Location); else - -- We check that the specified object directory does exist + -- We check that the specified exec directory does exist Locate_Directory (Project, @@ -6337,6 +6456,14 @@ package body Prj.Nmsc is then Data.Source_Dirs := Nil_String; + if Data.Qualifier = Standard then + Error_Msg + (Project, + In_Tree, + "a standard project cannot have no sources", + Source_Files.Location); + end if; + if Data.Extends = No_Project and then Data.Object_Directory = Data.Directory then @@ -6368,6 +6495,13 @@ package body Prj.Nmsc is end if; elsif Source_Dirs.Values = Nil_String then + if Data.Qualifier = Standard then + Error_Msg + (Project, + In_Tree, + "a standard project cannot have no source directories", + Source_Dirs.Location); + end if; -- If Source_Dirs is an empty string list, this means that this -- project contains no source. For projects that don't extend other @@ -6940,8 +7074,6 @@ package body Prj.Nmsc is Current_Dir : String; Location : Source_Ptr := No_Location) is - The_Name : String := Get_Name_String (Name); - The_Parent : constant String := Get_Name_String (Parent) & Directory_Separator; @@ -6950,18 +7082,35 @@ package body Prj.Nmsc is Full_Name : File_Name_Type; + The_Name : File_Name_Type; + begin + Get_Name_String (Name); + + -- Add Subdirs.all if it is a directory that may be created and + -- Subdirs is not null; + + if Create /= "" and then Subdirs /= null then + if Name_Buffer (Name_Len) /= Directory_Separator then + Add_Char_To_Name_Buffer (Directory_Separator); + end if; + + Add_Str_To_Name_Buffer (Subdirs.all); + end if; + -- Convert '/' to directory separator (for Windows) - for J in The_Name'Range loop - if The_Name (J) = '/' then - The_Name (J) := Directory_Separator; + for J in 1 .. Name_Len loop + if Name_Buffer (J) = '/' then + Name_Buffer (J) := Directory_Separator; end if; end loop; + The_Name := Name_Find; + if Current_Verbosity = High then Write_Str ("Locate_Directory ("""); - Write_Str (The_Name); + Write_Str (Get_Name_String (The_Name)); Write_Str (""", """); Write_Str (The_Parent); Write_Line (""")"); @@ -6970,14 +7119,14 @@ package body Prj.Nmsc is Dir := No_Path; Display := No_Path; - if Is_Absolute_Path (The_Name) then - Full_Name := Name; + if Is_Absolute_Path (Get_Name_String (The_Name)) then + Full_Name := The_Name; else Name_Len := 0; Add_Str_To_Name_Buffer (The_Parent (The_Parent'First .. The_Parent_Last)); - Add_Str_To_Name_Buffer (The_Name); + Add_Str_To_Name_Buffer (Get_Name_String (The_Name)); Full_Name := Name_Find; end if; @@ -6985,7 +7134,8 @@ package body Prj.Nmsc is Full_Path_Name : constant String := Get_Name_String (Full_Name); begin - if Setup_Projects and then Create'Length > 0 + if (Setup_Projects or else Subdirs /= null) + and then Create'Length > 0 and then not Is_Directory (Full_Path_Name) then begin @@ -7331,7 +7481,7 @@ package body Prj.Nmsc is and then Lang = Ada_Language_Index and then Data.Extends = No_Project then - -- We should have found at least one source. If not, report an error. + -- We should have found at least one source, if not report an error if Data.Ada_Sources = Nil_String then Report_No_Sources @@ -7979,8 +8129,10 @@ package body Prj.Nmsc is Kind => Kind); if Language = No_Language_Index then + + -- A file name in a list must be a source of a language + if Name_Loc.Found then - -- A file name in a list must be a source of a language. Error_Msg_File_1 := File_Name; Error_Msg (Project, @@ -8045,9 +8197,24 @@ package body Prj.Nmsc is Error_Msg_Name_1 := Unit; Error_Msg (Project, In_Tree, - "unit %% cannot belong to " & - "several projects", + "unit %% cannot belong to several projects", No_Location); + + Error_Msg_Name_1 := In_Tree.Projects.Table (Project).Name; + Error_Msg_Name_2 := Name_Id (Display_Path_Id); + Error_Msg + (Project, In_Tree, + "\ project %%, %%", + No_Location); + + Error_Msg_Name_1 := + In_Tree.Projects.Table (Src_Data.Project).Name; + Error_Msg_Name_2 := Name_Id (Src_Data.Display_Path); + Error_Msg + (Project, In_Tree, + "\ project %%, %%", + No_Location); + Add_Src := False; end if; end if; @@ -8847,7 +9014,7 @@ package body Prj.Nmsc is Err_Vars.Error_Msg_Name_1 := Unit_Name; Error_Msg - (Project, In_Tree, "duplicate source %%", The_Location); + (Project, In_Tree, "duplicate unit %%", The_Location); Err_Vars.Error_Msg_Name_1 := In_Tree.Projects.Table diff --git a/gcc/ada/prj-part.adb b/gcc/ada/prj-part.adb index a7864c5df81..00f3c32ba3c 100644 --- a/gcc/ada/prj-part.adb +++ b/gcc/ada/prj-part.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 2001-2007, Free Software Foundation, Inc. -- +-- Copyright (C) 2001-2008, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -945,6 +945,9 @@ package body Prj.Part is Project_Comment_State : Tree.Comment_State; + Proj_Qualifier : Project_Qualifier := Unspecified; + Qualifier_Location : Source_Ptr; + begin Extends_All := False; @@ -1119,8 +1122,63 @@ package body Prj.Part is Project_Stack.Table (Project_Stack.Last).Id := Project; Set_Directory_Of (Project, In_Tree, Project_Directory); Set_Path_Name_Of (Project, In_Tree, Normed_Path_Name); - Set_Location_Of (Project, In_Tree, Token_Ptr); Set_First_With_Clause_Of (Project, In_Tree, Imported_Projects); + + -- Check if there is a qualifier before the reserved word "project" + + Qualifier_Location := Token_Ptr; + + if Token = Tok_Abstract then + Proj_Qualifier := Dry; + Scan (In_Tree); + + elsif Token = Tok_Identifier then + case Token_Name is + when Snames.Name_Standard => + Proj_Qualifier := Standard; + Scan (In_Tree); + + when Snames.Name_Aggregate => + Proj_Qualifier := Aggregate; + Scan (In_Tree); + + if Token = Tok_Identifier and then + Token_Name = Snames.Name_Library + then + Proj_Qualifier := Aggregate_Library; + Scan (In_Tree); + end if; + + when Snames.Name_Library => + Proj_Qualifier := Library; + Scan (In_Tree); + + when Snames.Name_Configuration => + if not In_Configuration then + Error_Msg ("configuration projects cannot belong to a user" & + " project tree", + Token_Ptr); + end if; + + Scan (In_Tree); + + when others => + null; + end case; + end if; + + if Proj_Qualifier /= Unspecified then + if In_Configuration then + Error_Msg ("a configuration project cannot be qualified except " & + "as configuration project", + Qualifier_Location); + end if; + + Set_Project_Qualifier_Of (Project, In_Tree, Proj_Qualifier); + end if; + + Set_Location_Of (Project, In_Tree, Token_Ptr); + Expect (Tok_Project, "PROJECT"); -- Mark location of PROJECT token if present @@ -1780,7 +1838,7 @@ package body Prj.Part is begin if Current_Verbosity = High then Write_Str (" Trying "); - Write_Str (Path); + Write_Line (Path); end if; return Locate_Regular_File diff --git a/gcc/ada/prj-pp.adb b/gcc/ada/prj-pp.adb index c8dc931a982..db2a655748f 100644 --- a/gcc/ada/prj-pp.adb +++ b/gcc/ada/prj-pp.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 2001-2007, Free Software Foundation, Inc. -- +-- Copyright (C) 2001-2008, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -73,7 +73,9 @@ package body Prj.PP is W_Char : Write_Char_Ap := null; W_Eol : Write_Eol_Ap := null; W_Str : Write_Str_Ap := null; - Backward_Compatibility : Boolean) + Backward_Compatibility : Boolean; + Id : Prj.Project_Id := Prj.No_Project; + Id_Tree : Prj.Project_Tree_Ref := null) is procedure Print (Node : Project_Node_Id; Indent : Natural); -- A recursive procedure that traverses a project file tree and outputs @@ -335,7 +337,12 @@ package body Prj.PP is Print (First_Comment_Before (Node, In_Tree), Indent); Start_Line (Indent); Write_String ("project "); - Output_Name (Name_Of (Node, In_Tree)); + + if Id /= Prj.No_Project then + Output_Name (Id_Tree.Projects.Table (Id).Display_Name); + else + Output_Name (Name_Of (Node, In_Tree)); + end if; -- Check if this project extends another project @@ -363,7 +370,13 @@ package body Prj.PP is Indent + Increment); Start_Line (Indent); Write_String ("end "); - Output_Name (Name_Of (Node, In_Tree)); + + if Id /= Prj.No_Project then + Output_Name (Id_Tree.Projects.Table (Id).Display_Name); + else + Output_Name (Name_Of (Node, In_Tree)); + end if; + Write_Line (";"); Print (First_Comment_After_End (Node, In_Tree), Indent); diff --git a/gcc/ada/prj-pp.ads b/gcc/ada/prj-pp.ads index 61abba8c5e4..7d599f406d8 100644 --- a/gcc/ada/prj-pp.ads +++ b/gcc/ada/prj-pp.ads @@ -6,7 +6,7 @@ -- -- -- S p e c -- -- -- --- Copyright (C) 2001-2007, Free Software Foundation, Inc. -- +-- Copyright (C) 2001-2008, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -52,7 +52,9 @@ package Prj.PP is W_Char : Write_Char_Ap := null; W_Eol : Write_Eol_Ap := null; W_Str : Write_Str_Ap := null; - Backward_Compatibility : Boolean); + Backward_Compatibility : Boolean; + Id : Prj.Project_Id := Prj.No_Project; + Id_Tree : Prj.Project_Tree_Ref := null); -- Output a project file, using either the default output routines, or the -- ones specified by W_Char, W_Eol and W_Str. -- @@ -73,6 +75,9 @@ package Prj.PP is -- Spec_Suffix, Body, Body_Suffix) will be replaced by obsolete ones -- (Specification, Specification_Suffix, Implementation, -- Implementation_Suffix). + -- + -- Id is used to compute the display name of the project including its + -- proper casing. private diff --git a/gcc/ada/prj-proc.adb b/gcc/ada/prj-proc.adb index c0554223a31..638bf18ca48 100644 --- a/gcc/ada/prj-proc.adb +++ b/gcc/ada/prj-proc.adb @@ -1621,8 +1621,11 @@ package body Prj.Proc is if Next_Element = No_Array_Element then Array_Element_Table.Increment_Last (In_Tree.Array_Elements); - New_Element := Array_Element_Table.Last - (In_Tree.Array_Elements); + New_Element := + Array_Element_Table.Last + (In_Tree.Array_Elements); + In_Tree.Array_Elements.Table + (Prev_Element).Next := New_Element; else New_Element := Next_Element; @@ -1636,8 +1639,7 @@ package body Prj.Proc is In_Tree.Array_Elements.Table (New_Element) := - In_Tree.Array_Elements.Table - (Orig_Element); + In_Tree.Array_Elements.Table (Orig_Element); In_Tree.Array_Elements.Table (New_Element).Value.Project := Project; @@ -1872,9 +1874,7 @@ package body Prj.Proc is else In_Tree.Variable_Elements.Table - (The_Variable).Value := - New_Value; - + (The_Variable).Value := New_Value; end if; -- Associative array attribute @@ -2524,7 +2524,11 @@ package body Prj.Proc is Processed_Projects.Set (Name, Project); Processed_Data.Name := Name; + Processed_Data.Qualifier := + Project_Qualifier_Of (From_Project_Node, From_Project_Node_Tree); In_Tree.Projects.Table (Project).Name := Name; + In_Tree.Projects.Table (Project).Qualifier := + Processed_Data.Qualifier; Get_Name_String (Name); @@ -2786,6 +2790,8 @@ package body Prj.Proc is end if; end if; end; + + In_Tree.Projects.Table (Project) := Processed_Data; end if; -- Process limited withed projects diff --git a/gcc/ada/prj-tree.adb b/gcc/ada/prj-tree.adb index db32e4a0a07..83ee5f936b6 100644 --- a/gcc/ada/prj-tree.adb +++ b/gcc/ada/prj-tree.adb @@ -108,6 +108,7 @@ package body Prj.Tree is In_Tree.Project_Nodes.Table (Project_Node_Table.Last (In_Tree.Project_Nodes)) := (Kind => N_Comment_Zones, + Qualifier => Unspecified, Expr_Kind => Undefined, Location => No_Location, Directory => No_Path, @@ -153,6 +154,7 @@ package body Prj.Tree is In_Tree.Project_Nodes.Table (Project_Node_Table.Last (In_Tree.Project_Nodes)) := (Kind => N_Comment, + Qualifier => Unspecified, Expr_Kind => Undefined, Flag1 => Comments.Table (J).Follows_Empty_Line, Flag2 => @@ -321,6 +323,7 @@ package body Prj.Tree is Zone := Project_Node_Table.Last (In_Tree.Project_Nodes); In_Tree.Project_Nodes.Table (Zone) := (Kind => N_Comment_Zones, + Qualifier => Unspecified, Location => No_Location, Directory => No_Path, Expr_Kind => Undefined, @@ -395,6 +398,7 @@ package body Prj.Tree is In_Tree.Project_Nodes.Table (Project_Node_Table.Last (In_Tree.Project_Nodes)) := (Kind => Of_Kind, + Qualifier => Unspecified, Location => No_Location, Directory => No_Path, Expr_Kind => And_Expr_Kind, @@ -429,6 +433,7 @@ package body Prj.Tree is In_Tree.Project_Nodes.Table (Project_Node_Table.Last (In_Tree.Project_Nodes)) := (Kind => N_Comment_Zones, + Qualifier => Unspecified, Expr_Kind => Undefined, Location => No_Location, Directory => No_Path, @@ -458,6 +463,7 @@ package body Prj.Tree is In_Tree.Project_Nodes.Table (Project_Node_Table.Last (In_Tree.Project_Nodes)) := (Kind => N_Comment, + Qualifier => Unspecified, Expr_Kind => Undefined, Flag1 => Comments.Table (J).Follows_Empty_Line, Flag2 => @@ -1352,6 +1358,22 @@ package body Prj.Tree is return In_Tree.Project_Nodes.Table (Node).Field2; end Project_Declaration_Of; + -------------------------- + -- Project_Qualifier_Of -- + -------------------------- + + function Project_Qualifier_Of + (Node : Project_Node_Id; + In_Tree : Project_Node_Tree_Ref) return Project_Qualifier + is + begin + pragma Assert + (Node /= Empty_Node + and then + In_Tree.Project_Nodes.Table (Node).Kind = N_Project); + return In_Tree.Project_Nodes.Table (Node).Qualifier; + end Project_Qualifier_Of; + ------------------------------------------- -- Project_File_Includes_Unkept_Comments -- ------------------------------------------- @@ -2467,6 +2489,22 @@ package body Prj.Tree is In_Tree.Project_Nodes.Table (Node).Field2 := To; end Set_Project_Declaration_Of; + ------------------------------ + -- Set_Project_Qualifier_Of -- + ------------------------------ + + procedure Set_Project_Qualifier_Of + (Node : Project_Node_Id; + In_Tree : Project_Node_Tree_Ref; + To : Project_Qualifier) + is + begin + pragma Assert + (Node /= Empty_Node + and then In_Tree.Project_Nodes.Table (Node).Kind = N_Project); + In_Tree.Project_Nodes.Table (Node).Qualifier := To; + end Set_Project_Qualifier_Of; + ----------------------------------------------- -- Set_Project_File_Includes_Unkept_Comments -- ----------------------------------------------- diff --git a/gcc/ada/prj-tree.ads b/gcc/ada/prj-tree.ads index 19d600f4f6c..9649adddec8 100644 --- a/gcc/ada/prj-tree.ads +++ b/gcc/ada/prj-tree.ads @@ -6,7 +6,7 @@ -- -- -- S p e c -- -- -- --- Copyright (C) 2001-2007, Free Software Foundation, Inc. -- +-- Copyright (C) 2001-2008, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -344,6 +344,12 @@ package Prj.Tree is pragma Inline (Project_Declaration_Of); -- Only valid for N_Project nodes + function Project_Qualifier_Of + (Node : Project_Node_Id; + In_Tree : Project_Node_Tree_Ref) return Project_Qualifier; + pragma Inline (Project_Qualifier_Of); + -- Only valid for N_Project nodes + function Extending_Project_Of (Node : Project_Node_Id; In_Tree : Project_Node_Tree_Ref) return Project_Node_Id; @@ -694,6 +700,12 @@ package Prj.Tree is To : Project_Node_Id); pragma Inline (Set_Project_Declaration_Of); + procedure Set_Project_Qualifier_Of + (Node : Project_Node_Id; + In_Tree : Project_Node_Tree_Ref; + To : Project_Qualifier); + pragma Inline (Set_Project_Qualifier_Of); + procedure Set_Extending_Project_Of (Node : Project_Node_Id; In_Tree : Project_Node_Tree_Ref; @@ -912,6 +924,8 @@ package Prj.Tree is Kind : Project_Node_Kind; + Qualifier : Project_Qualifier := Unspecified; + Location : Source_Ptr := No_Location; Directory : Path_Name_Type := No_Path; diff --git a/gcc/ada/prj-util.adb b/gcc/ada/prj-util.adb index c41c3da25ad..2f953a36018 100644 --- a/gcc/ada/prj-util.adb +++ b/gcc/ada/prj-util.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 2001-2007, Free Software Foundation, Inc. -- +-- Copyright (C) 2001-2008, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -109,7 +109,8 @@ package body Prj.Util is In_Tree : Project_Tree_Ref; Main : File_Name_Type; Index : Int; - Ada_Main : Boolean := True) return File_Name_Type + Ada_Main : Boolean := True; + Language : String := "") return File_Name_Type is pragma Assert (Project /= No_Project); @@ -136,13 +137,55 @@ package body Prj.Util is Naming : constant Naming_Data := In_Tree.Projects.Table (Project).Naming; - Body_Suffix : constant String := - Body_Suffix_Of (In_Tree, "ada", Naming); + Spec_Suffix : Name_Id := No_Name; + Body_Suffix : Name_Id := No_Name; - Spec_Suffix : constant String := - Spec_Suffix_Of (In_Tree, "ada", Naming); + Spec_Suffix_Length : Natural := 0; + Body_Suffix_Length : Natural := 0; + + procedure Get_Suffixes + (B_Suffix : String; + S_Suffix : String); + -- Get the non empty suffixes in variables Spec_Suffix and Body_Suffix + + ------------------ + -- Get_Suffixes -- + ------------------ + + procedure Get_Suffixes + (B_Suffix : String; + S_Suffix : String) + is + begin + if B_Suffix'Length > 0 then + Name_Len := B_Suffix'Length; + Name_Buffer (1 .. Name_Len) := B_Suffix; + Body_Suffix := Name_Find; + Body_Suffix_Length := B_Suffix'Length; + end if; + + if S_Suffix'Length > 0 then + Name_Len := S_Suffix'Length; + Name_Buffer (1 .. Name_Len) := S_Suffix; + Spec_Suffix := Name_Find; + Spec_Suffix_Length := S_Suffix'Length; + end if; + end Get_Suffixes; + + -- Start of processing for Executable_Of begin + if Ada_Main then + Get_Suffixes + (B_Suffix => Body_Suffix_Of (In_Tree, "ada", Naming), + S_Suffix => Spec_Suffix_Of (In_Tree, "ada", Naming)); + + elsif Language /= "" then + Get_Suffixes + (B_Suffix => Body_Suffix_Of (In_Tree, Language, Naming), + S_Suffix => Spec_Suffix_Of (In_Tree, Language, Naming)); + end if; + if Builder_Package /= No_Package then if Get_Mode = Multi_Language then Executable_Suffix_Name := @@ -176,21 +219,21 @@ package body Prj.Util is Truncated : Boolean := False; begin - if Last > Body_Suffix'Length - and then Name (Last - Body_Suffix'Length + 1 .. Last) = - Body_Suffix + if Last > Natural (Length_Of_Name (Body_Suffix)) + and then Name (Last - Body_Suffix_Length + 1 .. Last) = + Get_Name_String (Body_Suffix) then Truncated := True; - Last := Last - Body_Suffix'Length; + Last := Last - Body_Suffix_Length; end if; if not Truncated - and then Last > Spec_Suffix'Length - and then Name (Last - Spec_Suffix'Length + 1 .. Last) = - Spec_Suffix + and then Last > Spec_Suffix_Length + and then Name (Last - Spec_Suffix_Length + 1 .. Last) = + Get_Name_String (Spec_Suffix) then Truncated := True; - Last := Last - Spec_Suffix'Length; + Last := Last - Spec_Suffix_Length; end if; if Truncated then @@ -238,21 +281,24 @@ package body Prj.Util is -- otherwise remove any suffix ('.' followed by other characters), if -- there is one. - if Ada_Main and then Name_Len > Body_Suffix'Length - and then Name_Buffer (Name_Len - Body_Suffix'Length + 1 .. Name_Len) = - Body_Suffix + if Body_Suffix /= No_Name + and then Name_Len > Body_Suffix_Length + and then Name_Buffer (Name_Len - Body_Suffix_Length + 1 .. Name_Len) = + Get_Name_String (Body_Suffix) then -- Found the body termination, remove it - Name_Len := Name_Len - Body_Suffix'Length; + Name_Len := Name_Len - Body_Suffix_Length; - elsif Ada_Main and then Name_Len > Spec_Suffix'Length - and then Name_Buffer (Name_Len - Spec_Suffix'Length + 1 .. Name_Len) = - Spec_Suffix + elsif Spec_Suffix /= No_Name + and then Name_Len > Spec_Suffix_Length + and then + Name_Buffer (Name_Len - Spec_Suffix_Length + 1 .. Name_Len) = + Get_Name_String (Spec_Suffix) then -- Found the spec termination, remove it - Name_Len := Name_Len - Spec_Suffix'Length; + Name_Len := Name_Len - Spec_Suffix_Length; else -- Remove any suffix, if there is one @@ -284,8 +330,13 @@ package body Prj.Util is Result : File_Name_Type; begin - Executable_Extension_On_Target := - In_Tree.Projects.Table (Project).Config.Executable_Suffix; + if In_Tree.Projects.Table (Project).Config.Executable_Suffix /= + No_Name + then + Executable_Extension_On_Target := + In_Tree.Projects.Table (Project).Config.Executable_Suffix; + end if; + Result := Executable_Name (Name_Find); Executable_Extension_On_Target := Saved_EEOT; return Result; @@ -418,20 +469,22 @@ package body Prj.Util is --------- procedure Put - (Into_List : in out Name_List_Index; - From_List : String_List_Id; - In_Tree : Project_Tree_Ref) + (Into_List : in out Name_List_Index; + From_List : String_List_Id; + In_Tree : Project_Tree_Ref; + Lower_Case : Boolean := False) is Current_Name : Name_List_Index; List : String_List_Id; Element : String_Element; Last : Name_List_Index := Name_List_Table.Last (In_Tree.Name_Lists); + Value : Name_Id; begin Current_Name := Into_List; - while Current_Name /= No_Name_List and then - In_Tree.Name_Lists.Table (Current_Name).Next /= No_Name_List + while Current_Name /= No_Name_List + and then In_Tree.Name_Lists.Table (Current_Name).Next /= No_Name_List loop Current_Name := In_Tree.Name_Lists.Table (Current_Name).Next; end loop; @@ -439,10 +492,16 @@ package body Prj.Util is List := From_List; while List /= Nil_String loop Element := In_Tree.String_Elements.Table (List); + Value := Element.Value; + + if Lower_Case then + Get_Name_String (Value); + To_Lower (Name_Buffer (1 .. Name_Len)); + Value := Name_Find; + end if; Name_List_Table.Append - (In_Tree.Name_Lists, - (Name => Element.Value, Next => No_Name_List)); + (In_Tree.Name_Lists, (Name => Value, Next => No_Name_List)); Last := Last + 1; diff --git a/gcc/ada/prj-util.ads b/gcc/ada/prj-util.ads index 24c90aab529..e2a9558e5eb 100644 --- a/gcc/ada/prj-util.ads +++ b/gcc/ada/prj-util.ads @@ -6,7 +6,7 @@ -- -- -- S p e c -- -- -- --- Copyright (C) 2001-2007, Free Software Foundation, Inc. -- +-- Copyright (C) 2001-2008, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -27,23 +27,30 @@ package Prj.Util is + -- ??? throughout this spec, parameters are not well enough documented + function Executable_Of (Project : Project_Id; In_Tree : Project_Tree_Ref; Main : File_Name_Type; Index : Int; - Ada_Main : Boolean := True) return File_Name_Type; + Ada_Main : Boolean := True; + Language : String := "") return File_Name_Type; -- Return the value of the attribute Builder'Executable for file Main in -- the project Project, if it exists. If there is no attribute Executable -- for Main, remove the suffix from Main; then, if the attribute -- Executable_Suffix is specified, add this suffix, otherwise add the -- standard executable suffix for the platform. + -- What is Ada_Main??? + -- What is Language??? procedure Put - (Into_List : in out Name_List_Index; - From_List : String_List_Id; - In_Tree : Project_Tree_Ref); + (Into_List : in out Name_List_Index; + From_List : String_List_Id; + In_Tree : Project_Tree_Ref; + Lower_Case : Boolean := False); -- Append a name list to a string list + -- Describe parameters??? procedure Duplicate (This : in out Name_List_Index; diff --git a/gcc/ada/prj.adb b/gcc/ada/prj.adb index f5752161297..a362fb8bd22 100644 --- a/gcc/ada/prj.adb +++ b/gcc/ada/prj.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 2001-2007, Free Software Foundation, Inc. -- +-- Copyright (C) 2001-2008, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -88,84 +88,87 @@ package body Prj is Supp_Suffixes => No_Supp_Language_Index); Project_Empty : constant Project_Data := - (Externally_Built => False, - Config => Default_Project_Config, - Languages => No_Name_List, - First_Referred_By => No_Project, - Name => No_Name, - Display_Name => No_Name, - Path_Name => No_Path, - Display_Path_Name => No_Path, - Virtual => False, - Location => No_Location, - Mains => Nil_String, - Directory => No_Path, - Display_Directory => No_Path, - Dir_Path => null, - Library => False, - Library_Dir => No_Path, - Display_Library_Dir => No_Path, - Library_Src_Dir => No_Path, - Display_Library_Src_Dir => No_Path, - Library_ALI_Dir => No_Path, - Display_Library_ALI_Dir => No_Path, - Library_Name => No_Name, - Library_Kind => Static, - Lib_Internal_Name => No_Name, - Standalone_Library => False, - Lib_Interface_ALIs => Nil_String, - Lib_Auto_Init => False, - Libgnarl_Needed => Unknown, - Symbol_Data => No_Symbols, - Ada_Sources => Nil_String, - Sources => Nil_String, - First_Source => No_Source, - Last_Source => No_Source, - Unit_Based_Language_Name => No_Name, - Unit_Based_Language_Index => No_Language_Index, - Imported_Directories_Switches => null, - Include_Path => null, - Include_Data_Set => False, - Include_Language => No_Language_Index, - Source_Dirs => Nil_String, - Known_Order_Of_Source_Dirs => True, - Object_Directory => No_Path, - Display_Object_Dir => No_Path, - Library_TS => Empty_Time_Stamp, - Exec_Directory => No_Path, - Display_Exec_Dir => No_Path, - Extends => No_Project, - Extended_By => No_Project, - Naming => Std_Naming_Data, - First_Language_Processing => No_Language_Index, - Decl => No_Declarations, - Imported_Projects => Empty_Project_List, - All_Imported_Projects => Empty_Project_List, - Ada_Include_Path => null, - Ada_Objects_Path => null, - Objects_Path => null, - Include_Path_File => No_Path, - Objects_Path_File_With_Libs => No_Path, - Objects_Path_File_Without_Libs => No_Path, - Config_File_Name => No_Path, - Config_File_Temp => False, - Linker_Name => No_File, - Linker_Path => No_Path, - Minimum_Linker_Options => No_Name_List, - Config_Checked => False, - Checked => False, - Seen => False, - Need_To_Build_Lib => False, - Depth => 0, - Unkept_Comments => False, - Langs => No_Languages, - Supp_Languages => No_Supp_Language_Index, - Ada_Sources_Present => True, - Other_Sources_Present => True, - First_Other_Source => No_Other_Source, - Last_Other_Source => No_Other_Source, - First_Lang_Processing => Default_First_Language_Processing_Data, - Supp_Language_Processing => No_Supp_Language_Index); + (Qualifier => Unspecified, + Externally_Built => False, + Config => Default_Project_Config, + Languages => No_Name_List, + First_Referred_By => No_Project, + Name => No_Name, + Display_Name => No_Name, + Path_Name => No_Path, + Display_Path_Name => No_Path, + Virtual => False, + Location => No_Location, + Mains => Nil_String, + Directory => No_Path, + Display_Directory => No_Path, + Dir_Path => null, + Library => False, + Library_Dir => No_Path, + Display_Library_Dir => No_Path, + Library_Src_Dir => No_Path, + Display_Library_Src_Dir => No_Path, + Library_ALI_Dir => No_Path, + Display_Library_ALI_Dir => No_Path, + Library_Name => No_Name, + Library_Kind => Static, + Lib_Internal_Name => No_Name, + Standalone_Library => False, + Lib_Interface_ALIs => Nil_String, + Lib_Auto_Init => False, + Libgnarl_Needed => Unknown, + Symbol_Data => No_Symbols, + Ada_Sources => Nil_String, + Sources => Nil_String, + First_Source => No_Source, + Last_Source => No_Source, + Unit_Based_Language_Name => No_Name, + Unit_Based_Language_Index => No_Language_Index, + Imported_Directories_Switches => null, + Include_Path => null, + Include_Data_Set => False, + Include_Language => No_Language_Index, + Source_Dirs => Nil_String, + Known_Order_Of_Source_Dirs => True, + Object_Directory => No_Path, + Display_Object_Dir => No_Path, + Library_TS => Empty_Time_Stamp, + Exec_Directory => No_Path, + Display_Exec_Dir => No_Path, + Extends => No_Project, + Extended_By => No_Project, + Naming => Std_Naming_Data, + First_Language_Processing => No_Language_Index, + Decl => No_Declarations, + Imported_Projects => Empty_Project_List, + All_Imported_Projects => Empty_Project_List, + Ada_Include_Path => null, + Ada_Objects_Path => null, + Objects_Path => null, + Include_Path_File => No_Path, + Objects_Path_File_With_Libs => No_Path, + Objects_Path_File_Without_Libs => No_Path, + Config_File_Name => No_Path, + Config_File_Temp => False, + Linker_Name => No_File, + Linker_Path => No_Path, + Minimum_Linker_Options => No_Name_List, + Config_Checked => False, + Checked => False, + Seen => False, + Need_To_Build_Lib => False, + Depth => 0, + Unkept_Comments => False, + Langs => No_Languages, + Supp_Languages => No_Supp_Language_Index, + Ada_Sources_Present => True, + Other_Sources_Present => True, + First_Other_Source => No_Other_Source, + Last_Other_Source => No_Other_Source, + First_Lang_Processing => + Default_First_Language_Processing_Data, + Supp_Language_Processing => + No_Supp_Language_Index); package Temp_Files is new Table.Table (Table_Component_Type => Path_Name_Type, @@ -626,6 +629,7 @@ package body Prj is Name_Len := 0; The_Empty_String := Name_Find; Empty_Name := The_Empty_String; + Empty_File_Name := File_Name_Type (The_Empty_String); Name_Len := 4; Name_Buffer (1 .. 4) := ".ads"; Default_Ada_Spec_Suffix_Id := Name_Find; @@ -1418,7 +1422,6 @@ package body Prj is if Tree = No_Project_Tree then Prj.Initialize (Tree => No_Project_Tree); return Std_Naming_Data; - else return Tree.Private_Part.Default_Naming; end if; diff --git a/gcc/ada/prj.ads b/gcc/ada/prj.ads index 4f6f37f45b7..5b62ec9e017 100644 --- a/gcc/ada/prj.ads +++ b/gcc/ada/prj.ads @@ -6,7 +6,7 @@ -- -- -- S p e c -- -- -- --- Copyright (C) 2001-2007, Free Software Foundation, Inc. -- +-- Copyright (C) 2001-2008, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -43,6 +43,15 @@ with System.HTable; package Prj is + Subdirs_Option : constant String := "--subdirs="; + -- Switch used to indicate that the real directories (object, exec, + -- library, ...) are subdirectories of what is indicated in the project + -- file. + + Subdirs : String_Ptr := null; + -- The value after the equal sign in switch --subdirs=... + -- Contains the relative subdirectory. + type Library_Support is (None, Static_Only, Full); -- Support for Library Project File. -- - None: Library Project Files are not supported at all @@ -55,6 +64,23 @@ package Prj is -- Tri-state to decide if -lgnarl is needed when linking type Mode is (Multi_Language, Ada_Only); + -- Ada_Only: mode for gnatmake, gnatname, the GNAT driver + -- Multi_Language: mode for gprbuild, gprclean + + type Project_Qualifier is + (Unspecified, + Standard, + Library, + Dry, + Aggregate, + Aggregate_Library); + -- Qualifiers that can prefix the reserved word "project" in a project + -- file: + -- Standard: standard project ... + -- Library: library project is ... + -- Dry: abstract project is + -- Aggregate: aggregate project is + -- Aggregate_Library: aggregate library project is ... function Get_Mode return Mode; pragma Inline (Get_Mode); @@ -373,6 +399,12 @@ package Prj is Naming_Data : Lang_Naming_Data; -- The naming data for the languages (prefixes, etc.) + Include_Compatible_Languages : Name_List_Index := No_Name_List; + -- The list of languages that are "include compatible" with this + -- language. A language B (for example "C") is "include compatible" with + -- a language A (for example "C++") if it is expected that sources of + -- language A may "include" header files from language B. + Compiler_Driver : File_Name_Type := No_File; -- The name of the executable for the compiler of the language @@ -488,38 +520,39 @@ package Prj is -- Record describing the configuration of a language No_Language_Config : constant Language_Config := - (Kind => File_Based, - Naming_Data => No_Lang_Naming_Data, - Compiler_Driver => No_File, - Compiler_Driver_Path => null, - Compiler_Required_Switches => No_Name_List, - Compilation_PIC_Option => No_Name_List, - Runtime_Library_Dir => No_Name, - Mapping_File_Switches => No_Name_List, - Mapping_Spec_Suffix => No_File, - Mapping_Body_Suffix => No_File, - Config_File_Switches => No_Name_List, - Dependency_Kind => Makefile, - Dependency_Option => No_Name_List, - Compute_Dependency => No_Name_List, - Include_Option => No_Name_List, - Include_Path => No_Name, - Include_Path_File => No_Name, - Objects_Path => No_Name, - Objects_Path_File => No_Name, - Config_Body => No_Name, - Config_Spec => No_Name, - Config_Body_Pattern => No_Name, - Config_Spec_Pattern => No_Name, - Config_File_Unique => False, - Binder_Driver => No_File, - Binder_Driver_Path => No_Path, - Binder_Required_Switches => No_Name_List, - Binder_Prefix => No_Name, - Toolchain_Version => No_Name, - Toolchain_Description => No_Name, - PIC_Option => No_Name, - Objects_Generated => True); + (Kind => File_Based, + Naming_Data => No_Lang_Naming_Data, + Include_Compatible_Languages => No_Name_List, + Compiler_Driver => No_File, + Compiler_Driver_Path => null, + Compiler_Required_Switches => No_Name_List, + Compilation_PIC_Option => No_Name_List, + Runtime_Library_Dir => No_Name, + Mapping_File_Switches => No_Name_List, + Mapping_Spec_Suffix => No_File, + Mapping_Body_Suffix => No_File, + Config_File_Switches => No_Name_List, + Dependency_Kind => Makefile, + Dependency_Option => No_Name_List, + Compute_Dependency => No_Name_List, + Include_Option => No_Name_List, + Include_Path => No_Name, + Include_Path_File => No_Name, + Objects_Path => No_Name, + Objects_Path_File => No_Name, + Config_Body => No_Name, + Config_Spec => No_Name, + Config_Body_Pattern => No_Name, + Config_Spec_Pattern => No_Name, + Config_File_Unique => False, + Binder_Driver => No_File, + Binder_Driver_Path => No_Path, + Binder_Required_Switches => No_Name_List, + Binder_Prefix => No_Name, + Toolchain_Version => No_Name, + Toolchain_Description => No_Name, + PIC_Option => No_Name, + Objects_Generated => True); type Language_Data is record Name : Name_Id := No_Name; @@ -580,6 +613,9 @@ package Prj is Lang_Kind : Language_Kind := File_Based; -- Kind of the language + Compiled : Boolean := True; + -- False when there is no compiler for the language + Alternate_Languages : Alternate_Language_Id := No_Alternate_Language; -- List of languages a header file may also be, in addition of -- language Language_Name. @@ -640,40 +676,40 @@ package Prj is Object_Path : Path_Name_Type := No_Path; -- Object path of the real object file - Object_TS : Time_Stamp_Type := Empty_Time_Stamp; + Object_TS : Time_Stamp_Type := Empty_Time_Stamp; -- Object file time stamp - Dep_Name : File_Name_Type := No_File; + Dep_Name : File_Name_Type := No_File; -- Dependency file simple name - Current_Dep_Path : Path_Name_Type := No_Path; + Current_Dep_Path : Path_Name_Type := No_Path; -- Path name of an existing dependency file - Dep_Path : Path_Name_Type := No_Path; + Dep_Path : Path_Name_Type := No_Path; -- Path name of the real dependency file - Dep_TS : Time_Stamp_Type := Empty_Time_Stamp; + Dep_TS : Time_Stamp_Type := Empty_Time_Stamp; -- Dependency file time stamp - Switches : File_Name_Type := No_File; + Switches : File_Name_Type := No_File; -- File name of the switches file - Switches_Path : Path_Name_Type := No_Path; + Switches_Path : Path_Name_Type := No_Path; -- Path name of the switches file - Switches_TS : Time_Stamp_Type := Empty_Time_Stamp; + Switches_TS : Time_Stamp_Type := Empty_Time_Stamp; -- Switches file time stamp - Naming_Exception : Boolean := False; + Naming_Exception : Boolean := False; -- True if the source has an exceptional name - Next_In_Sources : Source_Id := No_Source; + Next_In_Sources : Source_Id := No_Source; -- Link to another source in the project tree - Next_In_Project : Source_Id := No_Source; + Next_In_Project : Source_Id := No_Source; -- Link to another source in the project - Next_In_Lang : Source_Id := No_Source; + Next_In_Lang : Source_Id := No_Source; -- Link to another source of the same language end record; @@ -682,6 +718,7 @@ package Prj is Language_Name => No_Name, Language => No_Language_Index, Lang_Kind => File_Based, + Compiled => True, Alternate_Languages => No_Alternate_Language, Kind => Spec, Dependency => None, @@ -1110,6 +1147,9 @@ package Prj is -- The name of the executable to build archives, with the minimum -- switches. Specified in the configuration. + Archive_Builder_Append_Option : Name_List_Index := No_Name_List; + -- The options to append object files to an archive + Archive_Indexer : Name_List_Index := No_Name_List; -- The name of the executable to index archives, with the minimum -- switches. Specified in the configuration. @@ -1149,26 +1189,27 @@ package Prj is end record; Default_Project_Config : constant Project_Configuration := - (Run_Path_Option => No_Name_List, - Executable_Suffix => No_Name, - Linker => No_Path, - Minimum_Linker_Options => No_Name_List, - Linker_Executable_Option => No_Name_List, - Linker_Lib_Dir_Option => No_Name, - Linker_Lib_Name_Option => No_Name, - Library_Builder => No_Path, - Lib_Support => None, - Archive_Builder => No_Name_List, - Archive_Indexer => No_Name_List, - Archive_Suffix => No_File, - Lib_Partial_Linker => No_Name_List, - Shared_Lib_Prefix => No_File, - Shared_Lib_Suffix => No_File, - Shared_Lib_Min_Options => No_Name_List, - Lib_Version_Options => No_Name_List, - Symbolic_Link_Supported => False, - Lib_Maj_Min_Id_Supported => False, - Auto_Init_Supported => False); + (Run_Path_Option => No_Name_List, + Executable_Suffix => No_Name, + Linker => No_Path, + Minimum_Linker_Options => No_Name_List, + Linker_Executable_Option => No_Name_List, + Linker_Lib_Dir_Option => No_Name, + Linker_Lib_Name_Option => No_Name, + Library_Builder => No_Path, + Lib_Support => None, + Archive_Builder => No_Name_List, + Archive_Builder_Append_Option => No_Name_List, + Archive_Indexer => No_Name_List, + Archive_Suffix => No_File, + Lib_Partial_Linker => No_Name_List, + Shared_Lib_Prefix => No_File, + Shared_Lib_Suffix => No_File, + Shared_Lib_Min_Options => No_Name_List, + Lib_Version_Options => No_Name_List, + Symbolic_Link_Supported => False, + Lib_Maj_Min_Id_Supported => False, + Auto_Init_Supported => False); -- The following record describes a project file representation @@ -1177,6 +1218,9 @@ package Prj is -- separator. type Project_Data is record + Qualifier : Project_Qualifier := Unspecified; + -- The eventual qualifier for this project + Externally_Built : Boolean := False; -- True if the project is externally built. In such case, the Project -- Manager will not modify anything in this project. @@ -1436,21 +1480,21 @@ package Prj is Supp_Languages : Supp_Language_Index := No_Supp_Language_Index; -- Indicate the different languages of the source of this project - Ada_Sources_Present : Boolean := True; + Ada_Sources_Present : Boolean := True; -- True if there are Ada sources in the project - Other_Sources_Present : Boolean := True; + Other_Sources_Present : Boolean := True; -- True if there are sources from languages other than Ada in the -- project. - First_Other_Source : Other_Source_Id := No_Other_Source; + First_Other_Source : Other_Source_Id := No_Other_Source; -- First source of a language other than Ada - Last_Other_Source : Other_Source_Id := No_Other_Source; + Last_Other_Source : Other_Source_Id := No_Other_Source; -- Last source of a language other than Ada - First_Lang_Processing : First_Language_Processing_Data := - Default_First_Language_Processing_Data; + First_Lang_Processing : First_Language_Processing_Data := + Default_First_Language_Processing_Data; Supp_Language_Processing : Supp_Language_Index := No_Supp_Language_Index; -- Language configurations @@ -1740,8 +1784,12 @@ private -- normally forbidden for project names, there cannot be any name clash. Empty_Name : Name_Id; - -- Name_Id for an empty name (no characters). Initialized by the call - -- to procedure Initialize. + -- Name_Id for an empty name (no characters). Initialized in procedure + -- Initialize. + + Empty_File_Name : File_Name_Type; + -- Empty File_Name_Type (no characters). Initialized in procedure + -- Initialize. procedure Add_To_Buffer (S : String; diff --git a/gcc/ada/raise-gcc.c b/gcc/ada/raise-gcc.c index 8a7cf5a568f..bb25ea631d1 100644 --- a/gcc/ada/raise-gcc.c +++ b/gcc/ada/raise-gcc.c @@ -362,7 +362,7 @@ db_phases (int phases) context stack and not the actual call chain. The ACTION and TTYPES tables remain unchanged, which allows to search them - during the propagation phase to determine wether or not the propagated + during the propagation phase to determine whether or not the propagated exception is handled somewhere. When it is, we only "jump" up once directly to the context where the handler will be found. Besides, this allows "break exception unhandled" to work also @@ -811,7 +811,7 @@ get_call_site_action_for (_Unwind_Context *uw_context, /* With CHOICE an exception choice representing an "exception - when" argument, and PROPAGATED_EXCEPTION a pointer to the currently propagated - occurrence, return true iif the latter matches the former, that is, if + occurrence, return true if the latter matches the former, that is, if PROPAGATED_EXCEPTION is caught by the handling code controlled by CHOICE. This takes care of the special Non_Ada_Error case on VMS. */ @@ -1135,7 +1135,7 @@ PERSONALITY_FUNCTION (version_arg_t version_arg, /* If we are going to install a cleanup context, decrement the cleanup count. This is required in a FORCED_UNWINDing phase (for an unhandled exception), as this is used from the forced unwinding handler in - Ada.Exceptions.Exception_Propagation to decide wether unwinding should + Ada.Exceptions.Exception_Propagation to decide whether unwinding should proceed further or Unhandled_Exception_Terminate should be called. */ if (action.kind == cleanup) Adjust_N_Cleanups_For (gnat_exception, -1); diff --git a/gcc/ada/repinfo.adb b/gcc/ada/repinfo.adb index a36fb5902e6..6764994e4f3 100644 --- a/gcc/ada/repinfo.adb +++ b/gcc/ada/repinfo.adb @@ -1095,7 +1095,7 @@ package body Repinfo is -- Bit_And_Expr, for which there is no direct support in uintp. Uint -- values out of the Int range are expected to be seen in such -- expressions only with overflowing byte sizes around, introducing - -- inherent unreliabilties in computations anyway. + -- inherent unreliabilities in computations anyway. ------- -- B -- diff --git a/gcc/ada/repinfo.ads b/gcc/ada/repinfo.ads index beaaf98eb5d..39d037a15d9 100644 --- a/gcc/ada/repinfo.ads +++ b/gcc/ada/repinfo.ads @@ -88,7 +88,7 @@ package Repinfo is -- which contains the Size (more accurately the Object_SIze) value -- for the type or subtype. - -- For E_Component and E_Distriminant entities, the Esize (size + -- For E_Component and E_Discriminant entities, the Esize (size -- of component) and Component_Bit_Offset fields. Note that gigi -- does not (yet ???) back annotate Normalized_Position/First_Bit. @@ -156,12 +156,12 @@ package Repinfo is Truth_Or_Expr : constant TCode := 19; -- Boolean or 2 Truth_Xor_Expr : constant TCode := 20; -- Boolean xor 2 Truth_Not_Expr : constant TCode := 21; -- Boolean not 1 - Lt_Expr : constant TCode := 22; -- comparision < 2 - Le_Expr : constant TCode := 23; -- comparision <= 2 - Gt_Expr : constant TCode := 24; -- comparision > 2 - Ge_Expr : constant TCode := 25; -- comparision >= 2 - Eq_Expr : constant TCode := 26; -- comparision = 2 - Ne_Expr : constant TCode := 27; -- comparision /= 2 + Lt_Expr : constant TCode := 22; -- comparison < 2 + Le_Expr : constant TCode := 23; -- comparison <= 2 + Gt_Expr : constant TCode := 24; -- comparison > 2 + Ge_Expr : constant TCode := 25; -- comparison >= 2 + Eq_Expr : constant TCode := 26; -- comparison = 2 + Ne_Expr : constant TCode := 27; -- comparison /= 2 Bit_And_Expr : constant TCode := 28; -- Binary and 2 -- The following entry is used to represent a discriminant value in @@ -188,7 +188,7 @@ package Repinfo is -- => Discrim_Val, Op1 => discriminant_number). function Create_Discrim_Ref (Discr : Entity_Id) return Node_Ref; - -- Creates a refrerence to the discriminant whose entity is Discr + -- Creates a reference to the discriminant whose entity is Discr -------------------------------------------------------- -- Front-End Interface for Dynamic Size/Offset Values -- @@ -223,7 +223,7 @@ package Repinfo is -- In the case of components, if the location of the component is static, -- then all four fields (Component_Bit_Offset, Normalized_Position, Esize, - -- and Normalized_First_Bit) are set to appropraite values. In the case of + -- and Normalized_First_Bit) are set to appropriate values. In the case of -- a non-static component location, Component_Bit_Offset is not used and -- is left set to Unknown. Normalized_Position and Normalized_First_Bit -- are set appropriately. @@ -258,7 +258,7 @@ package Repinfo is -- Create_Dynamic_SO_Ref. The approach is that the front end makes -- the necessary Create_Dynamic_SO_Ref calls to associate the node -- and entity id values and the back end makes Get_Dynamic_SO_Ref - -- calls to retrive them. + -- calls to retrieve them. -------------------- -- ASIS_Interface -- diff --git a/gcc/ada/restrict.adb b/gcc/ada/restrict.adb index 068d601c2c6..5049c5b1be4 100644 --- a/gcc/ada/restrict.adb +++ b/gcc/ada/restrict.adb @@ -172,9 +172,9 @@ package body Restrict is end if; end loop; - -- If not predefied unit, then one special check still remains. - -- GNAT.Current_Exception is not allowed if we have restriction - -- No_Exception_Propagation active. + -- If not predefined unit, then one special check still + -- remains. GNAT.Current_Exception is not allowed if we have + -- restriction No_Exception_Propagation active. else if Name_Buffer (1 .. 8) = "g-curexc" then diff --git a/gcc/ada/restrict.ads b/gcc/ada/restrict.ads index 0cd4dbf28bf..9dacefb3005 100644 --- a/gcc/ada/restrict.ads +++ b/gcc/ada/restrict.ads @@ -37,7 +37,7 @@ package Restrict is -- This variable records restrictions found in any units in the main -- extended unit, and in the case of restrictions checked for partition -- consistency, restrictions found in any with'ed units, parent specs - -- etc, since we may as well check as much as we can at compile time. + -- etc., since we may as well check as much as we can at compile time. -- These variables should not be referenced directly by clients. Instead -- use Check_Restrictions to record a violation of a restriction, and -- Restriction_Active to test if a given restriction is active. @@ -270,7 +270,7 @@ package Restrict is function Restricted_Profile return Boolean; -- Tests if set of restrictions corresponding to Profile (Restricted) is -- currently in effect (set by pragma Profile, or by an appropriate set - -- of individual Restrictions pragms). Returns True only if all the + -- of individual Restrictions pragmas). Returns True only if all the -- required restrictions are set. procedure Set_Profile_Restrictions diff --git a/gcc/ada/rtsfind.adb b/gcc/ada/rtsfind.adb index b26693106ad..650e2eaad3f 100644 --- a/gcc/ada/rtsfind.adb +++ b/gcc/ada/rtsfind.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 1992-2007, Free Software Foundation, Inc. -- +-- Copyright (C) 1992-2008, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -100,9 +100,9 @@ package body Rtsfind is -- for the same entity can be satisfied immediately. -- NOTE: In order to avoid conflicts between record components and subprgs - -- that have the same name (ie. subprogram External_Tag and component - -- External_Tag of package Ada.Tags) this table is not used with - -- Record_Components. + -- that have the same name (i.e. subprogram External_Tag and + -- component External_Tag of package Ada.Tags) this table is not used + -- with Record_Components. RE_Table : array (RE_Id) of Entity_Id; @@ -145,7 +145,7 @@ package body Rtsfind is -- value in RTU_Id. procedure Load_Fail (S : String; U_Id : RTU_Id; Id : RE_Id); - -- Internal procedure called if we can't sucessfully locate or process a + -- Internal procedure called if we can't successfully locate or process a -- run-time unit. The parameters give information about the error message -- to be given. S is a reason for failing to compile the file and U_Id is -- the unit id. RE_Id is the RE_Id originally passed to RTE. The message in @@ -283,6 +283,9 @@ package body Rtsfind is if U_Id in Ada_Calendar_Child then Name_Buffer (13) := '.'; + elsif U_Id in Ada_Dispatching_Child then + Name_Buffer (16) := '.'; + elsif U_Id in Ada_Finalization_Child then Name_Buffer (17) := '.'; @@ -311,6 +314,10 @@ package body Rtsfind is elsif U_Id in System_Child then Name_Buffer (7) := '.'; + if U_Id in System_Strings_Child then + Name_Buffer (15) := '.'; + end if; + if U_Id in System_Tasking_Child then Name_Buffer (15) := '.'; end if; @@ -1207,7 +1214,7 @@ package body Rtsfind is -- If we didn't find the entity we want, something is wrong. The -- appropriate action will be taken by Check_CRT when we exit. - -- Cenerate a with-clause if the current unit is part of the extended + -- Generate a with-clause if the current unit is part of the extended -- main code unit, and if we have not already added the with. The clause -- is added to the appropriate unit (the current one). We do not need to -- generate it for a call issued from RTE_Component_Available. diff --git a/gcc/ada/rtsfind.ads b/gcc/ada/rtsfind.ads index 2388ed09870..ef61b8fd0e5 100644 --- a/gcc/ada/rtsfind.ads +++ b/gcc/ada/rtsfind.ads @@ -6,7 +6,7 @@ -- -- -- S p e c -- -- -- --- Copyright (C) 1992-2007, Free Software Foundation, Inc. -- +-- Copyright (C) 1992-2008, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -78,6 +78,9 @@ package Rtsfind is -- name is System.xxx. For example, the name System_Str_Concat refers to -- package System.Str_Concat. + -- Names of the form System_Strings_xxx are second level children of the + -- package System.Strings. + -- Names of the form System_Tasking_xxx are second level children of the -- package System.Tasking. For example, System_Tasking_Stages refers to -- refers to the package System.Tasking.Stages. @@ -112,6 +115,7 @@ package Rtsfind is -- Children of Ada Ada_Calendar, + Ada_Dispatching, Ada_Exceptions, Ada_Finalization, Ada_Interrupts, @@ -125,6 +129,10 @@ package Rtsfind is Ada_Calendar_Delays, + -- Children of Ada.Dispatching + + Ada_Dispatching_EDF, + -- Children of Ada.Finalization Ada_Finalization_List_Controller, @@ -348,6 +356,10 @@ package Rtsfind is System_WWd_Enum, System_WWd_Wchar, + -- Children of System.Strings + + System_Strings_Stream_Ops, + -- Children of System.Tasking System_Tasking_Async_Delays, @@ -369,6 +381,10 @@ package Rtsfind is range Ada_Calendar_Delays .. Ada_Calendar_Delays; -- Range of values for children of Ada.Calendar + subtype Ada_Dispatching_Child is RTU_Id + range Ada_Dispatching_EDF .. Ada_Dispatching_EDF; + -- Range of values for children of Ada.Dispatching + subtype Ada_Finalization_Child is Ada_Child range Ada_Finalization_List_Controller .. Ada_Finalization_List_Controller; -- Range of values for children of Ada.Finalization @@ -404,6 +420,9 @@ package Rtsfind is range System_Address_Image .. System_Tasking_Stages; -- Range of values for children or grandchildren of System + subtype System_Strings_Child is RTU_Id + range System_Strings_Stream_Ops .. System_Strings_Stream_Ops; + subtype System_Tasking_Child is System_Child range System_Tasking_Async_Delays .. System_Tasking_Stages; -- Range of values for children of System.Tasking @@ -451,6 +470,8 @@ package Rtsfind is RE_Null, + RE_Set_Deadline, -- Ada.Dispatching.EDF + RE_Code_Loc, -- Ada.Exceptions RE_Current_Target_Exception, -- Ada.Exceptions (JGNAT use only) RE_Exception_Id, -- Ada.Exceptions @@ -480,7 +501,7 @@ package Rtsfind is RE_Detach_Handler, -- Ada.Interrupts RE_Reference, -- Ada.Interrupts - RE_Names, -- Ada.Interupts.Names + RE_Names, -- Ada.Interrupts.Names RE_Root_Stream_Type, -- Ada.Streams RE_Stream_Element, -- Ada.Streams @@ -497,6 +518,7 @@ package Rtsfind is RE_Dispatch_Table_Wrapper, -- Ada.Tags RE_Displace, -- Ada.Tags RE_DT, -- Ada.Tags + RE_DT_Offset_To_Top_Offset, -- Ada.Tags RE_DT_Predef_Prims_Offset, -- Ada.Tags RE_DT_Typeinfo_Ptr_Size, -- Ada.Tags RE_External_Tag, -- Ada.Tags @@ -520,6 +542,7 @@ package Rtsfind is RE_Num_Prims, -- Ada.Tags RE_Object_Specific_Data, -- Ada.Tags RE_Offset_To_Top, -- Ada.Tags + RE_Offset_To_Top_Ptr, -- Ada.Tags RE_Offset_To_Top_Function_Ptr, -- Ada.Tags RE_OSD_Table, -- Ada.Tags RE_OSD_Num_Prims, -- Ada.Tags @@ -534,20 +557,24 @@ package Rtsfind is RE_Predef_Prims, -- Ada.Tags RE_Predef_Prims_Table_Ptr, -- Ada.Tags RE_Prim_Op_Kind, -- Ada.Tags + RE_Prim_Ptr, -- Ada.Tags RE_Prims_Ptr, -- Ada.Tags RE_Primary_DT, -- Ada.Tags RE_Signature, -- Ada.Tags RE_SSD, -- Ada.Tags RE_TSD, -- Ada.Tags RE_Type_Specific_Data, -- Ada.Tags + RE_Register_Interface_Offset, -- Ada.Tags RE_Register_Tag, -- Ada.Tags RE_Transportable, -- Ada.Tags RE_Secondary_DT, -- Ada.Tags RE_Secondary_Tag, -- Ada.Tags RE_Select_Specific_Data, -- Ada.Tags RE_Set_Entry_Index, -- Ada.Tags - RE_Set_Offset_To_Top, -- Ada.Tags + RE_Set_Dynamic_Offset_To_Top, -- Ada.Tags RE_Set_Prim_Op_Kind, -- Ada.Tags + RE_Size_Func, -- Ada.Tags + RE_Size_Ptr, -- Ada.Tags RE_Tag, -- Ada.Tags RE_Tag_Error, -- Ada.Tags RE_Tag_Kind, -- Ada.Tags @@ -573,6 +600,9 @@ package Rtsfind is RO_CA_Delay_Until, -- Ada.Calendar.Delays RO_CA_To_Duration, -- Ada.Calendar.Delays + RE_Clock, -- Ada.Real_Time + RE_Time_Span, -- Ada.Real_Time + RE_Time_Span_Zero, -- Ada.Real_Time RO_RT_Time, -- Ada.Real_Time RO_RT_Delay_Until, -- Ada.Real_Time.Delays @@ -749,6 +779,7 @@ package Rtsfind is RE_Default_Interrupt_Priority, -- System.Interrupts RE_Dynamic_Interrupt_Protection, -- System.Interrupts RE_Install_Handlers, -- System.Interrupts + RE_Install_Restricted_Handlers, -- System.Interrupts RE_Register_Interrupt_Handler, -- System.Interrupts RE_Static_Interrupt_Protection, -- System.Interrupts RE_System_Interrupt_Id, -- System.Interrupts @@ -1233,11 +1264,10 @@ package Rtsfind is RE_Storage_Offset, -- System.Storage_Elements RE_Storage_Array, -- System.Storage_Elements RE_To_Address, -- System.Storage_Elements - RE_Dummy_Communication_Block, -- System.Storage_Elements RE_Root_Storage_Pool, -- System.Storage_Pools - RE_Allocate_Any, -- System_Storage_Pools, - RE_Deallocate_Any, -- System_Storage_Pools, + RE_Allocate_Any, -- System.Storage_Pools, + RE_Deallocate_Any, -- System.Storage_Pools, RE_I_AD, -- System.Stream_Attributes RE_I_AS, -- System.Stream_Attributes @@ -1292,6 +1322,19 @@ package Rtsfind is RE_Str_Concat_5, -- System.String_Ops_Concat_5 + RE_String_Input, -- System.Strings.Stream_Ops + RE_String_Output, -- System.Strings.Stream_Ops + RE_String_Read, -- System.Strings.Stream_Ops + RE_String_Write, -- System.Strings.Stream_Ops + RE_Wide_String_Input, -- System.Strings.Stream_Ops + RE_Wide_String_Output, -- System.Strings.Stream_Ops + RE_Wide_String_Read, -- System.Strings.Stream_Ops + RE_Wide_String_Write, -- System.Strings.Stream_Ops + RE_Wide_Wide_String_Input, -- System.Strings.Stream_Ops + RE_Wide_Wide_String_Output, -- System.Strings.Stream_Ops + RE_Wide_Wide_String_Read, -- System.Strings.Stream_Ops + RE_Wide_Wide_String_Write, -- System.Strings.Stream_Ops + RE_Task_Info_Type, -- System.Task_Info RE_Unspecified_Task_Info, -- System.Task_Info @@ -1331,6 +1374,7 @@ package Rtsfind is RE_Abort_Undefer, -- System.Soft_Links RE_Complete_Master, -- System.Soft_Links RE_Current_Master, -- System.Soft_Links + RE_Dummy_Communication_Block, -- System.Soft_Links RE_Enter_Master, -- System.Soft_Links RE_Get_Current_Excep, -- System.Soft_Links RE_Get_GNAT_Exception, -- System.Soft_Links @@ -1555,6 +1599,8 @@ package Rtsfind is RE_Null => RTU_Null, + RE_Set_Deadline => Ada_Dispatching_EDF, + RE_Code_Loc => Ada_Exceptions, RE_Current_Target_Exception => Ada_Exceptions, -- of JGNAT RE_Exception_Id => Ada_Exceptions, @@ -1601,6 +1647,7 @@ package Rtsfind is RE_Dispatch_Table_Wrapper => Ada_Tags, RE_Displace => Ada_Tags, RE_DT => Ada_Tags, + RE_DT_Offset_To_Top_Offset => Ada_Tags, RE_DT_Predef_Prims_Offset => Ada_Tags, RE_DT_Typeinfo_Ptr_Size => Ada_Tags, RE_External_Tag => Ada_Tags, @@ -1624,6 +1671,7 @@ package Rtsfind is RE_Num_Prims => Ada_Tags, RE_Object_Specific_Data => Ada_Tags, RE_Offset_To_Top => Ada_Tags, + RE_Offset_To_Top_Ptr => Ada_Tags, RE_Offset_To_Top_Function_Ptr => Ada_Tags, RE_OSD_Table => Ada_Tags, RE_OSD_Num_Prims => Ada_Tags, @@ -1638,20 +1686,24 @@ package Rtsfind is RE_Predef_Prims => Ada_Tags, RE_Predef_Prims_Table_Ptr => Ada_Tags, RE_Prim_Op_Kind => Ada_Tags, + RE_Prim_Ptr => Ada_Tags, RE_Prims_Ptr => Ada_Tags, RE_Primary_DT => Ada_Tags, RE_Signature => Ada_Tags, RE_SSD => Ada_Tags, RE_TSD => Ada_Tags, RE_Type_Specific_Data => Ada_Tags, + RE_Register_Interface_Offset => Ada_Tags, RE_Register_Tag => Ada_Tags, RE_Transportable => Ada_Tags, RE_Secondary_DT => Ada_Tags, RE_Secondary_Tag => Ada_Tags, RE_Select_Specific_Data => Ada_Tags, RE_Set_Entry_Index => Ada_Tags, - RE_Set_Offset_To_Top => Ada_Tags, + RE_Set_Dynamic_Offset_To_Top => Ada_Tags, RE_Set_Prim_Op_Kind => Ada_Tags, + RE_Size_Func => Ada_Tags, + RE_Size_Ptr => Ada_Tags, RE_Tag => Ada_Tags, RE_Tag_Error => Ada_Tags, RE_Tag_Kind => Ada_Tags, @@ -1676,6 +1728,9 @@ package Rtsfind is RO_CA_Delay_Until => Ada_Calendar_Delays, RO_CA_To_Duration => Ada_Calendar_Delays, + RE_Clock => Ada_Real_Time, + RE_Time_Span => Ada_Real_Time, + RE_Time_Span_Zero => Ada_Real_Time, RO_RT_Time => Ada_Real_Time, RO_RT_Delay_Until => Ada_Real_Time_Delays, RO_RT_To_Duration => Ada_Real_Time_Delays, @@ -1851,6 +1906,7 @@ package Rtsfind is RE_Default_Interrupt_Priority => System_Interrupts, RE_Dynamic_Interrupt_Protection => System_Interrupts, RE_Install_Handlers => System_Interrupts, + RE_Install_Restricted_Handlers => System_Interrupts, RE_Register_Interrupt_Handler => System_Interrupts, RE_Static_Interrupt_Protection => System_Interrupts, RE_System_Interrupt_Id => System_Interrupts, @@ -2335,7 +2391,6 @@ package Rtsfind is RE_Storage_Offset => System_Storage_Elements, RE_Storage_Array => System_Storage_Elements, RE_To_Address => System_Storage_Elements, - RE_Dummy_Communication_Block => System_Storage_Elements, RE_Root_Storage_Pool => System_Storage_Pools, RE_Allocate_Any => System_Storage_Pools, @@ -2394,6 +2449,19 @@ package Rtsfind is RE_Str_Concat_5 => System_String_Ops_Concat_5, + RE_String_Input => System_Strings_Stream_Ops, + RE_String_Output => System_Strings_Stream_Ops, + RE_String_Read => System_Strings_Stream_Ops, + RE_String_Write => System_Strings_Stream_Ops, + RE_Wide_String_Input => System_Strings_Stream_Ops, + RE_Wide_String_Output => System_Strings_Stream_Ops, + RE_Wide_String_Read => System_Strings_Stream_Ops, + RE_Wide_String_Write => System_Strings_Stream_Ops, + RE_Wide_Wide_String_Input => System_Strings_Stream_Ops, + RE_Wide_Wide_String_Output => System_Strings_Stream_Ops, + RE_Wide_Wide_String_Read => System_Strings_Stream_Ops, + RE_Wide_Wide_String_Write => System_Strings_Stream_Ops, + RE_Task_Info_Type => System_Task_Info, RE_Unspecified_Task_Info => System_Task_Info, @@ -2433,6 +2501,7 @@ package Rtsfind is RE_Abort_Undefer => System_Soft_Links, RE_Complete_Master => System_Soft_Links, RE_Current_Master => System_Soft_Links, + RE_Dummy_Communication_Block => System_Soft_Links, RE_Enter_Master => System_Soft_Links, RE_Get_Current_Excep => System_Soft_Links, RE_Get_GNAT_Exception => System_Soft_Links, @@ -2719,7 +2788,7 @@ package Rtsfind is -- run-time library, but allows only a subset of entities to be -- accessed. If any other entity is accessed, then it is treated -- as a configurable run-time violation, and the exception - -- RE_Not_Availble is raised. + -- RE_Not_Available is raised. -- The following array defines the set of units that contain entities -- that can be referenced in No_Run_Time mode. For each of these units, diff --git a/gcc/ada/s-arit64.ads b/gcc/ada/s-arit64.ads index 9364277f938..b414949b127 100644 --- a/gcc/ada/s-arit64.ads +++ b/gcc/ada/s-arit64.ads @@ -63,7 +63,7 @@ package System.Arith_64 is -- or if the quotient does not fit in 64-bits. Round indicates if -- the result should be rounded. If Round is False, then Q, R are -- the normal quotient and remainder from a truncating division. - -- If Round is True, then Q is the rounded quotient. the remainder + -- If Round is True, then Q is the rounded quotient. The remainder -- R is not affected by the setting of the Round flag. procedure Double_Divide diff --git a/gcc/ada/s-asthan-vms-alpha.adb b/gcc/ada/s-asthan-vms-alpha.adb index b6b8395d498..9775f54bcd4 100644 --- a/gcc/ada/s-asthan-vms-alpha.adb +++ b/gcc/ada/s-asthan-vms-alpha.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 1996-2007, Free Software Foundation, Inc. -- +-- Copyright (C) 1996-2008, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -149,7 +149,7 @@ package body System.AST_Handling is -- Note: When we say it works fine, there is one delicate point, which -- is that the code for the AST procedure itself requires the original - -- descriptor address. We handle this by saving the orignal descriptor + -- descriptor address. We handle this by saving the original descriptor -- address in this structure and restoring in Process_AST. type AST_Handler_Data is record @@ -237,7 +237,7 @@ package body System.AST_Handling is -- number of AST instances that can be stored in the buffer. Since -- these entries are immediately serviced by the high priority server -- task that does the actual entry queuing, it is very unusual to have - -- any significant number of entries simulaneously queued. + -- any significant number of entries simultaneously queued. AST_Service_Queue : array (AST_Service_Queue_Index) of AST_Instance; pragma Volatile_Components (AST_Service_Queue); @@ -545,16 +545,16 @@ package body System.AST_Handling is -- from which we can obtain the task and entry number information. function To_Address is new Ada.Unchecked_Conversion - (ST.Task_Id, System.Address); + (ST.Task_Id, System.Task_Primitives.Task_Address); begin System.Machine_Code.Asm - (Template => "addl $27,0,%0", + (Template => "addq $27,0,%0", Outputs => AST_Handler_Data_Ref'Asm_Output ("=r", Handler_Data_Ptr), Volatile => True); System.Machine_Code.Asm - (Template => "ldl $27,%0", + (Template => "ldq $27,%0", Inputs => Descriptor_Ref'Asm_Input ("m", Handler_Data_Ptr.Original_Descriptor_Ref), Volatile => True); diff --git a/gcc/ada/s-auxdec-vms_64.ads b/gcc/ada/s-auxdec-vms_64.ads index 9d55cb8f50e..bb763667b5b 100644 --- a/gcc/ada/s-auxdec-vms_64.ads +++ b/gcc/ada/s-auxdec-vms_64.ads @@ -6,7 +6,7 @@ -- -- -- S p e c -- -- -- --- Copyright (C) 1996-2007, Free Software Foundation, Inc. -- +-- Copyright (C) 1996-2008, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -96,9 +96,10 @@ package System.Aux_DEC is function "or" (Left, Right : Largest_Integer) return Largest_Integer; function "xor" (Left, Right : Largest_Integer) return Largest_Integer; - Address_Zero : constant Address; - No_Addr : constant Address; - Address_Size : constant := Standard'Address_Size; + Address_Zero : constant Address; + No_Addr : constant Address; + Address_Size : constant := Standard'Address_Size; + Short_Address_Size : constant := 32; function "+" (Left : Address; Right : Integer) return Address; function "+" (Left : Integer; Right : Address) return Address; diff --git a/gcc/ada/s-auxdec.ads b/gcc/ada/s-auxdec.ads index 6e90f89852f..c507a7e7546 100644 --- a/gcc/ada/s-auxdec.ads +++ b/gcc/ada/s-auxdec.ads @@ -6,7 +6,7 @@ -- -- -- S p e c -- -- -- --- Copyright (C) 1996-2007, Free Software Foundation, Inc. -- +-- Copyright (C) 1996-2008, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -48,7 +48,7 @@ package System.Aux_DEC is -- name Short_Address is used for the short address form. To avoid -- difficulties (in regression tests and elsewhere) with units that -- reference Short_Address, it is provided for other targets as a - -- synonum for the normal Address type, and, as in the case where + -- synonym for the normal Address type, and, as in the case where -- the lengths are different, Address and Short_Address can be -- freely inter-converted. @@ -86,9 +86,10 @@ package System.Aux_DEC is function "or" (Left, Right : Largest_Integer) return Largest_Integer; function "xor" (Left, Right : Largest_Integer) return Largest_Integer; - Address_Zero : constant Address; - No_Addr : constant Address; - Address_Size : constant := Standard'Address_Size; + Address_Zero : constant Address; + No_Addr : constant Address; + Address_Size : constant := Standard'Address_Size; + Short_Address_Size : constant := Standard'Address_Size; function "+" (Left : Address; Right : Integer) return Address; function "+" (Left : Integer; Right : Address) return Address; diff --git a/gcc/ada/s-carsi8.adb b/gcc/ada/s-carsi8.adb index 4f41cdbc1b9..34c9a118170 100644 --- a/gcc/ada/s-carsi8.adb +++ b/gcc/ada/s-carsi8.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 2002-2007, Free Software Foundation, Inc. -- +-- Copyright (C) 2002-2008, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -42,6 +42,7 @@ package body System.Compare_Array_Signed_8 is type Big_Words is array (Natural) of Word; type Big_Words_Ptr is access Big_Words; + for Big_Words_Ptr'Storage_Size use 0; -- Array type used to access by words type Byte is range -128 .. +127; @@ -50,6 +51,7 @@ package body System.Compare_Array_Signed_8 is type Big_Bytes is array (Natural) of Byte; type Big_Bytes_Ptr is access Big_Bytes; + for Big_Bytes_Ptr'Storage_Size use 0; -- Array type used to access by bytes function To_Big_Words is new diff --git a/gcc/ada/s-carun8.adb b/gcc/ada/s-carun8.adb index d6f43f10cb9..79343aa092b 100644 --- a/gcc/ada/s-carun8.adb +++ b/gcc/ada/s-carun8.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 2002-2007, Free Software Foundation, Inc. -- +-- Copyright (C) 2002-2008, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -46,6 +46,7 @@ package body System.Compare_Array_Unsigned_8 is type Big_Words is array (Natural) of Word; type Big_Words_Ptr is access Big_Words; + for Big_Words_Ptr'Storage_Size use 0; -- Array type used to access by words type Byte is mod 2 ** 8; @@ -53,6 +54,7 @@ package body System.Compare_Array_Unsigned_8 is type Big_Bytes is array (Natural) of Byte; type Big_Bytes_Ptr is access Big_Bytes; + for Big_Bytes_Ptr'Storage_Size use 0; -- Array type used to access by bytes function To_Big_Words is new diff --git a/gcc/ada/s-casuti.ads b/gcc/ada/s-casuti.ads index 8ba633c288c..6831942d3fb 100644 --- a/gcc/ada/s-casuti.ads +++ b/gcc/ada/s-casuti.ads @@ -53,7 +53,7 @@ package System.Case_Util is -- returns the input argument unchanged. procedure To_Upper (A : in out String); - -- Folds all characters of string A to upper csae + -- Folds all characters of string A to upper case function To_Lower (A : Character) return Character; -- Converts A to lower case if it is an upper case letter, otherwise diff --git a/gcc/ada/s-crtl.ads b/gcc/ada/s-crtl.ads index 4ab0e7d606d..880780b0078 100644 --- a/gcc/ada/s-crtl.ads +++ b/gcc/ada/s-crtl.ads @@ -6,7 +6,7 @@ -- -- -- S p e c -- -- -- --- Copyright (C) 2003-2007, Free Software Foundation, Inc. -- +-- Copyright (C) 2003-2008, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -133,6 +133,11 @@ package System.CRTL is function malloc (Size : size_t) return System.Address; pragma Import (C, malloc, "malloc"); + function malloc32 (Size : size_t) return System.Address; + pragma Import (C, malloc32, "malloc"); + -- An uncalled alias for malloc except on 64bit systems needing to + -- allocate 32bit memory. + procedure memcpy (S1 : System.Address; S2 : System.Address; N : size_t); pragma Import (C, memcpy, "memcpy"); @@ -152,6 +157,12 @@ package System.CRTL is (Ptr : System.Address; Size : size_t) return System.Address; pragma Import (C, realloc, "realloc"); + function realloc32 + (Ptr : System.Address; Size : size_t) return System.Address; + pragma Import (C, realloc32, "realloc"); + -- An uncalled alias for realloc except on 64bit systems needing to + -- allocate 32bit memory. + procedure rewind (stream : FILEs); pragma Import (C, rewind, "rewind"); diff --git a/gcc/ada/s-fatflt.ads b/gcc/ada/s-fatflt.ads index 2ba596bc4a5..a1290791948 100644 --- a/gcc/ada/s-fatflt.ads +++ b/gcc/ada/s-fatflt.ads @@ -39,7 +39,7 @@ with System.Fat_Gen; package System.Fat_Flt is pragma Pure; - -- Note the only entity from this package that is acccessed by Rtsfind + -- Note the only entity from this package that is accessed by Rtsfind -- is the name of the package instantiation. Entities within this package -- (i.e. the individual floating-point attribute routines) are accessed -- by name using selected notation. diff --git a/gcc/ada/s-fatgen.adb b/gcc/ada/s-fatgen.adb index 20f3ead2828..f690177a59f 100644 --- a/gcc/ada/s-fatgen.adb +++ b/gcc/ada/s-fatgen.adb @@ -54,7 +54,7 @@ package body System.Fat_Gen is Invrad : constant T := 1.0 / Rad; subtype Expbits is Integer range 0 .. 6; - -- 2 ** (2 ** 7) might overflow. how big can radix-16 exponents get? + -- 2 ** (2 ** 7) might overflow. How big can radix-16 exponents get? Log_Power : constant array (Expbits) of Integer := (1, 2, 4, 8, 16, 32, 64); @@ -569,7 +569,7 @@ package body System.Fat_Gen is return X; end if; - -- Nonzero x. essentially, just multiply repeatedly by Rad ** (+-2**n) + -- Nonzero x essentially, just multiply repeatedly by Rad ** (+-2**n) declare Y : T := X; @@ -660,7 +660,7 @@ package body System.Fat_Gen is -- since the exponent is going to be reduced. -- Note that X_Frac has the same sign as X, so if X_Frac is -0.5, - -- then we know that we have a ngeative number (and hence a + -- then we know that we have a negative number (and hence a -- negative power of 2). if X_Frac = -0.5 then @@ -809,14 +809,14 @@ package body System.Fat_Gen is -- entire floating-point value. Do not take into account excessive -- padding, as occurs on IA-64 where 80 bits floats get padded to 128 -- bits. In general, the exponent field cannot be larger than 15 bits, - -- even for 128-bit floating-poin t types, so the final format size + -- even for 128-bit floating-point types, so the final format size -- won't be larger than T'Mantissa + 16. type Float_Rep is array (Rep_Index range 0 .. Rep_Index (Rep_Words - 1)) of Float_Word; pragma Suppress_Initialization (Float_Rep); - -- This pragma supresses the generation of an initialization procedure + -- This pragma suppresses the generation of an initialization procedure -- for type Float_Rep when operating in Initialize/Normalize_Scalars -- mode. This is not just a matter of efficiency, but of functionality, -- since Valid has a pragma Inline_Always, which is not permitted if @@ -873,8 +873,8 @@ package body System.Fat_Gen is begin if T'Denorm then - -- All denormalized numbers are valid, so only invalid numbers are - -- overflows and NaN's, both with exponent = Emax + 1. + -- All denormalized numbers are valid, so the only invalid numbers + -- are overflows and NaNs, both with exponent = Emax + 1. return E /= IEEE_Emax + 1; diff --git a/gcc/ada/s-fatlfl.ads b/gcc/ada/s-fatlfl.ads index 844f1b4739a..b4c5c510af8 100644 --- a/gcc/ada/s-fatlfl.ads +++ b/gcc/ada/s-fatlfl.ads @@ -39,7 +39,7 @@ with System.Fat_Gen; package System.Fat_LFlt is pragma Pure; - -- Note the only entity from this package that is acccessed by Rtsfind + -- Note the only entity from this package that is accessed by Rtsfind -- is the name of the package instantiation. Entities within this package -- (i.e. the individual floating-point attribute routines) are accessed -- by name using selected notation. diff --git a/gcc/ada/s-fatllf.ads b/gcc/ada/s-fatllf.ads index f2d554c4dab..6869d8e7e85 100644 --- a/gcc/ada/s-fatllf.ads +++ b/gcc/ada/s-fatllf.ads @@ -39,7 +39,7 @@ with System.Fat_Gen; package System.Fat_LLF is pragma Pure; - -- Note the only entity from this package that is acccessed by Rtsfind + -- Note the only entity from this package that is accessed by Rtsfind -- is the name of the package instantiation. Entities within this package -- (i.e. the individual floating-point attribute routines) are accessed -- by name using selected notation. diff --git a/gcc/ada/s-fatsfl.ads b/gcc/ada/s-fatsfl.ads index 129efea64a2..8539723bf04 100644 --- a/gcc/ada/s-fatsfl.ads +++ b/gcc/ada/s-fatsfl.ads @@ -39,7 +39,7 @@ with System.Fat_Gen; package System.Fat_SFlt is pragma Pure; - -- Note the only entity from this package that is acccessed by Rtsfind + -- Note the only entity from this package that is accessed by Rtsfind -- is the name of the package instantiation. Entities within this package -- (i.e. the individual floating-point attribute routines) are accessed -- by name using selected notation. diff --git a/gcc/ada/s-fileio.adb b/gcc/ada/s-fileio.adb index 7a490cdc15c..f34e68ab696 100644 --- a/gcc/ada/s-fileio.adb +++ b/gcc/ada/s-fileio.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 1992-2007, Free Software Foundation, Inc. -- +-- Copyright (C) 1992-2008, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -823,7 +823,7 @@ package body System.File_IO is if Stream /= NULL_Stream then Full_Name_Len := Name'Length + 1; Fullname (1 .. Full_Name_Len - 1) := Name; - Fullname (Full_Name_Len) := ASCII.Nul; + Fullname (Full_Name_Len) := ASCII.NUL; -- Normal case of Open or Create @@ -982,7 +982,7 @@ package body System.File_IO is Stream := fopen (Namestr'Address, Fopstr'Address, Encoding); if Stream = NULL_Stream then - if file_exists (Namestr'Address) = 0 then + if not Tempfile and then file_exists (Namestr'Address) = 0 then raise Name_Error; else raise Use_Error; diff --git a/gcc/ada/s-filofl.ads b/gcc/ada/s-filofl.ads index dded3cf5a94..b185890bf1e 100644 --- a/gcc/ada/s-filofl.ads +++ b/gcc/ada/s-filofl.ads @@ -32,7 +32,7 @@ ------------------------------------------------------------------------------ -- This package contains an instantiation of the floating-point attribute --- runtime routines for IEEE long float. This is used on VMS targest where +-- runtime routines for IEEE long float. This is used on VMS targets where -- we can't just use Long_Float, since this may have been mapped to Vax_Float -- using a Float_Representation configuration pragma. @@ -44,7 +44,7 @@ package System.Fat_IEEE_Long_Float is type Fat_IEEE_Long is digits 15; pragma Float_Representation (IEEE_Float, Fat_IEEE_Long); - -- Note the only entity from this package that is acccessed by Rtsfind + -- Note the only entity from this package that is accessed by Rtsfind -- is the name of the package instantiation. Entities within this package -- (i.e. the individual floating-point attribute routines) are accessed -- by name using selected notation. diff --git a/gcc/ada/s-finimp.adb b/gcc/ada/s-finimp.adb index 4ed7c6ce1e8..2d6defb3e6b 100644 --- a/gcc/ada/s-finimp.adb +++ b/gcc/ada/s-finimp.adb @@ -100,7 +100,7 @@ package body System.Finalization_Implementation is -- Subtract the offset to the pointer procedure Reverse_Adjust (P : Finalizable_Ptr); - -- Ajust the components in the reverse order in which they are stored + -- Adjust the components in the reverse order in which they are stored -- on the finalization list. (Adjust and Finalization are not done in -- the same order) @@ -139,7 +139,7 @@ package body System.Finalization_Implementation is First_Comp := Object.F; Object.F := null; -- nothing adjusted yet. - Ptr_Adjust (First_Comp); -- set addresss of first component. + Ptr_Adjust (First_Comp); -- set address of first component. Reverse_Adjust (First_Comp); -- Then Adjust the controller itself @@ -412,7 +412,7 @@ package body System.Finalization_Implementation is -- At this stage, we know that the controller is part of the -- ancestor corresponding to the tag "The_Tag" and that its parent -- is variable sized. We assume that the _controller is the first - -- compoment right after the parent. + -- component right after the parent. -- ??? note that it may not be true if there are new discriminants diff --git a/gcc/ada/s-finroo.ads b/gcc/ada/s-finroo.ads index 79f403c5fc6..0f4b7d189bf 100644 --- a/gcc/ada/s-finroo.ads +++ b/gcc/ada/s-finroo.ads @@ -61,7 +61,7 @@ package System.Finalization_Root is procedure Finalize (Object : in out Root_Controlled); procedure Adjust (Object : in out Root_Controlled); - -- Stream-oriented attibutes for Root_Controlled. These must be empty so + -- Stream-oriented attributes for Root_Controlled. These must be empty so -- as to not copy the finalization chain pointers. They are declared in -- a nested package so that they do not create primitive operations of -- Root_Controlled. Otherwise this would add unwanted primitives to (the diff --git a/gcc/ada/s-fishfl.ads b/gcc/ada/s-fishfl.ads index 7308618f1ad..0b0839fc998 100644 --- a/gcc/ada/s-fishfl.ads +++ b/gcc/ada/s-fishfl.ads @@ -32,7 +32,7 @@ ------------------------------------------------------------------------------ -- This package contains an instantiation of the floating-point attribute --- runtime routines for IEEE short float. This is used on VMS targest where +-- runtime routines for IEEE short float. This is used on VMS targets where -- we can't just use Float, since this may have been mapped to Vax_Float -- using a Float_Representation configuration pragma. @@ -44,7 +44,7 @@ package System.Fat_IEEE_Short_Float is type Fat_IEEE_Short is digits 6; pragma Float_Representation (IEEE_Float, Fat_IEEE_Short); - -- Note the only entity from this package that is acccessed by Rtsfind + -- Note the only entity from this package that is accessed by Rtsfind -- is the name of the package instantiation. Entities within this package -- (i.e. the individual floating-point attribute routines) are accessed -- by name using selected notation. diff --git a/gcc/ada/s-fvadfl.ads b/gcc/ada/s-fvadfl.ads index 05a367ca42f..76c3a0b4736 100644 --- a/gcc/ada/s-fvadfl.ads +++ b/gcc/ada/s-fvadfl.ads @@ -41,12 +41,12 @@ package System.Fat_VAX_D_Float is pragma Warnings (Off); -- This unit is normally used only for VMS, but we compile it for other - -- targest for the convenience of testing vms code using -gnatdm. + -- targets for the convenience of testing vms code using -gnatdm. type Fat_VAX_D is digits 9; pragma Float_Representation (VAX_Float, Fat_VAX_D); - -- Note the only entity from this package that is acccessed by Rtsfind + -- Note the only entity from this package that is accessed by Rtsfind -- is the name of the package instantiation. Entities within this package -- (i.e. the individual floating-point attribute routines) are accessed -- by name using selected notation. diff --git a/gcc/ada/s-fvaffl.ads b/gcc/ada/s-fvaffl.ads index 0c769bfd9d1..729391cb5df 100644 --- a/gcc/ada/s-fvaffl.ads +++ b/gcc/ada/s-fvaffl.ads @@ -41,12 +41,12 @@ package System.Fat_VAX_F_Float is pragma Warnings (Off); -- This unit is normally used only for VMS, but we compile it for other - -- targest for the convenience of testing vms code using -gnatdm. + -- targets for the convenience of testing vms code using -gnatdm. type Fat_VAX_F is digits 6; pragma Float_Representation (VAX_Float, Fat_VAX_F); - -- Note the only entity from this package that is acccessed by Rtsfind + -- Note the only entity from this package that is accessed by Rtsfind -- is the name of the package instantiation. Entities within this package -- (i.e. the individual floating-point attribute routines) are accessed -- by name using selected notation. diff --git a/gcc/ada/s-fvagfl.ads b/gcc/ada/s-fvagfl.ads index 50a06b9e9e1..bbce6ef9731 100644 --- a/gcc/ada/s-fvagfl.ads +++ b/gcc/ada/s-fvagfl.ads @@ -41,12 +41,12 @@ package System.Fat_VAX_G_Float is pragma Warnings (Off); -- This unit is normally used only for VMS, but we compile it for other - -- targest for the convenience of testing vms code using -gnatdm. + -- targets for the convenience of testing vms code using -gnatdm. type Fat_VAX_G is digits 15; pragma Float_Representation (VAX_Float, Fat_VAX_G); - -- Note the only entity from this package that is acccessed by Rtsfind + -- Note the only entity from this package that is accessed by Rtsfind -- is the name of the package instantiation. Entities within this package -- (i.e. the individual floating-point attribute routines) are accessed -- by name using selected notation. diff --git a/gcc/ada/s-gloloc-mingw.adb b/gcc/ada/s-gloloc-mingw.adb index e30a9b8de30..39c8abf097d 100644 --- a/gcc/ada/s-gloloc-mingw.adb +++ b/gcc/ada/s-gloloc-mingw.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 1999-2007, AdaCore -- +-- Copyright (C) 1999-2008, AdaCore -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -33,10 +33,11 @@ -- This implementation is specific to NT +with System.OS_Interface; with System.Task_Lock; +with System.Win32; with Interfaces.C.Strings; -with System.OS_Interface; package body System.Global_Locks is @@ -44,7 +45,7 @@ package body System.Global_Locks is package OSI renames System.OS_Interface; package ICS renames Interfaces.C.Strings; - subtype Lock_File_Entry is OSI.HANDLE; + subtype Lock_File_Entry is Win32.HANDLE; Last_Lock : Lock_Type := Null_Lock; Lock_Table : array (Lock_Type range 1 .. 15) of Lock_File_Entry; @@ -53,10 +54,7 @@ package body System.Global_Locks is -- Create_Lock -- ----------------- - procedure Create_Lock - (Lock : out Lock_Type; - Name : String) - is + procedure Create_Lock (Lock : out Lock_Type; Name : String) is L : Lock_Type; begin @@ -70,7 +68,7 @@ package body System.Global_Locks is end if; Lock_Table (L) := - OSI.CreateMutex (null, OSI.BOOL (False), ICS.New_String (Name)); + OSI.CreateMutex (null, Win32.FALSE, ICS.New_String (Name)); Lock := L; end Create_Lock; @@ -78,12 +76,11 @@ package body System.Global_Locks is -- Acquire_Lock -- ------------------ - procedure Acquire_Lock - (Lock : in out Lock_Type) - is - use type OSI.DWORD; + procedure Acquire_Lock (Lock : in out Lock_Type) is + use type Win32.DWORD; + + Res : Win32.DWORD; - Res : OSI.DWORD; begin Res := OSI.WaitForSingleObject (Lock_Table (Lock), OSI.Wait_Infinite); @@ -96,16 +93,15 @@ package body System.Global_Locks is -- Release_Lock -- ------------------ - procedure Release_Lock - (Lock : in out Lock_Type) - is - use type OSI.BOOL; + procedure Release_Lock (Lock : in out Lock_Type) is + use type Win32.BOOL; + + Res : Win32.BOOL; - Res : OSI.BOOL; begin Res := OSI.ReleaseMutex (Lock_Table (Lock)); - if Res = OSI.False then + if Res = Win32.FALSE then raise Lock_Error; end if; end Release_Lock; diff --git a/gcc/ada/s-hibaen.ads b/gcc/ada/s-hibaen.ads index 90ba0155d34..d7ae2325106 100644 --- a/gcc/ada/s-hibaen.ads +++ b/gcc/ada/s-hibaen.ads @@ -73,7 +73,7 @@ package System.HIE_Back_End is -- This entity controls whether the front end allows generation of -- long shift instructions, i.e. shifts that operate on 64-bit values. -- Such shifts are required for the implementation of fixed-point - -- types longer than 32 bits. This can safetly be set as High_Integrity + -- types longer than 32 bits. This can safely be set as High_Integrity -- on 64-bit machines that provide this operation at the hardware level, -- but on some 32-bit machines a run time call is required. If there -- is a certifiable version available of the relevant run-time routines, diff --git a/gcc/ada/s-htable.ads b/gcc/ada/s-htable.ads index d5116c69f3b..d7bcbef5f38 100644 --- a/gcc/ada/s-htable.ads +++ b/gcc/ada/s-htable.ads @@ -183,7 +183,7 @@ package System.HTable is function Get_Next return Elmt_Ptr; -- Returns a non-specified element that has not been returned by the -- same function since the last call to Get_First or Null_Ptr if - -- there is no such element or Get_First has bever been called. If + -- there is no such element or Get_First has never been called. If -- there is no call to 'Set' in between Get_Next calls, all the -- elements of the HTable will be traversed. diff --git a/gcc/ada/s-imgcha.adb b/gcc/ada/s-imgcha.adb index a8d7c10bc09..3d9bbe9b86b 100644 --- a/gcc/ada/s-imgcha.adb +++ b/gcc/ada/s-imgcha.adb @@ -159,7 +159,7 @@ package body System.Img_Char is end; end if; - -- Normal characters yield the character enlosed in quotes (RM 3.5(32)) + -- Normal characters yield the character enclosed in quotes (RM 3.5(32)) else S (1) := '''; diff --git a/gcc/ada/s-imgdec.adb b/gcc/ada/s-imgdec.adb index ce7365eb2a6..facafcb495f 100644 --- a/gcc/ada/s-imgdec.adb +++ b/gcc/ada/s-imgdec.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 1992-2007, Free Software Foundation, Inc. -- +-- Copyright (C) 1992-2008, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -129,6 +129,10 @@ package body System.Img_Dec is pragma Inline (Set_Zeroes); -- Set N zeroes, no effect if N is negative + ----------- + -- Round -- + ----------- + procedure Round (N : Natural) is D : Character; @@ -250,7 +254,7 @@ package body System.Img_Dec is if Exp > 0 then Set_Blanks_And_Sign (Fore - 1); - Round (Aft + 2); + Round (Digits_After_Point + 2); Set (Digs (FD)); FD := FD + 1; ND := ND - 1; @@ -258,7 +262,6 @@ package body System.Img_Dec is if ND >= Digits_After_Point then Set_Digits (FD, FD + Digits_After_Point - 1); - else Set_Digits (FD, LD); Set_Zeroes (Digits_After_Point - ND); @@ -317,27 +320,42 @@ package body System.Img_Dec is Set_Blanks_And_Sign (Fore - 1); Set ('0'); Set ('.'); - - Set_Zeroes (Digits_After_Point - ND); + Set_Zeroes (-Digits_Before_Point); Set_Digits (FD, LD); + Set_Zeroes (Digits_After_Point - Scale); -- At least one digit before point in input else - Set_Blanks_And_Sign (Fore - Digits_Before_Point); - -- Less digits in input than are needed before point -- Input: 1PP Output: 100.000 if ND < Digits_Before_Point then - Set_Digits (FD, LD); - Set_Zeroes (Digits_Before_Point - ND); + + -- Special case, if the input is the single digit 0, then we + -- do not want 000.000, but instead 0.000. + + if ND = 1 and then Digs (FD) = '0' then + Set_Blanks_And_Sign (Fore - 1); + Set ('0'); + + -- Normal case where we need to output scaling zeroes + + else + Set_Blanks_And_Sign (Fore - Digits_Before_Point); + Set_Digits (FD, LD); + Set_Zeroes (Digits_Before_Point - ND); + end if; + + -- Set period and zeroes after the period + Set ('.'); Set_Zeroes (Digits_After_Point); -- Input has full amount of digits before decimal point else + Set_Blanks_And_Sign (Fore - Digits_Before_Point); Set_Digits (FD, FD + Digits_Before_Point - 1); Set ('.'); Set_Digits (FD + Digits_Before_Point, LD); diff --git a/gcc/ada/s-imgenu.ads b/gcc/ada/s-imgenu.ads index 2b6fbdd3109..9dc66e68634 100644 --- a/gcc/ada/s-imgenu.ads +++ b/gcc/ada/s-imgenu.ads @@ -39,8 +39,8 @@ -- Note: this is an obsolete package, replaced by System.Img_Enum_New, which -- provides procedures instead of functions for these enumeration image calls. -- The reason we maintain this package is that when bootstrapping with old --- compilers, the old compiler will search for this unit, expectinng to find --- these functions. The new commpiler will search for procedures in the new +-- compilers, the old compiler will search for this unit, expecting to find +-- these functions. The new compiler will search for procedures in the new -- version of the unit. pragma Warnings (Off); diff --git a/gcc/ada/s-imgint.adb b/gcc/ada/s-imgint.adb index 74a5b736e48..a6c31489e69 100644 --- a/gcc/ada/s-imgint.adb +++ b/gcc/ada/s-imgint.adb @@ -65,7 +65,7 @@ package body System.Img_Int is end if; end Set_Digits; - -- Start of processinng for Image_Integer + -- Start of processing for Image_Integer begin P := 1; diff --git a/gcc/ada/s-imgrea.adb b/gcc/ada/s-imgrea.adb index e9fd56067f8..bbcf225a1dd 100644 --- a/gcc/ada/s-imgrea.adb +++ b/gcc/ada/s-imgrea.adb @@ -87,7 +87,7 @@ package body System.Img_Real is pragma Assert (S'First = 1); begin - -- Decide wether a blank should be prepended before the call to + -- Decide whether a blank should be prepended before the call to -- Set_Image_Real. We generate a blank for positive values, and -- also for positive zeroes. For negative zeroes, we generate a -- space only if Signed_Zeroes is True (the RM only permits the diff --git a/gcc/ada/s-inmaop-dummy.adb b/gcc/ada/s-inmaop-dummy.adb index edd636ed077..4c7f77c63ae 100644 --- a/gcc/ada/s-inmaop-dummy.adb +++ b/gcc/ada/s-inmaop-dummy.adb @@ -134,9 +134,9 @@ package body System.Interrupt_Management.Operations is null; end Empty_Interrupt_Mask; - ----------------------- - -- Add_To_Sigal_Mask -- - ----------------------- + --------------------------- + -- Add_To_Interrupt_Mask -- + --------------------------- procedure Add_To_Interrupt_Mask (Mask : access Interrupt_Mask; diff --git a/gcc/ada/s-inmaop-vms.adb b/gcc/ada/s-inmaop-vms.adb index 34eaf09547d..7d6a45b5dba 100644 --- a/gcc/ada/s-inmaop-vms.adb +++ b/gcc/ada/s-inmaop-vms.adb @@ -38,6 +38,7 @@ with System.Aux_DEC; with System.Parameters; with System.Tasking; with System.Tasking.Initialization; +with System.Task_Primitives; with System.Task_Primitives.Operations; with System.Task_Primitives.Operations.DEC; @@ -51,7 +52,8 @@ package body System.Interrupt_Management.Operations is use type unsigned_short; function To_Address is - new Ada.Unchecked_Conversion (Task_Id, System.Address); + new Ada.Unchecked_Conversion + (Task_Id, System.Task_Primitives.Task_Address); package POP renames System.Task_Primitives.Operations; diff --git a/gcc/ada/s-inmaop.ads b/gcc/ada/s-inmaop.ads index 1bd660ef875..2e9674d22df 100644 --- a/gcc/ada/s-inmaop.ads +++ b/gcc/ada/s-inmaop.ads @@ -96,7 +96,7 @@ package System.Interrupt_Management.Operations is procedure Copy_Interrupt_Mask (X : out Interrupt_Mask; Y : Interrupt_Mask); pragma Inline (Copy_Interrupt_Mask); - -- Assigment needed for limited private type Interrupt_Mask + -- Assignment needed for limited private type Interrupt_Mask procedure Interrupt_Self_Process (Interrupt : Interrupt_ID); pragma Inline (Interrupt_Self_Process); diff --git a/gcc/ada/s-interr-dummy.adb b/gcc/ada/s-interr-dummy.adb index 075c8b5755c..343f8f559f1 100644 --- a/gcc/ada/s-interr-dummy.adb +++ b/gcc/ada/s-interr-dummy.adb @@ -7,7 +7,7 @@ -- B o d y -- -- -- -- Copyright (C) 1991-1994, Florida State University -- --- Copyright (C) 1995-2007, AdaCore -- +-- Copyright (C) 1995-2008, AdaCore -- -- -- -- GNARL is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -185,6 +185,15 @@ package body System.Interrupts is Unimplemented; end Install_Handlers; + --------------------------------- + -- Install_Restricted_Handlers -- + --------------------------------- + + procedure Install_Restricted_Handlers (Handlers : New_Handler_Array) is + begin + Unimplemented; + end Install_Restricted_Handlers; + ---------------- -- Is_Blocked -- ---------------- diff --git a/gcc/ada/s-interr-sigaction.adb b/gcc/ada/s-interr-sigaction.adb index a63b35aaaa3..14bb9707fec 100644 --- a/gcc/ada/s-interr-sigaction.adb +++ b/gcc/ada/s-interr-sigaction.adb @@ -290,6 +290,17 @@ package body System.Interrupts is end loop; end Install_Handlers; + --------------------------------- + -- Install_Restricted_Handlers -- + --------------------------------- + + procedure Install_Restricted_Handlers (Handlers : New_Handler_Array) is + begin + for N in Handlers'Range loop + Attach_Handler (Handlers (N).Handler, Handlers (N).Interrupt, True); + end loop; + end Install_Restricted_Handlers; + --------------------- -- Current_Handler -- --------------------- diff --git a/gcc/ada/s-interr-vms.adb b/gcc/ada/s-interr-vms.adb index 3a7124025c2..83e814160d4 100644 --- a/gcc/ada/s-interr-vms.adb +++ b/gcc/ada/s-interr-vms.adb @@ -222,7 +222,7 @@ package body System.Interrupts is begin -- This routine registers the Handler as usable for Dynamic -- Interrupt Handler. Routines attaching and detaching Handler - -- dynamically should first consult if the Handler is rgistered. + -- dynamically should first consult if the Handler is registered. -- A Program Error should be raised if it is not registered. -- The pragma Interrupt_Handler can only appear in the library @@ -372,7 +372,7 @@ package body System.Interrupts is -- Calling this procedure with New_Handler = null and Static = True -- means we want to detach the current handler regardless of the - -- previous handler's binding status (ie. do not care if it is a + -- previous handler's binding status (i.e. do not care if it is a -- dynamic or static handler). -- This option is needed so that during the finalization of a PO, we @@ -398,7 +398,7 @@ package body System.Interrupts is -- Calling this procedure with New_Handler = null and Static = True means -- we want to detach the current handler regardless of the previous - -- handler's binding status (ie. do not care if it is dynamic or static + -- handler's binding status (i.e. do not care if it is dynamic or static -- handler). -- This option is needed so that during the finalization of a PO, we can @@ -630,7 +630,7 @@ package body System.Interrupts is "dynamic Handler"; end if; - -- The interrupt should no longer be ingnored if it was ever ignored + -- The interrupt should no longer be ignored if it was ever ignored Ignored (Interrupt) := False; @@ -715,7 +715,7 @@ package body System.Interrupts is System.Tasking.Utilities.Make_Independent; - -- Environmen task gets its own interrupt mask, saves it, + -- Environment task gets its own interrupt mask, saves it, -- and then masks all interrupts except the Keep_Unmasked set. -- During rendezvous, the Interrupt_Manager receives the old @@ -736,22 +736,22 @@ package body System.Interrupts is -- Abort_Task_Interrupt is one of the Interrupt unmasked -- in all tasks. We mask the Interrupt in this particular task - -- so that "sigwait" is possible to catch an explicitely sent + -- so that "sigwait" is possible to catch an explicitly sent -- Abort_Task_Interrupt from the Server_Tasks. -- This sigwaiting is needed so that we make sure a Server_Task is -- out of its own sigwait state. This extra synchronization is - -- necessary to prevent following senarios. + -- necessary to prevent following scenarios. -- 1) Interrupt_Manager sends an Abort_Task_Interrupt to the -- Server_Task then changes its own interrupt mask (OS level). -- If an interrupt (corresponding to the Server_Task) arrives - -- in the nean time we have the Interrupt_Manager umnasked and + -- in the mean time we have the Interrupt_Manager unmasked and -- the Server_Task waiting on sigwait. -- 2) For unbinding handler, we install a default action in the -- Interrupt_Manager. POSIX.1c states that the result of using - -- "sigwait" and "sigaction" simaltaneously on the same interrupt + -- "sigwait" and "sigaction" simultaneously on the same interrupt -- is undefined. Therefore, we need to be informed from the -- Server_Task of the fact that the Server_Task is out of its -- sigwait stage. @@ -806,7 +806,7 @@ package body System.Interrupts is "A binding for this interrupt is already present"; end if; - -- The interrupt should no longer be ingnored if + -- The interrupt should no longer be ignored if -- it was ever ignored. Ignored (Interrupt) := False; @@ -938,7 +938,7 @@ package body System.Interrupts is -- (Abort_Task_Interrupt) from the Interrupt_Manager for unbinding -- a Procedure Handler or an Entry. Or it could be a wake up -- from status change (Unblocked -> Blocked). If that is not - -- the case, we should exceute the attached Procedure or Entry. + -- the case, we should execute the attached Procedure or Entry. if Single_Lock then POP.Lock_RTS; @@ -1096,6 +1096,17 @@ package body System.Interrupts is end loop; end Install_Handlers; + --------------------------------- + -- Install_Restricted_Handlers -- + --------------------------------- + + procedure Install_Restricted_Handlers (Handlers : New_Handler_Array) is + begin + for N in Handlers'Range loop + Attach_Handler (Handlers (N).Handler, Handlers (N).Interrupt, True); + end loop; + end Install_Restricted_Handlers; + -- Elaboration code for package System.Interrupts begin diff --git a/gcc/ada/s-interr-vxworks.adb b/gcc/ada/s-interr-vxworks.adb index ec14f11c899..98254e617be 100644 --- a/gcc/ada/s-interr-vxworks.adb +++ b/gcc/ada/s-interr-vxworks.adb @@ -191,10 +191,10 @@ package body System.Interrupts is Interrupt_Access_Hold : Interrupt_Task_Access; -- Variable for allocating an Interrupt_Server_Task - Default_Handler : array (HW_Interrupt) of Interfaces.VxWorks.VOIDFUNCPTR; - -- Vectored interrupt handlers installed prior to program startup. - -- These are saved only when the umbrella handler is installed for - -- a given interrupt number. + Handler_Installed : array (HW_Interrupt) of Boolean := (others => False); + -- True if Notify_Interrupt was connected to the interrupt. Handlers + -- can be connected but disconnection is not possible on VxWorks. + -- Therefore we ensure Notify_Installed is connected at most once. ----------------------- -- Local Subprograms -- @@ -215,9 +215,6 @@ package body System.Interrupts is procedure Notify_Interrupt (Param : System.Address); -- Umbrella handler for vectored interrupts (not signals) - procedure Install_Default_Action (Interrupt : HW_Interrupt); - -- Restore a handler that was in place prior to program execution - procedure Install_Umbrella_Handler (Interrupt : HW_Interrupt; Handler : Interfaces.VxWorks.VOIDFUNCPTR); @@ -235,7 +232,7 @@ package body System.Interrupts is -- Calling this procedure with New_Handler = null and Static = True -- means we want to detach the current handler regardless of the - -- previous handler's binding status (ie. do not care if it is a + -- previous handler's binding status (i.e. do not care if it is a -- dynamic or static handler). -- This option is needed so that during the finalization of a PO, we @@ -345,7 +342,7 @@ package body System.Interrupts is -- Calling this procedure with New_Handler = null and Static = True -- means we want to detach the current handler regardless of the - -- previous handler's binding status (ie. do not care if it is a + -- previous handler's binding status (i.e. do not care if it is a -- dynamic or static handler). -- This option is needed so that during the finalization of a PO, we @@ -448,20 +445,6 @@ package body System.Interrupts is Unimplemented ("Ignore_Interrupt"); end Ignore_Interrupt; - ---------------------------- - -- Install_Default_Action -- - ---------------------------- - - procedure Install_Default_Action (Interrupt : HW_Interrupt) is - begin - -- Restore original interrupt handler - - Interfaces.VxWorks.intVecSet - (Interfaces.VxWorks.INUM_TO_IVEC (Integer (Interrupt)), - Default_Handler (Interrupt)); - Default_Handler (Interrupt) := null; - end Install_Default_Action; - ---------------------- -- Install_Handlers -- ---------------------- @@ -490,6 +473,17 @@ package body System.Interrupts is end loop; end Install_Handlers; + --------------------------------- + -- Install_Restricted_Handlers -- + --------------------------------- + + procedure Install_Restricted_Handlers (Handlers : New_Handler_Array) is + begin + for N in Handlers'Range loop + Attach_Handler (Handlers (N).Handler, Handlers (N).Interrupt, True); + end loop; + end Install_Restricted_Handlers; + ------------------------------ -- Install_Umbrella_Handler -- ------------------------------ @@ -503,10 +497,6 @@ package body System.Interrupts is Vec : constant Interrupt_Vector := INUM_TO_IVEC (Interfaces.VxWorks.int (Interrupt)); - Old_Handler : constant VOIDFUNCPTR := - intVecGet - (INUM_TO_IVEC (Interfaces.VxWorks.int (Interrupt))); - Stat : Interfaces.VxWorks.STATUS; pragma Unreferenced (Stat); -- ??? shouldn't we test Stat at least in a pragma Assert? @@ -517,10 +507,9 @@ package body System.Interrupts is -- when an interrupt occurs, so the umbrella handler has a different -- wrapper generated by intConnect for each interrupt number. - if Default_Handler (Interrupt) = null then - Stat := - intConnect (Vec, Handler, System.Address (Interrupt)); - Default_Handler (Interrupt) := Old_Handler; + if not Handler_Installed (Interrupt) then + Stat := intConnect (Vec, Handler, System.Address (Interrupt)); + Handler_Installed (Interrupt) := True; end if; end Install_Umbrella_Handler; @@ -616,8 +605,10 @@ package body System.Interrupts is -- Umbrella handler for vectored hardware interrupts (as opposed to -- signals and exceptions). As opposed to the signal implementation, - -- this handler is only installed in the vector table while there is - -- an active association of an Ada handler to the interrupt. + -- this handler is installed in the vector table when the first Ada + -- handler is attached to the interrupt. However because VxWorks don't + -- support disconnecting handlers, this subprogram always test wether + -- or not an Ada handler is effectively attached. -- Otherwise, the handler that existed prior to program startup is -- in the vector table. This ensures that handlers installed by @@ -625,7 +616,7 @@ package body System.Interrupts is -- Each Interrupt_Server_Task has an associated binary semaphore -- on which it pends once it's been started. This routine determines - -- The appropriate semaphore and and issues a semGive call, waking + -- The appropriate semaphore and issues a semGive call, waking -- the server task. When a handler is unbound, -- System.Interrupts.Unbind_Handler issues a semFlush, and the -- server task deletes its semaphore and terminates. @@ -633,11 +624,15 @@ package body System.Interrupts is procedure Notify_Interrupt (Param : System.Address) is Interrupt : constant Interrupt_ID := Interrupt_ID (Param); + Id : constant SEM_ID := Semaphore_ID_Map (Interrupt); + Discard_Result : STATUS; pragma Unreferenced (Discard_Result); begin - Discard_Result := semGive (Semaphore_ID_Map (Interrupt)); + if Id /= 0 then + Discard_Result := semGive (Id); + end if; end Notify_Interrupt; --------------- @@ -773,9 +768,6 @@ package body System.Interrupts is use type STATUS; begin - -- Hardware interrupt - - Install_Default_Action (HW_Interrupt (Interrupt)); -- Flush server task off semaphore, allowing it to terminate @@ -1093,6 +1085,10 @@ package body System.Interrupts is POP.Write_Lock (Self_Id); + -- Unassociate the interrupt handler. + + Semaphore_ID_Map (Interrupt) := 0; + -- Delete the associated semaphore S := semDelete (Int_Sema); @@ -1101,7 +1097,6 @@ package body System.Interrupts is -- Set status for the Interrupt_Manager - Semaphore_ID_Map (Interrupt) := 0; Server_ID (Interrupt) := Null_Task; POP.Unlock (Self_Id); diff --git a/gcc/ada/s-interr.adb b/gcc/ada/s-interr.adb index 7b4175eab59..44411125493 100644 --- a/gcc/ada/s-interr.adb +++ b/gcc/ada/s-interr.adb @@ -44,7 +44,7 @@ -- Note : Direct calls to sigaction, sigprocmask, pthread_sigsetmask or any -- other low-level interface that changes the interrupt action or -- interrupt mask needs a careful thought. --- One may acheive the effect of system calls first masking RTS blocked +-- One may achieve the effect of system calls first masking RTS blocked -- (by calling Block_Interrupt) for the interrupt under consideration. -- This will make all the tasks in RTS blocked for the Interrupt. @@ -224,7 +224,7 @@ package body System.Interrupts is -- Calling this procedure with New_Handler = null and Static = True means -- we want to detach the current handler regardless of the previous - -- handler's binding status (ie. do not care if it is a dynamic or static + -- handler's binding status (i.e. do not care if it is a dynamic or static -- handler). -- This option is needed so that during the finalization of a PO, we can @@ -342,7 +342,7 @@ package body System.Interrupts is -- Calling this procedure with New_Handler = null and Static = True means -- we want to detach the current handler regardless of the previous - -- handler's binding status (ie. do not care if it is a dynamic or static + -- handler's binding status (i.e. do not care if it is a dynamic or static -- handler). -- This option is needed so that during the finalization of a PO, we can @@ -451,6 +451,17 @@ package body System.Interrupts is end loop; end Install_Handlers; + --------------------------------- + -- Install_Restricted_Handlers -- + --------------------------------- + + procedure Install_Restricted_Handlers (Handlers : New_Handler_Array) is + begin + for N in Handlers'Range loop + Attach_Handler (Handlers (N).Handler, Handlers (N).Interrupt, True); + end loop; + end Install_Restricted_Handlers; + ---------------- -- Is_Blocked -- ---------------- @@ -694,7 +705,7 @@ package body System.Interrupts is if not Blocked (Interrupt) then -- Mask this task for the given Interrupt so that all tasks - -- are masked for the Interrupt and the actuall delivery of the + -- are masked for the Interrupt and the actual delivery of the -- Interrupt will be caught using "sigwait" by the -- corresponding Server_Task. @@ -856,7 +867,7 @@ package body System.Interrupts is "dynamic Handler"; end if; - -- The interrupt should no longer be ingnored if + -- The interrupt should no longer be ignored if -- it was ever ignored. Ignored (Interrupt) := False; @@ -942,22 +953,22 @@ package body System.Interrupts is -- Abort_Task_Interrupt is one of the Interrupt unmasked -- in all tasks. We mask the Interrupt in this particular task - -- so that "sigwait" is possible to catch an explicitely sent + -- so that "sigwait" is possible to catch an explicitly sent -- Abort_Task_Interrupt from the Server_Tasks. -- This sigwaiting is needed so that we make sure a Server_Task is -- out of its own sigwait state. This extra synchronization is - -- necessary to prevent following senarios. + -- necessary to prevent following scenarios. -- 1) Interrupt_Manager sends an Abort_Task_Interrupt to the -- Server_Task then changes its own interrupt mask (OS level). -- If an interrupt (corresponding to the Server_Task) arrives - -- in the nean time we have the Interrupt_Manager umnasked and + -- in the mean time we have the Interrupt_Manager unmasked and -- the Server_Task waiting on sigwait. -- 2) For unbinding handler, we install a default action in the -- Interrupt_Manager. POSIX.1c states that the result of using - -- "sigwait" and "sigaction" simaltaneously on the same interrupt + -- "sigwait" and "sigaction" simultaneously on the same interrupt -- is undefined. Therefore, we need to be informed from the -- Server_Task of the fact that the Server_Task is out of its -- sigwait stage. @@ -1018,7 +1029,7 @@ package body System.Interrupts is "A binding for this interrupt is already present"; end if; - -- The interrupt should no longer be ingnored if + -- The interrupt should no longer be ignored if -- it was ever ignored. Ignored (Interrupt) := False; @@ -1056,7 +1067,7 @@ package body System.Interrupts is if not Is_Reserved (J) then if User_Entry (J).T = T then - -- The interrupt should no longer be ingnored if + -- The interrupt should no longer be ignored if -- it was ever ignored. Ignored (J) := False; @@ -1228,7 +1239,7 @@ package body System.Interrupts is -- Abort_Task_Interrupt is one of the Interrupt unmasked in all tasks. -- We mask the Interrupt in this particular task so that "sigwait" is - -- possible to catch an explicitely sent Abort_Task_Interrupt from the + -- possible to catch an explicitly sent Abort_Task_Interrupt from the -- Interrupt_Manager. -- There are two Interrupt interrupts that this task catch through @@ -1290,7 +1301,7 @@ package body System.Interrupts is -- (Abort_Task_Interrupt) from the Interrupt_Manager for unbinding -- a Procedure Handler or an Entry. Or it could be a wake up -- from status change (Unblocked -> Blocked). If that is not - -- the case, we should exceute the attached Procedure or Entry. + -- the case, we should execute the attached Procedure or Entry. Self_ID.Common.State := Interrupt_Server_Blocked_On_Event_Flag; POP.Unlock (Self_ID); @@ -1412,7 +1423,7 @@ package body System.Interrupts is end if; -- Undefer abort here to allow a window for this task to be aborted - -- at the time of system shutdown. We also explicitely test for + -- at the time of system shutdown. We also explicitly test for -- Pending_Action in case System.Parameters.No_Abort is True. end loop; diff --git a/gcc/ada/s-interr.ads b/gcc/ada/s-interr.ads index 1eecfdb9af9..4254b30c0cf 100644 --- a/gcc/ada/s-interr.ads +++ b/gcc/ada/s-interr.ads @@ -150,7 +150,7 @@ package System.Interrupts is -- Comment needed ??? procedure Ignore_Interrupt (Interrupt : Interrupt_ID); - -- Set the sigacion for the interrupt to SIG_IGN + -- Set the sigaction for the interrupt to SIG_IGN procedure Unignore_Interrupt (Interrupt : Interrupt_ID); -- Comment needed ??? @@ -162,7 +162,7 @@ package System.Interrupts is -- other low-level interface that changes the signal action or signal mask -- needs a careful thought. - -- One may acheive the effect of system calls first making RTS blocked (by + -- One may achieve the effect of system calls first making RTS blocked (by -- calling Block_Interrupt) for the signal under consideration. This will -- make all the tasks in RTS blocked for the Interrupt. @@ -188,7 +188,7 @@ package System.Interrupts is -- (2) Attach_Handler pragmas are used, and possibly Interrupt_Handler -- pragma. We need to attach the handlers to the given interrupts when the - -- objet is elaborated. This should be done by constructing an array of + -- object is elaborated. This should be done by constructing an array of -- pairs (interrupt, handler) from the pragmas and calling Install_Handlers -- with it (types to be used are New_Handler_Item and New_Handler_Array). -- On finalization, we need to restore the handlers that were installed @@ -268,4 +268,11 @@ package System.Interrupts is -- Store the old handlers in Object.Previous_Handlers and install -- the new static handlers. + procedure Install_Restricted_Handlers (Handlers : New_Handler_Array); + -- Install the static Handlers for the given interrupts and do not store + -- previously installed handlers. This procedure is used when the Ravenscar + -- restrictions are in place since in that case there are only + -- library-level protected handlers that will be installed at + -- initialization and never be replaced. + end System.Interrupts; diff --git a/gcc/ada/s-intman-mingw.adb b/gcc/ada/s-intman-mingw.adb index f531750ab5a..a71208ce00e 100644 --- a/gcc/ada/s-intman-mingw.adb +++ b/gcc/ada/s-intman-mingw.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 1991-2005 Free Software Foundation, Inc. -- +-- Copyright (C) 1991-2008, Free Software Foundation, Inc. -- -- -- -- GNARL is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -43,7 +43,7 @@ package body System.Interrupt_Management is procedure Initialize is begin - -- "Reserve" all the interrupts, except those that are explicitely + -- "Reserve" all the interrupts, except those that are explicitly -- defined. for J in Interrupt_ID'Range loop diff --git a/gcc/ada/s-intman-posix.adb b/gcc/ada/s-intman-posix.adb index 38379dd1ecb..06a7b450029 100644 --- a/gcc/ada/s-intman-posix.adb +++ b/gcc/ada/s-intman-posix.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 1992-2007, Free Software Foundation, Inc. -- +-- Copyright (C) 1992-2008, Free Software Foundation, Inc. -- -- -- -- GNARL is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -59,6 +59,8 @@ -- default -- Reserved: the OS specific set of signals that are reserved. +with System.Task_Primitives; + package body System.Interrupt_Management is use Interfaces.C; @@ -117,7 +119,7 @@ package body System.Interrupt_Management is begin -- With the __builtin_longjmp, the signal mask is not restored, so we - -- need to restore it explicitely. + -- need to restore it explicitly. Result := pthread_sigmask (SIG_UNBLOCK, Signal_Mask'Access, null); pragma Assert (Result = 0); @@ -155,6 +157,10 @@ package body System.Interrupt_Management is old_act : aliased struct_sigaction; Result : System.OS_Interface.int; + Use_Alternate_Stack : constant Boolean := + System.Task_Primitives.Alternate_Stack_Size /= 0; + -- Whether to use an alternate signal stack for stack overflows + begin if Initialized then return; @@ -171,8 +177,6 @@ package body System.Interrupt_Management is act.sa_handler := Notify_Exception'Address; - act.sa_flags := SA_SIGINFO; - -- Setting SA_SIGINFO asks the kernel to pass more than just the signal -- number argument to the handler when it is called. The set of extra -- parameters includes a pointer to the interrupted context, which the @@ -191,7 +195,7 @@ package body System.Interrupt_Management is -- fix should be made in sigsetjmp so that we save the Signal_Set and -- restore it after a longjmp. - -- Since SA_NODEFER is obsolete, instead we reset explicitely the mask + -- Since SA_NODEFER is obsolete, instead we reset explicitly the mask -- in the exception handler. Result := sigemptyset (Signal_Mask'Access); @@ -220,10 +224,18 @@ package body System.Interrupt_Management is Reserve (Exception_Interrupts (J)) := True; if State (Exception_Interrupts (J)) /= Default then + act.sa_flags := SA_SIGINFO; + + if Use_Alternate_Stack + and then Exception_Interrupts (J) = SIGSEGV + then + act.sa_flags := act.sa_flags + SA_ONSTACK; + end if; + Result := sigaction - (Signal (Exception_Interrupts (J)), act'Unchecked_Access, - old_act'Unchecked_Access); + (Signal (Exception_Interrupts (J)), act'Unchecked_Access, + old_act'Unchecked_Access); pragma Assert (Result = 0); end if; end if; @@ -235,7 +247,7 @@ package body System.Interrupt_Management is end if; -- Set SIGINT to unmasked state as long as it is not in "User" state. - -- Check for Unreserve_All_Interrupts last + -- Check for Unreserve_All_Interrupts last. if State (SIGINT) /= User then Keep_Unmasked (SIGINT) := True; @@ -243,7 +255,7 @@ package body System.Interrupt_Management is end if; -- Check all signals for state that requires keeping them unmasked and - -- reserved + -- reserved. for J in Interrupt_ID'Range loop if State (J) = Default or else State (J) = Runtime then diff --git a/gcc/ada/s-intman-vxworks.adb b/gcc/ada/s-intman-vxworks.adb index a7c0b7f3da3..65617de2476 100644 --- a/gcc/ada/s-intman-vxworks.adb +++ b/gcc/ada/s-intman-vxworks.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 1992-2007, Free Software Foundation, Inc. -- +-- Copyright (C) 1992-2008, Free Software Foundation, Inc. -- -- -- -- GNARL is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -49,8 +49,11 @@ package body System.Interrupt_Management is Exception_Action : aliased struct_sigaction; -- Keep this variable global so that it is initialized only once - procedure Map_And_Raise_Exception (signo : Signal); - pragma Import (C, Map_And_Raise_Exception, "__gnat_map_signal"); + procedure Notify_Exception + (signo : Signal; + siginfo : System.Address; + sigcontext : System.Address); + pragma Import (C, Notify_Exception, "__gnat_error_handler"); -- Map signal to Ada exception and raise it. Different versions -- of VxWorks need different mappings. @@ -71,28 +74,6 @@ package body System.Interrupt_Management is -- 's' Interrupt_State pragma set state to System (use "default" -- system handler) - procedure Notify_Exception (signo : Signal); - -- Identify the Ada exception to be raised using - -- the information when the system received a synchronous signal. - - ---------------------- - -- Notify_Exception -- - ---------------------- - - procedure Notify_Exception (signo : Signal) is - Mask : aliased sigset_t; - - Result : int; - pragma Unreferenced (Result); - - begin - Result := pthread_sigmask (SIG_SETMASK, null, Mask'Access); - Result := sigdelset (Mask'Access, signo); - Result := pthread_sigmask (SIG_SETMASK, Mask'Access, null); - - Map_And_Raise_Exception (signo); - end Notify_Exception; - --------------------------- -- Initialize_Interrupts -- --------------------------- @@ -118,10 +99,12 @@ package body System.Interrupt_Management is ---------------- Initialized : Boolean := False; + -- Set to True once Initialize is called, further calls have no effect procedure Initialize is mask : aliased sigset_t; Result : int; + begin if Initialized then return; @@ -135,7 +118,7 @@ package body System.Interrupt_Management is Abort_Task_Interrupt := SIGABRT; Exception_Action.sa_handler := Notify_Exception'Address; - Exception_Action.sa_flags := SA_ONSTACK; + Exception_Action.sa_flags := SA_ONSTACK + SA_SIGINFO; Result := sigemptyset (mask'Access); pragma Assert (Result = 0); diff --git a/gcc/ada/s-intman-vxworks.ads b/gcc/ada/s-intman-vxworks.ads index 538c4e5a0e1..03937811ec4 100644 --- a/gcc/ada/s-intman-vxworks.ads +++ b/gcc/ada/s-intman-vxworks.ads @@ -45,7 +45,7 @@ -- Interrupt_ID is used to derive the type in Ada.Interrupts, and -- adding more operations to that type would be illegal according -- to the Ada Reference Manual. This is the reason why the signals --- sets are implemeneted using visible arrays rather than functions. +-- sets are implemented using visible arrays rather than functions. with System.OS_Interface; @@ -103,9 +103,9 @@ package System.Interrupt_Management is -- each task. procedure Initialize; - -- Initialize the various variables defined in this package. - -- This procedure must be called before accessing any object from this - -- package and can be called multiple times. + -- Initialize the various variables defined in this package. This procedure + -- must be called before accessing any object from this package and can be + -- called multiple times (only the first call has any effect). private type Interrupt_Mask is new System.OS_Interface.sigset_t; diff --git a/gcc/ada/s-intman.ads b/gcc/ada/s-intman.ads index ae68d27a334..fb91662bda1 100644 --- a/gcc/ada/s-intman.ads +++ b/gcc/ada/s-intman.ads @@ -42,7 +42,7 @@ -- Interrupt_ID into the visible part of this package. The type Interrupt_ID -- is used to derive the type in Ada.Interrupts, and adding more operations -- to that type would be illegal according to the Ada Reference Manual. This --- is the reason why the signals sets are implemeneted using visible arrays +-- is the reason why the signals sets are implemented using visible arrays -- rather than functions. with System.OS_Interface; diff --git a/gcc/ada/s-linux-alpha.ads b/gcc/ada/s-linux-alpha.ads new file mode 100644 index 00000000000..b2fd28f5672 --- /dev/null +++ b/gcc/ada/s-linux-alpha.ads @@ -0,0 +1,119 @@ +------------------------------------------------------------------------------ +-- -- +-- GNU ADA RUN-TIME LIBRARY (GNARL) COMPONENTS -- +-- -- +-- S Y S T E M . L I N U X -- +-- -- +-- S p e c -- +-- -- +-- Copyright (C) 2008, Free Software Foundation, Inc. -- +-- -- +-- GNARL is free software; you can redistribute it and/or modify it under -- +-- terms of the GNU General Public License as published by the Free Soft- -- +-- ware Foundation; either version 2, or (at your option) any later ver- -- +-- sion. GNARL is distributed in the hope that it will be useful, but WITH- -- +-- OUT 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 distributed with GNARL; see file COPYING. If not, write -- +-- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, -- +-- Boston, MA 02110-1301, USA. -- +-- -- +-- As a special exception, if other files instantiate generics from this -- +-- unit, or you link this unit with other files to produce an executable, -- +-- this unit does not by itself cause the resulting executable to be -- +-- covered by the GNU General Public License. This exception does not -- +-- however invalidate any other reasons why the executable file might be -- +-- covered by the GNU Public License. -- +-- -- +------------------------------------------------------------------------------ + +-- This is the alpha version of this package + +-- This package encapsulates cpu specific differences between implementations +-- of GNU/Linux, in order to share s-osinte-linux.ads. + +-- PLEASE DO NOT add any with-clauses to this package or remove the pragma +-- Preelaborate. This package is designed to be a bottom-level (leaf) package. + +with Interfaces.C; + +package System.Linux is + pragma Preelaborate; + + ----------- + -- Errno -- + ----------- + + EAGAIN : constant := 35; + EINTR : constant := 4; + EINVAL : constant := 22; + ENOMEM : constant := 12; + EPERM : constant := 1; + ETIMEDOUT : constant := 60; + + ------------- + -- Signals -- + ------------- + + SIGHUP : constant := 1; -- hangup + SIGINT : constant := 2; -- interrupt (rubout) + SIGQUIT : constant := 3; -- quit (ASCD FS) + SIGILL : constant := 4; -- illegal instruction (not reset) + SIGTRAP : constant := 5; -- trace trap (not reset) + SIGIOT : constant := 6; -- IOT instruction + SIGABRT : constant := 6; -- used by abort, replace SIGIOT in the future + SIGFPE : constant := 8; -- floating point exception + SIGKILL : constant := 9; -- kill (cannot be caught or ignored) + SIGBUS : constant := 10; -- bus error + SIGSEGV : constant := 11; -- segmentation violation + SIGPIPE : constant := 13; -- write on a pipe with no one to read it + SIGALRM : constant := 14; -- alarm clock + SIGTERM : constant := 15; -- software termination signal from kill + SIGURG : constant := 16; -- urgent condition on IO channel + SIGSTOP : constant := 17; -- stop (cannot be caught or ignored) + SIGTSTP : constant := 18; -- user stop requested from tty + SIGCONT : constant := 19; -- stopped process has been continued + SIGCLD : constant := 20; -- alias for SIGCHLD + SIGCHLD : constant := 20; -- child status change + SIGTTIN : constant := 21; -- background tty read attempted + SIGTTOU : constant := 22; -- background tty write attempted + SIGIO : constant := 23; -- I/O now possible (4.2 BSD) + SIGPOLL : constant := 23; -- pollable event occurred + SIGXCPU : constant := 24; -- CPU time limit exceeded + SIGXFSZ : constant := 25; -- filesize limit exceeded + SIGVTALRM : constant := 26; -- virtual timer expired + SIGPROF : constant := 27; -- profiling timer expired + SIGWINCH : constant := 28; -- window size change + SIGPWR : constant := 29; -- power-fail restart + SIGUSR1 : constant := 30; -- user defined signal 1 + SIGUSR2 : constant := 31; -- user defined signal 2 + + SIGLTHRRES : constant := 32; -- GNU/LinuxThreads restart signal + SIGLTHRCAN : constant := 33; -- GNU/LinuxThreads cancel signal + SIGLTHRDBG : constant := 34; -- GNU/LinuxThreads debugger signal + + SIGADAABORT : constant := SIGABRT; + -- Change this if you want to use another signal for task abort. + -- SIGTERM might be a good one. + + SIGUNUSED : constant := 0; + SIGSTKFLT : constant := 0; + SIGLOST : constant := 0; + -- These don't exist for Linux/Alpha. The constants are present + -- so that we can continue to use a-intnam-linux.ads. + + -- struct_sigaction offsets + + sa_mask_pos : constant := Standard'Address_Size / 8; + sa_flags_pos : constant := 128 + sa_mask_pos; + + SA_SIGINFO : constant := 16#40#; + SA_ONSTACK : constant := 16#01#; + + type pthread_mutex_t is record + dum0, dum1, dum2, dum3, dum4 : Interfaces.C.unsigned_long; + end record; + pragma Convention (C, pthread_mutex_t); + +end System.Linux; diff --git a/gcc/ada/s-linux-hppa.ads b/gcc/ada/s-linux-hppa.ads new file mode 100644 index 00000000000..3c746de3a92 --- /dev/null +++ b/gcc/ada/s-linux-hppa.ads @@ -0,0 +1,131 @@ +------------------------------------------------------------------------------ +-- -- +-- GNU ADA RUN-TIME LIBRARY (GNARL) COMPONENTS -- +-- -- +-- S Y S T E M . L I N U X -- +-- -- +-- S p e c -- +-- -- +-- Copyright (C) 2008, Free Software Foundation, Inc. -- +-- -- +-- GNARL is free software; you can redistribute it and/or modify it under -- +-- terms of the GNU General Public License as published by the Free Soft- -- +-- ware Foundation; either version 2, or (at your option) any later ver- -- +-- sion. GNARL is distributed in the hope that it will be useful, but WITH- -- +-- OUT 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 distributed with GNARL; see file COPYING. If not, write -- +-- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, -- +-- Boston, MA 02110-1301, USA. -- +-- -- +-- As a special exception, if other files instantiate generics from this -- +-- unit, or you link this unit with other files to produce an executable, -- +-- this unit does not by itself cause the resulting executable to be -- +-- covered by the GNU General Public License. This exception does not -- +-- however invalidate any other reasons why the executable file might be -- +-- covered by the GNU Public License. -- +-- -- +------------------------------------------------------------------------------ + +-- This is the hppa version of this package + +-- This package encapsulates cpu specific differences between implementations +-- of GNU/Linux, in order to share s-osinte-linux.ads. + +-- PLEASE DO NOT add any with-clauses to this package or remove the pragma +-- Preelaborate. This package is designed to be a bottom-level (leaf) package. + +package System.Linux is + pragma Preelaborate; + + ----------- + -- Errno -- + ----------- + + EAGAIN : constant := 11; + EINTR : constant := 4; + EINVAL : constant := 22; + ENOMEM : constant := 12; + EPERM : constant := 1; + ETIMEDOUT : constant := 238; + + ------------- + -- Signals -- + ------------- + + SIGHUP : constant := 1; -- hangup + SIGINT : constant := 2; -- interrupt (rubout) + SIGQUIT : constant := 3; -- quit (ASCD FS) + SIGILL : constant := 4; -- illegal instruction (not reset) + SIGTRAP : constant := 5; -- trace trap (not reset) + SIGIOT : constant := 6; -- IOT instruction + SIGABRT : constant := 6; -- used by abort, replace SIGIOT in the future + SIGEMT : constant := 7; -- EMT + SIGFPE : constant := 8; -- floating point exception + SIGKILL : constant := 9; -- kill (cannot be caught or ignored) + SIGBUS : constant := 10; -- bus error + SIGSEGV : constant := 11; -- segmentation violation + SIGSYS : constant := 12; -- bad system call + SIGPIPE : constant := 13; -- write on a pipe with no one to read it + SIGALRM : constant := 14; -- alarm clock + SIGTERM : constant := 15; -- software termination signal from kill + SIGUSR1 : constant := 16; -- user defined signal 1 + SIGUSR2 : constant := 17; -- user defined signal 2 + SIGCLD : constant := 18; -- alias for SIGCHLD + SIGCHLD : constant := 18; -- child status change + SIGPWR : constant := 19; -- power-fail restart + SIGVTALRM : constant := 20; -- virtual timer expired + SIGPROF : constant := 21; -- profiling timer expired + SIGPOLL : constant := 22; -- pollable event occurred + SIGIO : constant := 22; -- I/O now possible (4.2 BSD) + SIGWINCH : constant := 23; -- window size change + SIGSTOP : constant := 24; -- stop (cannot be caught or ignored) + SIGTSTP : constant := 25; -- user stop requested from tty + SIGCONT : constant := 26; -- stopped process has been continued + SIGTTIN : constant := 27; -- background tty read attempted + SIGTTOU : constant := 28; -- background tty write attempted + SIGURG : constant := 29; -- urgent condition on IO channel + SIGLOST : constant := 30; -- File lock lost + SIGUNUSED : constant := 31; -- unused signal (GNU/Linux) + SIGXCPU : constant := 33; -- CPU time limit exceeded + SIGXFSZ : constant := 34; -- filesize limit exceeded + SIGSTKFLT : constant := 36; -- coprocessor stack fault (Linux) + SIGLTHRRES : constant := 37; -- GNU/LinuxThreads restart signal + SIGLTHRCAN : constant := 38; -- GNU/LinuxThreads cancel signal + SIGLTHRDBG : constant := 39; -- GNU/LinuxThreads debugger signal + + -- struct_sigaction offsets + + sa_flags_pos : constant := Standard'Address_Size / 8; + sa_mask_pos : constant := sa_flags_pos * 2; + + SA_SIGINFO : constant := 16#10#; + SA_ONSTACK : constant := 16#01#; + + type lock_array is array (1 .. 4) of Integer; + type atomic_lock_t is record + lock : lock_array; + end record; + pragma Convention (C, atomic_lock_t); + -- ??? Alignment should be 16 but this is larger than BIGGEST_ALIGNMENT. + -- This causes an erroneous pointer value to sometimes be passed to free + -- during deallocation. See PR ada/24533 for more details. + for atomic_lock_t'Alignment use 8; + + type struct_pthread_fast_lock is record + spinlock : atomic_lock_t; + status : Long_Integer; + end record; + pragma Convention (C, struct_pthread_fast_lock); + + type pthread_mutex_t is record + m_reserved : Integer; + m_count : Integer; + m_owner : System.Address; + m_kind : Integer; + m_lock : struct_pthread_fast_lock; + end record; + pragma Convention (C, pthread_mutex_t); + +end System.Linux; diff --git a/gcc/ada/s-linux.ads b/gcc/ada/s-linux.ads new file mode 100644 index 00000000000..cb9ad42b018 --- /dev/null +++ b/gcc/ada/s-linux.ads @@ -0,0 +1,119 @@ +------------------------------------------------------------------------------ +-- -- +-- GNU ADA RUN-TIME LIBRARY (GNARL) COMPONENTS -- +-- -- +-- S Y S T E M . L I N U X -- +-- -- +-- S p e c -- +-- -- +-- Copyright (C) 2008, Free Software Foundation, Inc. -- +-- -- +-- GNARL is free software; you can redistribute it and/or modify it under -- +-- terms of the GNU General Public License as published by the Free Soft- -- +-- ware Foundation; either version 2, or (at your option) any later ver- -- +-- sion. GNARL is distributed in the hope that it will be useful, but WITH- -- +-- OUT 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 distributed with GNARL; see file COPYING. If not, write -- +-- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, -- +-- Boston, MA 02110-1301, USA. -- +-- -- +-- As a special exception, if other files instantiate generics from this -- +-- unit, or you link this unit with other files to produce an executable, -- +-- this unit does not by itself cause the resulting executable to be -- +-- covered by the GNU General Public License. This exception does not -- +-- however invalidate any other reasons why the executable file might be -- +-- covered by the GNU Public License. -- +-- -- +------------------------------------------------------------------------------ + +-- This is the default version of this package + +-- This package encapsulates cpu specific differences between implementations +-- of GNU/Linux, in order to share s-osinte-linux.ads. + +-- PLEASE DO NOT add any with-clauses to this package or remove the pragma +-- Preelaborate. This package is designed to be a bottom-level (leaf) package + +package System.Linux is + pragma Preelaborate; + + ----------- + -- Errno -- + ----------- + + EAGAIN : constant := 11; + EINTR : constant := 4; + EINVAL : constant := 22; + ENOMEM : constant := 12; + EPERM : constant := 1; + ETIMEDOUT : constant := 110; + + ------------- + -- Signals -- + ------------- + + SIGHUP : constant := 1; -- hangup + SIGINT : constant := 2; -- interrupt (rubout) + SIGQUIT : constant := 3; -- quit (ASCD FS) + SIGILL : constant := 4; -- illegal instruction (not reset) + SIGTRAP : constant := 5; -- trace trap (not reset) + SIGIOT : constant := 6; -- IOT instruction + SIGABRT : constant := 6; -- used by abort, replace SIGIOT in the future + SIGFPE : constant := 8; -- floating point exception + SIGKILL : constant := 9; -- kill (cannot be caught or ignored) + SIGBUS : constant := 7; -- bus error + SIGSEGV : constant := 11; -- segmentation violation + SIGPIPE : constant := 13; -- write on a pipe with no one to read it + SIGALRM : constant := 14; -- alarm clock + SIGTERM : constant := 15; -- software termination signal from kill + SIGUSR1 : constant := 10; -- user defined signal 1 + SIGUSR2 : constant := 12; -- user defined signal 2 + SIGCLD : constant := 17; -- alias for SIGCHLD + SIGCHLD : constant := 17; -- child status change + SIGPWR : constant := 30; -- power-fail restart + SIGWINCH : constant := 28; -- window size change + SIGURG : constant := 23; -- urgent condition on IO channel + SIGPOLL : constant := 29; -- pollable event occurred + SIGIO : constant := 29; -- I/O now possible (4.2 BSD) + SIGLOST : constant := 29; -- File lock lost + SIGSTOP : constant := 19; -- stop (cannot be caught or ignored) + SIGTSTP : constant := 20; -- user stop requested from tty + SIGCONT : constant := 18; -- stopped process has been continued + SIGTTIN : constant := 21; -- background tty read attempted + SIGTTOU : constant := 22; -- background tty write attempted + SIGVTALRM : constant := 26; -- virtual timer expired + SIGPROF : constant := 27; -- profiling timer expired + SIGXCPU : constant := 24; -- CPU time limit exceeded + SIGXFSZ : constant := 25; -- filesize limit exceeded + SIGUNUSED : constant := 31; -- unused signal (GNU/Linux) + SIGSTKFLT : constant := 16; -- coprocessor stack fault (Linux) + SIGLTHRRES : constant := 32; -- GNU/LinuxThreads restart signal + SIGLTHRCAN : constant := 33; -- GNU/LinuxThreads cancel signal + SIGLTHRDBG : constant := 34; -- GNU/LinuxThreads debugger signal + + -- struct_sigaction offsets + + sa_mask_pos : constant := Standard'Address_Size / 8; + sa_flags_pos : constant := 128 + sa_mask_pos; + + SA_SIGINFO : constant := 16#04#; + SA_ONSTACK : constant := 16#08000000#; + + type struct_pthread_fast_lock is record + status : Long_Integer; + spinlock : Integer; + end record; + pragma Convention (C, struct_pthread_fast_lock); + + type pthread_mutex_t is record + m_reserved : Integer; + m_count : Integer; + m_owner : System.Address; + m_kind : Integer; + m_lock : struct_pthread_fast_lock; + end record; + pragma Convention (C, pthread_mutex_t); + +end System.Linux; diff --git a/gcc/ada/s-mastop-irix.adb b/gcc/ada/s-mastop-irix.adb index 2e3d513bc66..a5b04e08117 100644 --- a/gcc/ada/s-mastop-irix.adb +++ b/gcc/ada/s-mastop-irix.adb @@ -45,7 +45,7 @@ package body System.Machine_State_Operations is use System.Storage_Elements; - -- The exc_unwind function in libexc operats on a Sigcontext + -- The exc_unwind function in libexc operates on a Sigcontext -- Type sigcontext_t is defined in /usr/include/sys/signal.h. -- We define an equivalent Ada type here. From the comments in @@ -115,7 +115,7 @@ package body System.Machine_State_Operations is o32n : constant Natural := Boolean'Pos (o32); n32n : constant Natural := Boolean'Pos (n32); -- Flags to indicate which ABI is in effect for this compilation. For the - -- purposes of this unit, the n32 and n64 ABI's are identical. + -- purposes of this unit, the n32 and n64 ABIs are identical. LSC : constant Character := Character'Val (o32n * Character'Pos ('w') + n32n * Character'Pos ('d')); diff --git a/gcc/ada/s-os_lib.adb b/gcc/ada/s-os_lib.adb index 7082ff0930c..ff65720d6e4 100755 --- a/gcc/ada/s-os_lib.adb +++ b/gcc/ada/s-os_lib.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 1995-2007, AdaCore -- +-- Copyright (C) 1995-2008, AdaCore -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -293,7 +293,7 @@ package body System.OS_Lib is -- Internal exception raised to signal error in copy function Build_Path (Dir : String; File : String) return String; - -- Returns pathname Dir catenated with File adding the directory + -- Returns pathname Dir concatenated with File adding the directory -- separator only if needed. procedure Copy (From, To : File_Descriptor); @@ -458,10 +458,10 @@ package body System.OS_Lib is -- Copy attributes C_From (1 .. Name'Length) := Name; - C_From (C_From'Last) := ASCII.Nul; + C_From (C_From'Last) := ASCII.NUL; C_To (1 .. To_Name'Length) := To_Name; - C_To (C_To'Last) := ASCII.Nul; + C_To (C_To'Last) := ASCII.NUL; case Preserve is @@ -1622,10 +1622,10 @@ package body System.OS_Lib is -- If null terminated string, put the quote before - if Res (J) = ASCII.Nul then + if Res (J) = ASCII.NUL then Res (J) := '"'; J := J + 1; - Res (J) := ASCII.Nul; + Res (J) := ASCII.NUL; -- If argument is terminated by '\', then double it. Otherwise -- the ending quote will be taken as-is. This is quite strange @@ -1833,7 +1833,7 @@ package body System.OS_Lib is -- First, convert VMS file spec to Unix file spec. -- If Name is not in VMS syntax, then this is equivalent - -- to put Name at the begining of Path_Buffer. + -- to put Name at the beginning of Path_Buffer. VMS_Conversion : begin The_Name (1 .. Name'Length) := Name; diff --git a/gcc/ada/s-os_lib.ads b/gcc/ada/s-os_lib.ads index e3c1079df19..8c319c845e1 100755 --- a/gcc/ada/s-os_lib.ads +++ b/gcc/ada/s-os_lib.ads @@ -65,7 +65,7 @@ package System.OS_Lib is ----------------------- -- These are reexported from package Strings (which was introduced to - -- avoid different packages declarting different types unnecessarily). + -- avoid different packages declaring different types unnecessarily). -- See package System.Strings for details. subtype String_Access is Strings.String_Access; @@ -875,7 +875,7 @@ private -- bootstrap path problems. To be changed later ??? Invalid_Time : constant OS_Time := -1; - -- This value should match the return valud by __gnat_file_time_* + -- This value should match the return value from __gnat_file_time_* pragma Inline ("<"); pragma Inline (">"); diff --git a/gcc/ada/s-osinte-aix.ads b/gcc/ada/s-osinte-aix.ads index 65db80a49de..b5de4f28ba9 100644 --- a/gcc/ada/s-osinte-aix.ads +++ b/gcc/ada/s-osinte-aix.ads @@ -132,7 +132,7 @@ package System.OS_Interface is SIGCPUFAIL : constant := 59; -- Predictive De-configuration of Processors SIGKAP : constant := 60; -- keep alive poll from native keyboard SIGGRANT : constant := SIGKAP; -- monitor mode granted - SIGRETRACT : constant := 61; -- monitor mode should be relinguished + SIGRETRACT : constant := 61; -- monitor mode should be relinquished SIGSOUND : constant := 62; -- sound control has completed SIGSAK : constant := 63; -- secure attention key @@ -174,7 +174,8 @@ package System.OS_Interface is pragma Convention (C, struct_sigaction); type struct_sigaction_ptr is access all struct_sigaction; - SA_SIGINFO : constant := 16#0100#; + SA_SIGINFO : constant := 16#0100#; + SA_ONSTACK : constant := 16#0001#; SIG_BLOCK : constant := 0; SIG_UNBLOCK : constant := 1; @@ -291,8 +292,26 @@ package System.OS_Interface is -- Stack -- ----------- + type stack_t is record + ss_sp : System.Address; + ss_size : size_t; + ss_flags : int; + end record; + pragma Convention (C, stack_t); + + function sigaltstack + (ss : not null access stack_t; + oss : access stack_t) return int; + pragma Import (C, sigaltstack, "sigaltstack"); + + Alternate_Stack : aliased System.Address; + -- This is a dummy definition, never used (Alternate_Stack_Size is null) + + Alternate_Stack_Size : constant := 0; + -- No alternate signal stack is used on this platform + Stack_Base_Available : constant Boolean := False; - -- Indicates wether the stack base is available on this target + -- Indicates whether the stack base is available on this target function Get_Stack_Base (thread : pthread_t) return Address; pragma Inline (Get_Stack_Base); @@ -309,7 +328,6 @@ package System.OS_Interface is PROT_WRITE : constant := 2; PROT_EXEC : constant := 4; PROT_ALL : constant := PROT_READ + PROT_WRITE + PROT_EXEC; - PROT_ON : constant := PROT_READ; PROT_OFF : constant := PROT_ALL; diff --git a/gcc/ada/s-osinte-darwin.ads b/gcc/ada/s-osinte-darwin.ads index da97aa0323c..d53e2c43dca 100644 --- a/gcc/ada/s-osinte-darwin.ads +++ b/gcc/ada/s-osinte-darwin.ads @@ -162,6 +162,7 @@ package System.OS_Interface is SIG_IGN : constant := 1; SA_SIGINFO : constant := 16#0040#; + SA_ONSTACK : constant := 16#0001#; function sigaction (sig : Signal; @@ -174,7 +175,7 @@ package System.OS_Interface is ---------- Time_Slice_Supported : constant Boolean := True; - -- Indicates wether time slicing is supported + -- Indicates whether time slicing is supported type timespec is private; @@ -229,10 +230,10 @@ package System.OS_Interface is --------- function lwp_self return System.Address; + pragma Import (C, lwp_self, "pthread_self"); -- lwp_self does not exist on this thread library, revert to pthread_self -- which is the closest approximation (with getpid). This function is -- needed to share 7staprop.adb across POSIX-like targets. - pragma Import (C, lwp_self, "pthread_self"); ------------- -- Threads -- @@ -264,22 +265,39 @@ package System.OS_Interface is -- Stack -- ----------- + type stack_t is record + ss_sp : System.Address; + ss_size : size_t; + ss_flags : int; + end record; + pragma Convention (C, stack_t); + + function sigaltstack + (ss : not null access stack_t; + oss : access stack_t) return int; + pragma Import (C, sigaltstack, "sigaltstack"); + + Alternate_Stack : aliased System.Address; + -- This is a dummy definition, never used (Alternate_Stack_Size is null) + + Alternate_Stack_Size : constant := 0; + -- No alternate signal stack is used on this platform + Stack_Base_Available : constant Boolean := False; - -- Indicates wether the stack base is available on this target. - -- This allows us to share s-osinte.adb between all the FSU run time. - -- Note that this value can only be true if pthread_t has a complete - -- definition that corresponds exactly to the C header files. + -- Indicates whether the stack base is available on this target. This + -- allows us to share s-osinte.adb between all the FSU run time. Note that + -- this value can only be true if pthread_t has a complete definition that + -- corresponds exactly to the C header files. function Get_Stack_Base (thread : pthread_t) return System.Address; pragma Inline (Get_Stack_Base); - -- returns the stack base of the specified thread. - -- Only call this function when Stack_Base_Available is True. + -- returns the stack base of the specified thread. Only call this function + -- when Stack_Base_Available is True. function Get_Page_Size return size_t; function Get_Page_Size return System.Address; pragma Import (C, Get_Page_Size, "getpagesize"); - -- returns the size of a page, or 0 if this is not relevant on this - -- target + -- Returns the size of a page, or 0 if this is not relevant on this target PROT_NONE : constant := 0; PROT_READ : constant := 1; @@ -290,9 +308,10 @@ package System.OS_Interface is PROT_ON : constant := PROT_NONE; PROT_OFF : constant := PROT_ALL; - function mprotect (addr : System.Address; - len : size_t; - prot : int) return int; + function mprotect + (addr : System.Address; + len : size_t; + prot : int) return int; pragma Import (C, mprotect); --------------------------------------- @@ -528,13 +547,6 @@ private end record; pragma Convention (C, siginfo_t); - type stack_t is record - ss_sp : System.Address; - ss_size : int; - ss_flags : int; - end record; - pragma Convention (C, stack_t); - type mcontext_t is new System.Address; type ucontext_t is record diff --git a/gcc/ada/s-osinte-freebsd.ads b/gcc/ada/s-osinte-freebsd.ads index 8794e995bd8..51f498397f9 100644 --- a/gcc/ada/s-osinte-freebsd.ads +++ b/gcc/ada/s-osinte-freebsd.ads @@ -182,6 +182,7 @@ package System.OS_Interface is SIG_IGN : constant := 1; SA_SIGINFO : constant := 16#0040#; + SA_ONSTACK : constant := 16#0001#; function sigaction (sig : Signal; @@ -194,7 +195,7 @@ package System.OS_Interface is ---------- Time_Slice_Supported : constant Boolean := True; - -- Indicates wether time slicing is supported (i.e SCHED_RR is supported) + -- Indicates whether time slicing is supported (i.e SCHED_RR is supported) type timespec is private; @@ -293,42 +294,57 @@ package System.OS_Interface is -- Stack -- ----------- + type stack_t is record + ss_sp : System.Address; + ss_size : size_t; + ss_flags : int; + end record; + pragma Convention (C, stack_t); + + function sigaltstack + (ss : not null access stack_t; + oss : access stack_t) return int; + pragma Import (C, sigaltstack, "sigaltstack"); + + Alternate_Stack : aliased System.Address; + -- This is a dummy definition, never used (Alternate_Stack_Size is null) + + Alternate_Stack_Size : constant := 0; + -- No alternate signal stack is used on this platform + Stack_Base_Available : constant Boolean := False; - -- Indicates wether the stack base is available on this target. - -- This allows us to share s-osinte.adb between all the FSU run time. - -- Note that this value can only be true if pthread_t has a complete - -- definition that corresponds exactly to the C header files. + -- Indicates whether the stack base is available on this target. This + -- allows us to share s-osinte.adb between all the FSU run time. Note that + -- this value can only be true if pthread_t has a complete definition that + -- corresponds exactly to the C header files. function Get_Stack_Base (thread : pthread_t) return Address; pragma Inline (Get_Stack_Base); - -- returns the stack base of the specified thread. - -- Only call this function when Stack_Base_Available is True. + -- returns the stack base of the specified thread. Only call this function + -- when Stack_Base_Available is True. function Get_Page_Size return size_t; function Get_Page_Size return Address; pragma Import (C, Get_Page_Size, "getpagesize"); - -- returns the size of a page, or 0 if this is not relevant on this - -- target + -- returns the size of a page, or 0 if this is not relevant on this target PROT_NONE : constant := 0; PROT_READ : constant := 1; PROT_WRITE : constant := 2; PROT_EXEC : constant := 4; PROT_ALL : constant := PROT_READ + PROT_WRITE + PROT_EXEC; - PROT_ON : constant := PROT_NONE; PROT_OFF : constant := PROT_ALL; - function mprotect - (addr : Address; len : size_t; prot : int) return int; + function mprotect (addr : Address; len : size_t; prot : int) return int; pragma Import (C, mprotect); --------------------------------------- -- Nonstandard Thread Initialization -- --------------------------------------- - -- FSU_THREADS requires pthread_init, which is nonstandard and - -- this should be invoked during the elaboration of s-taprop.adb + -- FSU_THREADS requires pthread_init, which is nonstandard and this should + -- be invoked during the elaboration of s-taprop.adb. -- FreeBSD does not require this so we provide an empty Ada body diff --git a/gcc/ada/s-osinte-hpux.ads b/gcc/ada/s-osinte-hpux.ads index 0e368919eeb..0fc5ef1db54 100644 --- a/gcc/ada/s-osinte-hpux.ads +++ b/gcc/ada/s-osinte-hpux.ads @@ -156,7 +156,8 @@ package System.OS_Interface is pragma Convention (C, struct_sigaction); type struct_sigaction_ptr is access all struct_sigaction; - SA_SIGINFO : constant := 16#10#; + SA_SIGINFO : constant := 16#10#; + SA_ONSTACK : constant := 16#01#; SIG_BLOCK : constant := 0; SIG_UNBLOCK : constant := 1; @@ -176,7 +177,7 @@ package System.OS_Interface is ---------- Time_Slice_Supported : constant Boolean := True; - -- Indicates wether time slicing is supported + -- Indicates whether time slicing is supported type timespec is private; @@ -278,26 +279,43 @@ package System.OS_Interface is -- Stack -- ----------- + type stack_t is record + ss_sp : System.Address; + ss_flags : int; + ss_size : size_t; + end record; + pragma Convention (C, stack_t); + + function sigaltstack + (ss : not null access stack_t; + oss : access stack_t) return int; + pragma Import (C, sigaltstack, "sigaltstack"); + + Alternate_Stack : aliased System.Address; + pragma Import (C, Alternate_Stack, "__gnat_alternate_stack"); + -- The alternate signal stack for stack overflows + + Alternate_Stack_Size : constant := 16 * 1024; + -- This must be in keeping with init.c:__gnat_alternate_stack + Stack_Base_Available : constant Boolean := False; - -- Indicates wether the stack base is available on this target + -- Indicates whether the stack base is available on this target function Get_Stack_Base (thread : pthread_t) return Address; pragma Inline (Get_Stack_Base); - -- returns the stack base of the specified thread. - -- Only call this function when Stack_Base_Available is True. + -- Returns the stack base of the specified thread. Only call this function + -- when Stack_Base_Available is True. function Get_Page_Size return size_t; function Get_Page_Size return Address; pragma Import (C, Get_Page_Size, "getpagesize"); - -- returns the size of a page, or 0 if this is not relevant on this - -- target + -- Returns the size of a page, or 0 if this is not relevant on this target PROT_NONE : constant := 0; PROT_READ : constant := 1; PROT_WRITE : constant := 2; PROT_EXEC : constant := 4; PROT_ALL : constant := PROT_READ + PROT_WRITE + PROT_EXEC; - PROT_ON : constant := PROT_READ; PROT_OFF : constant := PROT_ALL; diff --git a/gcc/ada/s-osinte-kfreebsd-gnu.ads b/gcc/ada/s-osinte-kfreebsd-gnu.ads index 05fb928fbbb..17c11290500 100644 --- a/gcc/ada/s-osinte-kfreebsd-gnu.ads +++ b/gcc/ada/s-osinte-kfreebsd-gnu.ads @@ -223,7 +223,8 @@ package System.OS_Interface is function sysconf (name : int) return long; pragma Import (C, sysconf); - SC_CLK_TCK : constant := 2; + SC_CLK_TCK : constant := 2; + SC_NPROCESSORS_ONLN : constant := 84; ------------------------- -- Priority Scheduling -- @@ -255,6 +256,7 @@ package System.OS_Interface is type Thread_Body is access function (arg : System.Address) return System.Address; + pragma Convention (C, Thread_Body); function Thread_Body_Access is new Unchecked_Conversion (System.Address, Thread_Body); @@ -438,12 +440,31 @@ package System.OS_Interface is pragma Import (C, pthread_getspecific, "pthread_getspecific"); type destructor_pointer is access procedure (arg : System.Address); + pragma Convention (C, destructor_pointer); function pthread_key_create (key : access pthread_key_t; destructor : destructor_pointer) return int; pragma Import (C, pthread_key_create, "pthread_key_create"); + CPU_SETSIZE : constant := 1_024; + + type bit_field is array (1 .. CPU_SETSIZE) of Boolean; + for bit_field'Size use CPU_SETSIZE; + pragma Pack (bit_field); + pragma Convention (C, bit_field); + + type cpu_set_t is record + bits : bit_field; + end record; + pragma Convention (C, cpu_set_t); + + function pthread_setaffinity_np + (thread : pthread_t; + cpusetsize : size_t; + cpuset : access cpu_set_t) return int; + pragma Import (C, pthread_setaffinity_np, "__gnat_pthread_setaffinity_np"); + private type sigset_t is array (1 .. 4) of unsigned; diff --git a/gcc/ada/s-osinte-linux-alpha.ads b/gcc/ada/s-osinte-linux-alpha.ads deleted file mode 100644 index 7925a5e0558..00000000000 --- a/gcc/ada/s-osinte-linux-alpha.ads +++ /dev/null @@ -1,508 +0,0 @@ ------------------------------------------------------------------------------- --- -- --- GNU ADA RUN-TIME LIBRARY (GNARL) COMPONENTS -- --- -- --- S Y S T E M . O S _ I N T E R F A C E -- --- -- --- S p e c -- --- -- --- Copyright (C) 1991-1994, Florida State University -- --- Copyright (C) 1995-2006, Free Software Foundation, Inc. -- --- -- --- GNARL is free software; you can redistribute it and/or modify it under -- --- terms of the GNU General Public License as published by the Free Soft- -- --- ware Foundation; either version 2, or (at your option) any later ver- -- --- sion. GNARL is distributed in the hope that it will be useful, but WITH- -- --- OUT 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 distributed with GNARL; see file COPYING. If not, write -- --- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, -- --- Boston, MA 02110-1301, USA. -- --- -- --- As a special exception, if other files instantiate generics from this -- --- unit, or you link this unit with other files to produce an executable, -- --- this unit does not by itself cause the resulting executable to be -- --- covered by the GNU General Public License. This exception does not -- --- however invalidate any other reasons why the executable file might be -- --- covered by the GNU Public License. -- --- -- --- GNARL was developed by the GNARL team at Florida State University. -- --- Extensive contributions were provided by Ada Core Technologies, Inc. -- --- -- ------------------------------------------------------------------------------- - --- This is a GNU/Linux (GNU/LinuxThreads) version of this package - --- This package encapsulates all direct interfaces to OS services --- that are needed by children of System. - --- PLEASE DO NOT add any with-clauses to this package or remove the pragma --- Preelaborate. This package is designed to be a bottom-level (leaf) package. - -with Interfaces.C; -with Unchecked_Conversion; - -package System.OS_Interface is - pragma Preelaborate; - - pragma Linker_Options ("-lpthread"); - - subtype int is Interfaces.C.int; - subtype char is Interfaces.C.char; - subtype short is Interfaces.C.short; - subtype long is Interfaces.C.long; - subtype unsigned is Interfaces.C.unsigned; - subtype unsigned_short is Interfaces.C.unsigned_short; - subtype unsigned_long is Interfaces.C.unsigned_long; - subtype unsigned_char is Interfaces.C.unsigned_char; - subtype plain_char is Interfaces.C.plain_char; - subtype size_t is Interfaces.C.size_t; - - ----------- - -- Errno -- - ----------- - - function errno return int; - pragma Import (C, errno, "__get_errno"); - - EAGAIN : constant := 35; - EINTR : constant := 4; - EINVAL : constant := 22; - ENOMEM : constant := 12; - EPERM : constant := 1; - ETIMEDOUT : constant := 60; - - ------------- - -- Signals -- - ------------- - - Max_Interrupt : constant := 63; - type Signal is new int range 0 .. Max_Interrupt; - for Signal'Size use int'Size; - - SIGHUP : constant := 1; -- hangup - SIGINT : constant := 2; -- interrupt (rubout) - SIGQUIT : constant := 3; -- quit (ASCD FS) - SIGILL : constant := 4; -- illegal instruction (not reset) - SIGTRAP : constant := 5; -- trace trap (not reset) - SIGIOT : constant := 6; -- IOT instruction - SIGABRT : constant := 6; -- used by abort, replace SIGIOT in the future - SIGFPE : constant := 8; -- floating point exception - SIGKILL : constant := 9; -- kill (cannot be caught or ignored) - SIGBUS : constant := 10; -- bus error - SIGSEGV : constant := 11; -- segmentation violation - SIGPIPE : constant := 13; -- write on a pipe with no one to read it - SIGALRM : constant := 14; -- alarm clock - SIGTERM : constant := 15; -- software termination signal from kill - SIGURG : constant := 16; -- urgent condition on IO channel - SIGSTOP : constant := 17; -- stop (cannot be caught or ignored) - SIGTSTP : constant := 18; -- user stop requested from tty - SIGCONT : constant := 19; -- stopped process has been continued - SIGCLD : constant := 20; -- alias for SIGCHLD - SIGCHLD : constant := 20; -- child status change - SIGTTIN : constant := 21; -- background tty read attempted - SIGTTOU : constant := 22; -- background tty write attempted - SIGIO : constant := 23; -- I/O now possible (4.2 BSD) - SIGPOLL : constant := 23; -- pollable event occurred - SIGXCPU : constant := 24; -- CPU time limit exceeded - SIGXFSZ : constant := 25; -- filesize limit exceeded - SIGVTALRM : constant := 26; -- virtual timer expired - SIGPROF : constant := 27; -- profiling timer expired - SIGWINCH : constant := 28; -- window size change - SIGPWR : constant := 29; -- power-fail restart - SIGUSR1 : constant := 30; -- user defined signal 1 - SIGUSR2 : constant := 31; -- user defined signal 2 - - SIGLTHRRES : constant := 32; -- GNU/LinuxThreads restart signal - SIGLTHRCAN : constant := 33; -- GNU/LinuxThreads cancel signal - SIGLTHRDBG : constant := 34; -- GNU/LinuxThreads debugger signal - - SIGADAABORT : constant := SIGABRT; - -- Change this if you want to use another signal for task abort. - -- SIGTERM might be a good one. - - SIGUNUSED : constant := 0; - SIGSTKFLT : constant := 0; - SIGLOST : constant := 0; - -- These don't exist for Linux/Alpha. The constants are present - -- so that we can continue to use a-intnam-linux.ads. - - type Signal_Set is array (Natural range <>) of Signal; - - Unmasked : constant Signal_Set := ( - SIGTRAP, - -- To enable debugging on multithreaded applications, mark SIGTRAP to - -- be kept unmasked. - - SIGBUS, - - SIGTTIN, SIGTTOU, SIGTSTP, - -- Keep these three signals unmasked so that background processes - -- and IO behaves as normal "C" applications - - SIGPROF, - -- To avoid confusing the profiler - - SIGKILL, SIGSTOP, - -- These two signals actually cannot be masked; - -- POSIX simply won't allow it. - - SIGLTHRRES, SIGLTHRCAN, SIGLTHRDBG); - -- These three signals are used by GNU/LinuxThreads starting from - -- glibc 2.1 (future 2.2). - - Reserved : constant Signal_Set := (SIGKILL, SIGSTOP); - - type sigset_t is private; - - function sigaddset (set : access sigset_t; sig : Signal) return int; - pragma Import (C, sigaddset, "sigaddset"); - - function sigdelset (set : access sigset_t; sig : Signal) return int; - pragma Import (C, sigdelset, "sigdelset"); - - function sigfillset (set : access sigset_t) return int; - pragma Import (C, sigfillset, "sigfillset"); - - function sigismember (set : access sigset_t; sig : Signal) return int; - pragma Import (C, sigismember, "sigismember"); - - function sigemptyset (set : access sigset_t) return int; - pragma Import (C, sigemptyset, "sigemptyset"); - - type union_type_3 is new String (1 .. 116); - type siginfo_t is record - si_signo : int; - si_code : int; - si_errno : int; - X_data : union_type_3; - end record; - pragma Convention (C, siginfo_t); - - type struct_sigaction is record - sa_handler : System.Address; - sa_mask : sigset_t; - sa_flags : unsigned_long; - end record; - pragma Convention (C, struct_sigaction); - type struct_sigaction_ptr is access all struct_sigaction; - - type Machine_State is record - dummy : unsigned_long; - end record; - type Machine_State_Ptr is access all Machine_State; - - SA_SIGINFO : constant := 16#40#; - - SIG_BLOCK : constant := 0; - SIG_UNBLOCK : constant := 1; - SIG_SETMASK : constant := 2; - - SIG_DFL : constant := 0; - SIG_IGN : constant := 1; - - function sigaction - (sig : Signal; - act : struct_sigaction_ptr; - oact : struct_sigaction_ptr) return int; - pragma Import (C, sigaction, "sigaction"); - - ---------- - -- Time -- - ---------- - - type timespec is private; - - function To_Duration (TS : timespec) return Duration; - pragma Inline (To_Duration); - - function To_Timespec (D : Duration) return timespec; - pragma Inline (To_Timespec); - - type struct_timeval is private; - - function To_Duration (TV : struct_timeval) return Duration; - pragma Inline (To_Duration); - - function To_Timeval (D : Duration) return struct_timeval; - pragma Inline (To_Timeval); - - function gettimeofday - (tv : access struct_timeval; - tz : System.Address := System.Null_Address) return int; - pragma Import (C, gettimeofday, "gettimeofday"); - - function sysconf (name : int) return long; - pragma Import (C, sysconf); - - SC_CLK_TCK : constant := 2; - - ------------------------- - -- Priority Scheduling -- - ------------------------- - - SCHED_OTHER : constant := 0; - SCHED_FIFO : constant := 1; - SCHED_RR : constant := 2; - - function To_Target_Priority - (Prio : System.Any_Priority) return Interfaces.C.int; - -- Maps System.Any_Priority to a POSIX priority. - - ------------- - -- Process -- - ------------- - - type pid_t is private; - - function kill (pid : pid_t; sig : Signal) return int; - pragma Import (C, kill, "kill"); - - function getpid return pid_t; - pragma Import (C, getpid, "getpid"); - - ------------- - -- Threads -- - ------------- - - type Thread_Body is access - function (arg : System.Address) return System.Address; - - function Thread_Body_Access is new - Unchecked_Conversion (System.Address, Thread_Body); - - type pthread_t is new unsigned_long; - subtype Thread_Id is pthread_t; - - function To_pthread_t is new Unchecked_Conversion - (unsigned_long, pthread_t); - - type pthread_mutex_t is limited private; - type pthread_cond_t is limited private; - type pthread_attr_t is limited private; - type pthread_mutexattr_t is limited private; - type pthread_condattr_t is limited private; - type pthread_key_t is private; - - PTHREAD_CREATE_DETACHED : constant := 1; - - ----------- - -- Stack -- - ----------- - - function Get_Stack_Base (thread : pthread_t) return Address; - pragma Inline (Get_Stack_Base); - -- This is a dummy procedure to share some GNULLI files - - --------------------------------------- - -- Nonstandard Thread Initialization -- - --------------------------------------- - - procedure pthread_init; - pragma Inline (pthread_init); - -- This is a dummy procedure to share some GNULLI files - - ------------------------- - -- POSIX.1c Section 3 -- - ------------------------- - - function sigwait (set : access sigset_t; sig : access Signal) return int; - pragma Import (C, sigwait, "sigwait"); - - function pthread_kill (thread : pthread_t; sig : Signal) return int; - pragma Import (C, pthread_kill, "pthread_kill"); - - function pthread_sigmask - (how : int; - set : access sigset_t; - oset : access sigset_t) return int; - pragma Import (C, pthread_sigmask, "pthread_sigmask"); - - -------------------------- - -- POSIX.1c Section 11 -- - -------------------------- - - function pthread_mutexattr_init - (attr : access pthread_mutexattr_t) return int; - pragma Import (C, pthread_mutexattr_init, "pthread_mutexattr_init"); - - function pthread_mutexattr_destroy - (attr : access pthread_mutexattr_t) return int; - pragma Import (C, pthread_mutexattr_destroy, "pthread_mutexattr_destroy"); - - function pthread_mutex_init - (mutex : access pthread_mutex_t; - attr : access pthread_mutexattr_t) return int; - pragma Import (C, pthread_mutex_init, "pthread_mutex_init"); - - function pthread_mutex_destroy (mutex : access pthread_mutex_t) return int; - pragma Import (C, pthread_mutex_destroy, "pthread_mutex_destroy"); - - function pthread_mutex_lock (mutex : access pthread_mutex_t) return int; - pragma Import (C, pthread_mutex_lock, "pthread_mutex_lock"); - - function pthread_mutex_unlock (mutex : access pthread_mutex_t) return int; - pragma Import (C, pthread_mutex_unlock, "pthread_mutex_unlock"); - - function pthread_condattr_init - (attr : access pthread_condattr_t) return int; - pragma Import (C, pthread_condattr_init, "pthread_condattr_init"); - - function pthread_condattr_destroy - (attr : access pthread_condattr_t) return int; - pragma Import (C, pthread_condattr_destroy, "pthread_condattr_destroy"); - - function pthread_cond_init - (cond : access pthread_cond_t; - attr : access pthread_condattr_t) return int; - pragma Import (C, pthread_cond_init, "pthread_cond_init"); - - function pthread_cond_destroy (cond : access pthread_cond_t) return int; - pragma Import (C, pthread_cond_destroy, "pthread_cond_destroy"); - - function pthread_cond_signal (cond : access pthread_cond_t) return int; - pragma Import (C, pthread_cond_signal, "pthread_cond_signal"); - - function pthread_cond_wait - (cond : access pthread_cond_t; - mutex : access pthread_mutex_t) return int; - pragma Import (C, pthread_cond_wait, "pthread_cond_wait"); - - function pthread_cond_timedwait - (cond : access pthread_cond_t; - mutex : access pthread_mutex_t; - abstime : access timespec) return int; - pragma Import (C, pthread_cond_timedwait, "pthread_cond_timedwait"); - - -------------------------- - -- POSIX.1c Section 13 -- - -------------------------- - - type struct_sched_param is record - sched_priority : int; -- scheduling priority - end record; - pragma Convention (C, struct_sched_param); - - function pthread_setschedparam - (thread : pthread_t; - policy : int; - param : access struct_sched_param) return int; - pragma Import (C, pthread_setschedparam, "pthread_setschedparam"); - - function pthread_attr_setschedpolicy - (attr : access pthread_attr_t; - policy : int) return int; - pragma Import - (C, pthread_attr_setschedpolicy, "pthread_attr_setschedpolicy"); - - function sched_yield return int; - pragma Import (C, sched_yield, "sched_yield"); - - --------------------------- - -- P1003.1c - Section 16 -- - --------------------------- - - function pthread_attr_init - (attributes : access pthread_attr_t) return int; - pragma Import (C, pthread_attr_init, "pthread_attr_init"); - - function pthread_attr_destroy - (attributes : access pthread_attr_t) return int; - pragma Import (C, pthread_attr_destroy, "pthread_attr_destroy"); - - function pthread_attr_setdetachstate - (attr : access pthread_attr_t; - detachstate : int) return int; - pragma Import - (C, pthread_attr_setdetachstate, "pthread_attr_setdetachstate"); - - function pthread_attr_setstacksize - (attr : access pthread_attr_t; - stacksize : size_t) return int; - pragma Import (C, pthread_attr_setstacksize, "pthread_attr_setstacksize"); - - function pthread_create - (thread : access pthread_t; - attributes : access pthread_attr_t; - start_routine : Thread_Body; - arg : System.Address) return int; - pragma Import (C, pthread_create, "pthread_create"); - - procedure pthread_exit (status : System.Address); - pragma Import (C, pthread_exit, "pthread_exit"); - - function pthread_self return pthread_t; - pragma Import (C, pthread_self, "pthread_self"); - - -------------------------- - -- POSIX.1c Section 17 -- - -------------------------- - - function pthread_setspecific - (key : pthread_key_t; - value : System.Address) return int; - pragma Import (C, pthread_setspecific, "pthread_setspecific"); - - function pthread_getspecific (key : pthread_key_t) return System.Address; - pragma Import (C, pthread_getspecific, "pthread_getspecific"); - - type destructor_pointer is access procedure (arg : System.Address); - - function pthread_key_create - (key : access pthread_key_t; - destructor : destructor_pointer) return int; - pragma Import (C, pthread_key_create, "pthread_key_create"); - -private - - type sigset_t is record - dum0, dum1, dum2, dum3, dum4, dum5, dum6, dum7 : unsigned_long; - dum8, dum9, dum10, dum11, dum12, dum13, dum14, dum15 : unsigned_long; - end record; - pragma Convention (C, sigset_t); - - type pid_t is new int; - - type time_t is new long; - - type timespec is record - tv_sec : time_t; - tv_nsec : long; - end record; - pragma Convention (C, timespec); - - type struct_timeval is record - tv_sec : time_t; - tv_usec : time_t; - end record; - pragma Convention (C, struct_timeval); - - type pthread_attr_t is record - dum0, dum1, dum2, dum3, dum4, dum5, dum6 : unsigned_long; - end record; - pragma Convention (C, pthread_attr_t); - - type pthread_condattr_t is record - dummy : int; - end record; - pragma Convention (C, pthread_condattr_t); - - type pthread_mutexattr_t is record - mutexkind : int; - end record; - pragma Convention (C, pthread_mutexattr_t); - - type pthread_mutex_t is record - dum0, dum1, dum2, dum3, dum4 : unsigned_long; - end record; - pragma Convention (C, pthread_mutex_t); - - type pthread_cond_t is record - dum0, dum1, dum2, dum3, dum4, dum5 : unsigned_long; - end record; - pragma Convention (C, pthread_cond_t); - - type pthread_key_t is new unsigned; - -end System.OS_Interface; diff --git a/gcc/ada/s-osinte-linux-hppa.ads b/gcc/ada/s-osinte-linux-hppa.ads deleted file mode 100644 index 2467f09cf5b..00000000000 --- a/gcc/ada/s-osinte-linux-hppa.ads +++ /dev/null @@ -1,560 +0,0 @@ ------------------------------------------------------------------------------- --- -- --- GNU ADA RUN-TIME LIBRARY (GNARL) COMPONENTS -- --- -- --- S Y S T E M . O S _ I N T E R F A C E -- --- -- --- S p e c -- --- (GNU/Linux-HPPA Version) -- --- -- --- Copyright (C) 1991-1994, Florida State University -- --- Copyright (C) 1995-2008, Free Software Foundation, Inc. -- --- -- --- GNARL is free software; you can redistribute it and/or modify it under -- --- terms of the GNU General Public License as published by the Free Soft- -- --- ware Foundation; either version 2, or (at your option) any later ver- -- --- sion. GNARL is distributed in the hope that it will be useful, but WITH- -- --- OUT 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 distributed with GNARL; see file COPYING. If not, write -- --- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, -- --- Boston, MA 02110-1301, USA. -- --- -- --- As a special exception, if other files instantiate generics from this -- --- unit, or you link this unit with other files to produce an executable, -- --- this unit does not by itself cause the resulting executable to be -- --- covered by the GNU General Public License. This exception does not -- --- however invalidate any other reasons why the executable file might be -- --- covered by the GNU Public License. -- --- -- --- GNARL was developed by the GNARL team at Florida State University. -- --- Extensive contributions were provided by Ada Core Technologies, Inc. -- --- -- ------------------------------------------------------------------------------- - --- This is a GNU/Linux (GNU/LinuxThreads) version of this package - --- This package encapsulates all direct interfaces to OS services that are --- needed by the tasking run-time (libgnarl). - --- PLEASE DO NOT add any with-clauses to this package or remove the pragma --- Preelaborate. This package is designed to be a bottom-level (leaf) package. - -with Ada.Unchecked_Conversion; - -with Interfaces.C; - -package System.OS_Interface is - pragma Preelaborate; - - pragma Linker_Options ("-lpthread"); - - subtype int is Interfaces.C.int; - subtype char is Interfaces.C.char; - subtype short is Interfaces.C.short; - subtype long is Interfaces.C.long; - subtype unsigned is Interfaces.C.unsigned; - subtype unsigned_short is Interfaces.C.unsigned_short; - subtype unsigned_long is Interfaces.C.unsigned_long; - subtype unsigned_char is Interfaces.C.unsigned_char; - subtype plain_char is Interfaces.C.plain_char; - subtype size_t is Interfaces.C.size_t; - - ----------- - -- Errno -- - ----------- - - function errno return int; - pragma Import (C, errno, "__get_errno"); - - EAGAIN : constant := 11; - EINTR : constant := 4; - EINVAL : constant := 22; - ENOMEM : constant := 12; - EPERM : constant := 1; - ETIMEDOUT : constant := 238; - - ------------- - -- Signals -- - ------------- - - Max_Interrupt : constant := 63; - type Signal is new int range 0 .. Max_Interrupt; - for Signal'Size use int'Size; - - SIGHUP : constant := 1; -- hangup - SIGINT : constant := 2; -- interrupt (rubout) - SIGQUIT : constant := 3; -- quit (ASCD FS) - SIGILL : constant := 4; -- illegal instruction (not reset) - SIGTRAP : constant := 5; -- trace trap (not reset) - SIGIOT : constant := 6; -- IOT instruction - SIGABRT : constant := 6; -- used by abort, replace SIGIOT in the future - SIGEMT : constant := 7; -- EMT - SIGFPE : constant := 8; -- floating point exception - SIGKILL : constant := 9; -- kill (cannot be caught or ignored) - SIGBUS : constant := 10; -- bus error - SIGSEGV : constant := 11; -- segmentation violation - SIGSYS : constant := 12; -- bad system call - SIGPIPE : constant := 13; -- write on a pipe with no one to read it - SIGALRM : constant := 14; -- alarm clock - SIGTERM : constant := 15; -- software termination signal from kill - SIGUSR1 : constant := 16; -- user defined signal 1 - SIGUSR2 : constant := 17; -- user defined signal 2 - SIGCLD : constant := 18; -- alias for SIGCHLD - SIGCHLD : constant := 18; -- child status change - SIGPWR : constant := 19; -- power-fail restart - SIGVTALRM : constant := 20; -- virtual timer expired - SIGPROF : constant := 21; -- profiling timer expired - SIGPOLL : constant := 22; -- pollable event occurred - SIGIO : constant := 22; -- I/O now possible (4.2 BSD) - SIGWINCH : constant := 23; -- window size change - SIGSTOP : constant := 24; -- stop (cannot be caught or ignored) - SIGTSTP : constant := 25; -- user stop requested from tty - SIGCONT : constant := 26; -- stopped process has been continued - SIGTTIN : constant := 27; -- background tty read attempted - SIGTTOU : constant := 28; -- background tty write attempted - SIGURG : constant := 29; -- urgent condition on IO channel - SIGLOST : constant := 30; -- File lock lost - SIGUNUSED : constant := 31; -- unused signal (GNU/Linux) - SIGXCPU : constant := 33; -- CPU time limit exceeded - SIGXFSZ : constant := 34; -- filesize limit exceeded - SIGSTKFLT : constant := 36; -- coprocessor stack fault (Linux) - SIGLTHRRES : constant := 37; -- GNU/LinuxThreads restart signal - SIGLTHRCAN : constant := 38; -- GNU/LinuxThreads cancel signal - SIGLTHRDBG : constant := 39; -- GNU/LinuxThreads debugger signal - - SIGADAABORT : constant := SIGABRT; - -- Change this if you want to use another signal for task abort. - -- SIGTERM might be a good one. - - type Signal_Set is array (Natural range <>) of Signal; - - Unmasked : constant Signal_Set := ( - SIGTRAP, - -- To enable debugging on multithreaded applications, mark SIGTRAP to - -- be kept unmasked. - - SIGBUS, - - SIGTTIN, SIGTTOU, SIGTSTP, - -- Keep these three signals unmasked so that background processes - -- and IO behaves as normal "C" applications - - SIGPROF, - -- To avoid confusing the profiler - - SIGKILL, SIGSTOP, - -- These two signals actually cannot be masked; - -- POSIX simply won't allow it. - - SIGLTHRRES, SIGLTHRCAN, SIGLTHRDBG); - -- These three signals are used by GNU/LinuxThreads starting from - -- glibc 2.1 (future 2.2). - - Reserved : constant Signal_Set := - -- I am not sure why the following two signals are reserved. - -- I guess they are not supported by this version of GNU/Linux. - (SIGVTALRM, SIGUNUSED); - - type sigset_t is private; - - function sigaddset (set : access sigset_t; sig : Signal) return int; - pragma Import (C, sigaddset, "sigaddset"); - - function sigdelset (set : access sigset_t; sig : Signal) return int; - pragma Import (C, sigdelset, "sigdelset"); - - function sigfillset (set : access sigset_t) return int; - pragma Import (C, sigfillset, "sigfillset"); - - function sigismember (set : access sigset_t; sig : Signal) return int; - pragma Import (C, sigismember, "sigismember"); - - function sigemptyset (set : access sigset_t) return int; - pragma Import (C, sigemptyset, "sigemptyset"); - - type union_type_3 is new String (1 .. 116); - type siginfo_t is record - si_signo : int; - si_code : int; - si_errno : int; - X_data : union_type_3; - end record; - pragma Convention (C, siginfo_t); - - type struct_sigaction is record - sa_handler : System.Address; - sa_flags : unsigned_long; - sa_mask : sigset_t; - end record; - pragma Convention (C, struct_sigaction); - type struct_sigaction_ptr is access all struct_sigaction; - - type Machine_State is record - eip : unsigned_long; - ebx : unsigned_long; - esp : unsigned_long; - ebp : unsigned_long; - esi : unsigned_long; - edi : unsigned_long; - end record; - type Machine_State_Ptr is access all Machine_State; - - SA_SIGINFO : constant := 16; - - SIG_BLOCK : constant := 0; - SIG_UNBLOCK : constant := 1; - SIG_SETMASK : constant := 2; - - SIG_DFL : constant := 0; - SIG_IGN : constant := 1; - - function sigaction - (sig : Signal; - act : struct_sigaction_ptr; - oact : struct_sigaction_ptr) return int; - pragma Import (C, sigaction, "sigaction"); - - ---------- - -- Time -- - ---------- - - type timespec is private; - - function To_Duration (TS : timespec) return Duration; - pragma Inline (To_Duration); - - function To_Timespec (D : Duration) return timespec; - pragma Inline (To_Timespec); - - type struct_timeval is private; - - function To_Duration (TV : struct_timeval) return Duration; - pragma Inline (To_Duration); - - function To_Timeval (D : Duration) return struct_timeval; - pragma Inline (To_Timeval); - - function gettimeofday - (tv : access struct_timeval; - tz : System.Address := System.Null_Address) return int; - pragma Import (C, gettimeofday, "gettimeofday"); - - function sysconf (name : int) return long; - pragma Import (C, sysconf); - - SC_CLK_TCK : constant := 2; - SC_NPROCESSORS_ONLN : constant := 84; - - ------------------------- - -- Priority Scheduling -- - ------------------------- - - SCHED_OTHER : constant := 0; - SCHED_FIFO : constant := 1; - SCHED_RR : constant := 2; - - function To_Target_Priority - (Prio : System.Any_Priority) return Interfaces.C.int; - -- Maps System.Any_Priority to a POSIX priority - - ------------- - -- Process -- - ------------- - - type pid_t is private; - - function kill (pid : pid_t; sig : Signal) return int; - pragma Import (C, kill, "kill"); - - function getpid return pid_t; - pragma Import (C, getpid, "getpid"); - - ------------- - -- Threads -- - ------------- - - type Thread_Body is access - function (arg : System.Address) return System.Address; - pragma Convention (C, Thread_Body); - - function Thread_Body_Access is new - Ada.Unchecked_Conversion (System.Address, Thread_Body); - - type pthread_t is new unsigned_long; - subtype Thread_Id is pthread_t; - - function To_pthread_t is new Ada.Unchecked_Conversion - (unsigned_long, pthread_t); - - type pthread_mutex_t is limited private; - type pthread_cond_t is limited private; - type pthread_attr_t is limited private; - type pthread_mutexattr_t is limited private; - type pthread_condattr_t is limited private; - type pthread_key_t is private; - - PTHREAD_CREATE_DETACHED : constant := 1; - - ----------- - -- Stack -- - ----------- - - function Get_Stack_Base (thread : pthread_t) return Address; - pragma Inline (Get_Stack_Base); - -- This is a dummy procedure to share some GNULLI files - - --------------------------------------- - -- Nonstandard Thread Initialization -- - --------------------------------------- - - procedure pthread_init; - pragma Inline (pthread_init); - -- This is a dummy procedure to share some GNULLI files - - ------------------------- - -- POSIX.1c Section 3 -- - ------------------------- - - function sigwait (set : access sigset_t; sig : access Signal) return int; - pragma Import (C, sigwait, "sigwait"); - - function pthread_kill (thread : pthread_t; sig : Signal) return int; - pragma Import (C, pthread_kill, "pthread_kill"); - - function pthread_sigmask - (how : int; - set : access sigset_t; - oset : access sigset_t) return int; - pragma Import (C, pthread_sigmask, "pthread_sigmask"); - - -------------------------- - -- POSIX.1c Section 11 -- - -------------------------- - - function pthread_mutexattr_init - (attr : access pthread_mutexattr_t) return int; - pragma Import (C, pthread_mutexattr_init, "pthread_mutexattr_init"); - - function pthread_mutexattr_destroy - (attr : access pthread_mutexattr_t) return int; - pragma Import (C, pthread_mutexattr_destroy, "pthread_mutexattr_destroy"); - - function pthread_mutex_init - (mutex : access pthread_mutex_t; - attr : access pthread_mutexattr_t) return int; - pragma Import (C, pthread_mutex_init, "pthread_mutex_init"); - - function pthread_mutex_destroy (mutex : access pthread_mutex_t) return int; - pragma Import (C, pthread_mutex_destroy, "pthread_mutex_destroy"); - - function pthread_mutex_lock (mutex : access pthread_mutex_t) return int; - pragma Import (C, pthread_mutex_lock, "pthread_mutex_lock"); - - function pthread_mutex_unlock (mutex : access pthread_mutex_t) return int; - pragma Import (C, pthread_mutex_unlock, "pthread_mutex_unlock"); - - function pthread_condattr_init - (attr : access pthread_condattr_t) return int; - pragma Import (C, pthread_condattr_init, "pthread_condattr_init"); - - function pthread_condattr_destroy - (attr : access pthread_condattr_t) return int; - pragma Import (C, pthread_condattr_destroy, "pthread_condattr_destroy"); - - function pthread_cond_init - (cond : access pthread_cond_t; - attr : access pthread_condattr_t) return int; - pragma Import (C, pthread_cond_init, "pthread_cond_init"); - - function pthread_cond_destroy (cond : access pthread_cond_t) return int; - pragma Import (C, pthread_cond_destroy, "pthread_cond_destroy"); - - function pthread_cond_signal (cond : access pthread_cond_t) return int; - pragma Import (C, pthread_cond_signal, "pthread_cond_signal"); - - function pthread_cond_wait - (cond : access pthread_cond_t; - mutex : access pthread_mutex_t) return int; - pragma Import (C, pthread_cond_wait, "pthread_cond_wait"); - - function pthread_cond_timedwait - (cond : access pthread_cond_t; - mutex : access pthread_mutex_t; - abstime : access timespec) return int; - pragma Import (C, pthread_cond_timedwait, "pthread_cond_timedwait"); - - -------------------------- - -- POSIX.1c Section 13 -- - -------------------------- - - type struct_sched_param is record - sched_priority : int; -- scheduling priority - end record; - pragma Convention (C, struct_sched_param); - - function pthread_setschedparam - (thread : pthread_t; - policy : int; - param : access struct_sched_param) return int; - pragma Import (C, pthread_setschedparam, "pthread_setschedparam"); - - function pthread_attr_setschedpolicy - (attr : access pthread_attr_t; - policy : int) return int; - pragma Import - (C, pthread_attr_setschedpolicy, "pthread_attr_setschedpolicy"); - - function sched_yield return int; - pragma Import (C, sched_yield, "sched_yield"); - - --------------------------- - -- P1003.1c - Section 16 -- - --------------------------- - - function pthread_attr_init - (attributes : access pthread_attr_t) return int; - pragma Import (C, pthread_attr_init, "pthread_attr_init"); - - function pthread_attr_destroy - (attributes : access pthread_attr_t) return int; - pragma Import (C, pthread_attr_destroy, "pthread_attr_destroy"); - - function pthread_attr_setdetachstate - (attr : access pthread_attr_t; - detachstate : int) return int; - pragma Import - (C, pthread_attr_setdetachstate, "pthread_attr_setdetachstate"); - - function pthread_attr_setstacksize - (attr : access pthread_attr_t; - stacksize : size_t) return int; - pragma Import (C, pthread_attr_setstacksize, "pthread_attr_setstacksize"); - - function pthread_create - (thread : access pthread_t; - attributes : access pthread_attr_t; - start_routine : Thread_Body; - arg : System.Address) return int; - pragma Import (C, pthread_create, "pthread_create"); - - procedure pthread_exit (status : System.Address); - pragma Import (C, pthread_exit, "pthread_exit"); - - function pthread_self return pthread_t; - pragma Import (C, pthread_self, "pthread_self"); - - -------------------------- - -- POSIX.1c Section 17 -- - -------------------------- - - function pthread_setspecific - (key : pthread_key_t; - value : System.Address) return int; - pragma Import (C, pthread_setspecific, "pthread_setspecific"); - - function pthread_getspecific (key : pthread_key_t) return System.Address; - pragma Import (C, pthread_getspecific, "pthread_getspecific"); - - type destructor_pointer is access procedure (arg : System.Address); - pragma Convention (C, destructor_pointer); - - function pthread_key_create - (key : access pthread_key_t; - destructor : destructor_pointer) return int; - pragma Import (C, pthread_key_create, "pthread_key_create"); - - CPU_SETSIZE : constant := 1_024; - - type bit_field is array (1 .. CPU_SETSIZE) of Boolean; - for bit_field'Size use CPU_SETSIZE; - pragma Pack (bit_field); - pragma Convention (C, bit_field); - - type cpu_set_t is record - bits : bit_field; - end record; - pragma Convention (C, cpu_set_t); - - function pthread_setaffinity_np - (thread : pthread_t; - cpusetsize : size_t; - cpuset : access cpu_set_t) return int; - pragma Import (C, pthread_setaffinity_np, "__gnat_pthread_setaffinity_np"); - -private - - type sigset_t is array (0 .. 31) of unsigned_long; - pragma Convention (C, sigset_t); - - type pid_t is new int; - - type time_t is new long; - - type timespec is record - tv_sec : time_t; - tv_nsec : long; - end record; - pragma Convention (C, timespec); - - type struct_timeval is record - tv_sec : time_t; - tv_usec : time_t; - end record; - pragma Convention (C, struct_timeval); - - type pthread_attr_t is record - detachstate : int; - schedpolicy : int; - schedparam : struct_sched_param; - inheritsched : int; - scope : int; - guardsize : size_t; - stackaddr_set : int; - stackaddr : System.Address; - stacksize : size_t; - end record; - pragma Convention (C, pthread_attr_t); - - type pthread_condattr_t is record - dummy : int; - end record; - pragma Convention (C, pthread_condattr_t); - - type pthread_mutexattr_t is record - mutexkind : int; - end record; - pragma Convention (C, pthread_mutexattr_t); - - type lock_array is array (1 .. 4) of int; - type atomic_lock_t is record - lock : lock_array; - end record; - pragma Convention (C, atomic_lock_t); - -- ??? Alignment should be 16 but this is larger than BIGGEST_ALIGNMENT. - -- This causes an erroneous pointer value to sometimes be passed to free - -- during deallocation. See PR ada/24533 for more details. - for atomic_lock_t'Alignment use 8; - - type struct_pthread_fast_lock is record - spinlock : atomic_lock_t; - status : long; - end record; - pragma Convention (C, struct_pthread_fast_lock); - - type pthread_mutex_t is record - m_reserved : int; - m_count : int; - m_owner : System.Address; - m_kind : int; - m_lock : struct_pthread_fast_lock; - end record; - pragma Convention (C, pthread_mutex_t); - - type pthread_cond_t is array (0 .. 47) of unsigned_char; - pragma Convention (C, pthread_cond_t); - - type pthread_key_t is new unsigned; - -end System.OS_Interface; diff --git a/gcc/ada/s-osinte-linux.ads b/gcc/ada/s-osinte-linux.ads index bb06c01a0b8..bbaa0b4282e 100644 --- a/gcc/ada/s-osinte-linux.ads +++ b/gcc/ada/s-osinte-linux.ads @@ -41,8 +41,8 @@ -- Preelaborate. This package is designed to be a bottom-level (leaf) package. with Ada.Unchecked_Conversion; - with Interfaces.C; +with System.Linux; package System.OS_Interface is pragma Preelaborate; @@ -67,12 +67,12 @@ package System.OS_Interface is function errno return int; pragma Import (C, errno, "__get_errno"); - EAGAIN : constant := 11; - EINTR : constant := 4; - EINVAL : constant := 22; - ENOMEM : constant := 12; - EPERM : constant := 1; - ETIMEDOUT : constant := 110; + EAGAIN : constant := System.Linux.EAGAIN; + EINTR : constant := System.Linux.EINTR; + EINVAL : constant := System.Linux.EINVAL; + ENOMEM : constant := System.Linux.ENOMEM; + EPERM : constant := System.Linux.EPERM; + ETIMEDOUT : constant := System.Linux.ETIMEDOUT; ------------- -- Signals -- @@ -82,44 +82,44 @@ package System.OS_Interface is type Signal is new int range 0 .. Max_Interrupt; for Signal'Size use int'Size; - SIGHUP : constant := 1; -- hangup - SIGINT : constant := 2; -- interrupt (rubout) - SIGQUIT : constant := 3; -- quit (ASCD FS) - SIGILL : constant := 4; -- illegal instruction (not reset) - SIGTRAP : constant := 5; -- trace trap (not reset) - SIGIOT : constant := 6; -- IOT instruction - SIGABRT : constant := 6; -- used by abort, replace SIGIOT in the future - SIGFPE : constant := 8; -- floating point exception - SIGKILL : constant := 9; -- kill (cannot be caught or ignored) - SIGBUS : constant := 7; -- bus error - SIGSEGV : constant := 11; -- segmentation violation - SIGPIPE : constant := 13; -- write on a pipe with no one to read it - SIGALRM : constant := 14; -- alarm clock - SIGTERM : constant := 15; -- software termination signal from kill - SIGUSR1 : constant := 10; -- user defined signal 1 - SIGUSR2 : constant := 12; -- user defined signal 2 - SIGCLD : constant := 17; -- alias for SIGCHLD - SIGCHLD : constant := 17; -- child status change - SIGPWR : constant := 30; -- power-fail restart - SIGWINCH : constant := 28; -- window size change - SIGURG : constant := 23; -- urgent condition on IO channel - SIGPOLL : constant := 29; -- pollable event occurred - SIGIO : constant := 29; -- I/O now possible (4.2 BSD) - SIGLOST : constant := 29; -- File lock lost - SIGSTOP : constant := 19; -- stop (cannot be caught or ignored) - SIGTSTP : constant := 20; -- user stop requested from tty - SIGCONT : constant := 18; -- stopped process has been continued - SIGTTIN : constant := 21; -- background tty read attempted - SIGTTOU : constant := 22; -- background tty write attempted - SIGVTALRM : constant := 26; -- virtual timer expired - SIGPROF : constant := 27; -- profiling timer expired - SIGXCPU : constant := 24; -- CPU time limit exceeded - SIGXFSZ : constant := 25; -- filesize limit exceeded - SIGUNUSED : constant := 31; -- unused signal (GNU/Linux) - SIGSTKFLT : constant := 16; -- coprocessor stack fault (Linux) - SIGLTHRRES : constant := 32; -- GNU/LinuxThreads restart signal - SIGLTHRCAN : constant := 33; -- GNU/LinuxThreads cancel signal - SIGLTHRDBG : constant := 34; -- GNU/LinuxThreads debugger signal + SIGHUP : constant := System.Linux.SIGHUP; + SIGINT : constant := System.Linux.SIGINT; + SIGQUIT : constant := System.Linux.SIGQUIT; + SIGILL : constant := System.Linux.SIGILL; + SIGTRAP : constant := System.Linux.SIGTRAP; + SIGIOT : constant := System.Linux.SIGIOT; + SIGABRT : constant := System.Linux.SIGABRT; + SIGFPE : constant := System.Linux.SIGFPE; + SIGKILL : constant := System.Linux.SIGKILL; + SIGBUS : constant := System.Linux.SIGBUS; + SIGSEGV : constant := System.Linux.SIGSEGV; + SIGPIPE : constant := System.Linux.SIGPIPE; + SIGALRM : constant := System.Linux.SIGALRM; + SIGTERM : constant := System.Linux.SIGTERM; + SIGUSR1 : constant := System.Linux.SIGUSR1; + SIGUSR2 : constant := System.Linux.SIGUSR2; + SIGCLD : constant := System.Linux.SIGCLD; + SIGCHLD : constant := System.Linux.SIGCHLD; + SIGPWR : constant := System.Linux.SIGPWR; + SIGWINCH : constant := System.Linux.SIGWINCH; + SIGURG : constant := System.Linux.SIGURG; + SIGPOLL : constant := System.Linux.SIGPOLL; + SIGIO : constant := System.Linux.SIGIO; + SIGLOST : constant := System.Linux.SIGLOST; + SIGSTOP : constant := System.Linux.SIGSTOP; + SIGTSTP : constant := System.Linux.SIGTSTP; + SIGCONT : constant := System.Linux.SIGCONT; + SIGTTIN : constant := System.Linux.SIGTTIN; + SIGTTOU : constant := System.Linux.SIGTTOU; + SIGVTALRM : constant := System.Linux.SIGVTALRM; + SIGPROF : constant := System.Linux.SIGPROF; + SIGXCPU : constant := System.Linux.SIGXCPU; + SIGXFSZ : constant := System.Linux.SIGXFSZ; + SIGUNUSED : constant := System.Linux.SIGUNUSED; + SIGSTKFLT : constant := System.Linux.SIGSTKFLT; + SIGLTHRRES : constant := System.Linux.SIGLTHRRES; + SIGLTHRCAN : constant := System.Linux.SIGLTHRCAN; + SIGLTHRDBG : constant := System.Linux.SIGLTHRDBG; SIGADAABORT : constant := SIGABRT; -- Change this if you want to use another signal for task abort. @@ -181,12 +181,13 @@ package System.OS_Interface is pragma Convention (C, siginfo_t); type struct_sigaction is record - sa_handler : System.Address; - sa_mask : sigset_t; - sa_flags : unsigned_long; - sa_restorer : System.Address; + sa_handler : System.Address; + sa_mask : sigset_t; + sa_flags : Interfaces.C.unsigned_long; + sa_restorer : System.Address; end record; pragma Convention (C, struct_sigaction); + type struct_sigaction_ptr is access all struct_sigaction; type Machine_State is record @@ -199,7 +200,8 @@ package System.OS_Interface is end record; type Machine_State_Ptr is access all Machine_State; - SA_SIGINFO : constant := 16#04#; + SA_SIGINFO : constant := System.Linux.SA_SIGINFO; + SA_ONSTACK : constant := System.Linux.SA_ONSTACK; SIG_BLOCK : constant := 0; SIG_UNBLOCK : constant := 1; @@ -299,6 +301,25 @@ package System.OS_Interface is -- Stack -- ----------- + type stack_t is record + ss_sp : System.Address; + ss_flags : int; + ss_size : size_t; + end record; + pragma Convention (C, stack_t); + + function sigaltstack + (ss : not null access stack_t; + oss : access stack_t) return int; + pragma Import (C, sigaltstack, "sigaltstack"); + + Alternate_Stack : aliased System.Address; + pragma Import (C, Alternate_Stack, "__gnat_alternate_stack"); + -- The alternate signal stack for stack overflows + + Alternate_Stack_Size : constant := 16 * 1024; + -- This must be in keeping with init.c:__gnat_alternate_stack + function Get_Stack_Base (thread : pthread_t) return Address; pragma Inline (Get_Stack_Base); -- This is a dummy procedure to share some GNULLI files @@ -483,9 +504,19 @@ package System.OS_Interface is private - type sigset_t is array (0 .. 127) of unsigned_char; + type sigset_t is array (0 .. 127) of Interfaces.C.unsigned_char; pragma Convention (C, sigset_t); - for sigset_t'Alignment use unsigned_long'Alignment; + for sigset_t'Alignment use Interfaces.C.unsigned_long'Alignment; + + pragma Warnings (Off); + for struct_sigaction use record + sa_handler at 0 range 0 .. Standard'Address_Size - 1; + sa_mask at Linux.sa_mask_pos range 0 .. 1023; + sa_flags at Linux.sa_flags_pos range 0 .. Standard'Address_Size - 1; + end record; + -- We intentionally leave sa_restorer unspecified and let the compiler + -- append it after the last field, so disable corresponding warning. + pragma Warnings (On); type pid_t is new int; @@ -526,20 +557,7 @@ private end record; pragma Convention (C, pthread_mutexattr_t); - type struct_pthread_fast_lock is record - status : long; - spinlock : int; - end record; - pragma Convention (C, struct_pthread_fast_lock); - - type pthread_mutex_t is record - m_reserved : int; - m_count : int; - m_owner : System.Address; - m_kind : int; - m_lock : struct_pthread_fast_lock; - end record; - pragma Convention (C, pthread_mutex_t); + type pthread_mutex_t is new System.Linux.pthread_mutex_t; type pthread_cond_t is array (0 .. 47) of unsigned_char; pragma Convention (C, pthread_cond_t); diff --git a/gcc/ada/s-osinte-lynxos-3.adb b/gcc/ada/s-osinte-lynxos-3.adb index 01524c89251..09cbfca99b7 100644 --- a/gcc/ada/s-osinte-lynxos-3.adb +++ b/gcc/ada/s-osinte-lynxos-3.adb @@ -138,7 +138,7 @@ package body System.OS_Interface is -------------------------- -- For all the following functions, LynxOS threads has the POSIX Draft 4 - -- begavior; it sets errno but the standard Posix requires it to be + -- behavior; it sets errno but the standard Posix requires it to be -- returned. function pthread_mutexattr_init diff --git a/gcc/ada/s-osinte-lynxos-3.ads b/gcc/ada/s-osinte-lynxos-3.ads index f6ceec0790a..8098a8fbe88 100644 --- a/gcc/ada/s-osinte-lynxos-3.ads +++ b/gcc/ada/s-osinte-lynxos-3.ads @@ -175,7 +175,7 @@ package System.OS_Interface is ---------- Time_Slice_Supported : constant Boolean := True; - -- Indicates wether time slicing is supported + -- Indicates whether time slicing is supported type timespec is private; @@ -267,8 +267,11 @@ package System.OS_Interface is -- Stack -- ----------- + Alternate_Stack_Size : constant := 0; + -- No alternate signal stack is used on this platform + Stack_Base_Available : constant Boolean := False; - -- Indicates wether the stack base is available on this target + -- Indicates whether the stack base is available on this target function Get_Stack_Base (thread : pthread_t) return Address; pragma Inline (Get_Stack_Base); @@ -380,7 +383,7 @@ package System.OS_Interface is mutex : access pthread_mutex_t; reltime : access timespec) return int; pragma Inline (pthread_cond_timedwait); - -- LynxOS has a nonstandard pthrad_cond_timedwait + -- LynxOS has a nonstandard pthread_cond_timedwait Relative_Timed_Wait : constant Boolean := True; -- pthread_cond_timedwait requires a relative delay time diff --git a/gcc/ada/s-osinte-lynxos.ads b/gcc/ada/s-osinte-lynxos.ads index 90107631261..dd30d242176 100644 --- a/gcc/ada/s-osinte-lynxos.ads +++ b/gcc/ada/s-osinte-lynxos.ads @@ -87,7 +87,7 @@ package System.OS_Interface is -- -- -- The lowest numbered signal is 1, but 0 is a valid argument to some - -- library functions, eg. kill(2). However, 0 is not just another + -- library functions, e.g. kill(2). However, 0 is not just another -- signal: For instance 'I in Signal' and similar should be used with -- caution. @@ -170,7 +170,12 @@ package System.OS_Interface is pragma Convention (C, struct_sigaction); type struct_sigaction_ptr is access all struct_sigaction; - SA_SIGINFO : constant := 16#80#; + SA_SIGINFO : constant := 16#80#; + + SA_ONSTACK : constant := 16#00#; + -- SA_ONSTACK is not defined on LynxOS, but it is refered to in the POSIX + -- implementation of System.Interrupt_Management. Therefore we define a + -- dummy value of zero here so that setting this flag is a nop. SIG_BLOCK : constant := 0; SIG_UNBLOCK : constant := 1; @@ -276,6 +281,9 @@ package System.OS_Interface is -- Stack -- ----------- + Alternate_Stack_Size : constant := 0; + -- No alternate signal stack is used on this platform + Stack_Base_Available : constant Boolean := False; -- Indicates whether the stack base is available on this target diff --git a/gcc/ada/s-osinte-mingw.ads b/gcc/ada/s-osinte-mingw.ads index e0a3d7c75df..f526c77df8c 100644 --- a/gcc/ada/s-osinte-mingw.ads +++ b/gcc/ada/s-osinte-mingw.ads @@ -35,16 +35,17 @@ -- This is a NT (native) version of this package -- This package encapsulates all direct interfaces to OS services --- that are needed by the tasking run-time (libgnarl). +-- that are needed by the tasking run-time (libgnarl). For non tasking +-- oriented services consider declaring them into system-win32. -- PLEASE DO NOT add any with-clauses to this package or remove the pragma -- Preelaborate. This package is designed to be a bottom-level (leaf) package. -with Interfaces.C; +with Ada.Unchecked_Conversion; +with Interfaces.C; with Interfaces.C.Strings; - -with Ada.Unchecked_Conversion; +with System.Win32; package System.OS_Interface is pragma Preelaborate; @@ -58,39 +59,15 @@ package System.OS_Interface is -- General Types -- ------------------- - type DWORD is new Interfaces.C.unsigned_long; - type WORD is new Interfaces.C.unsigned_short; - - -- The LARGE_INTEGER type is actually a fixed point type - -- that only can represent integers. The reason for this is - -- easier conversion to Duration or other fixed point types. - -- (See Operations.Clock) - - type LARGE_INTEGER is delta 1.0 range -2.0**63 .. 2.0**63 - 1.0; - subtype PSZ is Interfaces.C.Strings.chars_ptr; - subtype PCHAR is Interfaces.C.Strings.chars_ptr; - - subtype PVOID is System.Address; - - Null_Void : constant PVOID := System.Null_Address; - type PLONG is access all Interfaces.C.long; - type PDWORD is access all DWORD; - type BYTE is new Interfaces.C.unsigned_char; - subtype CHAR is Interfaces.C.char; - - type BOOL is new Boolean; - for BOOL'Size use Interfaces.C.unsigned_long'Size; + Null_Void : constant Win32.PVOID := System.Null_Address; ------------------------- -- Handles for objects -- ------------------------- - type HANDLE is new Interfaces.C.long; - type PHANDLE is access all HANDLE; - - subtype Thread_Id is HANDLE; + subtype Thread_Id is Win32.HANDLE; ----------- -- Errno -- @@ -99,38 +76,6 @@ package System.OS_Interface is NO_ERROR : constant := 0; FUNC_ERR : constant := -1; - ----------- - -- Files -- - ----------- - - type SECURITY_ATTRIBUTES is record - nLength : DWORD; - pSecurityDescriptor : PVOID; - bInheritHandle : BOOL; - end record; - - function CloseHandle (hObject : HANDLE) return BOOL; - pragma Import (Stdcall, CloseHandle, "CloseHandle"); - - ------------------------ - -- System Information -- - ------------------------ - - type SYSTEM_INFO is record - dwOemId : DWORD; - dwPageSize : DWORD; - lpMinimumApplicationAddress : PVOID; - lpMaximumApplicationAddress : PVOID; - dwActiveProcessorMask : DWORD; - dwNumberOfProcessors : DWORD; - dwProcessorType : DWORD; - dwAllocationGranularity : DWORD; - dwReserved : DWORD; - end record; - - procedure GetSystemInfo (SI : access SYSTEM_INFO); - pragma Import (Stdcall, GetSystemInfo, "GetSystemInfo"); - ------------- -- Signals -- ------------- @@ -161,63 +106,6 @@ package System.OS_Interface is procedure kill (sig : Signal); pragma Import (C, kill, "raise"); - --------------------- - -- Time Management -- - --------------------- - - procedure Sleep (dwMilliseconds : DWORD); - pragma Import (Stdcall, Sleep, External_Name => "Sleep"); - - type SYSTEMTIME is record - wYear : WORD; - wMonth : WORD; - wDayOfWeek : WORD; - wDay : WORD; - wHour : WORD; - wMinute : WORD; - wSecond : WORD; - wMilliseconds : WORD; - end record; - - procedure GetSystemTime (pSystemTime : access SYSTEMTIME); - pragma Import (Stdcall, GetSystemTime, "GetSystemTime"); - - procedure GetSystemTimeAsFileTime (lpFileTime : access Long_Long_Integer); - pragma Import (Stdcall, GetSystemTimeAsFileTime, "GetSystemTimeAsFileTime"); - - function SetSystemTime (pSystemTime : access SYSTEMTIME) return BOOL; - pragma Import (Stdcall, SetSystemTime, "SetSystemTime"); - - function FileTimeToSystemTime - (lpFileTime : access Long_Long_Integer; - lpSystemTime : access SYSTEMTIME) return BOOL; - pragma Import (Stdcall, FileTimeToSystemTime, "FileTimeToSystemTime"); - - function SystemTimeToFileTime - (lpSystemTime : access SYSTEMTIME; - lpFileTime : access Long_Long_Integer) return BOOL; - pragma Import (Stdcall, SystemTimeToFileTime, "SystemTimeToFileTime"); - - function FileTimeToLocalFileTime - (lpFileTime : access Long_Long_Integer; - lpLocalFileTime : access Long_Long_Integer) return BOOL; - pragma Import (Stdcall, FileTimeToLocalFileTime, "FileTimeToLocalFileTime"); - - function LocalFileTimeToFileTime - (lpFileTime : access Long_Long_Integer; - lpLocalFileTime : access Long_Long_Integer) return BOOL; - pragma Import (Stdcall, LocalFileTimeToFileTime, "LocalFileTimeToFileTime"); - - function QueryPerformanceCounter - (lpPerformanceCount : access LARGE_INTEGER) return BOOL; - pragma Import - (Stdcall, QueryPerformanceCounter, "QueryPerformanceCounter"); - - function QueryPerformanceFrequency - (lpFrequency : access LARGE_INTEGER) return BOOL; - pragma Import - (Stdcall, QueryPerformanceFrequency, "QueryPerformanceFrequency"); - ------------- -- Threads -- ------------- @@ -233,11 +121,11 @@ package System.OS_Interface is pragma Import (Stdcall, SwitchToThread, "SwitchToThread"); function GetThreadTimes - (hThread : HANDLE; + (hThread : Win32.HANDLE; lpCreationTime : access Long_Long_Integer; lpExitTime : access Long_Long_Integer; lpKernelTime : access Long_Long_Integer; - lpUserTime : access Long_Long_Integer) return BOOL; + lpUserTime : access Long_Long_Integer) return Win32.BOOL; pragma Import (Stdcall, GetThreadTimes, "GetThreadTimes"); ----------------------- @@ -246,52 +134,33 @@ package System.OS_Interface is type CRITICAL_SECTION is private; - procedure InitializeCriticalSection - (pCriticalSection : access CRITICAL_SECTION); - pragma Import - (Stdcall, InitializeCriticalSection, "InitializeCriticalSection"); - - procedure EnterCriticalSection - (pCriticalSection : access CRITICAL_SECTION); - pragma Import (Stdcall, EnterCriticalSection, "EnterCriticalSection"); - - procedure LeaveCriticalSection - (pCriticalSection : access CRITICAL_SECTION); - pragma Import (Stdcall, LeaveCriticalSection, "LeaveCriticalSection"); - - procedure DeleteCriticalSection - (pCriticalSection : access CRITICAL_SECTION); - pragma Import (Stdcall, DeleteCriticalSection, "DeleteCriticalSection"); - ------------------------------------------------------------- -- Thread Creation, Activation, Suspension And Termination -- ------------------------------------------------------------- - subtype ProcessorId is DWORD; - type PTHREAD_START_ROUTINE is access function - (pThreadParameter : PVOID) return DWORD; + (pThreadParameter : Win32.PVOID) return Win32.DWORD; pragma Convention (Stdcall, PTHREAD_START_ROUTINE); function To_PTHREAD_START_ROUTINE is new Ada.Unchecked_Conversion (System.Address, PTHREAD_START_ROUTINE); function CreateThread - (pThreadAttributes : access SECURITY_ATTRIBUTES; - dwStackSize : DWORD; + (pThreadAttributes : access Win32.SECURITY_ATTRIBUTES; + dwStackSize : Win32.DWORD; pStartAddress : PTHREAD_START_ROUTINE; - pParameter : PVOID; - dwCreationFlags : DWORD; - pThreadId : PDWORD) return HANDLE; + pParameter : Win32.PVOID; + dwCreationFlags : Win32.DWORD; + pThreadId : access Win32.DWORD) return Win32.HANDLE; pragma Import (Stdcall, CreateThread, "CreateThread"); function BeginThreadEx - (pThreadAttributes : access SECURITY_ATTRIBUTES; - dwStackSize : DWORD; + (pThreadAttributes : access Win32.SECURITY_ATTRIBUTES; + dwStackSize : Win32.DWORD; pStartAddress : PTHREAD_START_ROUTINE; - pParameter : PVOID; - dwCreationFlags : DWORD; - pThreadId : PDWORD) return HANDLE; + pParameter : Win32.PVOID; + dwCreationFlags : Win32.DWORD; + pThreadId : not null access Win32.DWORD) return Win32.HANDLE; pragma Import (C, BeginThreadEx, "_beginthreadex"); Debug_Process : constant := 16#00000001#; @@ -311,70 +180,66 @@ package System.OS_Interface is Stack_Size_Param_Is_A_Reservation : constant := 16#00010000#; function GetExitCodeThread - (hThread : HANDLE; - pExitCode : PDWORD) return BOOL; + (hThread : Win32.HANDLE; + pExitCode : not null access Win32.DWORD) return Win32.BOOL; pragma Import (Stdcall, GetExitCodeThread, "GetExitCodeThread"); - function ResumeThread (hThread : HANDLE) return DWORD; + function ResumeThread (hThread : Win32.HANDLE) return Win32.DWORD; pragma Import (Stdcall, ResumeThread, "ResumeThread"); - function SuspendThread (hThread : HANDLE) return DWORD; + function SuspendThread (hThread : Win32.HANDLE) return Win32.DWORD; pragma Import (Stdcall, SuspendThread, "SuspendThread"); - procedure ExitThread (dwExitCode : DWORD); + procedure ExitThread (dwExitCode : Win32.DWORD); pragma Import (Stdcall, ExitThread, "ExitThread"); - procedure EndThreadEx (dwExitCode : DWORD); + procedure EndThreadEx (dwExitCode : Win32.DWORD); pragma Import (C, EndThreadEx, "_endthreadex"); function TerminateThread - (hThread : HANDLE; - dwExitCode : DWORD) return BOOL; + (hThread : Win32.HANDLE; + dwExitCode : Win32.DWORD) return Win32.BOOL; pragma Import (Stdcall, TerminateThread, "TerminateThread"); - function GetCurrentThread return HANDLE; + function GetCurrentThread return Win32.HANDLE; pragma Import (Stdcall, GetCurrentThread, "GetCurrentThread"); - function GetCurrentProcess return HANDLE; + function GetCurrentProcess return Win32.HANDLE; pragma Import (Stdcall, GetCurrentProcess, "GetCurrentProcess"); - function GetCurrentThreadId return DWORD; + function GetCurrentThreadId return Win32.DWORD; pragma Import (Stdcall, GetCurrentThreadId, "GetCurrentThreadId"); - function TlsAlloc return DWORD; + function TlsAlloc return Win32.DWORD; pragma Import (Stdcall, TlsAlloc, "TlsAlloc"); - function TlsGetValue (dwTlsIndex : DWORD) return PVOID; + function TlsGetValue (dwTlsIndex : Win32.DWORD) return Win32.PVOID; pragma Import (Stdcall, TlsGetValue, "TlsGetValue"); - function TlsSetValue (dwTlsIndex : DWORD; pTlsValue : PVOID) return BOOL; + function TlsSetValue + (dwTlsIndex : Win32.DWORD; pTlsValue : Win32.PVOID) return Win32.BOOL; pragma Import (Stdcall, TlsSetValue, "TlsSetValue"); - function TlsFree (dwTlsIndex : DWORD) return BOOL; + function TlsFree (dwTlsIndex : Win32.DWORD) return Win32.BOOL; pragma Import (Stdcall, TlsFree, "TlsFree"); - TLS_Nothing : constant := DWORD'Last; + TLS_Nothing : constant := Win32.DWORD'Last; procedure ExitProcess (uExitCode : Interfaces.C.unsigned); pragma Import (Stdcall, ExitProcess, "ExitProcess"); function WaitForSingleObject - (hHandle : HANDLE; - dwMilliseconds : DWORD) return DWORD; + (hHandle : Win32.HANDLE; + dwMilliseconds : Win32.DWORD) return Win32.DWORD; pragma Import (Stdcall, WaitForSingleObject, "WaitForSingleObject"); function WaitForSingleObjectEx - (hHandle : HANDLE; - dwMilliseconds : DWORD; - fAlertable : BOOL) return DWORD; + (hHandle : Win32.HANDLE; + dwMilliseconds : Win32.DWORD; + fAlertable : Win32.BOOL) return Win32.DWORD; pragma Import (Stdcall, WaitForSingleObjectEx, "WaitForSingleObjectEx"); - function SetThreadIdealProcessor - (hThread : HANDLE; - dwIdealProcessor : ProcessorId) return DWORD; - pragma Import (Stdcall, SetThreadIdealProcessor, "SetThreadIdealProcessor"); - - Wait_Infinite : constant := DWORD'Last; + Wait_Infinite : constant := Win32.DWORD'Last; WAIT_TIMEOUT : constant := 16#0000_0102#; WAIT_FAILED : constant := 16#FFFF_FFFF#; @@ -383,59 +248,59 @@ package System.OS_Interface is ------------------------------------ function CreateSemaphore - (pSemaphoreAttributes : access SECURITY_ATTRIBUTES; + (pSemaphoreAttributes : access Win32.SECURITY_ATTRIBUTES; lInitialCount : Interfaces.C.long; lMaximumCount : Interfaces.C.long; - pName : PSZ) return HANDLE; + pName : PSZ) return Win32.HANDLE; pragma Import (Stdcall, CreateSemaphore, "CreateSemaphoreA"); function OpenSemaphore - (dwDesiredAccess : DWORD; - bInheritHandle : BOOL; - pName : PSZ) return HANDLE; + (dwDesiredAccess : Win32.DWORD; + bInheritHandle : Win32.BOOL; + pName : PSZ) return Win32.HANDLE; pragma Import (Stdcall, OpenSemaphore, "OpenSemaphoreA"); function ReleaseSemaphore - (hSemaphore : HANDLE; + (hSemaphore : Win32.HANDLE; lReleaseCount : Interfaces.C.long; - pPreviousCount : PLONG) return BOOL; + pPreviousCount : access Win32.LONG) return Win32.BOOL; pragma Import (Stdcall, ReleaseSemaphore, "ReleaseSemaphore"); function CreateEvent - (pEventAttributes : access SECURITY_ATTRIBUTES; - bManualReset : BOOL; - bInitialState : BOOL; - pName : PSZ) return HANDLE; + (pEventAttributes : access Win32.SECURITY_ATTRIBUTES; + bManualReset : Win32.BOOL; + bInitialState : Win32.BOOL; + pName : PSZ) return Win32.HANDLE; pragma Import (Stdcall, CreateEvent, "CreateEventA"); function OpenEvent - (dwDesiredAccess : DWORD; - bInheritHandle : BOOL; - pName : PSZ) return HANDLE; + (dwDesiredAccess : Win32.DWORD; + bInheritHandle : Win32.BOOL; + pName : PSZ) return Win32.HANDLE; pragma Import (Stdcall, OpenEvent, "OpenEventA"); - function SetEvent (hEvent : HANDLE) return BOOL; + function SetEvent (hEvent : Win32.HANDLE) return Win32.BOOL; pragma Import (Stdcall, SetEvent, "SetEvent"); - function ResetEvent (hEvent : HANDLE) return BOOL; + function ResetEvent (hEvent : Win32.HANDLE) return Win32.BOOL; pragma Import (Stdcall, ResetEvent, "ResetEvent"); - function PulseEvent (hEvent : HANDLE) return BOOL; + function PulseEvent (hEvent : Win32.HANDLE) return Win32.BOOL; pragma Import (Stdcall, PulseEvent, "PulseEvent"); function CreateMutex - (pMutexAttributes : access SECURITY_ATTRIBUTES; - bInitialOwner : BOOL; - pName : PSZ) return HANDLE; + (pMutexAttributes : access Win32.SECURITY_ATTRIBUTES; + bInitialOwner : Win32.BOOL; + pName : PSZ) return Win32.HANDLE; pragma Import (Stdcall, CreateMutex, "CreateMutexA"); function OpenMutex - (dwDesiredAccess : DWORD; - bInheritHandle : BOOL; - pName : PSZ) return HANDLE; + (dwDesiredAccess : Win32.DWORD; + bInheritHandle : Win32.BOOL; + pName : PSZ) return Win32.HANDLE; pragma Import (Stdcall, OpenMutex, "OpenMutexA"); - function ReleaseMutex (hMutex : HANDLE) return BOOL; + function ReleaseMutex (hMutex : Win32.HANDLE) return Win32.BOOL; pragma Import (Stdcall, ReleaseMutex, "ReleaseMutex"); --------------------------------------------------- @@ -447,21 +312,21 @@ package System.OS_Interface is ----------------- function SetThreadPriority - (hThread : HANDLE; - nPriority : Interfaces.C.int) return BOOL; + (hThread : Win32.HANDLE; + nPriority : Interfaces.C.int) return Win32.BOOL; pragma Import (Stdcall, SetThreadPriority, "SetThreadPriority"); - function GetThreadPriority (hThread : HANDLE) return Interfaces.C.int; + function GetThreadPriority (hThread : Win32.HANDLE) return Interfaces.C.int; pragma Import (Stdcall, GetThreadPriority, "GetThreadPriority"); function SetPriorityClass - (hProcess : HANDLE; - dwPriorityClass : DWORD) return BOOL; + (hProcess : Win32.HANDLE; + dwPriorityClass : Win32.DWORD) return Win32.BOOL; pragma Import (Stdcall, SetPriorityClass, "SetPriorityClass"); procedure SetThreadPriorityBoost - (hThread : HANDLE; - DisablePriorityBoost : BOOL); + (hThread : Win32.HANDLE; + DisablePriorityBoost : Win32.BOOL); pragma Import (Stdcall, SetThreadPriorityBoost, "SetThreadPriorityBoost"); Normal_Priority_Class : constant := 16#00000020#; @@ -478,22 +343,21 @@ package System.OS_Interface is Thread_Priority_Time_Critical : constant := 15; Thread_Priority_Error_Return : constant := Interfaces.C.long'Last; - function GetLastError return DWORD; - pragma Import (Stdcall, GetLastError, "GetLastError"); - private type sigset_t is new Interfaces.C.unsigned_long; type CRITICAL_SECTION is record - DebugInfo : System.Address; - -- The following three fields control entering and - -- exiting the critical section for the resource + DebugInfo : System.Address; + LockCount : Long_Integer; RecursionCount : Long_Integer; - OwningThread : HANDLE; - LockSemaphore : HANDLE; - Reserved : DWORD; + OwningThread : Win32.HANDLE; + -- The above three fields control entering and exiting the critical + -- section for the resource. + + LockSemaphore : Win32.HANDLE; + Reserved : Win32.DWORD; end record; end System.OS_Interface; diff --git a/gcc/ada/s-osinte-rtems.ads b/gcc/ada/s-osinte-rtems.ads index 268eb43ac21..f28e14d3083 100644 --- a/gcc/ada/s-osinte-rtems.ads +++ b/gcc/ada/s-osinte-rtems.ads @@ -159,7 +159,7 @@ package System.OS_Interface is ---------- Time_Slice_Supported : constant Boolean := True; - -- Indicates wether time slicing is supported (i.e SCHED_RR is supported) + -- Indicates whether time slicing is supported (i.e SCHED_RR is supported) type timespec is private; @@ -250,7 +250,7 @@ package System.OS_Interface is ----------- Stack_Base_Available : constant Boolean := False; - -- Indicates wether the stack base is available on this target. + -- Indicates whether the stack base is available on this target. -- This allows us to share s-osinte.adb between all the FSU/RTEMS -- run time. -- Note that this value can only be true if pthread_t has a complete diff --git a/gcc/ada/s-osinte-solaris-posix.ads b/gcc/ada/s-osinte-solaris-posix.ads index c45dca19cfc..ae318060ccd 100644 --- a/gcc/ada/s-osinte-solaris-posix.ads +++ b/gcc/ada/s-osinte-solaris-posix.ads @@ -165,6 +165,7 @@ package System.OS_Interface is type struct_sigaction_ptr is access all struct_sigaction; SA_SIGINFO : constant := 16#0008#; + SA_ONSTACK : constant := 16#0001#; SIG_BLOCK : constant := 1; SIG_UNBLOCK : constant := 2; @@ -184,7 +185,7 @@ package System.OS_Interface is ---------- Time_Slice_Supported : constant Boolean := True; - -- Indicates wether time slicing is supported + -- Indicates whether time slicing is supported type timespec is private; @@ -272,26 +273,42 @@ package System.OS_Interface is -- Stack -- ----------- + type stack_t is record + ss_sp : System.Address; + ss_size : size_t; + ss_flags : int; + end record; + pragma Convention (C, stack_t); + + function sigaltstack + (ss : not null access stack_t; + oss : access stack_t) return int; + pragma Import (C, sigaltstack, "sigaltstack"); + + Alternate_Stack : aliased System.Address; + -- This is a dummy definition, never used (Alternate_Stack_Size is null) + + Alternate_Stack_Size : constant := 0; + -- No alternate signal stack is used on this platform + Stack_Base_Available : constant Boolean := False; -- Indicates whether the stack base is available on this target function Get_Stack_Base (thread : pthread_t) return Address; pragma Inline (Get_Stack_Base); - -- returns the stack base of the specified thread. - -- Only call this function when Stack_Base_Available is True. + -- Returns the stack base of the specified thread. Only call this function + -- when Stack_Base_Available is True. function Get_Page_Size return size_t; function Get_Page_Size return Address; pragma Import (C, Get_Page_Size, "getpagesize"); - -- returns the size of a page, or 0 if this is not relevant on this - -- target + -- Returns the size of a page, or 0 if this is not relevant on this target PROT_NONE : constant := 0; PROT_READ : constant := 1; PROT_WRITE : constant := 2; PROT_EXEC : constant := 4; PROT_ALL : constant := PROT_READ + PROT_WRITE + PROT_EXEC; - PROT_ON : constant := PROT_READ; PROT_OFF : constant := PROT_ALL; diff --git a/gcc/ada/s-osinte-tru64.ads b/gcc/ada/s-osinte-tru64.ads index 512267780b0..efb739f8f50 100644 --- a/gcc/ada/s-osinte-tru64.ads +++ b/gcc/ada/s-osinte-tru64.ads @@ -176,6 +176,7 @@ package System.OS_Interface is SA_NODEFER : constant := 8; SA_SIGINFO : constant := 16#40#; + SA_ONSTACK : constant := 16#01#; function sigaction (sig : Signal; diff --git a/gcc/ada/s-osinte-vxworks.adb b/gcc/ada/s-osinte-vxworks.adb index 417ab5d415a..312fabaaeb6 100644 --- a/gcc/ada/s-osinte-vxworks.adb +++ b/gcc/ada/s-osinte-vxworks.adb @@ -47,62 +47,15 @@ package body System.OS_Interface is Low_Priority : constant := 255; -- VxWorks native (default) lowest scheduling priority - ------------ - -- getpid -- - ------------ - - function getpid return t_id is - begin - -- VxWorks 5 (and VxWorks 6 in kernel mode) does not have a getpid - -- function. taskIdSelf is the equivalent routine. - - return taskIdSelf; - end getpid; - - -------------- - -- Int_Lock -- - -------------- - - function Int_Lock return int is - function intLock return int; - pragma Import (C, intLock, "intLock"); - begin - return intLock; - end Int_Lock; - - ---------------- - -- Int_Unlock -- - ---------------- - - function Int_Unlock return int is - function intUnlock return int; - pragma Import (C, intUnlock, "intUnlock"); - begin - return intUnlock; - end Int_Unlock; - ---------- -- kill -- ---------- function kill (pid : t_id; sig : Signal) return int is - function c_kill (pid : t_id; sig : Signal) return int; - pragma Import (C, c_kill, "kill"); begin - return c_kill (pid, sig); + return System.VxWorks.Ext.kill (pid, int (sig)); end kill; - -------------------- - -- Set_Time_Slice -- - -------------------- - - function Set_Time_Slice (ticks : int) return int is - function kernelTimeSlice (ticks : int) return int; - pragma Import (C, kernelTimeSlice, "kernelTimeSlice"); - begin - return kernelTimeSlice (ticks); - end Set_Time_Slice; - ------------- -- sigwait -- ------------- @@ -129,28 +82,6 @@ package body System.OS_Interface is end if; end sigwait; - --------------- - -- Task_Cont -- - --------------- - - function Task_Cont (tid : t_id) return int is - function taskResume (tid : t_id) return int; - pragma Import (C, taskResume, "taskResume"); - begin - return taskResume (tid); - end Task_Cont; - - --------------- - -- Task_Stop -- - --------------- - - function Task_Stop (tid : t_id) return int is - function taskSuspend (tid : t_id) return int; - pragma Import (C, taskSuspend, "taskSuspend"); - begin - return taskSuspend (tid); - end Task_Stop; - ----------------- -- To_Duration -- ----------------- diff --git a/gcc/ada/s-osinte-vxworks.ads b/gcc/ada/s-osinte-vxworks.ads index 3204b4bb267..35baabb6924 100644 --- a/gcc/ada/s-osinte-vxworks.ads +++ b/gcc/ada/s-osinte-vxworks.ads @@ -6,7 +6,7 @@ -- -- -- S p e c -- -- -- --- Copyright (C) 1991-1994, Florida State University -- +-- Copyright (C) 1991-1994, Florida State University -- -- Copyright (C) 1995-2008, Free Software Foundation, Inc. -- -- -- -- GNARL is free software; you can redistribute it and/or modify it under -- @@ -32,7 +32,7 @@ -- -- ------------------------------------------------------------------------------ --- This is the VxWorks version of this package +-- This is the VxWorks 5.x and 6.x version of this package -- This package encapsulates all direct interfaces to OS services -- that are needed by the tasking run-time (libgnarl). @@ -41,18 +41,20 @@ -- Preelaborate. This package is designed to be a bottom-level (leaf) package. with Interfaces.C; - with System.VxWorks; +with System.VxWorks.Ext; package System.OS_Interface is pragma Preelaborate; - subtype int is Interfaces.C.int; - subtype short is Short_Integer; - type unsigned_int is mod 2 ** int'Size; - type long is new Long_Integer; - type unsigned_long is mod 2 ** long'Size; - type size_t is mod 2 ** Standard'Address_Size; + subtype int is Interfaces.C.int; + subtype short is Short_Integer; + type unsigned_int is mod 2 ** int'Size; + type long is new Long_Integer; + type unsigned_long is mod 2 ** long'Size; + type long_long is new Long_Long_Integer; + type unsigned_long_long is mod 2 ** long_long'Size; + type size_t is mod 2 ** Standard'Address_Size; ----------- -- Errno -- @@ -73,7 +75,7 @@ package System.OS_Interface is -- Signals and Interrupts -- ---------------------------- - NSIG : constant := 32; + NSIG : constant := 64; -- Number of signals on the target OS type Signal is new int range 0 .. Interfaces.C."-" (NSIG, 1); @@ -82,11 +84,58 @@ package System.OS_Interface is Max_Interrupt : constant := Max_HW_Interrupt; - SIGILL : constant := 4; -- illegal instruction (not reset) - SIGABRT : constant := 6; -- used by abort, replace SIGIOT in the future - SIGFPE : constant := 8; -- floating point exception - SIGBUS : constant := 10; -- bus error - SIGSEGV : constant := 11; -- segmentation violation + -- Signals common to Vxworks 5.x and 6.x + + SIGILL : constant := 4; -- illegal instruction (not reset when caught) + SIGABRT : constant := 6; -- used by abort, replace SIGIOT in the future + SIGFPE : constant := 8; -- floating point exception + SIGBUS : constant := 10; -- bus error + SIGSEGV : constant := 11; -- segmentation violation + + -- Signals specific to VxWorks 6.x + + SIGHUP : constant := 1; -- hangup + SIGINT : constant := 2; -- interrupt + SIGQUIT : constant := 3; -- quit + SIGTRAP : constant := 5; -- trace trap (not reset when caught) + SIGEMT : constant := 7; -- EMT instruction + SIGKILL : constant := 9; -- kill + SIGFMT : constant := 12; -- STACK FORMAT ERROR (not posix) + SIGPIPE : constant := 13; -- write on a pipe with no one to read it + SIGALRM : constant := 14; -- alarm clock + SIGTERM : constant := 15; -- software termination signal from kill + SIGCNCL : constant := 16; -- pthreads cancellation signal + SIGSTOP : constant := 17; -- sendable stop signal not from tty + SIGTSTP : constant := 18; -- stop signal from tty + SIGCONT : constant := 19; -- continue a stopped process + SIGCHLD : constant := 20; -- to parent on child stop or exit + SIGTTIN : constant := 21; -- to readers pgrp upon background tty read + SIGTTOU : constant := 22; -- like TTIN for output + + SIGRES1 : constant := 23; -- reserved signal number (Not POSIX) + SIGRES2 : constant := 24; -- reserved signal number (Not POSIX) + SIGRES3 : constant := 25; -- reserved signal number (Not POSIX) + SIGRES4 : constant := 26; -- reserved signal number (Not POSIX) + SIGRES5 : constant := 27; -- reserved signal number (Not POSIX) + SIGRES6 : constant := 28; -- reserved signal number (Not POSIX) + SIGRES7 : constant := 29; -- reserved signal number (Not POSIX) + + SIGUSR1 : constant := 30; -- user defined signal 1 + SIGUSR2 : constant := 31; -- user defined signal 2 + + SIGPOLL : constant := 32; -- pollable event + SIGPROF : constant := 33; -- profiling timer expired + SIGSYS : constant := 34; -- bad system call + SIGURG : constant := 35; -- high bandwidth data is available at socket + SIGVTALRM : constant := 36; -- virtual timer expired + SIGXCPU : constant := 37; -- CPU time limit exceeded + SIGXFSZ : constant := 38; -- file size time limit exceeded + + SIGEVTS : constant := 39; -- signal event thread send + SIGEVTD : constant := 40; -- signal event thread delete + + SIGRTMIN : constant := 48; -- Realtime signal min + SIGRTMAX : constant := 63; -- Realtime signal max ----------------------------------- -- Signal processing definitions -- @@ -100,8 +149,8 @@ package System.OS_Interface is -- The sa_flags in struct sigaction - SA_SIGINFO : constant := 16#0002#; - SA_ONSTACK : constant := 16#0004#; + SA_SIGINFO : constant := 16#0002#; + SA_ONSTACK : constant := 16#0004#; SIG_DFL : constant := 0; SIG_IGN : constant := 1; @@ -152,36 +201,33 @@ package System.OS_Interface is oset : access sigset_t) return int; pragma Import (C, pthread_sigmask, "sigprocmask"); - type t_id is new long; + subtype t_id is System.VxWorks.Ext.t_id; subtype Thread_Id is t_id; function kill (pid : t_id; sig : Signal) return int; pragma Inline (kill); - function getpid return t_id; - pragma Inline (getpid); + function getpid return t_id renames System.VxWorks.Ext.getpid; - function Task_Stop (tid : t_id) return int; - pragma Inline (Task_Stop); + function Task_Stop (tid : t_id) return int + renames System.VxWorks.Ext.Task_Stop; -- If we are in the kernel space, stop the task whose t_id is -- given in parameter in such a way that it can be examined by the -- debugger. This typically maps to taskSuspend on VxWorks 5 and -- to taskStop on VxWorks 6. - function Task_Cont (tid : t_id) return int; - pragma Inline (Task_Cont); + function Task_Cont (tid : t_id) return int + renames System.VxWorks.Ext.Task_Cont; -- If we are in the kernel space, continue the task whose t_id is -- given in parameter if it has been stopped previously to be examined -- by the debugger (e.g. by taskStop). It typically maps to taskResume -- on VxWorks 5 and to taskCont on VxWorks 6. - function Int_Lock return int; - pragma Inline (Int_Lock); + function Int_Lock return int renames System.VxWorks.Ext.Int_Lock; -- If we are in the kernel space, lock interrupts. It typically maps to -- intLock. - function Int_Unlock return int; - pragma Inline (Int_Unlock); + function Int_Unlock return int renames System.VxWorks.Ext.Int_Unlock; -- If we are in the kernel space, unlock interrupts. It typically maps to -- intUnlock. @@ -214,14 +260,6 @@ package System.OS_Interface is (clock_id : clockid_t; tp : access timespec) return int; pragma Import (C, clock_gettime, "clock_gettime"); - type ULONG is new unsigned_long; - - procedure tickSet (ticks : ULONG); - pragma Import (C, tickSet, "tickSet"); - - function tickGet return ULONG; - pragma Import (C, tickGet, "tickGet"); - ---------------------- -- Utility Routines -- ---------------------- @@ -324,8 +362,8 @@ package System.OS_Interface is procedure taskDelete (tid : t_id); pragma Import (C, taskDelete, "taskDelete"); - function Set_Time_Slice (ticks : int) return int; - pragma Inline (Set_Time_Slice); + function Set_Time_Slice (ticks : int) return int + renames System.VxWorks.Ext.Set_Time_Slice; -- Calls kernelTimeSlice under VxWorks 5.x -- Do nothing under VxWorks 6.x @@ -395,7 +433,7 @@ package System.OS_Interface is -- Release all threads blocked on the semaphore private - type sigset_t is new long; + type sigset_t is new unsigned_long_long; type pid_t is new int; diff --git a/gcc/ada/s-osinte-vxworks6.ads b/gcc/ada/s-osinte-vxworks6.ads deleted file mode 100644 index 4ef43c9c31f..00000000000 --- a/gcc/ada/s-osinte-vxworks6.ads +++ /dev/null @@ -1,446 +0,0 @@ ------------------------------------------------------------------------------- --- -- --- GNAT RUN-TIME LIBRARY (GNARL) COMPONENTS -- --- -- --- S Y S T E M . O S _ I N T E R F A C E -- --- -- --- S p e c -- --- -- --- Copyright (C) 1991-1994, Florida State University -- --- Copyright (C) 1995-2008, Free Software Foundation, Inc. -- --- -- --- GNARL is free software; you can redistribute it and/or modify it under -- --- terms of the GNU General Public License as published by the Free Soft- -- --- ware Foundation; either version 2, or (at your option) any later ver- -- --- sion. GNARL is distributed in the hope that it will be useful, but WITH- -- --- OUT 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 distributed with GNARL; see file COPYING. If not, write -- --- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, -- --- Boston, MA 02110-1301, USA. -- --- -- --- As a special exception, if other files instantiate generics from this -- --- unit, or you link this unit with other files to produce an executable, -- --- this unit does not by itself cause the resulting executable to be -- --- covered by the GNU General Public License. This exception does not -- --- however invalidate any other reasons why the executable file might be -- --- covered by the GNU Public License. -- --- -- --- GNARL was developed by the GNARL team at Florida State University. -- --- Extensive contributions were provided by Ada Core Technologies, Inc. -- --- -- ------------------------------------------------------------------------------- - --- This is the VxWorks 6.x version of this package - --- This package encapsulates all direct interfaces to OS services --- that are needed by the tasking run-time (libgnarl). - --- PLEASE DO NOT add any with-clauses to this package or remove the pragma --- Preelaborate. This package is designed to be a bottom-level (leaf) package. - -with Interfaces.C; -with System.VxWorks; - -package System.OS_Interface is - pragma Preelaborate; - - subtype int is Interfaces.C.int; - subtype short is Short_Integer; - type unsigned_int is mod 2 ** int'Size; - type long is new Long_Integer; - type unsigned_long is mod 2 ** long'Size; - type long_long is new Long_Long_Integer; - type unsigned_long_long is mod 2 ** long_long'Size; - type size_t is mod 2 ** Standard'Address_Size; - - ----------- - -- Errno -- - ----------- - - function errno return int; - pragma Import (C, errno, "errnoGet"); - - EINTR : constant := 4; - EAGAIN : constant := 35; - ENOMEM : constant := 12; - EINVAL : constant := 22; - ETIMEDOUT : constant := 60; - - FUNC_ERR : constant := -1; - - ---------------------------- - -- Signals and Interrupts -- - ---------------------------- - - NSIG : constant := 64; - -- Number of signals on the target OS - type Signal is new int range 0 .. Interfaces.C."-" (NSIG, 1); - - Max_HW_Interrupt : constant := System.VxWorks.Num_HW_Interrupts - 1; - type HW_Interrupt is new int range 0 .. Max_HW_Interrupt; - - Max_Interrupt : constant := Max_HW_Interrupt; - - SIGHUP : constant := 1; -- hangup - SIGINT : constant := 2; -- interrupt - SIGQUIT : constant := 3; -- quit - SIGILL : constant := 4; -- illegal instruction (not reset when caught) - SIGTRAP : constant := 5; -- trace trap (not reset when caught) - SIGABRT : constant := 6; -- used by abort, replace SIGIOT in the future - SIGEMT : constant := 7; -- EMT instruction - SIGFPE : constant := 8; -- floating point exception - SIGKILL : constant := 9; -- kill - SIGBUS : constant := 10; -- bus error - SIGSEGV : constant := 11; -- segmentation violation - SIGFMT : constant := 12; -- STACK FORMAT ERROR (not posix) - SIGPIPE : constant := 13; -- write on a pipe with no one to read it - SIGALRM : constant := 14; -- alarm clock - SIGTERM : constant := 15; -- software termination signal from kill - SIGCNCL : constant := 16; -- pthreads cancellation signal - SIGSTOP : constant := 17; -- sendable stop signal not from tty - SIGTSTP : constant := 18; -- stop signal from tty - SIGCONT : constant := 19; -- continue a stopped process - SIGCHLD : constant := 20; -- to parent on child stop or exit - SIGTTIN : constant := 21; -- to readers pgrp upon background tty read - SIGTTOU : constant := 22; -- like TTIN for output - - SIGRES1 : constant := 23; -- reserved signal number (Not POSIX) - SIGRES2 : constant := 24; -- reserved signal number (Not POSIX) - SIGRES3 : constant := 25; -- reserved signal number (Not POSIX) - SIGRES4 : constant := 26; -- reserved signal number (Not POSIX) - SIGRES5 : constant := 27; -- reserved signal number (Not POSIX) - SIGRES6 : constant := 28; -- reserved signal number (Not POSIX) - SIGRES7 : constant := 29; -- reserved signal number (Not POSIX) - - SIGUSR1 : constant := 30; -- user defined signal 1 - SIGUSR2 : constant := 31; -- user defined signal 2 - - SIGPOLL : constant := 32; -- pollable event - SIGPROF : constant := 33; -- profiling timer expired - SIGSYS : constant := 34; -- bad system call - SIGURG : constant := 35; -- high bandwidth data is available at socket - SIGVTALRM : constant := 36; -- virtual timer expired - SIGXCPU : constant := 37; -- CPU time limit exceeded - SIGXFSZ : constant := 38; -- file size time limit exceeded - - SIGEVTS : constant := 39; -- signal event thread send - SIGEVTD : constant := 40; -- signal event thread delete - - SIGRTMIN : constant := 48; -- Realtime signal min - SIGRTMAX : constant := 63; -- Realtime signal max - - ----------------------------------- - -- Signal processing definitions -- - ----------------------------------- - - -- The how in sigprocmask() - SIG_BLOCK : constant := 1; - SIG_UNBLOCK : constant := 2; - SIG_SETMASK : constant := 3; - - -- The sa_flags in struct sigaction - SA_SIGINFO : constant := 16#0002#; - SA_ONSTACK : constant := 16#0004#; - - SIG_DFL : constant := 0; - SIG_IGN : constant := 1; - - type sigset_t is private; - - type struct_sigaction is record - sa_handler : System.Address; - sa_mask : sigset_t; - sa_flags : int; - end record; - pragma Convention (C, struct_sigaction); - type struct_sigaction_ptr is access all struct_sigaction; - - function sigaddset (set : access sigset_t; sig : Signal) return int; - pragma Import (C, sigaddset, "sigaddset"); - - function sigdelset (set : access sigset_t; sig : Signal) return int; - pragma Import (C, sigdelset, "sigdelset"); - - function sigfillset (set : access sigset_t) return int; - pragma Import (C, sigfillset, "sigfillset"); - - function sigismember (set : access sigset_t; sig : Signal) return int; - pragma Import (C, sigismember, "sigismember"); - - function sigemptyset (set : access sigset_t) return int; - pragma Import (C, sigemptyset, "sigemptyset"); - - function sigaction - (sig : Signal; - act : struct_sigaction_ptr; - oact : struct_sigaction_ptr) return int; - pragma Import (C, sigaction, "sigaction"); - - type isr_address is access procedure (sig : int); - pragma Convention (C, isr_address); - - function c_signal (sig : Signal; handler : isr_address) return isr_address; - pragma Import (C, c_signal, "signal"); - - function sigwait (set : access sigset_t; sig : access Signal) return int; - pragma Inline (sigwait); - - function pthread_sigmask - (how : int; - set : access sigset_t; - oset : access sigset_t) return int; - pragma Import (C, pthread_sigmask, "sigprocmask"); - - type t_id is new long; - subtype Thread_Id is t_id; - - function kill (pid : t_id; sig : Signal) return int; - pragma Inline (kill); - - function getpid return t_id; - pragma Inline (getpid); - - function Task_Stop (tid : t_id) return int; - pragma Inline (Task_Stop); - -- If we are in the kernel space, continue the task whose t_id is - -- given in parameter if it has been stopped previously to be examined - -- by the debugger (e.g. by taskStop). It typically maps to taskResume - -- on VxWorks 5 and to taskCont on VxWorks 6. - - function Task_Cont (tid : t_id) return int; - pragma Inline (Task_Cont); - -- If we are in the kernel space, lock interrupts. It typically maps to - -- intLock. - - function Int_Lock return int; - pragma Inline (Int_Lock); - -- If we are in the kernel space, lock interrupts. It typically maps to - -- intLock. - - function Int_Unlock return int; - pragma Inline (Int_Unlock); - -- If we are in the kernel space, unlock interrupts. It typically maps to - -- intUnlock. - - ---------- - -- Time -- - ---------- - - type time_t is new unsigned_long; - - type timespec is record - ts_sec : time_t; - ts_nsec : long; - end record; - pragma Convention (C, timespec); - - type clockid_t is private; - - CLOCK_REALTIME : constant clockid_t; -- System wide realtime clock - - function To_Duration (TS : timespec) return Duration; - pragma Inline (To_Duration); - - function To_Timespec (D : Duration) return timespec; - pragma Inline (To_Timespec); - - function To_Clock_Ticks (D : Duration) return int; - -- Convert a duration value (in seconds) into clock ticks - - function clock_gettime - (clock_id : clockid_t; tp : access timespec) return int; - pragma Import (C, clock_gettime, "clock_gettime"); - - type ULONG is new unsigned_long; - - procedure tickSet (ticks : ULONG); - pragma Import (C, tickSet, "tickSet"); - - function tickGet return ULONG; - pragma Import (C, tickGet, "tickGet"); - - ---------------------- - -- Utility Routines -- - ---------------------- - - function To_VxWorks_Priority (Priority : int) return int; - pragma Inline (To_VxWorks_Priority); - -- Convenience routine to convert between VxWorks priority and Ada priority - - -------------------------- - -- VxWorks specific API -- - -------------------------- - - subtype STATUS is int; - -- Equivalent of the C type STATUS - - OK : constant STATUS := 0; - ERROR : constant STATUS := Interfaces.C.int (-1); - - function taskIdVerify (tid : t_id) return STATUS; - pragma Import (C, taskIdVerify, "taskIdVerify"); - - function taskIdSelf return t_id; - pragma Import (C, taskIdSelf, "taskIdSelf"); - - function taskOptionsGet (tid : t_id; pOptions : access int) return int; - pragma Import (C, taskOptionsGet, "taskOptionsGet"); - - function taskSuspend (tid : t_id) return int; - pragma Import (C, taskSuspend, "taskSuspend"); - - function taskResume (tid : t_id) return int; - pragma Import (C, taskResume, "taskResume"); - - function taskIsSuspended (tid : t_id) return int; - pragma Import (C, taskIsSuspended, "taskIsSuspended"); - - function taskDelay (ticks : int) return int; - procedure taskDelay (ticks : int); - pragma Import (C, taskDelay, "taskDelay"); - - function sysClkRateGet return int; - pragma Import (C, sysClkRateGet, "sysClkRateGet"); - - -- VxWorks 5.x specific functions - - function taskVarAdd - (tid : t_id; pVar : access System.Address) return int; - pragma Import (C, taskVarAdd, "taskVarAdd"); - - function taskVarDelete - (tid : t_id; pVar : access System.Address) return int; - pragma Import (C, taskVarDelete, "taskVarDelete"); - - function taskVarSet - (tid : t_id; - pVar : access System.Address; - value : System.Address) return int; - pragma Import (C, taskVarSet, "taskVarSet"); - - function taskVarGet - (tid : t_id; - pVar : access System.Address) return int; - pragma Import (C, taskVarGet, "taskVarGet"); - - -- VxWorks 6.x specific functions - - function tlsKeyCreate return int; - pragma Import (C, tlsKeyCreate, "tlsKeyCreate"); - - function tlsValueGet (key : int) return System.Address; - pragma Import (C, tlsValueGet, "tlsValueGet"); - - function tlsValueSet (key : int; value : System.Address) return STATUS; - pragma Import (C, tlsValueSet, "tlsValueSet"); - - -- Option flags for taskSpawn - - VX_UNBREAKABLE : constant := 16#0002#; - VX_FP_PRIVATE_ENV : constant := 16#0080#; - VX_NO_STACK_FILL : constant := 16#0100#; - - function taskSpawn - (name : System.Address; -- Pointer to task name - priority : int; - options : int; - stacksize : size_t; - start_routine : System.Address; - arg1 : System.Address; - arg2 : int := 0; - arg3 : int := 0; - arg4 : int := 0; - arg5 : int := 0; - arg6 : int := 0; - arg7 : int := 0; - arg8 : int := 0; - arg9 : int := 0; - arg10 : int := 0) return t_id; - pragma Import (C, taskSpawn, "taskSpawn"); - - procedure taskDelete (tid : t_id); - pragma Import (C, taskDelete, "taskDelete"); - - function Set_Time_Slice (ticks : int) return int; - pragma Inline (Set_Time_Slice); - -- Calls kernelTimeSlice under VxWorks 5.x - -- Do nothing under VxWorks 6.x - - function taskPriorityGet (tid : t_id; pPriority : access int) return int; - pragma Import (C, taskPriorityGet, "taskPriorityGet"); - - function taskPrioritySet (tid : t_id; newPriority : int) return int; - pragma Import (C, taskPrioritySet, "taskPrioritySet"); - - -- Semaphore creation flags - - SEM_Q_FIFO : constant := 0; - SEM_Q_PRIORITY : constant := 1; - SEM_DELETE_SAFE : constant := 4; -- only valid for binary semaphore - SEM_INVERSION_SAFE : constant := 8; -- only valid for binary semaphore - - -- Semaphore initial state flags - - SEM_EMPTY : constant := 0; - SEM_FULL : constant := 1; - - -- Semaphore take (semTake) time constants - - WAIT_FOREVER : constant := -1; - NO_WAIT : constant := 0; - - -- Error codes (errno). The lower level 16 bits are the error code, with - -- the upper 16 bits representing the module number in which the error - -- occurred. By convention, the module number is 0 for UNIX errors. VxWorks - -- reserves module numbers 1-500, with the remaining module numbers being - -- available for user applications. - - M_objLib : constant := 61 * 2**16; - -- semTake() failure with ticks = NO_WAIT - S_objLib_OBJ_UNAVAILABLE : constant := M_objLib + 2; - -- semTake() timeout with ticks > NO_WAIT - S_objLib_OBJ_TIMEOUT : constant := M_objLib + 4; - - type SEM_ID is new System.Address; - -- typedef struct semaphore *SEM_ID; - - -- We use two different kinds of VxWorks semaphores: mutex and binary - -- semaphores. A null ID is returned when a semaphore cannot be created. - - function semBCreate (options : int; initial_state : int) return SEM_ID; - pragma Import (C, semBCreate, "semBCreate"); - -- Create a binary semaphore. Return ID, or 0 if memory could not - -- be allocated. - - function semMCreate (options : int) return SEM_ID; - pragma Import (C, semMCreate, "semMCreate"); - - function semDelete (Sem : SEM_ID) return int; - pragma Import (C, semDelete, "semDelete"); - -- Delete a semaphore - - function semGive (Sem : SEM_ID) return int; - pragma Import (C, semGive, "semGive"); - - function semTake (Sem : SEM_ID; timeout : int) return int; - pragma Import (C, semTake, "semTake"); - -- Attempt to take binary semaphore. Error is returned if operation - -- times out - - function semFlush (SemID : SEM_ID) return STATUS; - pragma Import (C, semFlush, "semFlush"); - -- Release all threads blocked on the semaphore - -private - type sigset_t is new unsigned_long_long; - - type pid_t is new int; - - ERROR_PID : constant pid_t := -1; - - type clockid_t is new int; - CLOCK_REALTIME : constant clockid_t := 0; - -end System.OS_Interface; diff --git a/gcc/ada/s-osprim-mingw.adb b/gcc/ada/s-osprim-mingw.adb index ff1c9a31baa..d9712858c39 100644 --- a/gcc/ada/s-osprim-mingw.adb +++ b/gcc/ada/s-osprim-mingw.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 1998-2007, Free Software Foundation, Inc. -- +-- Copyright (C) 1998-2008, Free Software Foundation, Inc. -- -- -- -- GNARL is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -33,40 +33,12 @@ -- This is the NT version of this package -with Interfaces.C; +with System.Win32.Ext; package body System.OS_Primitives is - --------------------------- - -- Win32 API Definitions -- - --------------------------- - - -- These definitions are copied from System.OS_Interface because we do not - -- want to depend on gnarl here. - - type DWORD is new Interfaces.C.unsigned_long; - - type LARGE_INTEGER is delta 1.0 range -2.0**63 .. 2.0**63 - 1.0; - - type BOOL is new Boolean; - for BOOL'Size use Interfaces.C.unsigned_long'Size; - - procedure GetSystemTimeAsFileTime - (lpFileTime : not null access Long_Long_Integer); - pragma Import (Stdcall, GetSystemTimeAsFileTime, "GetSystemTimeAsFileTime"); - - function QueryPerformanceCounter - (lpPerformanceCount : not null access LARGE_INTEGER) return BOOL; - pragma Import - (Stdcall, QueryPerformanceCounter, "QueryPerformanceCounter"); - - function QueryPerformanceFrequency - (lpFrequency : not null access LARGE_INTEGER) return BOOL; - pragma Import - (Stdcall, QueryPerformanceFrequency, "QueryPerformanceFrequency"); - - procedure Sleep (dwMilliseconds : DWORD); - pragma Import (Stdcall, Sleep, External_Name => "Sleep"); + use System.Win32; + use System.Win32.Ext; ---------------------------------------- -- Data for the high resolution clock -- @@ -144,7 +116,7 @@ package body System.OS_Primitives is Now : aliased Long_Long_Integer; begin - if not QueryPerformanceCounter (Current_Ticks'Access) then + if QueryPerformanceCounter (Current_Ticks'Access) = Win32.FALSE then return 0.0; end if; @@ -158,10 +130,10 @@ package body System.OS_Primitives is Duration (Long_Long_Float (Current_Ticks - BTA.all) / Long_Long_Float (TFA.all)); - -- If we have a shift of more than Max_Shift seconds we resynchonize the - -- Clock. This is probably due to a manual Clock adjustment, an DST - -- adjustment or an NTP synchronisation. And we want to adjust the time - -- for this system (non-monotonic) clock. + -- If we have a shift of more than Max_Shift seconds we resynchronize + -- the Clock. This is probably due to a manual Clock adjustment, an + -- DST adjustment or an NTP synchronisation. And we want to adjust the + -- time for this system (non-monotonic) clock. if abs (Elap_Secs_Sys - Elap_Secs_Tick) > Max_Shift then Get_Base_Time; @@ -202,7 +174,7 @@ package body System.OS_Primitives is loop GetSystemTimeAsFileTime (Base_Time'Access); - if not QueryPerformanceCounter (Base_Ticks'Access) then + if QueryPerformanceCounter (Base_Ticks'Access) = Win32.FALSE then pragma Assert (Standard.False, "Could not query high performance counter in Clock"); @@ -228,7 +200,7 @@ package body System.OS_Primitives is Elap_Secs_Tick : Duration; begin - if not QueryPerformanceCounter (Current_Ticks'Access) then + if QueryPerformanceCounter (Current_Ticks'Access) = Win32.FALSE then return 0.0; end if; @@ -313,9 +285,9 @@ package body System.OS_Primitives is -- Get starting time as base - if not QueryPerformanceFrequency (Tick_Frequency'Access) then - raise Program_Error - with "cannot get high performance counter frequency"; + if QueryPerformanceFrequency (Tick_Frequency'Access) = Win32.FALSE then + raise Program_Error with + "cannot get high performance counter frequency"; end if; Get_Base_Time; diff --git a/gcc/ada/s-osprim-vms.adb b/gcc/ada/s-osprim-vms.adb index 9bd8e61bff2..93138414571 100644 --- a/gcc/ada/s-osprim-vms.adb +++ b/gcc/ada/s-osprim-vms.adb @@ -71,7 +71,7 @@ package body System.OS_Primitives is -- pidadr = address of process id to be woken up -- prcnam = name of process to be woken up -- daytim = time to wake up - -- reptim = repitition interval of wakeup calls + -- reptim = repetition interval of wakeup calls -- procedure Sys_Schdwk diff --git a/gcc/ada/s-parame-ae653.ads b/gcc/ada/s-parame-ae653.ads index a2a5c0647e1..5d4fd4caed8 100644 --- a/gcc/ada/s-parame-ae653.ads +++ b/gcc/ada/s-parame-ae653.ads @@ -125,7 +125,7 @@ package System.Parameters is -- The system releases all storage on program termination only, -- but not other garbage collection occurs, so finalization calls - -- are ommitted only for outer level onjects can be omitted if + -- are omitted only for outer level objects can be omitted if -- pragma Finalize_Storage_Only is used. -- Garbage_Collected = True diff --git a/gcc/ada/s-parame-hpux.ads b/gcc/ada/s-parame-hpux.ads index 86bc0282e51..865ed763f44 100644 --- a/gcc/ada/s-parame-hpux.ads +++ b/gcc/ada/s-parame-hpux.ads @@ -123,7 +123,7 @@ package System.Parameters is -- The system releases all storage on program termination only, -- but not other garbage collection occurs, so finalization calls - -- are ommitted only for outer level onjects can be omitted if + -- are omitted only for outer level objects can be omitted if -- pragma Finalize_Storage_Only is used. -- Garbage_Collected = True diff --git a/gcc/ada/s-parame-vms-alpha.ads b/gcc/ada/s-parame-vms-alpha.ads index 6df2a47aa12..b9119bc00d7 100644 --- a/gcc/ada/s-parame-vms-alpha.ads +++ b/gcc/ada/s-parame-vms-alpha.ads @@ -123,7 +123,7 @@ package System.Parameters is -- The system releases all storage on program termination only, -- but not other garbage collection occurs, so finalization calls - -- are ommitted only for outer level onjects can be omitted if + -- are omitted only for outer level objects can be omitted if -- pragma Finalize_Storage_Only is used. -- Garbage_Collected = True diff --git a/gcc/ada/s-parame-vms-ia64.ads b/gcc/ada/s-parame-vms-ia64.ads index 10332527a68..4273df9dd95 100644 --- a/gcc/ada/s-parame-vms-ia64.ads +++ b/gcc/ada/s-parame-vms-ia64.ads @@ -123,7 +123,7 @@ package System.Parameters is -- The system releases all storage on program termination only, -- but not other garbage collection occurs, so finalization calls - -- are ommitted only for outer level onjects can be omitted if + -- are omitted only for outer level objects can be omitted if -- pragma Finalize_Storage_Only is used. -- Garbage_Collected = True diff --git a/gcc/ada/s-parame-vms-restrict.ads b/gcc/ada/s-parame-vms-restrict.ads index 6cd04775023..a0404edaac2 100644 --- a/gcc/ada/s-parame-vms-restrict.ads +++ b/gcc/ada/s-parame-vms-restrict.ads @@ -123,7 +123,7 @@ package System.Parameters is -- The system releases all storage on program termination only, -- but not other garbage collection occurs, so finalization calls - -- are ommitted only for outer level onjects can be omitted if + -- are omitted only for outer level objects can be omitted if -- pragma Finalize_Storage_Only is used. -- Garbage_Collected = True diff --git a/gcc/ada/s-parame-vxworks.ads b/gcc/ada/s-parame-vxworks.ads index 4f7cc2c7fcb..bc0ee16ca60 100644 --- a/gcc/ada/s-parame-vxworks.ads +++ b/gcc/ada/s-parame-vxworks.ads @@ -125,7 +125,7 @@ package System.Parameters is -- The system releases all storage on program termination only, -- but not other garbage collection occurs, so finalization calls - -- are ommitted only for outer level onjects can be omitted if + -- are omitted only for outer level objects can be omitted if -- pragma Finalize_Storage_Only is used. -- Garbage_Collected = True diff --git a/gcc/ada/s-parame.adb b/gcc/ada/s-parame.adb index 67b0d4fb03d..2b9a5fe821f 100644 --- a/gcc/ada/s-parame.adb +++ b/gcc/ada/s-parame.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 1995-2005, Free Software Foundation, Inc. -- +-- Copyright (C) 1995-2008, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -73,8 +73,10 @@ package body System.Parameters is begin -- 12K is required for stack-checking to work reliably on most platforms -- when using the GCC scheme to propagate an exception in the ZCX case. + -- 16K is the value of PTHREAD_STACK_MIN under Linux, so is a reasonable + -- default. - return 12 * 1024; + return 16 * 1024; end Minimum_Stack_Size; end System.Parameters; diff --git a/gcc/ada/s-parame.ads b/gcc/ada/s-parame.ads index 20c95bea0c4..a94b22296bc 100644 --- a/gcc/ada/s-parame.ads +++ b/gcc/ada/s-parame.ads @@ -123,7 +123,7 @@ package System.Parameters is -- The system releases all storage on program termination only, -- but not other garbage collection occurs, so finalization calls - -- are ommitted only for outer level onjects can be omitted if + -- are omitted only for outer level objects can be omitted if -- pragma Finalize_Storage_Only is used. -- Garbage_Collected = True diff --git a/gcc/ada/s-parint.adb b/gcc/ada/s-parint.adb index 622c2d01062..94b08326c25 100644 --- a/gcc/ada/s-parint.adb +++ b/gcc/ada/s-parint.adb @@ -34,7 +34,7 @@ package body System.Partition_Interface is - pragma Warnings (Off); -- supress warnings for unreferenced formals + pragma Warnings (Off); -- suppress warnings for unreferenced formals M : constant := 7; diff --git a/gcc/ada/s-parint.ads b/gcc/ada/s-parint.ads index 39b96c97dea..9191c0731b6 100644 --- a/gcc/ada/s-parint.ads +++ b/gcc/ada/s-parint.ads @@ -94,7 +94,7 @@ package System.Partition_Interface is pragma No_Strict_Aliasing (RAS_Proxy_Type_Access); -- This type is used by the expansion to implement distributed objects. -- Do not change its definition or its layout without updating - -- Exp_Dist.Build_Remote_Supbrogram_Proxy_Type. + -- Exp_Dist.Build_Remote_Subprogram_Proxy_Type. -- The Request_Access type is used for communication between the PCS -- and the RPC receiver generated by the compiler: it contains all the diff --git a/gcc/ada/s-poosiz.adb b/gcc/ada/s-poosiz.adb index a86f1d113fc..5d7318da3eb 100644 --- a/gcc/ada/s-poosiz.adb +++ b/gcc/ada/s-poosiz.adb @@ -59,7 +59,7 @@ package body System.Pool_Size is -- Embedded pool that manages allocation of variable-size data - -- This pool is used as soon as the Elmt_sizS of the pool object is 0 + -- This pool is used as soon as the Elmt_Size of the pool object is 0 -- Allocation is done on the first chunk long enough for the request. -- Deallocation just puts the freed chunk at the beginning of the list. @@ -261,7 +261,7 @@ package body System.Pool_Size is raise Storage_Error; end if; - -- When the chunk is bigger than what is needed, take appropraite + -- When the chunk is bigger than what is needed, take appropriate -- amount and build a new shrinked chunk with the remainder. if Size (Pool, Chunk) - Align_Size > Minimum_Size then diff --git a/gcc/ada/s-proinf-irix-athread.ads b/gcc/ada/s-proinf-irix-athread.ads index 83fff261117..aa266ac924d 100644 --- a/gcc/ada/s-proinf-irix-athread.ads +++ b/gcc/ada/s-proinf-irix-athread.ads @@ -56,7 +56,7 @@ package System.Program_Info is function Default_Task_Stack return Integer; -- The default stack size for each created thread. This default value can - -- be overriden on a per-task basis by the language-defined Storage_Size + -- be overridden on a per-task basis by the language-defined Storage_Size -- pragma. function Stack_Guard_Pages return Integer; diff --git a/gcc/ada/s-proinf.ads b/gcc/ada/s-proinf.ads index 2a4e78e9766..f5133d66ad1 100644 --- a/gcc/ada/s-proinf.ads +++ b/gcc/ada/s-proinf.ads @@ -39,7 +39,7 @@ package System.Program_Info is function Default_Task_Stack return Integer; -- The default stack size for each created thread. This default value - -- can be overriden on a per-task basis by the language-defined + -- can be overridden on a per-task basis by the language-defined -- Storage_Size pragma. end System.Program_Info; diff --git a/gcc/ada/s-regexp.adb b/gcc/ada/s-regexp.adb index c548199b49f..2dae7b29103 100755 --- a/gcc/ada/s-regexp.adb +++ b/gcc/ada/s-regexp.adb @@ -140,7 +140,7 @@ package body System.Regexp is Num_States : out State_Index; Start_State : out State_Index; End_State : out State_Index); - -- Creates the first version of the regexp (this is a non determinist + -- Creates the first version of the regexp (this is a non deterministic -- finite state machine, which is unadapted for a fast pattern -- matching algorithm). We use a recursive algorithm to process the -- parenthesis sub-expressions. @@ -1137,7 +1137,7 @@ package body System.Regexp is end loop; end Closure; - -- Start of procesing for Create_Secondary_Table + -- Start of processing for Create_Secondary_Table begin -- Create a new state diff --git a/gcc/ada/s-regpat.adb b/gcc/ada/s-regpat.adb index 4204f0cfa06..68d915f8ad0 100755 --- a/gcc/ada/s-regpat.adb +++ b/gcc/ada/s-regpat.adb @@ -7,7 +7,7 @@ -- B o d y -- -- -- -- Copyright (C) 1986 by University of Toronto. -- --- Copyright (C) 1999-2007, AdaCore -- +-- Copyright (C) 1999-2008, AdaCore -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -136,10 +136,10 @@ package body System.Regpat is -- Matches after or before a word BOL, -- no Match "" at beginning of line - MBOL, -- no Same, assuming mutiline (match after \n) + MBOL, -- no Same, assuming multiline (match after \n) SBOL, -- no Same, assuming single line (don't match at \n) EOL, -- no Match "" at end of line - MEOL, -- no Same, assuming mutiline (match before \n) + MEOL, -- no Same, assuming multiline (match before \n) SEOL, -- no Same, assuming single line (don't match at \n) BOUND, -- no Match "" at any word boundary @@ -386,7 +386,7 @@ package body System.Regpat is function Emit_Node (Op : Opcode) return Pointer; -- If code-generation is enabled, Emit_Node outputs the -- opcode Op and reserves space for a pointer to the next node. - -- Return value is the location of new opcode, ie old Emit_Ptr. + -- Return value is the location of new opcode, i.e. old Emit_Ptr. procedure Emit_Natural (IP : Pointer; N : Natural); -- Split N on two characters at position IP @@ -449,7 +449,7 @@ package body System.Regpat is -- Link_Tail sets the next-pointer at the end of a node chain procedure Link_Operand_Tail (P, Val : Pointer); - -- Link_Tail on operand of first argument; nop if operandless + -- Link_Tail on operand of first argument; noop if operand-less function Next_Instruction (P : Pointer) return Pointer; -- Dig the "next" pointer out of a node @@ -460,7 +460,7 @@ package body System.Regpat is function Is_Curly_Operator (IP : Natural) return Boolean; -- Return True if IP is looking at a '{' that is the beginning - -- of a curly operator, ie it matches {\d+,?\d*} + -- of a curly operator, i.e. it matches {\d+,?\d*} function Is_Mult (IP : Natural) return Boolean; -- Return True if C is a regexp multiplier: '+', '*' or '?' @@ -484,8 +484,8 @@ package body System.Regpat is -- Parse_Literal encodes a string of characters to be matched exactly function Parse_Posix_Character_Class return Std_Class; - -- Parse a posic character class, like [:alpha:] or [:^alpha:]. - -- The called is suppoed to absorbe the opening [. + -- Parse a posix character class, like [:alpha:] or [:^alpha:]. + -- The caller is supposed to absorb the opening [. pragma Inline (Is_Mult); pragma Inline (Emit_Natural); @@ -1195,7 +1195,7 @@ package body System.Regpat is In_Range : Boolean := False; Named_Class : Std_Class := ANYOF_NONE; Value : Character; - Last_Value : Character := ASCII.Nul; + Last_Value : Character := ASCII.NUL; begin Reset_Class (Bitmap); @@ -2192,7 +2192,7 @@ package body System.Regpat is when ANYOF => null; declare Bitmap : Character_Class; - Last : Character := ASCII.Nul; + Last : Character := ASCII.NUL; Current : Natural := 0; Current_Char : Character; @@ -2858,7 +2858,7 @@ package body System.Regpat is Next : Pointer; Greedy : Boolean) return Boolean is - Next_Char : Character := ASCII.Nul; + Next_Char : Character := ASCII.NUL; Next_Char_Known : Boolean := False; No : Integer; -- Can be negative Min : Natural; diff --git a/gcc/ada/s-regpat.ads b/gcc/ada/s-regpat.ads index 0425a2eb983..077518dd903 100755 --- a/gcc/ada/s-regpat.ads +++ b/gcc/ada/s-regpat.ads @@ -7,7 +7,7 @@ -- S p e c -- -- -- -- Copyright (C) 1986 by University of Toronto. -- --- Copyright (C) 1996-2007, AdaCore -- +-- Copyright (C) 1996-2008, AdaCore -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -414,7 +414,7 @@ package System.Regpat is -- approach, in addition to the improved efficiency, is that the same -- Pattern_Matcher variable can be used to hold the compiled code for -- several different regular expressions by setting a size that is large - -- enough to accomodate all possibilities. + -- enough to accommodate all possibilities. -- -- In this version of the procedure call, the actual required code size is -- returned. Also if Matcher.Size is zero on entry, then the resulting code @@ -604,7 +604,7 @@ private -- compile to execute that permits the execute phase to run lots faster on -- simple cases. They are: - -- First character that must begin a match or ASCII.Nul + -- First character that must begin a match or ASCII.NUL -- Anchored true iff match must start at beginning of line -- Must_Have pointer to string that match must include or null -- Must_Have_Length length of Must_Have string @@ -621,7 +621,7 @@ private -- The initialization is meant to fail-safe in case the user of this -- package tries to use an uninitialized matcher. This takes advantage - -- of the knowledge that ASCII.Nul translates to the end-of-program (EOP) + -- of the knowledge that ASCII.NUL translates to the end-of-program (EOP) -- instruction code of the state machine. No_Flags : constant Regexp_Flags := 0; diff --git a/gcc/ada/s-rident.ads b/gcc/ada/s-rident.ads index b88e3691cba..c28ba3c5a92 100644 --- a/gcc/ada/s-rident.ads +++ b/gcc/ada/s-rident.ads @@ -6,7 +6,7 @@ -- -- -- S p e c -- -- -- --- Copyright (C) 1992-2006, Free Software Foundation, Inc. -- +-- Copyright (C) 1992-2008, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -56,7 +56,9 @@ package System.Rident is type Restriction_Id is - -- The following cases are checked for consistency in the binder + -- The following cases are checked for consistency in the binder. The + -- binder will check that every unit either has the restriction set, or + -- does not violate the restriction. (Simple_Barriers, -- GNAT (Ravenscar) No_Abort_Statements, -- (RM D.7(5), H.4(3)) @@ -111,7 +113,12 @@ package System.Rident is Static_Priorities, -- GNAT Static_Storage_Size, -- GNAT - -- The following cases do not require partition-wide checks + -- The following require consistency checking with special rules. See + -- individual routines in unit Bcheck for details of what is required. + + No_Default_Initialization, -- GNAT + + -- The following cases do not require consistency checking Immediate_Reclamation, -- (RM H.4(10)) No_Implementation_Attributes, -- Ada 2005 AI-257 @@ -123,29 +130,28 @@ package System.Rident is -- The following cases require a parameter value - -- The following entries are fully checked at compile/bind time, - -- which means that the compiler can in general tell the minimum - -- value which could be used with a restrictions pragma. The binder - -- can deduce the appropriate minimum value for the partition by - -- taking the maximum value required by any unit. + -- The following entries are fully checked at compile/bind time, which + -- means that the compiler can in general tell the minimum value which + -- could be used with a restrictions pragma. The binder can deduce the + -- appropriate minimum value for the partition by taking the maximum + -- value required by any unit. Max_Protected_Entries, -- (RM D.7(14)) Max_Select_Alternatives, -- (RM D.7(12)) Max_Task_Entries, -- (RM D.7(13), H.4(3)) - -- The following entries are also fully checked at compile/bind - -- time, and the compiler can also at least in some cases tell - -- the minimum value which could be used with a restriction pragma. - -- The difference is that the contributions are additive, so the - -- binder deduces this value by adding the unit contributions. + -- The following entries are also fully checked at compile/bind time, + -- and the compiler can also at least in some cases tell the minimum + -- value which could be used with a restriction pragma. The difference + -- is that the contributions are additive, so the binder deduces this + -- value by adding the unit contributions. Max_Tasks, -- (RM D.7(19), H.4(3)) - -- The following entries are checked at compile time only for - -- zero/nonzero entries. This means that the compiler can tell - -- at compile time if a restriction value of zero is (would be) - -- violated, but that is all. The compiler cannot distinguish - -- between different non-zero values. + -- The following entries are checked at compile time only for zero/ + -- nonzero entries. This means that the compiler can tell at compile + -- time if a restriction value of zero is (would be) violated, but that + -- the compiler cannot distinguish between different non-zero values. Max_Asynchronous_Select_Nesting, -- (RM D.7(18), H.4(3)) Max_Entry_Queue_Length, -- GNAT @@ -185,7 +191,7 @@ package System.Rident is -- Boolean restrictions that are not checked for partition consistency -- and that thus apply only to the current unit. Note that for these -- restrictions, the compiler does not apply restrictions found in - -- with'ed units, parent specs etc to the main unit. + -- with'ed units, parent specs etc. to the main unit. subtype All_Parameter_Restrictions is Restriction_Id range @@ -237,9 +243,9 @@ package System.Rident is -- Restriction Status Declarations -- ------------------------------------- - -- The following declarations are used to record the current status - -- or restrictions (for the current unit, or related units, at compile - -- time, and for all units in a partition at bind time or run time). + -- The following declarations are used to record the current status or + -- restrictions (for the current unit, or related units, at compile time, + -- and for all units in a partition at bind time or run time). type Restriction_Flags is array (All_Restrictions) of Boolean; type Restriction_Values is array (All_Parameter_Restrictions) of Natural; @@ -247,11 +253,10 @@ package System.Rident is type Restrictions_Info is record Set : Restriction_Flags; - -- An entry is True in the Set array if a restrictions pragma has - -- been encountered for the given restriction. If the value is - -- True for a parameter restriction, then the corresponding entry - -- in the Value array gives the minimum value encountered for any - -- such restriction. + -- An entry is True in the Set array if a restrictions pragma has been + -- encountered for the given restriction. If the value is True for a + -- parameter restriction, then the corresponding entry in the Value + -- array gives the minimum value encountered for any such restriction. Value : Restriction_Values; -- If the entry for a parameter restriction in Set is True (i.e. a @@ -261,23 +266,23 @@ package System.Rident is -- pragma specifying a value greater than Int'Last is simply ignored. Violated : Restriction_Flags; - -- An entry is True in the violations array if the compiler has - -- detected a violation of the restriction. For a parameter - -- restriction, the Count and Unknown arrays have additional - -- information. + -- An entry is True in the violations array if the compiler has detected + -- a violation of the restriction. For a parameter restriction, the + -- Count and Unknown arrays have additional information. Count : Restriction_Values; - -- If an entry for a parameter restriction is True in Violated, - -- the corresponding entry in the Count array may record additional + -- If an entry for a parameter restriction is True in Violated, the + -- corresponding entry in the Count array may record additional -- information. If the actual minimum count is known (by taking -- maximums, or sums, depending on the restriction), it will be -- recorded in this array. If not, then the value will remain zero. + -- The value is also zero for a non-violated restriction. Unknown : Parameter_Flags; - -- If an entry for a parameter restriction is True in Violated, - -- the corresponding entry in the Unknown array may record additional + -- If an entry for a parameter restriction is True in Violated, the + -- corresponding entry in the Unknown array may record additional -- information. If the actual count is not known by the compiler (but - -- is known to be non-zero), then the entry in Unknown will be True. + -- is nown to be non-zero), then the entry in Unknown will be True. -- This indicates that the value in Count is not known to be exact, -- and the actual violation count may be higher. @@ -300,7 +305,7 @@ package System.Rident is ---------------------------------- type Profile_Name is (Ravenscar, Restricted); - -- Names of recognized pfofiles + -- Names of recognized profiles type Profile_Data is record Set : Restriction_Flags; diff --git a/gcc/ada/s-secsta.adb b/gcc/ada/s-secsta.adb index 6fafa8cfdab..2b53f5959a4 100644 --- a/gcc/ada/s-secsta.adb +++ b/gcc/ada/s-secsta.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 1992-2007, Free Software Foundation, Inc. -- +-- Copyright (C) 1992-2008, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -135,7 +135,7 @@ package body System.Secondary_Stack is -- For the static case, the secondary stack is a single contiguous -- chunk of storage, carved out of the primary stack, and represented - -- by the following data strcuture + -- by the following data structure type Fixed_Stack_Id is record Top : SS_Ptr; @@ -237,7 +237,7 @@ package body System.Secondary_Stack is end loop; -- Find out if the available memory in the current chunk is - -- sufficient, if not, go to the next one and eventally create + -- sufficient, if not, go to the next one and eventually create -- the necessary room. while Chunk.Last - Stack.Top + 1 < Max_Size loop diff --git a/gcc/ada/s-sequio.ads b/gcc/ada/s-sequio.ads index d263ec33f45..1c8d217befa 100644 --- a/gcc/ada/s-sequio.ads +++ b/gcc/ada/s-sequio.ads @@ -6,7 +6,7 @@ -- -- -- S p e c -- -- -- --- Copyright (C) 1992-2006, Free Software Foundation, Inc. -- +-- Copyright (C) 1992-2008, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -32,7 +32,7 @@ ------------------------------------------------------------------------------ -- This package contains the declaration of the control block used for --- Seqential_IO. This must be declared at the outer library level. It also +-- Sequential_IO. This must be declared at the outer library level. It also -- contains code that is shared between instances of Sequential_IO. with System.File_Control_Block; diff --git a/gcc/ada/s-shasto.ads b/gcc/ada/s-shasto.ads index 77cfa7b6421..fc4055b9826 100644 --- a/gcc/ada/s-shasto.ads +++ b/gcc/ada/s-shasto.ads @@ -6,7 +6,7 @@ -- -- -- S p e c -- -- -- --- Copyright (C) 1998-2006, Free Software Foundation, Inc. -- +-- Copyright (C) 1998-2008, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -31,7 +31,7 @@ -- -- ------------------------------------------------------------------------------ --- This package manages the shared/persistant storage required for +-- This package manages the shared/persistent storage required for -- full implementation of variables in Shared_Passive packages, more -- precisely variables whose enclosing dynamic scope is a shared -- passive package. This implementation is specific to GNAT and GLADE @@ -134,7 +134,7 @@ -- the same stream is used simultaneously, both operations can -- terminate abruptly by raising exception Mode_Error because the -- stream has been opened in read mode and then in write mode and at --- least used by the read opartion. To avoid this unexpected +-- least used by the read operation. To avoid this unexpected -- behaviour, we introduce a synchronization at the partition level. -- Note: a special circuit allows the use of stream attributes Read and @@ -214,7 +214,7 @@ package System.Shared_Storage is -- the lock is busy. procedure Shared_Var_Unlock (Var : String); - -- This procedure releases the shared storage lock obtaind by a + -- This procedure releases the shared storage lock obtained by a -- prior call to the Shared_Mem_Lock procedure, and is to be -- generated as the last operation in the body of a protected -- subprogram. diff --git a/gcc/ada/s-soflin.ads b/gcc/ada/s-soflin.ads index 19f851c4bf0..324308900ed 100644 --- a/gcc/ada/s-soflin.ads +++ b/gcc/ada/s-soflin.ads @@ -6,7 +6,7 @@ -- -- -- S p e c -- -- -- --- Copyright (C) 1992-2007, Free Software Foundation, Inc. -- +-- Copyright (C) 1992-2008, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -107,7 +107,7 @@ package System.Soft_Links is function return String; pragma Favor_Top_Level (Task_Name_Call); - -- Suppress checks on all these types, since we know the corrresponding + -- Suppress checks on all these types, since we know the corresponding -- values can never be null (the soft links are always initialized). pragma Suppress (Access_Check, No_Param_Proc); @@ -381,4 +381,25 @@ package System.Soft_Links is function Get_Exc_Stack_Addr_Soft return Address; + -- The following is a dummy record designed to mimic Communication_Block as + -- defined in s-tpobop.ads: + + -- type Communication_Block is record + -- Self : Task_Id; -- An access type + -- Enqueued : Boolean := True; + -- Cancelled : Boolean := False; + -- end record; + + -- The record is used in the construction of the predefined dispatching + -- primitive _disp_asynchronous_select in order to avoid the import of + -- System.Tasking.Protected_Objects.Operations. Note that this package + -- is always imported in the presence of interfaces since the dispatch + -- table uses entities from here. + + type Dummy_Communication_Block is record + Comp_1 : Address; -- Address and access have the same size + Comp_2 : Boolean; + Comp_3 : Boolean; + end record; + end System.Soft_Links; diff --git a/gcc/ada/s-stalib.adb b/gcc/ada/s-stalib.adb index 1036f3ff2fa..e9df807d389 100644 --- a/gcc/ada/s-stalib.adb +++ b/gcc/ada/s-stalib.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 1995-2007, Free Software Foundation, Inc. -- +-- Copyright (C) 1995-2008, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -51,7 +51,7 @@ with System.Soft_Links; -- Referenced directly from generated code using external symbols so it -- must always be present in a build, even if no unit has a direct with -- of this unit. Also referenced from exception handling routines. --- This is needed for programs that don't use exceptions explicitely but +-- This is needed for programs that don't use exceptions explicitly but -- direct calls to Ada.Exceptions are generated by gigi (for example, -- by calling __gnat_raise_constraint_error directly). diff --git a/gcc/ada/s-stalib.ads b/gcc/ada/s-stalib.ads index 15a7864013f..9b340ddc2b2 100644 --- a/gcc/ada/s-stalib.ads +++ b/gcc/ada/s-stalib.ads @@ -6,7 +6,7 @@ -- -- -- S p e c -- -- -- --- Copyright (C) 1992-2007, Free Software Foundation, Inc. -- +-- Copyright (C) 1992-2008, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -63,6 +63,7 @@ package System.Standard_Library is pragma Warnings (On); type Big_String_Ptr is access all String (Positive); + for Big_String_Ptr'Storage_Size use 0; -- A non-fat pointer type for null terminated strings function To_Ptr is @@ -115,7 +116,7 @@ package System.Standard_Library is -- The following record defines the underlying representation of exceptions - -- WARNING! Any changes to this may need to be reflectd in the following + -- WARNING! Any changes to this may need to be reflected in the following -- locations in the compiler and runtime code: -- 1. The Internal_Exception routine in s-exctab.adb @@ -164,7 +165,7 @@ package System.Standard_Library is -- Definitions for standard predefined exceptions defined in Standard, - -- Why are the Nul's necessary here, seems like they should not be + -- Why are the NULs necessary here, seems like they should not be -- required, since Gigi is supposed to add a Nul to each name ??? Constraint_Error_Name : constant String := "CONSTRAINT_ERROR" & ASCII.NUL; diff --git a/gcc/ada/s-stausa.adb b/gcc/ada/s-stausa.adb index 42fe418d7c5..6eb8a0ca6ef 100644 --- a/gcc/ada/s-stausa.adb +++ b/gcc/ada/s-stausa.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 2004-2007, Free Software Foundation, Inc. -- +-- Copyright (C) 2004-2008, Free Software Foundation, Inc. -- -- -- -- GNARL is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -219,7 +219,7 @@ package body System.Stack_Usage is -- If variable GNAT_STACK_LIMIT is set, then we will take care of the -- environment task, using GNAT_STASK_LIMIT as the size of the stack. - -- It doens't make sens to process the stack when no bound is set (e.g. + -- It doesn't make sens to process the stack when no bound is set (e.g. -- limit is typically up to 4 GB). if Stack_Size_Chars /= Null_Address then diff --git a/gcc/ada/s-stausa.ads b/gcc/ada/s-stausa.ads index 4da9c00aef8..b309c3735e8 100644 --- a/gcc/ada/s-stausa.ads +++ b/gcc/ada/s-stausa.ads @@ -6,7 +6,7 @@ -- -- -- S p e c -- -- -- --- Copyright (C) 2004-2007, Free Software Foundation, Inc. -- +-- Copyright (C) 2004-2008, Free Software Foundation, Inc. -- -- -- -- GNARL is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -127,7 +127,7 @@ package System.Stack_Usage is -- this point, it will increase the measured stack size. -- Strategy: We could augment this stack frame and see if it changes the - -- measure. However, this error should be negligeable. + -- measure. However, this error should be negligible. -- Pattern zone overflow: @@ -225,7 +225,7 @@ package System.Stack_Usage is -- When this flag is true, then stack analysis is enabled procedure Compute_Result (Analyzer : in out Stack_Analyzer); - -- Read the patern zone and deduce the stack usage. It should be called + -- Read the pattern zone and deduce the stack usage. It should be called -- from the same frame as Fill_Stack. If Analyzer.Probe is not null, an -- array of Unsigned_32 with Analyzer.Probe elements is allocated on -- Compute_Result's stack frame. Probe can be used to detect the error: @@ -249,7 +249,7 @@ package System.Stack_Usage is procedure Report_Result (Analyzer : Stack_Analyzer); -- Store the results of the computation in memory, at the address -- corresponding to the symbol __gnat_stack_usage_results. This is not - -- done inside Compute_Resuls in order to use as less stack as possible + -- done inside Compute_Result in order to use as less stack as possible -- within a task. procedure Output_Results; @@ -281,7 +281,7 @@ private -- Pattern used to recognize untouched memory Bottom_Pattern_Mark : Stack_Address; - -- Bound of the pattern area on the stack clostest to the bottom + -- Bound of the pattern area on the stack closest to the bottom Top_Pattern_Mark : Stack_Address; -- Topmost bound of the pattern area on the stack @@ -334,7 +334,7 @@ private (SP_Low : Stack_Address; SP_High : Stack_Address) return Natural; pragma Inline (Stack_Size); - -- Return the size of a portion of stack delimeted by SP_High and SP_Low + -- Return the size of a portion of stack delimited by SP_High and SP_Low -- (), i.e. the difference between SP_High and SP_Low. The storage element -- pointed by SP_Low is not included in the size. Inlined to reduce the -- size of the stack used by the instrumentation code. diff --git a/gcc/ada/s-stoele.ads b/gcc/ada/s-stoele.ads index ef75211430c..45871a5f3b4 100644 --- a/gcc/ada/s-stoele.ads +++ b/gcc/ada/s-stoele.ads @@ -6,7 +6,7 @@ -- -- -- S p e c -- -- -- --- Copyright (C) 2002-2007, Free Software Foundation, Inc. -- +-- Copyright (C) 2002-2008, Free Software Foundation, Inc. -- -- -- -- This specification is derived from the Ada Reference Manual for use with -- -- GNAT. The copyright notice above, and the license provisions that follow -- @@ -122,25 +122,4 @@ package System.Storage_Elements is pragma Inline_Always (To_Integer); pragma Pure_Function (To_Integer); - -- The following is a dummy record designed to mimic Communication_Block as - -- defined in s-tpobop.ads: - - -- type Communication_Block is record - -- Self : Task_Id; -- An access type - -- Enqueued : Boolean := True; - -- Cancelled : Boolean := False; - -- end record; - - -- The record is used in the construction of the predefined dispatching - -- primitive _disp_asynchronous_select in order to avoid the import of - -- System.Tasking.Protected_Objects.Operations. Note that this package - -- is always imported in the presence of interfaces since the dispatch - -- table uses entities from here. - - type Dummy_Communication_Block is record - Comp_1 : Address; -- Address and access have the same size - Comp_2 : Boolean; - Comp_3 : Boolean; - end record; - end System.Storage_Elements; diff --git a/gcc/ada/s-stratt.adb b/gcc/ada/s-stratt.adb index ebfd22cf3e0..757fad6e173 100644 --- a/gcc/ada/s-stratt.adb +++ b/gcc/ada/s-stratt.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 1992-2007, Free Software Foundation, Inc. -- +-- Copyright (C) 1992-2008, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -74,6 +74,7 @@ package body System.Stream_Attributes is subtype S_SU is SEA (1 .. (UST.Short_Unsigned'Size + SU - 1) / SU); subtype S_U is SEA (1 .. (UST.Unsigned'Size + SU - 1) / SU); subtype S_WC is SEA (1 .. (Wide_Character'Size + SU - 1) / SU); + subtype S_WWC is SEA (1 .. (Wide_Wide_Character'Size + SU - 1) / SU); -- Unchecked conversions from the elementary type to the stream type @@ -94,6 +95,7 @@ package body System.Stream_Attributes is function From_SU is new UC (UST.Short_Unsigned, S_SU); function From_U is new UC (UST.Unsigned, S_U); function From_WC is new UC (Wide_Character, S_WC); + function From_WWC is new UC (Wide_Wide_Character, S_WWC); -- Unchecked conversions from the stream type to elementary type @@ -114,6 +116,16 @@ package body System.Stream_Attributes is function To_SU is new UC (S_SU, UST.Short_Unsigned); function To_U is new UC (S_U, UST.Unsigned); function To_WC is new UC (S_WC, Wide_Character); + function To_WWC is new UC (S_WWC, Wide_Wide_Character); + + ----------------- + -- Block_IO_OK -- + ----------------- + + function Block_IO_OK return Boolean is + begin + return True; + end Block_IO_OK; ---------- -- I_AD -- @@ -461,6 +473,24 @@ package body System.Stream_Attributes is end if; end I_WC; + ----------- + -- I_WWC -- + ----------- + + function I_WWC (Stream : not null access RST) return Wide_Wide_Character is + T : S_WWC; + L : SEO; + + begin + Ada.Streams.Read (Stream.all, T, L); + + if L < T'Last then + raise Err; + else + return To_WWC (T); + end if; + end I_WWC; + ---------- -- W_AD -- ---------- @@ -665,4 +695,16 @@ package body System.Stream_Attributes is Ada.Streams.Write (Stream.all, T); end W_WC; + ----------- + -- W_WWC -- + ----------- + + procedure W_WWC + (Stream : not null access RST; Item : Wide_Wide_Character) + is + T : constant S_WWC := From_WWC (Item); + begin + Ada.Streams.Write (Stream.all, T); + end W_WWC; + end System.Stream_Attributes; diff --git a/gcc/ada/s-stratt.ads b/gcc/ada/s-stratt.ads index e1b5960d84e..7cb837fc96d 100644 --- a/gcc/ada/s-stratt.ads +++ b/gcc/ada/s-stratt.ads @@ -6,7 +6,7 @@ -- -- -- S p e c -- -- -- --- Copyright (C) 1992-2006, Free Software Foundation, Inc. -- +-- Copyright (C) 1992-2008, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -121,6 +121,7 @@ package System.Stream_Attributes is function I_SU (Stream : not null access RST) return UST.Short_Unsigned; function I_U (Stream : not null access RST) return UST.Unsigned; function I_WC (Stream : not null access RST) return Wide_Character; + function I_WWC (Stream : not null access RST) return Wide_Wide_Character; ----------------------- -- Output Procedures -- @@ -154,6 +155,14 @@ package System.Stream_Attributes is Item : UST.Short_Unsigned); procedure W_U (Stream : not null access RST; Item : UST.Unsigned); procedure W_WC (Stream : not null access RST; Item : Wide_Character); + procedure W_WWC (Stream : not null access RST; Item : Wide_Wide_Character); + + function Block_IO_OK return Boolean; + -- Package System.Stream_Attributes has several bodies - the default one + -- distributed with GNAT, s-strxdr.adb which is based on the XDR standard + -- and s-stratt.adb for Garlic. All three bodies share the same spec. The + -- role of this function is to determine whether the current version of + -- System.Stream_Attributes is able to support block IO. private pragma Inline (I_AD); @@ -175,6 +184,7 @@ private pragma Inline (I_SU); pragma Inline (I_U); pragma Inline (I_WC); + pragma Inline (I_WWC); pragma Inline (W_AD); pragma Inline (W_AS); @@ -195,5 +205,8 @@ private pragma Inline (W_SU); pragma Inline (W_U); pragma Inline (W_WC); + pragma Inline (W_WWC); + + pragma Inline (Block_IO_OK); end System.Stream_Attributes; diff --git a/gcc/ada/s-strcom.adb b/gcc/ada/s-strcom.adb index 7a1daa7a6ce..00346439998 100644 --- a/gcc/ada/s-strcom.adb +++ b/gcc/ada/s-strcom.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 2002-2007, Free Software Foundation, Inc. -- +-- Copyright (C) 2002-2008, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -44,6 +44,7 @@ package body System.String_Compare is type Big_Words is array (Natural) of Word; type Big_Words_Ptr is access Big_Words; + for Big_Words_Ptr'Storage_Size use 0; -- Array type used to access by words type Byte is mod 2 ** 8; @@ -51,6 +52,7 @@ package body System.String_Compare is type Big_Bytes is array (Natural) of Byte; type Big_Bytes_Ptr is access Big_Bytes; + for Big_Bytes_Ptr'Storage_Size use 0; -- Array type used to access by bytes function To_Big_Words is new diff --git a/gcc/ada/s-strxdr.adb b/gcc/ada/s-strxdr.adb index 053582ceee1..7732daadfb1 100644 --- a/gcc/ada/s-strxdr.adb +++ b/gcc/ada/s-strxdr.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 1996-2006, Free Software Foundation, Inc. -- +-- Copyright (C) 1996-2008, Free Software Foundation, Inc. -- -- -- -- GARLIC is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -33,7 +33,7 @@ -- This file is an alternate version of s-stratt.adb based on the XDR -- standard. It is especially useful for exchanging streams between two --- different systems with different basic type representations and endianess. +-- different systems with different basic type representations and endianness. with Ada.IO_Exceptions; with Ada.Streams; use Ada.Streams; @@ -74,8 +74,8 @@ package body System.Stream_Attributes is F_Size : Integer; -- Fraction bit size E_Last : Integer; -- Max exponent value F_Mask : SE; -- Mask to apply on first fraction byte - E_Bytes : SEO; -- N. of exponent bytes completly used - F_Bytes : SEO; -- N. of fraction bytes completly used + E_Bytes : SEO; -- N. of exponent bytes completely used + F_Bytes : SEO; -- N. of fraction bytes completely used F_Bits : Integer; -- N. of bits used on first fraction word end record; @@ -267,6 +267,12 @@ package body System.Stream_Attributes is subtype XDR_S_WC is SEA (1 .. WC_L); type XDR_WC is mod BB ** WC_L; + -- Consider Wide_Wide_Character as an enumeration type + + WWC_L : constant := 8; + subtype XDR_S_WWC is SEA (1 .. WWC_L); + type XDR_WWC is mod BB ** WWC_L; + -- Optimization: if we already have the correct Bit_Order, then some -- computations can be avoided since the source and the target will be -- identical anyway. They will be replaced by direct unchecked @@ -275,6 +281,15 @@ package body System.Stream_Attributes is Optimize_Integers : constant Boolean := Default_Bit_Order = High_Order_First; + ----------------- + -- Block_IO_OK -- + ----------------- + + function Block_IO_OK return Boolean is + begin + return False; + end Block_IO_OK; + ---------- -- I_AD -- ---------- @@ -303,6 +318,7 @@ package body System.Stream_Attributes is if L /= S'Last then raise Data_Error; + else for N in S'Range loop U := U * BB + XDR_TM (S (N)); @@ -338,8 +354,8 @@ package body System.Stream_Attributes is if L /= S'Last then raise Data_Error; - else + else -- Use Ada requirements on Character representation clause return Character'Val (S (1)); @@ -694,10 +710,11 @@ package body System.Stream_Attributes is if L /= S'Last then raise Data_Error; + elsif Optimize_Integers then return XDR_S_LLI_To_Long_Long_Integer (S); - else + else -- Compute using machine unsigned for computing -- rather than long_long_unsigned. @@ -737,10 +754,11 @@ package body System.Stream_Attributes is if L /= S'Last then raise Data_Error; + elsif Optimize_Integers then return XDR_S_LLU_To_Long_Long_Unsigned (S); - else + else -- Compute using machine unsigned -- rather than long_long_unsigned. @@ -774,10 +792,11 @@ package body System.Stream_Attributes is if L /= S'Last then raise Data_Error; + elsif Optimize_Integers then return Long_Unsigned (XDR_S_LU_To_Long_Long_Unsigned (S)); - else + else -- Compute using machine unsigned -- rather than long_unsigned. @@ -924,8 +943,10 @@ package body System.Stream_Attributes is if L /= S'Last then raise Data_Error; + elsif Optimize_Integers then return XDR_S_SSI_To_Short_Short_Integer (S); + else U := XDR_SSU (S (1)); @@ -953,9 +974,9 @@ package body System.Stream_Attributes is if L /= S'Last then raise Data_Error; + else U := XDR_SSU (S (1)); - return Short_Short_Unsigned (U); end if; end I_SSU; @@ -974,8 +995,10 @@ package body System.Stream_Attributes is if L /= S'Last then raise Data_Error; + elsif Optimize_Integers then return XDR_S_SU_To_Short_Unsigned (S); + else for N in S'Range loop U := U * BB + XDR_SU (S (N)); @@ -1026,6 +1049,7 @@ package body System.Stream_Attributes is if L /= S'Last then raise Data_Error; + else for N in S'Range loop U := U * BB + XDR_WC (S (N)); @@ -1037,6 +1061,32 @@ package body System.Stream_Attributes is end if; end I_WC; + ----------- + -- I_WWC -- + ----------- + + function I_WWC (Stream : not null access RST) return Wide_Wide_Character is + S : XDR_S_WWC; + L : SEO; + U : XDR_WWC := 0; + + begin + Ada.Streams.Read (Stream.all, S, L); + + if L /= S'Last then + raise Data_Error; + + else + for N in S'Range loop + U := U * BB + XDR_WWC (S (N)); + end loop; + + -- Use Ada requirements on Wide_Wide_Character representation clause + + return Wide_Wide_Character'Val (U); + end if; + end I_WWC; + ---------- -- W_AD -- ---------- @@ -1111,7 +1161,6 @@ package body System.Stream_Attributes is pragma Assert (C_L = 1); begin - -- Use Ada requirements on Character representation clause S (1) := SE (Character'Pos (Item)); @@ -1212,8 +1261,8 @@ package body System.Stream_Attributes is begin if Optimize_Integers then S := Integer_To_XDR_S_I (Item); - else + else -- Test sign and apply two complement notation if Item < 0 then @@ -1329,8 +1378,8 @@ package body System.Stream_Attributes is begin if Optimize_Integers then S := Long_Long_Integer_To_XDR_S_LI (Long_Long_Integer (Item)); - else + else -- Test sign and apply two complement notation if Item < 0 then @@ -1462,8 +1511,9 @@ package body System.Stream_Attributes is -- W_LLI -- ----------- - procedure W_LLI (Stream : not null access RST; - Item : Long_Long_Integer) + procedure W_LLI + (Stream : not null access RST; + Item : Long_Long_Integer) is S : XDR_S_LLI; U : Unsigned; @@ -1472,8 +1522,8 @@ package body System.Stream_Attributes is begin if Optimize_Integers then S := Long_Long_Integer_To_XDR_S_LLI (Item); - else + else -- Test sign and apply two complement notation if Item < 0 then @@ -1510,8 +1560,10 @@ package body System.Stream_Attributes is -- W_LLU -- ----------- - procedure W_LLU (Stream : not null access RST; - Item : Long_Long_Unsigned) is + procedure W_LLU + (Stream : not null access RST; + Item : Long_Long_Unsigned) + is S : XDR_S_LLU; U : Unsigned; X : Long_Long_Unsigned := Item; @@ -1519,6 +1571,7 @@ package body System.Stream_Attributes is begin if Optimize_Integers then S := Long_Long_Unsigned_To_XDR_S_LLU (Item); + else -- Compute using machine unsigned -- rather than long_long_unsigned. @@ -1556,6 +1609,7 @@ package body System.Stream_Attributes is begin if Optimize_Integers then S := Long_Long_Unsigned_To_XDR_S_LU (Long_Long_Unsigned (Item)); + else -- Compute using machine unsigned -- rather than long_unsigned. @@ -1673,8 +1727,8 @@ package body System.Stream_Attributes is begin if Optimize_Integers then S := Short_Integer_To_XDR_S_SI (Item); - else + else -- Test sign and apply two complement's notation if Item < 0 then @@ -1710,8 +1764,8 @@ package body System.Stream_Attributes is begin if Optimize_Integers then S := Short_Short_Integer_To_XDR_S_SSI (Item); - else + else -- Test sign and apply two complement's notation if Item < 0 then @@ -1739,7 +1793,6 @@ package body System.Stream_Attributes is begin S (1) := SE (U); - Ada.Streams.Write (Stream.all, S); end W_SSU; @@ -1754,6 +1807,7 @@ package body System.Stream_Attributes is begin if Optimize_Integers then S := Short_Unsigned_To_XDR_S_SU (Item); + else for N in reverse S'Range loop S (N) := SE (U mod BB); @@ -1779,6 +1833,7 @@ package body System.Stream_Attributes is begin if Optimize_Integers then S := Unsigned_To_XDR_S_U (Item); + else for N in reverse S'Range loop S (N) := SE (U mod BB); @@ -1802,7 +1857,6 @@ package body System.Stream_Attributes is U : XDR_WC; begin - -- Use Ada requirements on Wide_Character representation clause U := XDR_WC (Wide_Character'Pos (Item)); @@ -1819,4 +1873,31 @@ package body System.Stream_Attributes is end if; end W_WC; + ----------- + -- W_WWC -- + ----------- + + procedure W_WWC + (Stream : not null access RST; Item : Wide_Wide_Character) + is + S : XDR_S_WWC; + U : XDR_WWC; + + begin + -- Use Ada requirements on Wide_Wide_Character representation clause + + U := XDR_WWC (Wide_Wide_Character'Pos (Item)); + + for N in reverse S'Range loop + S (N) := SE (U mod BB); + U := U / BB; + end loop; + + Ada.Streams.Write (Stream.all, S); + + if U /= 0 then + raise Data_Error; + end if; + end W_WWC; + end System.Stream_Attributes; diff --git a/gcc/ada/s-ststop.adb b/gcc/ada/s-ststop.adb new file mode 100644 index 00000000000..8d181087e97 --- /dev/null +++ b/gcc/ada/s-ststop.adb @@ -0,0 +1,581 @@ +------------------------------------------------------------------------------ +-- -- +-- GNAT RUN-TIME LIBRARY (GNARL) COMPONENTS -- +-- -- +-- S Y S T E M . S T R I N G S . S T R E A M _ O P S -- +-- -- +-- B o d y -- +-- -- +-- Copyright (C) 2008, Free Software Foundation, Inc. -- +-- -- +-- GNAT is free software; you can redistribute it and/or modify it under -- +-- terms of the GNU General Public License as published by the Free Soft- -- +-- ware Foundation; either version 2, or (at your option) any later ver- -- +-- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- +-- OUT 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 distributed with GNAT; see file COPYING. If not, write -- +-- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, -- +-- Boston, MA 02110-1301, USA. -- +-- -- +-- As a special exception, if other files instantiate generics from this -- +-- unit, or you link this unit with other files to produce an executable, -- +-- this unit does not by itself cause the resulting executable to be -- +-- covered by the GNU General Public License. This exception does not -- +-- however invalidate any other reasons why the executable file might be -- +-- covered by the GNU Public License. -- +-- -- +-- GNAT was originally developed by the GNAT team at New York University. -- +-- Extensive contributions were provided by Ada Core Technologies Inc. -- +-- -- +------------------------------------------------------------------------------ + +pragma Warnings (Off); +pragma Compiler_Unit; +pragma Warnings (On); + +with Ada.Streams; use Ada.Streams; +with Ada.Streams.Stream_IO; use Ada.Streams.Stream_IO; +with Ada.Unchecked_Conversion; + +with System.Stream_Attributes; use System; + +package body System.Strings.Stream_Ops is + + -- The following package provides an IO framework for strings. Depending + -- on the version of System.Stream_Attributes as well as the size of + -- formal parameter Character_Type, the package will either utilize block + -- IO or character-by-character IO. + + generic + type Character_Type is private; + type String_Type is array (Positive range <>) of Character_Type; + + package Stream_Ops_Internal is + procedure Read + (Strm : access Root_Stream_Type'Class; + Item : out String_Type); + + procedure Write + (Strm : access Root_Stream_Type'Class; + Item : String_Type); + end Stream_Ops_Internal; + + ------------------------- + -- Stream_Ops_Internal -- + ------------------------- + + package body Stream_Ops_Internal is + + -- The following value represents the number of BITS allocated for the + -- default block used in string IO. The sizes of all other types are + -- calculated relative to this value. + + Default_Block_Size : constant := 512 * 8; + + -- Shorthand notation for stream element and character sizes + + C_Size : constant Integer := Character_Type'Size; + SE_Size : constant Integer := Stream_Element'Size; + + -- The following constants describe the number of stream elements or + -- characters that can fit into a default block. + + C_In_Default_Block : constant Integer := Default_Block_Size / C_Size; + SE_In_Default_Block : constant Integer := Default_Block_Size / SE_Size; + + -- Buffer types + + subtype Default_Block is Stream_Element_Array + (1 .. Stream_Element_Offset (SE_In_Default_Block)); + + subtype String_Block is String_Type (1 .. C_In_Default_Block); + + -- Block IO is used in the following two scenarios: + + -- 1) When the size of the character type equals that of the stream + -- element type, regardless of endianness. + + -- 2) When using the standard stream IO routines for elementary + -- types which guarantees the same endianness over partitions. + + Use_Block_IO : constant Boolean := + C_Size = SE_Size + or else Stream_Attributes.Block_IO_OK; + + -- Conversions to and from Default_Block + + function To_Default_Block is + new Ada.Unchecked_Conversion (String_Block, Default_Block); + + function To_String_Block is + new Ada.Unchecked_Conversion (Default_Block, String_Block); + + ---------- + -- Read -- + ---------- + + procedure Read + (Strm : access Root_Stream_Type'Class; + Item : out String_Type) + is + begin + if Strm = null then + raise Constraint_Error; + end if; + + -- Nothing to do if the desired string is empty + + if Item'Length = 0 then + return; + end if; + + if Use_Block_IO then + declare + -- Determine the size in BITS of the block necessary to contain + -- the whole string. + + Block_Size : constant Natural := + (Item'Last - Item'First + 1) * C_Size; + + -- Item can be larger than what the default block can store, + -- determine the number of whole reads necessary to read the + -- string. + + Blocks : constant Natural := Block_Size / Default_Block_Size; + + -- The size of Item may not be a multiple of the default block + -- size, determine the size of the remaining chunk in BITS. + + Rem_Size : constant Natural := + Block_Size mod Default_Block_Size; + + -- String indices + + Low : Positive := Item'First; + High : Positive := Low + C_In_Default_Block - 1; + + -- End of stream error detection + + Last : Stream_Element_Offset := 0; + Sum : Stream_Element_Offset := 0; + + begin + -- Step 1: If the string is too large, read in individual + -- chunks the size of the default block. + + if Blocks > 0 then + declare + Block : Default_Block; + + begin + for Counter in 1 .. Blocks loop + Read (Strm.all, Block, Last); + Item (Low .. High) := To_String_Block (Block); + + Low := High + 1; + High := Low + C_In_Default_Block - 1; + Sum := Sum + Last; + Last := 0; + end loop; + end; + end if; + + -- Step 2: Read in any remaining elements + + if Rem_Size > 0 then + declare + subtype Rem_Block is Stream_Element_Array + (1 .. Stream_Element_Offset (Rem_Size / SE_Size)); + + subtype Rem_String_Block is + String_Type (1 .. Rem_Size / C_Size); + + function To_Rem_String_Block is new + Ada.Unchecked_Conversion (Rem_Block, Rem_String_Block); + + Block : Rem_Block; + + begin + Read (Strm.all, Block, Last); + Item (Low .. Item'Last) := To_Rem_String_Block (Block); + + Sum := Sum + Last; + end; + end if; + + -- Step 3: Potential error detection. The sum of all the + -- chunks is less than we initially wanted to read. In other + -- words, the stream does not contain enough elements to fully + -- populate Item. + + if (Integer (Sum) * SE_Size) / C_Size < Item'Length then + raise End_Error; + end if; + end; + + -- Character-by-character IO + + else + declare + C : Character_Type; + + begin + for Index in Item'First .. Item'Last loop + Character_Type'Read (Strm, C); + Item (Index) := C; + end loop; + end; + end if; + end Read; + + ----------- + -- Write -- + ----------- + + procedure Write + (Strm : access Root_Stream_Type'Class; + Item : String_Type) + is + begin + if Strm = null then + raise Constraint_Error; + end if; + + -- Nothing to do if the input string is empty + + if Item'Length = 0 then + return; + end if; + + if Use_Block_IO then + declare + -- Determine the size in BITS of the block necessary to contain + -- the whole string. + + Block_Size : constant Natural := Item'Length * C_Size; + + -- Item can be larger than what the default block can store, + -- determine the number of whole writes necessary to output the + -- string. + + Blocks : constant Natural := Block_Size / Default_Block_Size; + + -- The size of Item may not be a multiple of the default block + -- size, determine the size of the remaining chunk. + + Rem_Size : constant Natural := + Block_Size mod Default_Block_Size; + + -- String indices + + Low : Positive := Item'First; + High : Positive := Low + C_In_Default_Block - 1; + + begin + -- Step 1: If the string is too large, write out individual + -- chunks the size of the default block. + + for Counter in 1 .. Blocks loop + Write (Strm.all, To_Default_Block (Item (Low .. High))); + + Low := High + 1; + High := Low + C_In_Default_Block - 1; + end loop; + + -- Step 2: Write out any remaining elements + + if Rem_Size > 0 then + declare + subtype Rem_Block is Stream_Element_Array + (1 .. Stream_Element_Offset (Rem_Size / SE_Size)); + + subtype Rem_String_Block is + String_Type (1 .. Rem_Size / C_Size); + + function To_Rem_Block is new + Ada.Unchecked_Conversion (Rem_String_Block, Rem_Block); + + begin + Write (Strm.all, To_Rem_Block (Item (Low .. Item'Last))); + end; + end if; + end; + + -- Character-by-character IO + + else + for Index in Item'First .. Item'Last loop + Character_Type'Write (Strm, Item (Index)); + end loop; + end if; + end Write; + end Stream_Ops_Internal; + + -- Specific instantiations for different string types + + package String_Ops is + new Stream_Ops_Internal + (Character_Type => Character, + String_Type => String); + + package Wide_String_Ops is + new Stream_Ops_Internal + (Character_Type => Wide_Character, + String_Type => Wide_String); + + package Wide_Wide_String_Ops is + new Stream_Ops_Internal + (Character_Type => Wide_Wide_Character, + String_Type => Wide_Wide_String); + + ------------------ + -- String_Input -- + ------------------ + + function String_Input + (Strm : access Ada.Streams.Root_Stream_Type'Class) return String + is + begin + if Strm = null then + raise Constraint_Error; + end if; + + declare + Low : Positive; + High : Positive; + + begin + -- Read the bounds of the string + + Positive'Read (Strm, Low); + Positive'Read (Strm, High); + + declare + Item : String (Low .. High); + + begin + -- Read the character content of the string + + String_Read (Strm, Item); + + return Item; + end; + end; + end String_Input; + + ------------------- + -- String_Output -- + ------------------- + + procedure String_Output + (Strm : access Ada.Streams.Root_Stream_Type'Class; + Item : String) + is + begin + if Strm = null then + raise Constraint_Error; + end if; + + -- Write the bounds of the string + + Positive'Write (Strm, Item'First); + Positive'Write (Strm, Item'Last); + + -- Write the character content of the string + + String_Write (Strm, Item); + end String_Output; + + ----------------- + -- String_Read -- + ----------------- + + procedure String_Read + (Strm : access Ada.Streams.Root_Stream_Type'Class; + Item : out String) + is + begin + String_Ops.Read (Strm, Item); + end String_Read; + + ------------------ + -- String_Write -- + ------------------ + + procedure String_Write + (Strm : access Ada.Streams.Root_Stream_Type'Class; + Item : String) + is + begin + String_Ops.Write (Strm, Item); + end String_Write; + + ----------------------- + -- Wide_String_Input -- + ----------------------- + + function Wide_String_Input + (Strm : access Ada.Streams.Root_Stream_Type'Class) + return Wide_String + is + begin + if Strm = null then + raise Constraint_Error; + end if; + + declare + Low : Positive; + High : Positive; + + begin + -- Read the bounds of the string + + Positive'Read (Strm, Low); + Positive'Read (Strm, High); + + declare + Item : Wide_String (Low .. High); + + begin + -- Read the character content of the string + + Wide_String_Read (Strm, Item); + + return Item; + end; + end; + end Wide_String_Input; + + ------------------------ + -- Wide_String_Output -- + ------------------------ + + procedure Wide_String_Output + (Strm : access Ada.Streams.Root_Stream_Type'Class; + Item : Wide_String) + is + begin + if Strm = null then + raise Constraint_Error; + end if; + + -- Write the bounds of the string + + Positive'Write (Strm, Item'First); + Positive'Write (Strm, Item'Last); + + -- Write the character content of the string + + Wide_String_Write (Strm, Item); + end Wide_String_Output; + + ---------------------- + -- Wide_String_Read -- + ---------------------- + + procedure Wide_String_Read + (Strm : access Ada.Streams.Root_Stream_Type'Class; + Item : out Wide_String) + is + begin + Wide_String_Ops.Read (Strm, Item); + end Wide_String_Read; + + ----------------------- + -- Wide_String_Write -- + ----------------------- + + procedure Wide_String_Write + (Strm : access Ada.Streams.Root_Stream_Type'Class; + Item : Wide_String) + is + begin + Wide_String_Ops.Write (Strm, Item); + end Wide_String_Write; + + ---------------------------- + -- Wide_Wide_String_Input -- + ---------------------------- + + function Wide_Wide_String_Input + (Strm : access Ada.Streams.Root_Stream_Type'Class) + return Wide_Wide_String + is + begin + if Strm = null then + raise Constraint_Error; + end if; + + declare + Low : Positive; + High : Positive; + + begin + -- Read the bounds of the string + + Positive'Read (Strm, Low); + Positive'Read (Strm, High); + + declare + Item : Wide_Wide_String (Low .. High); + + begin + -- Read the character content of the string + + Wide_Wide_String_Read (Strm, Item); + + return Item; + end; + end; + end Wide_Wide_String_Input; + + ----------------------------- + -- Wide_Wide_String_Output -- + ----------------------------- + + procedure Wide_Wide_String_Output + (Strm : access Ada.Streams.Root_Stream_Type'Class; + Item : Wide_Wide_String) + is + begin + if Strm = null then + raise Constraint_Error; + end if; + + -- Write the bounds of the string + + Positive'Write (Strm, Item'First); + Positive'Write (Strm, Item'Last); + + -- Write the character content of the string + + Wide_Wide_String_Write (Strm, Item); + end Wide_Wide_String_Output; + + --------------------------- + -- Wide_Wide_String_Read -- + --------------------------- + + procedure Wide_Wide_String_Read + (Strm : access Ada.Streams.Root_Stream_Type'Class; + Item : out Wide_Wide_String) + is + begin + Wide_Wide_String_Ops.Read (Strm, Item); + end Wide_Wide_String_Read; + + ---------------------------- + -- Wide_Wide_String_Write -- + ---------------------------- + + procedure Wide_Wide_String_Write + (Strm : access Ada.Streams.Root_Stream_Type'Class; + Item : Wide_Wide_String) + is + begin + Wide_Wide_String_Ops.Write (Strm, Item); + end Wide_Wide_String_Write; + +end System.Strings.Stream_Ops; diff --git a/gcc/ada/s-ststop.ads b/gcc/ada/s-ststop.ads new file mode 100644 index 00000000000..f954bccfc7b --- /dev/null +++ b/gcc/ada/s-ststop.ads @@ -0,0 +1,117 @@ +------------------------------------------------------------------------------ +-- -- +-- GNAT RUN-TIME LIBRARY (GNARL) COMPONENTS -- +-- -- +-- S Y S T E M . S T R I N G S . S T R E A M _ O P S -- +-- -- +-- S p e c -- +-- -- +-- Copyright (C) 2008, Free Software Foundation, Inc. -- +-- -- +-- GNAT is free software; you can redistribute it and/or modify it under -- +-- terms of the GNU General Public License as published by the Free Soft- -- +-- ware Foundation; either version 2, or (at your option) any later ver- -- +-- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- +-- OUT 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 distributed with GNAT; see file COPYING. If not, write -- +-- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, -- +-- Boston, MA 02110-1301, USA. -- +-- -- +-- As a special exception, if other files instantiate generics from this -- +-- unit, or you link this unit with other files to produce an executable, -- +-- this unit does not by itself cause the resulting executable to be -- +-- covered by the GNU General Public License. This exception does not -- +-- however invalidate any other reasons why the executable file might be -- +-- covered by the GNU Public License. -- +-- -- +-- GNAT was originally developed by the GNAT team at New York University. -- +-- Extensive contributions were provided by Ada Core Technologies Inc. -- +-- -- +------------------------------------------------------------------------------ + +-- This package provides subprogram implementations of stream attributes for +-- the following types: +-- Ada.String +-- Ada.Wide_String +-- Ada.Wide_Wide_String +-- +-- The compiler will generate references to the subprograms in this package +-- when expanding stream attributes for the above mentioned types. Example: +-- +-- String'Output (Some_Stream, Some_String); +-- +-- will be expanded into: +-- +-- String_Output (Some_Stream, Some_String); + +pragma Warnings (Off); +pragma Compiler_Unit; +pragma Warnings (On); + +with Ada.Streams; + +package System.Strings.Stream_Ops is + + ------------------------------ + -- String stream operations -- + ------------------------------ + + function String_Input + (Strm : access Ada.Streams.Root_Stream_Type'Class) + return String; + + procedure String_Output + (Strm : access Ada.Streams.Root_Stream_Type'Class; + Item : String); + + procedure String_Read + (Strm : access Ada.Streams.Root_Stream_Type'Class; + Item : out String); + + procedure String_Write + (Strm : access Ada.Streams.Root_Stream_Type'Class; + Item : String); + + ----------------------------------- + -- Wide_String stream operations -- + ----------------------------------- + + function Wide_String_Input + (Strm : access Ada.Streams.Root_Stream_Type'Class) + return Wide_String; + + procedure Wide_String_Output + (Strm : access Ada.Streams.Root_Stream_Type'Class; + Item : Wide_String); + + procedure Wide_String_Read + (Strm : access Ada.Streams.Root_Stream_Type'Class; + Item : out Wide_String); + + procedure Wide_String_Write + (Strm : access Ada.Streams.Root_Stream_Type'Class; + Item : Wide_String); + + ---------------------------------------- + -- Wide_Wide_String stream operations -- + ---------------------------------------- + + function Wide_Wide_String_Input + (Strm : access Ada.Streams.Root_Stream_Type'Class) + return Wide_Wide_String; + + procedure Wide_Wide_String_Output + (Strm : access Ada.Streams.Root_Stream_Type'Class; + Item : Wide_Wide_String); + + procedure Wide_Wide_String_Read + (Strm : access Ada.Streams.Root_Stream_Type'Class; + Item : out Wide_Wide_String); + + procedure Wide_Wide_String_Write + (Strm : access Ada.Streams.Root_Stream_Type'Class; + Item : Wide_Wide_String); + +end System.Strings.Stream_Ops; diff --git a/gcc/ada/s-taenca.adb b/gcc/ada/s-taenca.adb index 0f4b0c8fa4d..a37538b7308 100644 --- a/gcc/ada/s-taenca.adb +++ b/gcc/ada/s-taenca.adb @@ -113,7 +113,7 @@ package body System.Tasking.Entry_Calls is pragma Inline (Poll_Base_Priority_Change_At_Entry_Call); -- A specialized version of Poll_Base_Priority_Change, that does the -- optional entry queue reordering. Has to be called with the Self_ID's - -- ATCB write-locked. May temporariliy release the lock. + -- ATCB write-locked. May temporarily release the lock. --------------------- -- Check_Exception -- diff --git a/gcc/ada/s-taenca.ads b/gcc/ada/s-taenca.ads index 1b88b16dc8e..e4449707be0 100644 --- a/gcc/ada/s-taenca.ads +++ b/gcc/ada/s-taenca.ads @@ -6,7 +6,7 @@ -- -- -- S p e c -- -- -- --- Copyright (C) 1992-2005, Free Software Foundation, Inc. -- +-- Copyright (C) 1992-2008, Free Software Foundation, Inc. -- -- -- -- GNARL is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -70,7 +70,7 @@ package System.Tasking.Entry_Calls is pragma Inline (Try_To_Cancel_Entry_Call); -- Try to cancel async. entry call. -- Effect includes Abort_To_Level and Wait_For_Completion. - -- Cancelled = True iff the cancelation was successful, i.e., + -- Cancelled = True iff the cancellation was successful, i.e., -- the call was not Done before this call. -- On return, the call is off-queue and the ATC level is reduced by one. diff --git a/gcc/ada/s-taprob.adb b/gcc/ada/s-taprob.adb index 547dcb72264..ee06529d19e 100644 --- a/gcc/ada/s-taprob.adb +++ b/gcc/ada/s-taprob.adb @@ -101,7 +101,7 @@ package body System.Tasking.Protected_Objects is Ceiling_Violation : Boolean; begin - -- The lock is made without defering abort + -- The lock is made without deferring abort -- Therefore the abort has to be deferred before calling this routine. -- This means that the compiler has to generate a Defer_Abort call @@ -171,7 +171,7 @@ package body System.Tasking.Protected_Objects is -- read ownership of the protected object, so that this method of -- storing the (single) protected object's owner does not work reliably -- for read locks. However, this is the approach taken for two major - -- reasosn: first, this function is not currently being used (it is + -- reasons: first, this function is not currently being used (it is -- provided for possible future use), and second, it largely simplifies -- the implementation. diff --git a/gcc/ada/s-taprop-hpux-dce.adb b/gcc/ada/s-taprop-hpux-dce.adb index 329c56f8ccb..85c266ae322 100644 --- a/gcc/ada/s-taprop-hpux-dce.adb +++ b/gcc/ada/s-taprop-hpux-dce.adb @@ -221,7 +221,7 @@ package body System.Task_Primitives.Operations is -- Note: mutexes and cond_variables needed per-task basis are initialized -- in Initialize_TCB and the Storage_Error is handled. Other mutexes (such -- as RTS_Lock, Memory_Lock...) used in RTS is initialized before any - -- status change of RTS. Therefore rasing Storage_Error in the following + -- status change of RTS. Therefore raising Storage_Error in the following -- routines should be able to be handled safely. procedure Initialize_Lock @@ -859,7 +859,7 @@ package body System.Task_Primitives.Operations is Succeeded := Result = 0; pthread_detach (T.Common.LL.Thread'Access); - -- Detach the thread using pthread_detach, sinc DCE threads do not have + -- Detach the thread using pthread_detach, since DCE threads do not have -- pthread_attr_set_detachstate. Result := pthread_attr_destroy (Attributes'Access); diff --git a/gcc/ada/s-taprop-irix.adb b/gcc/ada/s-taprop-irix.adb index a7221903cc8..6f48dfddb8e 100644 --- a/gcc/ada/s-taprop-irix.adb +++ b/gcc/ada/s-taprop-irix.adb @@ -219,7 +219,7 @@ package body System.Task_Primitives.Operations is -- Note: mutexes and cond_variables needed per-task basis are initialized -- in Initialize_TCB and the Storage_Error is handled. Other mutexes (such -- as RTS_Lock, Memory_Lock...) used in RTS is initialized before any - -- status change of RTS. Therefore rasing Storage_Error in the following + -- status change of RTS. Therefore raising Storage_Error in the following -- routines should be able to be handled safely. procedure Initialize_Lock diff --git a/gcc/ada/s-taprop-linux.adb b/gcc/ada/s-taprop-linux.adb index 6c64f341eec..56e94a96781 100644 --- a/gcc/ada/s-taprop-linux.adb +++ b/gcc/ada/s-taprop-linux.adb @@ -49,7 +49,6 @@ with System.Task_Info; with System.Tasking.Debug; with System.Interrupt_Management; with System.OS_Primitives; -with System.Storage_Elements; with System.Stack_Checking.Operations; with System.Soft_Links; @@ -69,9 +68,11 @@ package body System.Task_Primitives.Operations is use System.OS_Interface; use System.Parameters; use System.OS_Primitives; - use System.Storage_Elements; use System.Task_Info; + Use_Alternate_Stack : constant Boolean := Alternate_Stack_Size /= 0; + -- Whether to use an alternate signal stack for stack overflows + ---------------- -- Local Data -- ---------------- @@ -161,13 +162,6 @@ package body System.Task_Primitives.Operations is function To_pthread_t is new Ada.Unchecked_Conversion (unsigned_long, System.OS_Interface.pthread_t); - procedure Get_Stack_Attributes - (T : Task_Id; - ISP : out System.Address; - Size : out Storage_Offset); - -- Fill ISP and Size with the Initial Stack Pointer value and the - -- thread stack size for task T. - ------------------- -- Abort_Handler -- ------------------- @@ -256,7 +250,7 @@ package body System.Task_Primitives.Operations is -- Note: mutexes and cond_variables needed per-task basis are initialized -- in Initialize_TCB and the Storage_Error is handled. Other mutexes (such -- as RTS_Lock, Memory_Lock...) used in RTS is initialized before any - -- status change of RTS. Therefore rasing Storage_Error in the following + -- status change of RTS. Therefore raising Storage_Error in the following -- routines should be able to be handled safely. procedure Initialize_Lock @@ -696,50 +690,6 @@ package body System.Task_Primitives.Operations is return T.Common.Current_Priority; end Get_Priority; - -------------------------- - -- Get_Stack_Attributes -- - -------------------------- - - procedure Get_Stack_Attributes - (T : Task_Id; - ISP : out System.Address; - Size : out Storage_Offset) - is - function pthread_getattr_np - (thread : pthread_t; - attr : System.Address) return Interfaces.C.int; - pragma Import (C, pthread_getattr_np, "pthread_getattr_np"); - - function pthread_attr_getstack - (attr : System.Address; - base : System.Address; - size : System.Address) return Interfaces.C.int; - pragma Import (C, pthread_attr_getstack, "pthread_attr_getstack"); - - Result : Interfaces.C.int; - - Attributes : aliased pthread_attr_t; - Stack_Base : aliased System.Address; - Stack_Size : aliased Storage_Offset; - - begin - Result := - pthread_getattr_np - (T.Common.LL.Thread, Attributes'Address); - pragma Assert (Result = 0); - - Result := - pthread_attr_getstack - (Attributes'Address, Stack_Base'Address, Stack_Size'Address); - pragma Assert (Result = 0); - - Result := pthread_attr_destroy (Attributes'Access); - pragma Assert (Result = 0); - - ISP := Stack_Base + Stack_Size; - Size := Stack_Size; - end Get_Stack_Attributes; - ---------------- -- Enter_Task -- ---------------- @@ -747,8 +697,7 @@ package body System.Task_Primitives.Operations is procedure Enter_Task (Self_ID : Task_Id) is begin if Self_ID.Common.Task_Info /= null - and then - Self_ID.Common.Task_Info.CPU_Affinity = No_CPU + and then Self_ID.Common.Task_Info.CPU_Affinity = No_CPU then raise Invalid_CPU_Number; end if; @@ -769,17 +718,18 @@ package body System.Task_Primitives.Operations is Unlock_RTS; - -- Determine where the task stack starts, how large it is, and let the - -- stack checking engine know about it. - - declare - Initial_SP : System.Address; - Stack_Size : Storage_Offset; - begin - Get_Stack_Attributes (Self_ID, Initial_SP, Stack_Size); - System.Stack_Checking.Operations.Notify_Stack_Attributes - (Initial_SP, Stack_Size); - end; + if Use_Alternate_Stack then + declare + Stack : aliased stack_t; + Result : Interfaces.C.int; + begin + Stack.ss_sp := Self_ID.Common.Task_Alternate_Stack; + Stack.ss_size := Alternate_Stack_Size; + Stack.ss_flags := 0; + Result := sigaltstack (Stack'Access, null); + pragma Assert (Result = 0); + end; + end if; end Enter_Task; -------------- @@ -864,10 +814,14 @@ package body System.Task_Primitives.Operations is Priority : System.Any_Priority; Succeeded : out Boolean) is - Attributes : aliased pthread_attr_t; - Result : Interfaces.C.int; + Attributes : aliased pthread_attr_t; + Adjusted_Stack_Size : Interfaces.C.size_t; + Result : Interfaces.C.int; begin + Adjusted_Stack_Size := + Interfaces.C.size_t (Stack_Size + Alternate_Stack_Size); + Result := pthread_attr_init (Attributes'Access); pragma Assert (Result = 0 or else Result = ENOMEM); @@ -878,7 +832,7 @@ package body System.Task_Primitives.Operations is Result := pthread_attr_setstacksize - (Attributes'Access, Interfaces.C.size_t (Stack_Size)); + (Attributes'Access, Adjusted_Stack_Size); pragma Assert (Result = 0); Result := @@ -896,7 +850,8 @@ package body System.Task_Primitives.Operations is Attributes'Access, Thread_Body_Access (Wrapper), To_Address (T)); - pragma Assert (Result = 0 or else Result = EAGAIN); + pragma Assert + (Result = 0 or else Result = EAGAIN or else Result = ENOMEM); if Result /= 0 then Succeeded := False; @@ -1148,8 +1103,7 @@ package body System.Task_Primitives.Operations is pragma Assert (Result = 0); SSL.Abort_Undefer.all; - end - if; + end if; end Suspend_Until_True; ---------------- @@ -1253,6 +1207,7 @@ package body System.Task_Primitives.Operations is old_act : aliased struct_sigaction; Tmp_Set : aliased sigset_t; Result : Interfaces.C.int; + -- Whether to use an alternate signal stack for stack overflows function State (Int : System.Interrupt_Management.Interrupt_ID) return Character; @@ -1297,6 +1252,11 @@ package body System.Task_Primitives.Operations is Specific.Initialize (Environment_Task); + if Use_Alternate_Stack then + Environment_Task.Common.Task_Alternate_Stack := + Alternate_Stack'Address; + end if; + Enter_Task (Environment_Task); -- Install the abort-signal handler diff --git a/gcc/ada/s-taprop-lynxos.adb b/gcc/ada/s-taprop-lynxos.adb index 31b36eca579..df1d9510d02 100644 --- a/gcc/ada/s-taprop-lynxos.adb +++ b/gcc/ada/s-taprop-lynxos.adb @@ -668,7 +668,7 @@ package body System.Task_Primitives.Operations is begin Result := clock_getres - (clock_id => CLOCK_REALTIME, Res => Res'Unchecked_Access); + (clock_id => CLOCK_REALTIME, res => Res'Unchecked_Access); pragma Assert (Result = 0); return To_Duration (Res); end RT_Resolution; diff --git a/gcc/ada/s-taprop-mingw.adb b/gcc/ada/s-taprop-mingw.adb index adf1a31ec45..33fb253e2aa 100644 --- a/gcc/ada/s-taprop-mingw.adb +++ b/gcc/ada/s-taprop-mingw.adb @@ -49,6 +49,7 @@ with System.Tasking.Debug; with System.OS_Primitives; with System.Task_Info; with System.Interrupt_Management; +with System.Win32.Ext; with System.Soft_Links; -- We use System.Soft_Links instead of System.Tasking.Initialization because @@ -68,6 +69,8 @@ package body System.Task_Primitives.Operations is use System.Parameters; use System.OS_Primitives; use System.Task_Info; + use System.Win32; + use System.Win32.Ext; pragma Link_With ("-Xlinker --stack=0x200000,0x1000"); -- Change the default stack size (2 MB) for tasking programs on Windows. @@ -76,6 +79,30 @@ package body System.Task_Primitives.Operations is -- Also note that under Windows XP, we use a Windows XP extension to -- specify the stack size on a per task basis, as done under other OSes. + --------------------- + -- Local Functions -- + --------------------- + + procedure InitializeCriticalSection (pCriticalSection : access RTS_Lock); + procedure InitializeCriticalSection + (pCriticalSection : access CRITICAL_SECTION); + pragma Import + (Stdcall, InitializeCriticalSection, "InitializeCriticalSection"); + + procedure EnterCriticalSection (pCriticalSection : access RTS_Lock); + procedure EnterCriticalSection + (pCriticalSection : access CRITICAL_SECTION); + pragma Import (Stdcall, EnterCriticalSection, "EnterCriticalSection"); + + procedure LeaveCriticalSection (pCriticalSection : access RTS_Lock); + procedure LeaveCriticalSection (pCriticalSection : access CRITICAL_SECTION); + pragma Import (Stdcall, LeaveCriticalSection, "LeaveCriticalSection"); + + procedure DeleteCriticalSection (pCriticalSection : access RTS_Lock); + procedure DeleteCriticalSection + (pCriticalSection : access CRITICAL_SECTION); + pragma Import (Stdcall, DeleteCriticalSection, "DeleteCriticalSection"); + ---------------- -- Local Data -- ---------------- @@ -140,7 +167,7 @@ package body System.Task_Primitives.Operations is Succeeded : BOOL; begin Succeeded := TlsSetValue (TlsIndex, To_Address (Self_Id)); - pragma Assert (Succeeded = True); + pragma Assert (Succeeded = Win32.TRUE); end Set; end Specific; @@ -192,7 +219,7 @@ package body System.Task_Primitives.Operations is procedure Initialize_Cond (Cond : not null access Condition_Variable) is hEvent : HANDLE; begin - hEvent := CreateEvent (null, True, False, Null_Ptr); + hEvent := CreateEvent (null, Win32.TRUE, Win32.FALSE, Null_Ptr); pragma Assert (hEvent /= 0); Cond.all := Condition_Variable (hEvent); end Initialize_Cond; @@ -208,7 +235,7 @@ package body System.Task_Primitives.Operations is Result : BOOL; begin Result := CloseHandle (HANDLE (Cond.all)); - pragma Assert (Result = True); + pragma Assert (Result = Win32.TRUE); end Finalize_Cond; ----------------- @@ -219,7 +246,7 @@ package body System.Task_Primitives.Operations is Result : BOOL; begin Result := SetEvent (HANDLE (Cond.all)); - pragma Assert (Result = True); + pragma Assert (Result = Win32.TRUE); end Cond_Signal; --------------- @@ -243,7 +270,7 @@ package body System.Task_Primitives.Operations is -- Must reset Cond BEFORE L is unlocked Result_Bool := ResetEvent (HANDLE (Cond.all)); - pragma Assert (Result_Bool = True); + pragma Assert (Result_Bool = Win32.TRUE); Unlock (L, Global_Lock => True); -- No problem if we are interrupted here: if the condition is signaled, @@ -283,7 +310,7 @@ package body System.Task_Primitives.Operations is -- Must reset Cond BEFORE L is unlocked Result := ResetEvent (HANDLE (Cond.all)); - pragma Assert (Result = True); + pragma Assert (Result = Win32.TRUE); Unlock (L, Global_Lock => True); -- No problem if we are interrupted here: if the condition is signaled, @@ -316,7 +343,7 @@ package body System.Task_Primitives.Operations is if Timed_Out then Result := SetEvent (HANDLE (Cond.all)); - pragma Assert (Result = True); + pragma Assert (Result = Win32.TRUE); end if; Status := Integer (Wait_Result); @@ -364,7 +391,7 @@ package body System.Task_Primitives.Operations is --------------------- -- Note: mutexes and cond_variables needed per-task basis are initialized - -- in Intialize_TCB and the Storage_Error is handled. Other mutexes (such + -- in Initialize_TCB and the Storage_Error is handled. Other mutexes (such -- as RTS_Lock, Memory_Lock...) used in the RTS is initialized before any -- status change of RTS. Therefore raising Storage_Error in the following -- routines should be able to be handled safely. @@ -384,7 +411,7 @@ package body System.Task_Primitives.Operations is is pragma Unreferenced (Level); begin - InitializeCriticalSection (CRITICAL_SECTION (L.all)'Unrestricted_Access); + InitializeCriticalSection (L); end Initialize_Lock; ------------------- @@ -398,7 +425,7 @@ package body System.Task_Primitives.Operations is procedure Finalize_Lock (L : not null access RTS_Lock) is begin - DeleteCriticalSection (CRITICAL_SECTION (L.all)'Unrestricted_Access); + DeleteCriticalSection (L); end Finalize_Lock; ---------------- @@ -426,15 +453,14 @@ package body System.Task_Primitives.Operations is is begin if not Single_Lock or else Global_Lock then - EnterCriticalSection (CRITICAL_SECTION (L.all)'Unrestricted_Access); + EnterCriticalSection (L); end if; end Write_Lock; procedure Write_Lock (T : Task_Id) is begin if not Single_Lock then - EnterCriticalSection - (CRITICAL_SECTION (T.Common.LL.L)'Unrestricted_Access); + EnterCriticalSection (T.Common.LL.L'Access); end if; end Write_Lock; @@ -461,15 +487,14 @@ package body System.Task_Primitives.Operations is (L : not null access RTS_Lock; Global_Lock : Boolean := False) is begin if not Single_Lock or else Global_Lock then - LeaveCriticalSection (CRITICAL_SECTION (L.all)'Unrestricted_Access); + LeaveCriticalSection (L); end if; end Unlock; procedure Unlock (T : Task_Id) is begin if not Single_Lock then - LeaveCriticalSection - (CRITICAL_SECTION (T.Common.LL.L)'Unrestricted_Access); + LeaveCriticalSection (T.Common.LL.L'Access); end if; end Unlock; @@ -708,7 +733,7 @@ package body System.Task_Primitives.Operations is begin Res := SetThreadPriority (T.Common.LL.Thread, Interfaces.C.int (Underlying_Priorities (Prio))); - pragma Assert (Res = True); + pragma Assert (Res = Win32.TRUE); if Dispatching_Policy = 'F' or else Get_Policy (Prio) = 'F' then @@ -763,7 +788,7 @@ package body System.Task_Primitives.Operations is -- This is because the GetCurrentThread NT call does not return the real -- thread handler but only a "pseudo" one. It is not possible to release - -- the thread handle and free the system ressources from this "pseudo" + -- the thread handle and free the system resources from this "pseudo" -- handle. So we really want to keep the real thread handle set in -- System.Task_Primitives.Operations.Create_Task during thread creation. @@ -869,7 +894,7 @@ package body System.Task_Primitives.Operations is hTask : HANDLE; TaskId : aliased DWORD; - pTaskParameter : System.OS_Interface.PVOID; + pTaskParameter : Win32.PVOID; Result : DWORD; Entry_Point : PTHREAD_START_ROUTINE; @@ -920,7 +945,7 @@ package body System.Task_Primitives.Operations is -- boost. A priority boost is temporarily given by the system to a -- thread when it is taken out of a wait state. - SetThreadPriorityBoost (hTask, DisablePriorityBoost => True); + SetThreadPriorityBoost (hTask, DisablePriorityBoost => Win32.TRUE); end if; -- Step 4: Handle Task_Info @@ -967,12 +992,12 @@ package body System.Task_Primitives.Operations is if Self_ID.Common.LL.Thread /= 0 then -- This task has been activated. Wait for the thread to terminate - -- then close it. this is needed to release system ressources. + -- then close it. This is needed to release system resources. Result := WaitForSingleObject (T.Common.LL.Thread, Wait_Infinite); pragma Assert (Result /= WAIT_FAILED); Succeeded := CloseHandle (T.Common.LL.Thread); - pragma Assert (Succeeded = True); + pragma Assert (Succeeded = Win32.TRUE); end if; Free (Self_ID); @@ -1095,7 +1120,7 @@ package body System.Task_Primitives.Operations is -- Initialize internal condition variable - S.CV := CreateEvent (null, True, False, Null_Ptr); + S.CV := CreateEvent (null, Win32.TRUE, Win32.FALSE, Null_Ptr); pragma Assert (S.CV /= 0); end Initialize; @@ -1113,7 +1138,7 @@ package body System.Task_Primitives.Operations is -- Destroy internal condition variable Result := CloseHandle (S.CV); - pragma Assert (Result = True); + pragma Assert (Result = Win32.TRUE); end Finalize; ------------------- @@ -1166,7 +1191,7 @@ package body System.Task_Primitives.Operations is S.State := False; Result := SetEvent (S.CV); - pragma Assert (Result = True); + pragma Assert (Result = Win32.TRUE); else S.State := True; end if; @@ -1215,7 +1240,7 @@ package body System.Task_Primitives.Operations is -- Must reset CV BEFORE L is unlocked Result_Bool := ResetEvent (S.CV); - pragma Assert (Result_Bool = True); + pragma Assert (Result_Bool = Win32.TRUE); LeaveCriticalSection (S.L'Access); diff --git a/gcc/ada/s-taprop-posix.adb b/gcc/ada/s-taprop-posix.adb index 816bb50a7b6..74ab07a0abb 100644 --- a/gcc/ada/s-taprop-posix.adb +++ b/gcc/ada/s-taprop-posix.adb @@ -73,6 +73,9 @@ package body System.Task_Primitives.Operations is use System.Parameters; use System.OS_Primitives; + Use_Alternate_Stack : constant Boolean := Alternate_Stack_Size /= 0; + -- Whether to use an alternate signal stack for stack overflows + ---------------- -- Local Data -- ---------------- @@ -268,10 +271,10 @@ package body System.Task_Primitives.Operations is --------------------- -- Note: mutexes and cond_variables needed per-task basis are - -- initialized in Intialize_TCB and the Storage_Error is + -- initialized in Initialize_TCB and the Storage_Error is -- handled. Other mutexes (such as RTS_Lock, Memory_Lock...) -- used in RTS is initialized before any status change of RTS. - -- Therefore rasing Storage_Error in the following routines + -- Therefore raising Storage_Error in the following routines -- should be able to be handled safely. procedure Initialize_Lock @@ -798,6 +801,19 @@ package body System.Task_Primitives.Operations is end loop; Unlock_RTS; + + if Use_Alternate_Stack then + declare + Stack : aliased stack_t; + Result : Interfaces.C.int; + begin + Stack.ss_sp := Self_ID.Common.Task_Alternate_Stack; + Stack.ss_size := Alternate_Stack_Size; + Stack.ss_flags := 0; + Result := sigaltstack (Stack'Access, null); + pragma Assert (Result = 0); + end; + end if; end Enter_Task; -------------- @@ -932,7 +948,8 @@ package body System.Task_Primitives.Operations is use System.Task_Info; begin - Adjusted_Stack_Size := Interfaces.C.size_t (Stack_Size); + Adjusted_Stack_Size := + Interfaces.C.size_t (Stack_Size + Alternate_Stack_Size); if Stack_Base_Available then @@ -1415,6 +1432,11 @@ package body System.Task_Primitives.Operations is Specific.Initialize (Environment_Task); + if Use_Alternate_Stack then + Environment_Task.Common.Task_Alternate_Stack := + Alternate_Stack'Address; + end if; + Enter_Task (Environment_Task); -- Install the abort-signal handler diff --git a/gcc/ada/s-taprop-solaris.adb b/gcc/ada/s-taprop-solaris.adb index 068d3401f62..2555eb8fee3 100644 --- a/gcc/ada/s-taprop-solaris.adb +++ b/gcc/ada/s-taprop-solaris.adb @@ -107,16 +107,16 @@ package body System.Task_Primitives.Operations is -- controls whether we emulate priority ceiling locking -- To get a scheduling close to annex D requirements, we use the real-time - -- class provided for LWP's and map each task/thread to a specific and + -- class provided for LWPs and map each task/thread to a specific and -- unique LWP (there is 1 thread per LWP, and 1 LWP per thread). -- The real time class can only be set when the process has root - -- priviledges, so in the other cases, we use the normal thread scheduling + -- privileges, so in the other cases, we use the normal thread scheduling -- and priority handling. Using_Real_Time_Class : Boolean := False; - -- indicates wether the real time class is being used (i.e the process - -- has root priviledges). + -- indicates whether the real time class is being used (i.e the process + -- has root privileges). Prio_Param : aliased struct_pcparms; -- Hold priority info (Real_Time) initialized during the package @@ -521,7 +521,7 @@ package body System.Task_Primitives.Operations is -- Note: mutexes and cond_variables needed per-task basis are initialized -- in Initialize_TCB and the Storage_Error is handled. Other mutexes (such -- as RTS_Lock, Memory_Lock...) used in RTS is initialized before any - -- status change of RTS. Therefore rasing Storage_Error in the following + -- status change of RTS. Therefore raising Storage_Error in the following -- routines should be able to be handled safely. procedure Initialize_Lock @@ -1139,11 +1139,12 @@ package body System.Task_Primitives.Operations is pragma Assert (Result = 0 or else Result = EINTR); end Sleep; - -- Note that we are relying heaviliy here on GNAT represting Calendar.Time, - -- System.Real_Time.Time, Duration, System.Real_Time.Time_Span in the same - -- way, i.e., as a 64-bit count of nanoseconds. + -- Note that we are relying heavily here on GNAT representing + -- Calendar.Time, System.Real_Time.Time, Duration, + -- System.Real_Time.Time_Span in the same way, i.e., as a 64-bit count of + -- nanoseconds. - -- This allows us to always pass the timeout value as a Duration + -- This allows us to always pass the timeout value as a Duration. -- ??? -- We are taking liberties here with the semantics of the delays. That is, diff --git a/gcc/ada/s-taprop-tru64.adb b/gcc/ada/s-taprop-tru64.adb index ace4756fea0..232c138bae1 100644 --- a/gcc/ada/s-taprop-tru64.adb +++ b/gcc/ada/s-taprop-tru64.adb @@ -226,7 +226,7 @@ package body System.Task_Primitives.Operations is -- Note: mutexes and cond_variables needed per-task basis are initialized -- in Initialize_TCB and the Storage_Error is handled. Other mutexes (such -- as RTS_Lock, Memory_Lock...) used in RTS is initialized before any - -- status change of RTS. Therefore rasing Storage_Error in the following + -- status change of RTS. Therefore raising Storage_Error in the following -- routines should be able to be handled safely. procedure Initialize_Lock diff --git a/gcc/ada/s-taprop-vms.adb b/gcc/ada/s-taprop-vms.adb index f1be10194a4..92d1a187b7d 100644 --- a/gcc/ada/s-taprop-vms.adb +++ b/gcc/ada/s-taprop-vms.adb @@ -131,10 +131,12 @@ package body System.Task_Primitives.Operations is ----------------------- function To_Task_Id is - new Ada.Unchecked_Conversion (System.Address, Task_Id); + new Ada.Unchecked_Conversion + (System.Task_Primitives.Task_Address, Task_Id); function To_Address is - new Ada.Unchecked_Conversion (Task_Id, System.Address); + new Ada.Unchecked_Conversion + (Task_Id, System.Task_Primitives.Task_Address); function Get_Exc_Stack_Addr return Address; -- Replace System.Soft_Links.Get_Exc_Stack_Addr_NT @@ -190,7 +192,7 @@ package body System.Task_Primitives.Operations is -- Note: mutexes and cond_variables needed per-task basis are initialized -- in Initialize_TCB and the Storage_Error is handled. Other mutexes (such -- as RTS_Lock, Memory_Lock...) used in RTS is initialized before any - -- status change of RTS. Therefore rasing Storage_Error in the following + -- status change of RTS. Therefore raising Storage_Error in the following -- routines should be able to be handled safely. procedure Initialize_Lock @@ -519,7 +521,7 @@ package body System.Task_Primitives.Operations is if Time /= 0.0 or else Mode /= Relative then Sleep_Time := To_OS_Time (Time, Mode); - if Mode = Relative or else OS_Clock < Sleep_Time then + if Mode = Relative or else OS_Clock <= Sleep_Time then Self_ID.Common.State := Delay_Sleep; Self_ID.Common.LL.AST_Pending := True; diff --git a/gcc/ada/s-taprop-vxworks.adb b/gcc/ada/s-taprop-vxworks.adb index c6469cd2b05..bbe2ae50d48 100644 --- a/gcc/ada/s-taprop-vxworks.adb +++ b/gcc/ada/s-taprop-vxworks.adb @@ -54,6 +54,8 @@ with System.Soft_Links; -- on. For example when using the restricted run time, it is replaced by -- System.Tasking.Restricted.Stages. +with System.VxWorks.Ext; + package body System.Task_Primitives.Operations is package SSL renames System.Soft_Links; @@ -62,6 +64,7 @@ package body System.Task_Primitives.Operations is use System.Tasking; use System.OS_Interface; use System.Parameters; + use type System.VxWorks.Ext.t_id; use type Interfaces.C.int; subtype int is System.OS_Interface.int; @@ -532,7 +535,7 @@ package body System.Task_Primitives.Operations is else -- If Ticks = int'last, it was most probably truncated so -- let's make another round after recomputing Ticks from - -- the the absolute time. + -- the absolute time. if Ticks /= int'Last then Timedout := True; @@ -652,7 +655,7 @@ package body System.Task_Primitives.Operations is -- If Ticks = int'last, it was most probably truncated -- so let's make another round after recomputing Ticks - -- from the the absolute time. + -- from the absolute time. if errno = S_objLib_OBJ_TIMEOUT and then Ticks /= int'Last then Timedout := True; diff --git a/gcc/ada/s-taprop.ads b/gcc/ada/s-taprop.ads index 7938ae1002e..4f0a5408d9c 100644 --- a/gcc/ada/s-taprop.ads +++ b/gcc/ada/s-taprop.ads @@ -250,7 +250,7 @@ package System.Task_Primitives.Operations is -- It is not clear what to do about ceiling violations due to RTS calls -- done at interrupt priority. In general, it is not acceptable to give - -- all RTS locks interrupt priority, since that whould give terrible + -- all RTS locks interrupt priority, since that would give terrible -- performance on systems where this has the effect of masking hardware -- interrupts, though we could get away allowing Interrupt_Priority'last -- where we are layered on an OS that does not allow us to mask interrupts. @@ -413,7 +413,7 @@ package System.Task_Primitives.Operations is -- thread of control in the RTS. Since we intend these routines to be used -- for implementing the Single_Lock RTS, Lock_RTS should follow the first -- Defer_Abort operation entering RTS. In the same fashion Unlock_RTS - -- should preceed the last Undefer_Abort exiting RTS. + -- should precede the last Undefer_Abort exiting RTS. -- -- These routines also replace the functions Lock/Unlock_All_Tasks_List diff --git a/gcc/ada/s-tarest.adb b/gcc/ada/s-tarest.adb index 08802c6e22f..1a4c6b96f97 100644 --- a/gcc/ada/s-tarest.adb +++ b/gcc/ada/s-tarest.adb @@ -200,7 +200,7 @@ package body System.Tasking.Restricted.Stages is -- a task terminating due to completing the last statement of its body. -- If the task terminates because of an exception raised by the -- execution of its task body, then Cause is set to Unhandled_Exception. - -- Aborts are not allowed in the restriced profile to which this file + -- Aborts are not allowed in the restricted profile to which this file -- belongs. EO : Exception_Occurrence; diff --git a/gcc/ada/s-tarest.ads b/gcc/ada/s-tarest.ads index 6f0e36b43e6..67583c9f75e 100644 --- a/gcc/ada/s-tarest.ads +++ b/gcc/ada/s-tarest.ads @@ -158,7 +158,7 @@ package System.Tasking.Restricted.Stages is -- single argument to State. -- -- Elaborated is a pointer to a Boolean that must be set to true on exit - -- if the task could be sucessfully elaborated. + -- if the task could be successfully elaborated. -- -- Chain is a linked list of task that needs to be created. On exit, -- Created_Task.Activation_Link will be Chain.T_ID, and Chain.T_ID will be diff --git a/gcc/ada/s-tasdeb.adb b/gcc/ada/s-tasdeb.adb index 05719426d24..8146b97726a 100644 --- a/gcc/ada/s-tasdeb.adb +++ b/gcc/ada/s-tasdeb.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 1997-2007, Free Software Foundation, Inc. -- +-- Copyright (C) 1997-2008, Free Software Foundation, Inc. -- -- -- -- GNARL is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -40,6 +40,7 @@ -- in both normal and restricted (ravenscar) environments. with System.CRTL; +with System.Task_Primitives; with System.Task_Primitives.Operations; with Ada.Unchecked_Conversion; @@ -48,7 +49,7 @@ package body System.Tasking.Debug is package STPO renames System.Task_Primitives.Operations; function To_Integer is new - Ada.Unchecked_Conversion (Task_Id, System.Address); + Ada.Unchecked_Conversion (Task_Id, System.Task_Primitives.Task_Address); type Trace_Flag_Set is array (Character) of Boolean; diff --git a/gcc/ada/s-tasinf-mingw.adb b/gcc/ada/s-tasinf-mingw.adb index c992da54991..33b9c739853 100644 --- a/gcc/ada/s-tasinf-mingw.adb +++ b/gcc/ada/s-tasinf-mingw.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 2007, Free Software Foundation, Inc. -- +-- Copyright (C) 2007-2008, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -48,9 +48,9 @@ package body System.Task_Info is begin if N_CPU = 0 then declare - SI : aliased System.OS_Interface.SYSTEM_INFO; + SI : aliased Win32.SYSTEM_INFO; begin - System.OS_Interface.GetSystemInfo (SI'Access); + Win32.GetSystemInfo (SI'Access); N_CPU := Positive (SI.dwNumberOfProcessors); end; end if; diff --git a/gcc/ada/s-tasinf-mingw.ads b/gcc/ada/s-tasinf-mingw.ads index 056044e5f09..d67c3c18bee 100644 --- a/gcc/ada/s-tasinf-mingw.ads +++ b/gcc/ada/s-tasinf-mingw.ads @@ -6,7 +6,7 @@ -- -- -- S p e c -- -- -- --- Copyright (C) 2007, Free Software Foundation, Inc. -- +-- Copyright (C) 2007-2008, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -43,14 +43,14 @@ -- This is the Windows (native) version of this module -with System.OS_Interface; +with System.Win32; package System.Task_Info is pragma Preelaborate; pragma Elaborate_Body; -- To ensure that a body is allowed - use type System.OS_Interface.ProcessorId; + use type System.Win32.ProcessorId; -- Windows provides a way to define the ideal processor to use for a given -- thread. The ideal processor is not necessarily the one that will be used @@ -80,7 +80,7 @@ package System.Task_Info is -- Thread Attributes -- ----------------------- - subtype CPU_Number is System.OS_Interface.ProcessorId; + subtype CPU_Number is System.Win32.ProcessorId; Any_CPU : constant CPU_Number := -1; diff --git a/gcc/ada/s-tasini.adb b/gcc/ada/s-tasini.adb index 557bf9a8cb3..6719cc05395 100644 --- a/gcc/ada/s-tasini.adb +++ b/gcc/ada/s-tasini.adb @@ -387,7 +387,7 @@ package body System.Tasking.Initialization is -- should not be necessary here, if Abort_Task is implemented correctly, -- since Abort_Task should include the effect of Wakeup. However, the -- above call was in earlier versions of this file, and at least for - -- some targets Abort_Task has not beek doing Wakeup. It should not + -- some targets Abort_Task has not been doing Wakeup. It should not -- hurt to uncomment the above call, until the error is corrected for -- all targets. @@ -402,7 +402,7 @@ package body System.Tasking.Initialization is -- and let it decide if it wants to complete the aborted construct -- immediately. - -- Note that the effect of the lowl-level Abort_Task is not persistent. + -- Note that the effect of the low-level Abort_Task is not persistent. -- If the target task is not blocked, this wakeup will be missed. -- We don't bother calling Abort_Task if this task is aborting itself, @@ -413,7 +413,7 @@ package body System.Tasking.Initialization is -- Note that an earlier version of this code had some false reasoning -- about being able to reliably wake up a task that had suspended on - -- a blocking system call that does not atomically relase the task's + -- a blocking system call that does not atomically release the task's -- lock (e.g., UNIX nanosleep, which we once thought could be used to -- implement delays). That still left the possibility of missed -- wakeups. diff --git a/gcc/ada/s-tasini.ads b/gcc/ada/s-tasini.ads index 41dbc218fb2..020fd33255f 100644 --- a/gcc/ada/s-tasini.ads +++ b/gcc/ada/s-tasini.ads @@ -6,7 +6,7 @@ -- -- -- S p e c -- -- -- --- Copyright (C) 1992-2005, Free Software Foundation, Inc. -- +-- Copyright (C) 1992-2008, Free Software Foundation, Inc. -- -- -- -- GNARL is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -80,7 +80,7 @@ package System.Tasking.Initialization is -- nested. The symptom of over-deferring abort is that an exception may -- fail to be raised, or an abort may fail to take place. - -- Therefore, there are two sets of the inlinable defer/undefer routines, + -- Therefore, there are two sets of the inlineable defer/undefer routines, -- which are the ones to be used inside GNARL. One set allows nesting. The -- other does not. People who maintain the GNARL should try to avoid using -- the nested versions, or at least look very critically at the places @@ -98,8 +98,8 @@ package System.Tasking.Initialization is -- internal calls to the tasking runtime system assume abort is already -- deferred, and do not modify the deferral level. - -- There is also a set of non-linable defer/undefer routines, for direct - -- call from the compiler. These are not in-lineable because they may need + -- There is also a set of non-inlineable defer/undefer routines, for direct + -- call from the compiler. These are not inlineable because they may need -- to be called via pointers ("soft links"). For the sake of efficiency, -- the version with Self_ID as parameter should used wherever possible. -- These are all nestable. @@ -137,7 +137,7 @@ package System.Tasking.Initialization is procedure Change_Base_Priority (T : Task_Id); -- Change the base priority of T. Has to be called with the affected - -- task's ATCB write-locked. May temporariliy release the lock. + -- task's ATCB write-locked. May temporarily release the lock. ---------------------- -- Task Lock/Unlock -- diff --git a/gcc/ada/s-taskin.ads b/gcc/ada/s-taskin.ads index 045f176db02..70e755da016 100644 --- a/gcc/ada/s-taskin.ads +++ b/gcc/ada/s-taskin.ads @@ -60,7 +60,7 @@ package System.Tasking is -- Never undefer abort while holding a lock -- Overlapping critical sections must be properly nested, and locks must - -- be released in LIFO order. e.g., the following is not allowed: + -- be released in LIFO order. E.g., the following is not allowed: -- Lock (X); -- ... @@ -106,6 +106,7 @@ package System.Tasking is type Ada_Task_Control_Block; type Task_Id is access all Ada_Task_Control_Block; + for Task_Id'Size use System.Task_Primitives.Task_Address_Size; Null_Task : constant Task_Id; @@ -117,9 +118,11 @@ package System.Tasking is -- from the run-time system. function To_Task_Id is - new Ada.Unchecked_Conversion (System.Address, Task_Id); + new Ada.Unchecked_Conversion + (System.Task_Primitives.Task_Address, Task_Id); function To_Address is - new Ada.Unchecked_Conversion (Task_Id, System.Address); + new Ada.Unchecked_Conversion + (Task_Id, System.Task_Primitives.Task_Address); ----------------------- -- Enumeration types -- @@ -340,7 +343,7 @@ package System.Tasking is -- Abnormal means that the task terminates because it is being aborted -- handled_Exception means that the task terminates because of exception - -- raised by by the execution of its task_body. + -- raised by the execution of its task_body. type Termination_Handler is access protected procedure (Cause : Cause_Of_Termination; @@ -492,6 +495,11 @@ package System.Tasking is -- Activator writes it, once, before Self starts executing. Thereafter, -- Self only reads it. + Task_Alternate_Stack : System.Address; + -- The address of the alternate signal stack for this task, if any + -- + -- Protection: Only accessed by Self + Task_Entry_Point : Task_Procedure_Access; -- Information needed to call the procedure containing the code for -- the body of this task. @@ -801,7 +809,8 @@ package System.Tasking is ------------------------------------ type Access_Address is access all System.Address; - -- Comment on what this is used for ??? + -- Anonymous pointer used to implement task attributes (see s-tataat.adb + -- and a-tasatt.adb) pragma No_Strict_Aliasing (Access_Address); -- This type is used in contexts where aliasing may be an issue (see diff --git a/gcc/ada/s-taspri-dummy.ads b/gcc/ada/s-taspri-dummy.ads index 06cb9c13d6e..42fdabf9147 100644 --- a/gcc/ada/s-taspri-dummy.ads +++ b/gcc/ada/s-taspri-dummy.ads @@ -54,4 +54,16 @@ package System.Task_Primitives is L : aliased RTS_Lock; end record; + subtype Task_Address is System.Address; + -- In some versions of Task_Primitives, notably for VMS, Task_Address is + -- the short version of address defined in System.Aux_DEC. To avoid + -- dragging Aux_DEC into tasking packages a tasking specific subtype is + -- defined here. + + Task_Address_Size : constant := Standard'Address_Size; + -- The size of Task_Address + + Alternate_Stack_Size : constant := 0; + -- No alternate signal stack is used on this platform + end System.Task_Primitives; diff --git a/gcc/ada/s-taspri-hpux-dce.ads b/gcc/ada/s-taspri-hpux-dce.ads index 9ed8b011129..822b1b76ba1 100644 --- a/gcc/ada/s-taspri-hpux-dce.ads +++ b/gcc/ada/s-taspri-hpux-dce.ads @@ -64,6 +64,18 @@ package System.Task_Primitives is -- A component of this type is guaranteed to be included in the -- Ada_Task_Control_Block. + subtype Task_Address is System.Address; + -- In some versions of Task_Primitives, notably for VMS, Task_Address is + -- the short version of address defined in System.Aux_DEC. To avoid + -- dragging Aux_DEC into tasking packages a tasking specific subtype is + -- defined here. + + Task_Address_Size : constant := Standard'Address_Size; + -- The size of Task_Address + + Alternate_Stack_Size : constant := 0; + -- No alternate signal stack is used on this platform + private type Lock is record L : aliased System.OS_Interface.pthread_mutex_t; diff --git a/gcc/ada/s-taspri-lynxos.ads b/gcc/ada/s-taspri-lynxos.ads index 7d85e67392f..4e08865d831 100644 --- a/gcc/ada/s-taspri-lynxos.ads +++ b/gcc/ada/s-taspri-lynxos.ads @@ -63,6 +63,18 @@ package System.Task_Primitives is -- A component of this type is guaranteed to be included in the -- Ada_Task_Control_Block. + subtype Task_Address is System.Address; + -- In some versions of Task_Primitives, notably for VMS, Task_Address is + -- the short version of address defined in System.Aux_DEC. To avoid + -- dragging Aux_DEC into tasking packages a tasking specific subtype is + -- defined here. + + Task_Address_Size : constant := Standard'Address_Size; + -- The size of Task_Address + + Alternate_Stack_Size : constant := 0; + -- No alternate signal stack is used on this platform + private type Lock is record diff --git a/gcc/ada/s-taspri-mingw.ads b/gcc/ada/s-taspri-mingw.ads index 5997cba640c..f9e13e9d499 100644 --- a/gcc/ada/s-taspri-mingw.ads +++ b/gcc/ada/s-taspri-mingw.ads @@ -38,6 +38,7 @@ pragma Polling (Off); -- operations. It causes infinite loops and other problems. with System.OS_Interface; +with System.Win32; package System.Task_Primitives is pragma Preelaborate; @@ -62,6 +63,18 @@ package System.Task_Primitives is -- A component of this type is guaranteed to be included in the -- Ada_Task_Control_Block. + subtype Task_Address is System.Address; + -- In some versions of Task_Primitives, notably for VMS, Task_Address is + -- the short version of address defined in System.Aux_DEC. To avoid + -- dragging Aux_DEC into tasking packages a tasking specific subtype is + -- defined here. + + Task_Address_Size : constant := Standard'Address_Size; + -- The size of Task_Address + + Alternate_Stack_Size : constant := 0; + -- No alternate signal stack is used on this platform + private type Lock is record @@ -70,7 +83,7 @@ private Owner_Priority : Integer; end record; - type Condition_Variable is new System.OS_Interface.HANDLE; + type Condition_Variable is new System.Win32.HANDLE; type RTS_Lock is new System.OS_Interface.CRITICAL_SECTION; @@ -87,12 +100,12 @@ private L : aliased System.OS_Interface.CRITICAL_SECTION; -- Protection for ensuring mutual exclusion on the Suspension_Object - CV : aliased System.OS_Interface.HANDLE; + CV : aliased Win32.HANDLE; -- Condition variable used to queue threads until condition is signaled end record; type Private_Data is record - Thread : aliased System.OS_Interface.HANDLE; + Thread : aliased Win32.HANDLE; pragma Atomic (Thread); -- Thread field may be updated by two different threads of control. -- (See, Enter_Task and Create_Task in s-taprop.adb). @@ -100,7 +113,7 @@ private -- use lock on those operations and the only thing we have to -- make sure is that they are updated in atomic fashion. - Thread_Id : aliased System.OS_Interface.DWORD; + Thread_Id : aliased Win32.DWORD; -- Used to provide a better tasking support in gdb CV : aliased Condition_Variable; diff --git a/gcc/ada/s-taspri-posix-noaltstack.ads b/gcc/ada/s-taspri-posix-noaltstack.ads new file mode 100644 index 00000000000..2fb8655eb83 --- /dev/null +++ b/gcc/ada/s-taspri-posix-noaltstack.ads @@ -0,0 +1,124 @@ +------------------------------------------------------------------------------ +-- -- +-- GNAT RUN-TIME LIBRARY (GNARL) COMPONENTS -- +-- -- +-- S Y S T E M . T A S K _ P R I M I T I V E S -- +-- -- +-- S p e c -- +-- -- +-- Copyright (C) 1991-1994, Florida State University -- +-- Copyright (C) 1995-2008, AdaCore -- +-- -- +-- GNARL is free software; you can redistribute it and/or modify it under -- +-- terms of the GNU General Public License as published by the Free Soft- -- +-- ware Foundation; either version 2, or (at your option) any later ver- -- +-- sion. GNARL is distributed in the hope that it will be useful, but WITH- -- +-- OUT 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 distributed with GNARL; see file COPYING. If not, write -- +-- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, -- +-- Boston, MA 02110-1301, USA. -- +-- -- +-- As a special exception, if other files instantiate generics from this -- +-- unit, or you link this unit with other files to produce an executable, -- +-- this unit does not by itself cause the resulting executable to be -- +-- covered by the GNU General Public License. This exception does not -- +-- however invalidate any other reasons why the executable file might be -- +-- covered by the GNU Public License. -- +-- -- +-- GNARL was developed by the GNARL team at Florida State University. -- +-- Extensive contributions were provided by Ada Core Technologies, Inc. -- +-- -- +------------------------------------------------------------------------------ + +-- This is a POSIX-like version of this package where no alternate stack +-- is needed for stack checking. + +-- Note: this file can only be used for POSIX compliant systems + +pragma Polling (Off); +-- Turn off polling, we do not want ATC polling to take place during tasking +-- operations. It causes infinite loops and other problems. + +with System.OS_Interface; + +package System.Task_Primitives is + pragma Preelaborate; + + type Lock is limited private; + -- Should be used for implementation of protected objects + + type RTS_Lock is limited private; + -- Should be used inside the runtime system. The difference between Lock + -- and the RTS_Lock is that the later one serves only as a semaphore so + -- that do not check for ceiling violations. + + type Suspension_Object is limited private; + -- Should be used for the implementation of Ada.Synchronous_Task_Control + + type Task_Body_Access is access procedure; + -- Pointer to the task body's entry point (or possibly a wrapper declared + -- local to the GNARL). + + type Private_Data is limited private; + -- Any information that the GNULLI needs maintained on a per-task basis. + -- A component of this type is guaranteed to be included in the + -- Ada_Task_Control_Block. + + subtype Task_Address is System.Address; + -- In some versions of Task_Primitives, notably for VMS, Task_Address is + -- the short version of address defined in System.Aux_DEC. To avoid + -- dragging Aux_DEC into tasking packages a tasking specific subtype is + -- defined here. + + Task_Address_Size : constant := Standard'Address_Size; + -- The size of Task_Address + + Alternate_Stack_Size : constant := 0; + -- No alternate signal stack is used on this platform + +private + + type Lock is new System.OS_Interface.pthread_mutex_t; + type RTS_Lock is new System.OS_Interface.pthread_mutex_t; + + type Suspension_Object is record + State : Boolean; + pragma Atomic (State); + -- Boolean that indicates whether the object is open. This field is + -- marked Atomic to ensure that we can read its value without locking + -- the access to the Suspension_Object. + + Waiting : Boolean; + -- Flag showing if there is a task already suspended on this object + + L : aliased System.OS_Interface.pthread_mutex_t; + -- Protection for ensuring mutual exclusion on the Suspension_Object + + CV : aliased System.OS_Interface.pthread_cond_t; + -- Condition variable used to queue threads until condition is signaled + end record; + + type Private_Data is record + Thread : aliased System.OS_Interface.pthread_t; + pragma Atomic (Thread); + -- Thread field may be updated by two different threads of control. + -- (See, Enter_Task and Create_Task in s-taprop.adb). They put the same + -- value (thr_self value). We do not want to use lock on those + -- operations and the only thing we have to make sure is that they are + -- updated in atomic fashion. + + LWP : aliased System.Address; + -- The purpose of this field is to provide a better tasking support on + -- gdb. The order of the two first fields (Thread and LWP) is important. + -- On targets where lwp is not relevant, this is equivalent to Thread. + + CV : aliased System.OS_Interface.pthread_cond_t; + -- Should be commented ??? (in all versions of taspri) + + L : aliased RTS_Lock; + -- Protection for all components is lock L + end record; + +end System.Task_Primitives; diff --git a/gcc/ada/s-taspri-posix.ads b/gcc/ada/s-taspri-posix.ads index c59a780c161..23723f829a4 100644 --- a/gcc/ada/s-taspri-posix.ads +++ b/gcc/ada/s-taspri-posix.ads @@ -65,6 +65,18 @@ package System.Task_Primitives is -- A component of this type is guaranteed to be included in the -- Ada_Task_Control_Block. + subtype Task_Address is System.Address; + -- In some versions of Task_Primitives, notably for VMS, Task_Address is + -- the short version of address defined in System.Aux_DEC. To avoid + -- dragging Aux_DEC into tasking packages a tasking specific subtype is + -- defined here. + + Task_Address_Size : constant := Standard'Address_Size; + -- The size of Task_Address + + Alternate_Stack_Size : constant := System.OS_Interface.Alternate_Stack_Size; + -- Import value from System.OS_Interface + private type Lock is new System.OS_Interface.pthread_mutex_t; diff --git a/gcc/ada/s-taspri-solaris.ads b/gcc/ada/s-taspri-solaris.ads index 810f89c61a6..0bf5139ef15 100644 --- a/gcc/ada/s-taspri-solaris.ads +++ b/gcc/ada/s-taspri-solaris.ads @@ -71,6 +71,18 @@ package System.Task_Primitives is -- A component of this type is guaranteed to be included in the -- Ada_Task_Control_Block. + subtype Task_Address is System.Address; + -- In some versions of Task_Primitives, notably for VMS, Task_Address is + -- the short version of address defined in System.Aux_DEC. To avoid + -- dragging Aux_DEC into tasking packages a tasking specific subtype is + -- defined here. + + Task_Address_Size : constant := Standard'Address_Size; + -- The size of Task_Address + + Alternate_Stack_Size : constant := 0; + -- No alternate signal stack is used on this platform + private type Private_Task_Serial_Number is mod 2 ** 64; diff --git a/gcc/ada/s-taspri-tru64.ads b/gcc/ada/s-taspri-tru64.ads index d666dfea396..50760c5d651 100644 --- a/gcc/ada/s-taspri-tru64.ads +++ b/gcc/ada/s-taspri-tru64.ads @@ -65,6 +65,18 @@ package System.Task_Primitives is -- Any information that the GNULLI needs maintained on a per-task basis. -- A component of this type is guaranteed to be included + subtype Task_Address is System.Address; + -- In some versions of Task_Primitives, notably for VMS, Task_Address is + -- the short version of address defined in System.Aux_DEC. To avoid + -- dragging Aux_DEC into tasking packages a tasking specific subtype is + -- defined here. + + Task_Address_Size : constant := Standard'Address_Size; + -- The size of Task_Address + + Alternate_Stack_Size : constant := 0; + -- No alternate signal stack is used on this platform + private type Lock is record diff --git a/gcc/ada/s-taspri-vms.ads b/gcc/ada/s-taspri-vms.ads index d2e78cb6cb6..8f5cb28bc59 100644 --- a/gcc/ada/s-taspri-vms.ads +++ b/gcc/ada/s-taspri-vms.ads @@ -42,6 +42,7 @@ pragma Polling (Off); with Interfaces.C; with System.OS_Interface; +with System.Aux_DEC; package System.Task_Primitives is pragma Preelaborate; @@ -66,6 +67,17 @@ package System.Task_Primitives is -- A component of this type is guaranteed to be included in the -- Ada_Task_Control_Block. + subtype Task_Address is System.Aux_DEC.Short_Address; + -- Task_Address is the short version of address defined in System.Aux_DEC. + -- To avoid dragging Aux_DEC into tasking packages a tasking specific + -- subtype is defined here. + + Task_Address_Size : constant := System.Aux_DEC.Short_Address_Size; + -- The size of Task_Address + + Alternate_Stack_Size : constant := 0; + -- No alternate signal stack is used on this platform + private type Exc_Stack_T is array (0 .. 8192) of aliased Character; diff --git a/gcc/ada/s-tasque.ads b/gcc/ada/s-tasque.ads index d8a23a04aad..858bd7ba98c 100644 --- a/gcc/ada/s-tasque.ads +++ b/gcc/ada/s-tasque.ads @@ -6,7 +6,7 @@ -- -- -- S p e c -- -- -- --- Copyright (C) 1992-2006, Free Software Foundation, Inc. -- +-- Copyright (C) 1992-2008, Free Software Foundation, Inc. -- -- -- -- GNARL is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -95,7 +95,7 @@ package System.Tasking.Queuing is procedure Requeue_Call_With_New_Prio (Entry_Call : Entry_Call_Link; Prio : System.Any_Priority); -- Change Priority of the call and re insert to the queue when priority - -- queueing is in effect. When FIFO is inforced, this routine + -- queueing is in effect. When FIFO is enforced, this routine -- should not have any effect. end System.Tasking.Queuing; diff --git a/gcc/ada/s-tassta.adb b/gcc/ada/s-tassta.adb index 22da42bb08f..65cc80b24f7 100644 --- a/gcc/ada/s-tassta.adb +++ b/gcc/ada/s-tassta.adb @@ -40,6 +40,7 @@ with Ada.Unchecked_Deallocation; with System.Tasking.Debug; with System.Address_Image; +with System.Task_Primitives; with System.Task_Primitives.Operations; with System.Tasking.Utilities; with System.Tasking.Queuing; @@ -55,7 +56,7 @@ with System.Stack_Usage; with System.Soft_Links; -- These are procedure pointers to non-tasking routines that use task -- specific data. In the absence of tasking, these routines refer to global --- data. In the presense of tasking, they must be replaced with pointers to +-- data. In the presence of tasking, they must be replaced with pointers to -- task-specific versions. Also used for Create_TSD, Destroy_TSD, -- Get_Current_Excep, Finalize_Global_List, Task_Termination, Handler. @@ -111,7 +112,7 @@ package body System.Tasking.Stages is procedure Vulnerable_Complete_Task (Self_ID : Task_Id); -- Complete the calling task. This procedure must be called with -- abort deferred. It should only be called by Complete_Task and - -- Finalizate_Global_Tasks (for the environment task). + -- Finalize_Global_Tasks (for the environment task). procedure Vulnerable_Complete_Master (Self_ID : Task_Id); -- Complete the current master of the calling task. This procedure @@ -135,9 +136,6 @@ package body System.Tasking.Stages is -- For tasks created by an allocator that fails, due to an exception, it is -- called from Expunge_Unactivated_Tasks. -- - -- It is also called from Ada.Unchecked_Deallocation, for objects that are - -- or contain tasks. - -- -- Different code is used at master completion, in Terminate_Dependents, -- due to a need for tighter synchronization with the master. @@ -408,8 +406,7 @@ package body System.Tasking.Stages is Initialization.Undefer_Abort_Nestable (Self_ID); - -- ??? - -- Why do we need to allow for nested deferral here? + -- ??? Why do we need to allow for nested deferral here? if Runtime_Traces then Send_Trace_Info (T_Activate); @@ -457,17 +454,18 @@ package body System.Tasking.Stages is -- called to create a new task. procedure Create_Task - (Priority : Integer; - Size : System.Parameters.Size_Type; - Task_Info : System.Task_Info.Task_Info_Type; - Num_Entries : Task_Entry_Index; - Master : Master_Level; - State : Task_Procedure_Access; - Discriminants : System.Address; - Elaborated : Access_Boolean; - Chain : in out Activation_Chain; - Task_Image : String; - Created_Task : out Task_Id) + (Priority : Integer; + Size : System.Parameters.Size_Type; + Task_Info : System.Task_Info.Task_Info_Type; + Relative_Deadline : Ada.Real_Time.Time_Span; + Num_Entries : Task_Entry_Index; + Master : Master_Level; + State : Task_Procedure_Access; + Discriminants : System.Address; + Elaborated : Access_Boolean; + Chain : in out Activation_Chain; + Task_Image : String; + Created_Task : out Task_Id) is T, P : Task_Id; Self_ID : constant Task_Id := STPO.Self; @@ -475,6 +473,10 @@ package body System.Tasking.Stages is Base_Priority : System.Any_Priority; Len : Natural; + pragma Unreferenced (Relative_Deadline); + -- EDF scheduling is not supported by any of the target platforms so + -- this parameter is not passed any further. + begin -- If Master is greater than the current master, it means that Master -- has already awaited its dependent tasks. This raises Program_Error, @@ -749,7 +751,7 @@ package body System.Tasking.Stages is Unlock_RTS; end if; - -- We need to explicitely wait for the task to be terminated here + -- We need to explicitly wait for the task to be terminated here -- because on true concurrent system, we may end this procedure before -- the tasks are really terminated. @@ -829,6 +831,7 @@ package body System.Tasking.Stages is Initialization.Task_Lock (Self_Id); Lock_RTS; + Initialization.Finalize_Attributes_Link.all (T); Initialization.Remove_From_All_Tasks_List (T); Unlock_RTS; @@ -896,12 +899,12 @@ package body System.Tasking.Stages is -- Task_Wrapper -- ------------------ - -- The task wrapper is a procedure that is called first for each task - -- task body, and which in turn calls the compiler-generated task body - -- procedure. The wrapper's main job is to do initialization for the task. - -- It also has some locally declared objects that server as per-task local - -- data. Task finalization is done by Complete_Task, which is called from - -- an at-end handler that the compiler generates. + -- The task wrapper is a procedure that is called first for each task body + -- and which in turn calls the compiler-generated task body procedure. + -- The wrapper's main job is to do initialization for the task. It also + -- has some locally declared objects that serve as per-task local data. + -- Task finalization is done by Complete_Task, which is called from an + -- at-end handler that the compiler generates. procedure Task_Wrapper (Self_ID : Task_Id) is use type SSE.Storage_Offset; @@ -910,6 +913,13 @@ package body System.Tasking.Stages is Bottom_Of_Stack : aliased Integer; + Task_Alternate_Stack : + aliased SSE.Storage_Array (1 .. Alternate_Stack_Size); + -- The alternate signal stack for this task, if any + + Use_Alternate_Stack : constant Boolean := Alternate_Stack_Size /= 0; + -- Whether to use above alternate signal stack for stack overflows + Secondary_Stack_Size : constant SSE.Storage_Offset := Self_ID.Common.Compiler_Data.Pri_Stack_Info.Size * @@ -921,6 +931,9 @@ package body System.Tasking.Stages is -- Why are warnings being turned off here??? Secondary_Stack_Address : System.Address := Secondary_Stack'Address; + -- Address of secondary stack. In the fixed secondary stack case, this + -- value is not modified, causing a warning, hence the bracketing with + -- Warnings (Off/On). But why is so much *more* bracketed??? Small_Overflow_Guard : constant := 12 * 1024; -- Note: this used to be 4K, but was changed to 12K, since smaller @@ -939,9 +952,6 @@ package body System.Tasking.Stages is -- Size of the overflow guard, used by dynamic stack usage analysis pragma Warnings (On); - -- Address of secondary stack. In the fixed secondary stack case, this - -- value is not modified, causing a warning, hence the bracketing with - -- Warnings (Off/On). But why is so much *more* bracketed ??? SEH_Table : aliased SSE.Storage_Array (1 .. 8); -- Structured Exception Registration table (2 words) @@ -1017,6 +1027,10 @@ package body System.Tasking.Stages is Size := Size - Natural (Secondary_Stack_Size); end if; + if Use_Alternate_Stack then + Self_ID.Common.Task_Alternate_Stack := Task_Alternate_Stack'Address; + end if; + if System.Stack_Usage.Is_Enabled then STPO.Lock_RTS; Initialize_Analyzer (Self_ID.Common.Analyzer, @@ -1309,7 +1323,8 @@ package body System.Tasking.Stages is use System.Standard_Library; function To_Address is new - Ada.Unchecked_Conversion (Task_Id, System.Address); + Ada.Unchecked_Conversion + (Task_Id, System.Task_Primitives.Task_Address); function Tailored_Exception_Information (E : Exception_Occurrence) return String; @@ -1868,7 +1883,7 @@ package body System.Tasking.Stages is -- Package elaboration code begin - -- Establish the Adafinal softlink + -- Establish the Adafinal oftlink -- This is not done inside the central RTS initialization routine -- to avoid with-ing this package from System.Tasking.Initialization. diff --git a/gcc/ada/s-tassta.ads b/gcc/ada/s-tassta.ads index e96e2d906e7..36f0fbfc3f2 100644 --- a/gcc/ada/s-tassta.ads +++ b/gcc/ada/s-tassta.ads @@ -44,6 +44,8 @@ with System.Task_Info; with System.Parameters; +with Ada.Real_Time; + package System.Tasking.Stages is pragma Elaborate_Body; @@ -81,8 +83,8 @@ package System.Tasking.Stages is -- _init.discr := discr; -- _init._task_id := null; -- create_task (unspecified_priority, tZ, - -- unspecified_task_info, 0, _master, - -- task_procedure_access!(tB'address), + -- unspecified_task_info, ada__real_time__time_span_zero, 0, + -- _master, task_procedure_access!(tB'address), -- _init'address, tE'unchecked_access, _chain, _task_id, _init. -- _task_id); -- return; @@ -167,17 +169,18 @@ package System.Tasking.Stages is -- now in order to wake up the activator (the environment task). procedure Create_Task - (Priority : Integer; - Size : System.Parameters.Size_Type; - Task_Info : System.Task_Info.Task_Info_Type; - Num_Entries : Task_Entry_Index; - Master : Master_Level; - State : Task_Procedure_Access; - Discriminants : System.Address; - Elaborated : Access_Boolean; - Chain : in out Activation_Chain; - Task_Image : String; - Created_Task : out Task_Id); + (Priority : Integer; + Size : System.Parameters.Size_Type; + Task_Info : System.Task_Info.Task_Info_Type; + Relative_Deadline : Ada.Real_Time.Time_Span; + Num_Entries : Task_Entry_Index; + Master : Master_Level; + State : Task_Procedure_Access; + Discriminants : System.Address; + Elaborated : Access_Boolean; + Chain : in out Activation_Chain; + Task_Image : String; + Created_Task : out Task_Id); -- Compiler interface only. Do not call from within the RTS. -- This must be called to create a new task. -- @@ -186,12 +189,14 @@ package System.Tasking.Stages is -- Size is the stack size of the task to create -- Task_Info is the task info associated with the created task, or -- Unspecified_Task_Info if none. + -- Relative_Deadline is the relative deadline associated with the created + -- task by means of a pragma Relative_Deadline, or 0.0 if none. -- State is the compiler generated task's procedure body -- Discriminants is a pointer to a limited record whose discriminants -- are those of the task to create. This parameter should be passed as -- the single argument to State. -- Elaborated is a pointer to a Boolean that must be set to true on exit - -- if the task could be sucessfully elaborated. + -- if the task could be successfully elaborated. -- Chain is a linked list of task that needs to be created. On exit, -- Created_Task.Activation_Link will be Chain.T_ID, and Chain.T_ID -- will be Created_Task (e.g the created task will be linked at the front diff --git a/gcc/ada/s-tasuti.ads b/gcc/ada/s-tasuti.ads index 286b5a0d70c..83709f704b0 100644 --- a/gcc/ada/s-tasuti.ads +++ b/gcc/ada/s-tasuti.ads @@ -6,7 +6,7 @@ -- -- -- S p e c -- -- -- --- Copyright (C) 1992-2007, Free Software Foundation, Inc. -- +-- Copyright (C) 1992-2008, Free Software Foundation, Inc. -- -- -- -- GNARL is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -35,11 +35,12 @@ -- These declarations are not part of the GNARLI with Ada.Unchecked_Conversion; +with System.Task_Primitives; package System.Tasking.Utilities is function ATCB_To_Address is new - Ada.Unchecked_Conversion (Task_Id, System.Address); + Ada.Unchecked_Conversion (Task_Id, System.Task_Primitives.Task_Address); --------------------------------- -- Task_Stage Related routines -- @@ -94,7 +95,7 @@ package System.Tasking.Utilities is procedure Abort_Tasks (Tasks : Task_List); -- Abort_Tasks is called to initiate abort, however, the actual - -- aborti is done by aborted task by means of Abort_Handler + -- aborting is done by aborted task by means of Abort_Handler procedure Make_Passive (Self_ID : Task_Id; Task_Completed : Boolean); -- Update counts to indicate current task is either terminated or diff --git a/gcc/ada/s-tpoben.adb b/gcc/ada/s-tpoben.adb index fd8a16814e8..986a30af9e8 100644 --- a/gcc/ada/s-tpoben.adb +++ b/gcc/ada/s-tpoben.adb @@ -239,7 +239,7 @@ package body System.Tasking.Protected_Objects.Entries is raise Program_Error; end if; - -- The lock is made without defering abort + -- The lock is made without deferring abort -- Therefore the abort has to be deferred before calling this routine. -- This means that the compiler has to generate a Defer_Abort call @@ -311,7 +311,7 @@ package body System.Tasking.Protected_Objects.Entries is -- have read ownership of the protected object, so that this method of -- storing the (single) protected object's owner does not work -- reliably for read locks. However, this is the approach taken for two - -- major reasosn: first, this function is not currently being used (it + -- major reasons: first, this function is not currently being used (it -- is provided for possible future use), and second, it largely -- simplifies the implementation. diff --git a/gcc/ada/s-tpoben.ads b/gcc/ada/s-tpoben.ads index afbdc6bac0d..9feba091396 100644 --- a/gcc/ada/s-tpoben.ads +++ b/gcc/ada/s-tpoben.ads @@ -159,7 +159,7 @@ package System.Tasking.Protected_Objects.Entries is (Object : Protection_Entries_Access) return Boolean; -- Returns True if an Interrupt_Handler or Attach_Handler pragma applies -- to the protected object. That is to say this primitive returns False for - -- Protection, but is overriden to return True when interrupt handlers are + -- Protection, but is overridden to return True when interrupt handlers are -- declared so the check required by C.3.1(11) can be implemented in -- System.Tasking.Protected_Objects.Initialize_Protection. diff --git a/gcc/ada/s-tpobop.adb b/gcc/ada/s-tpobop.adb index 7ff99e5e34d..8ad468c7be8 100644 --- a/gcc/ada/s-tpobop.adb +++ b/gcc/ada/s-tpobop.adb @@ -506,7 +506,7 @@ package body System.Tasking.Protected_Objects.Operations is -- See also Cancel_Protected_Entry_Call for code expansion of asynchronous -- entry call. - -- The initial part of this procedure does not need to lock the the calling + -- The initial part of this procedure does not need to lock the calling -- task's ATCB, up to the point where the call record first may be queued -- (PO_Do_Or_Queue), since before that no other task will have access to -- the record. @@ -520,7 +520,7 @@ package body System.Tasking.Protected_Objects.Operations is -- There are some heuristics here, just to save time for frequently -- occurring cases. For example, we check Initially_Abortable to try to -- avoid calling the procedure Wait_Until_Abortable, since the normal case - -- for async. entry calls is to be queued abortably. + -- for async. entry calls is to be queued abortably. -- Another heuristic uses the Block.Enqueued to try to avoid calling -- Cancel_Protected_Entry_Call if the call can be served immediately. diff --git a/gcc/ada/s-tpobop.ads b/gcc/ada/s-tpobop.ads index 8620c796f43..0e409aa7efa 100644 --- a/gcc/ada/s-tpobop.ads +++ b/gcc/ada/s-tpobop.ads @@ -198,6 +198,15 @@ private end record; pragma Volatile (Communication_Block); + -- When a program contains limited interfaces, the compiler generates the + -- predefined primitives associated with dispatching selects. One of the + -- parameters of these routines is of type Communication_Block. Even if + -- the program lacks implementing concurrent types, the tasking runtime is + -- dragged in unconditionally because of Communication_Block. To avoid this + -- case, the compiler uses type Dummy_Communication_Block which defined in + -- System.Soft_Links. If the structure of Communication_Block is changed, + -- the corresponding dummy type must be changed as well. + -- The Communication_Block seems to be a relic. At the moment, the -- compiler seems to be generating unnecessary conditional code based on -- this block. See the code generated for async. select with task entry diff --git a/gcc/ada/s-tpopde-vms.adb b/gcc/ada/s-tpopde-vms.adb index c222c0cdad9..e552efa5699 100644 --- a/gcc/ada/s-tpopde-vms.adb +++ b/gcc/ada/s-tpopde-vms.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 2000-2007, Free Software Foundation, Inc. -- +-- Copyright (C) 2000-2008, Free Software Foundation, Inc. -- -- -- -- GNARL is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -69,17 +69,12 @@ package body System.Task_Primitives.Operations.DEC is -- Local Subprograms -- ----------------------- - pragma Warnings (Off); - -- Task_Id is 64 bits wide (but only 32 bits significant) on Integrity/VMS - function To_Unsigned_Longword is new Ada.Unchecked_Conversion (Task_Id, Unsigned_Longword); function To_Task_Id is new Ada.Unchecked_Conversion (Unsigned_Longword, Task_Id); - pragma Warnings (On); - function To_FAB_RAB is new Ada.Unchecked_Conversion (Address, FAB_RAB_Access_Type); diff --git a/gcc/ada/s-tpopsp-posix.adb b/gcc/ada/s-tpopsp-posix.adb index 0b7f2779822..866a4054070 100644 --- a/gcc/ada/s-tpopsp-posix.adb +++ b/gcc/ada/s-tpopsp-posix.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 1992-2007, Free Software Foundation, Inc. -- +-- Copyright (C) 1992-2008, Free Software Foundation, Inc. -- -- -- -- GNARL is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- diff --git a/gcc/ada/s-tpopsp-rtems.adb b/gcc/ada/s-tpopsp-rtems.adb index adfaf11d961..81afc79cb7b 100644 --- a/gcc/ada/s-tpopsp-rtems.adb +++ b/gcc/ada/s-tpopsp-rtems.adb @@ -10,6 +10,7 @@ -- $Revision: 1.2 $ -- -- -- Copyright (C) 1991-2003, Florida State University -- +-- Copyright (C) 2008, Free Software Foundation, Inc. -- -- -- -- GNARL is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -36,7 +37,7 @@ ------------------------------------------------------------------------------ -- This is a RTEMS version of this package which uses a special --- variable for Ada self which is contexted switch implicitly by RTEMS. +-- variable for Ada self which is context switched implicitly by RTEMS. -- -- This is the same as the POSIX version except that an RTEMS variable -- is used instead of a POSIX key. diff --git a/gcc/ada/s-tposen.adb b/gcc/ada/s-tposen.adb index cfa7d3a7e7e..dfa4c03beba 100644 --- a/gcc/ada/s-tposen.adb +++ b/gcc/ada/s-tposen.adb @@ -407,7 +407,7 @@ package body System.Tasking.Protected_Objects.Single_Entry is -- have read ownership of the protected object, so that this method of -- storing the (single) protected object's owner does not work -- reliably for read locks. However, this is the approach taken for two - -- major reasosn: first, this function is not currently being used (it + -- major reasons: first, this function is not currently being used (it -- is provided for possible future use), and second, it largely -- simplifies the implementation. diff --git a/gcc/ada/s-tposen.ads b/gcc/ada/s-tposen.ads index f8bf9114409..90e8bb37374 100644 --- a/gcc/ada/s-tposen.ads +++ b/gcc/ada/s-tposen.ads @@ -204,7 +204,7 @@ package System.Tasking.Protected_Objects.Single_Entry is -- Lock a protected object for read access. Upon return, the caller -- owns the lock for read access, and no other calls to Lock -- with the same argument will return until the corresponding call - -- to Unlock has been made by the caller. Other cals to Lock_Read_Only + -- to Unlock has been made by the caller. Other calls to Lock_Read_Only -- may (but need not) return before the call to Unlock, and the -- corresponding callers will also own the lock for read access. diff --git a/gcc/ada/s-traceb-hpux.adb b/gcc/ada/s-traceb-hpux.adb index c2718af3f60..d8cf7872616 100644 --- a/gcc/ada/s-traceb-hpux.adb +++ b/gcc/ada/s-traceb-hpux.adb @@ -8,6 +8,7 @@ -- B o d y -- -- -- -- Copyright (C) 1999-2006, AdaCore -- +-- Copyright (C) 2008, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -86,7 +87,7 @@ package body System.Traceback is -- Frames with dynamic stack allocation are handled using the associated -- frame pointer, but HP compilers and GCC setup this pointer differently. -- HP compilers set it to point at the top (highest address) of the static - -- part of the frame, wheras GCC sets it to point at the bottom of this + -- part of the frame, whereas GCC sets it to point at the bottom of this -- region. We have to fake the unwinder to compensate for this difference, -- for which we'll need to access some subprograms unwind descriptors. diff --git a/gcc/ada/s-traces.ads b/gcc/ada/s-traces.ads index c42cc516820..03897acff06 100644 --- a/gcc/ada/s-traces.ads +++ b/gcc/ada/s-traces.ads @@ -6,7 +6,7 @@ -- -- -- S p e c -- -- -- --- Copyright (C) 2001-2007, Free Software Foundation, Inc. -- +-- Copyright (C) 2001-2008, Free Software Foundation, Inc. -- -- -- -- GNARL is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -40,17 +40,17 @@ -- A new primitive, Send_Trace_Info (Id : Trace_T; 'data') is introduced. -- Trace_T is an event identifier, 'data' are the informations to pass --- with the event. Thid procedure is used from within the Runtime to send +-- with the event. This procedure is used from within the Runtime to send -- debug informations. -- This primitive is overloaded in System.Traces.Tasking and this package --- Send_Trace_Info calls Send_Trace, in System.Traces.Send, which is trarget +-- Send_Trace_Info calls Send_Trace, in System.Traces.Send, which is target -- dependent, to send the debug informations to a debugger, stream .. -- To add a new event, just add them to the Trace_T type, and write the -- corresponding Send_Trace_Info procedure. It may be required for some --- target to modify Send_Trace (eg. VxWorks). +-- target to modify Send_Trace (e.g. VxWorks). -- To add a new target, just adapt System.Traces.Send to your own purposes diff --git a/gcc/ada/s-trafor-default.ads b/gcc/ada/s-trafor-default.ads index 182ade1ba94..bc5b193e83f 100644 --- a/gcc/ada/s-trafor-default.ads +++ b/gcc/ada/s-trafor-default.ads @@ -6,7 +6,7 @@ -- -- -- S p e c -- -- -- --- Copyright (C) 2001-2007, Free Software Foundation, Inc. -- +-- Copyright (C) 2001-2008, Free Software Foundation, Inc. -- -- -- -- GNARL is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -42,7 +42,7 @@ package System.Traces.Format is subtype String_Trace is String (1 .. Max_Size); -- Specific type in which trace information is stored. An ASCII.NUL -- character ends the string so that it is compatible with C strings - -- which is useful on some targets (eg. VxWorks) + -- which is useful on some targets (e.g. VxWorks) -- These private functions handles String_Trace formatting diff --git a/gcc/ada/s-unstyp.ads b/gcc/ada/s-unstyp.ads index c87d651c5d6..0609e0b0345 100644 --- a/gcc/ada/s-unstyp.ads +++ b/gcc/ada/s-unstyp.ads @@ -6,7 +6,7 @@ -- -- -- S p e c -- -- -- --- Copyright (C) 1992-2007, Free Software Foundation, Inc. -- +-- Copyright (C) 1992-2008, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -55,7 +55,7 @@ package System.Unsigned_Types is type Packed_Byte is mod 2 ** 8; for Packed_Byte'Size use 8; - -- Component type for Packed_Butes array + -- Component type for Packed_Bytes array type Packed_Bytes1 is array (Natural range <>) of Packed_Byte; for Packed_Bytes1'Alignment use 1; @@ -200,7 +200,7 @@ package System.Unsigned_Types is pragma Import (Intrinsic, Rotate_Left); pragma Import (Intrinsic, Rotate_Right); - -- The following definitions are obsolsecent. They were needed by the + -- The following definitions are obsolescent. They were needed by the -- previous version of the compiler and runtime, but are not needed -- by the current version. We retain them to help with bootstrap path -- problems. Also they seem harmless, and if any user programs have diff --git a/gcc/ada/s-utf_32.ads b/gcc/ada/s-utf_32.ads index 8f6fab9c4fd..c189be4aaf7 100755 --- a/gcc/ada/s-utf_32.ads +++ b/gcc/ada/s-utf_32.ads @@ -6,7 +6,7 @@ -- -- -- S p e c -- -- -- --- Copyright (C) 2005-2007, Free Software Foundation, Inc. -- +-- Copyright (C) 2005-2008, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -117,14 +117,14 @@ package System.UTF_32 is function Is_UTF_32_Digit (U : UTF_32) return Boolean; function Is_UTF_32_Digit (C : Category) return Boolean; pragma Inline (Is_UTF_32_Digit); - -- Returns true iff U is a digit that can be used to extend an identifer, + -- Returns true iff U is a digit that can be used to extend an identifier, -- or if C is one of the corresponding categories, which are the following: -- Number, Decimal_Digit (Nd) function Is_UTF_32_Line_Terminator (U : UTF_32) return Boolean; pragma Inline (Is_UTF_32_Line_Terminator); -- Returns true iff U is an allowed line terminator for source programs, - -- if U is in the category Zp (Separator, Paragaph), or Zs (Separator, + -- if U is in the category Zp (Separator, Paragraph), or Zs (Separator, -- Line), or if U is a conventional line terminator (CR, LF, VT, FF). -- There is no category version for this function, since the set of -- characters does not correspond to a set of Unicode categories. @@ -143,7 +143,7 @@ package System.UTF_32 is pragma Inline (Is_UTF_32_Other); -- Returns true iff U is an other format character, which means that it -- can be used to extend an identifier, but is ignored for the purposes of - -- matching of identiers, or if C is one of the corresponding categories, + -- matching of identifiers, or if C is one of the corresponding categories, -- which are the following: -- Other, Format (Cf) @@ -151,7 +151,7 @@ package System.UTF_32 is function Is_UTF_32_Punctuation (C : Category) return Boolean; pragma Inline (Is_UTF_32_Punctuation); -- Returns true iff U is a punctuation character that can be used to - -- separate pices of an identifier, or if C is one of the corresponding + -- separate pieces of an identifier, or if C is one of the corresponding -- categories, which are the following: -- Punctuation, Connector (Pc) @@ -177,7 +177,7 @@ package System.UTF_32 is -- Note that the Ada category format effector is subsumed by the above -- list of Unicode categories. -- - -- Note that Other, Unassiged (Cn) is quite deliberately not included + -- Note that Other, Unassigned (Cn) is quite deliberately not included -- in the list of categories above. This means that should any of these -- code positions be defined in future with graphic characters they will -- be allowed without a need to change implementations or the standard. diff --git a/gcc/ada/s-vaflop.adb b/gcc/ada/s-vaflop.adb index 3cf96e26e93..0741664082b 100644 --- a/gcc/ada/s-vaflop.adb +++ b/gcc/ada/s-vaflop.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 1997-2005, Free Software Foundation, Inc. -- +-- Copyright (C) 1997-2008, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -33,7 +33,7 @@ -- This is a dummy body for use on non-Alpha systems so that the library -- can compile. This dummy version uses ordinary conversions and other --- arithmetic operations. it is used only for testing purposes in the +-- arithmetic operations. It is used only for testing purposes in the -- case where the -gnatdm switch is used to force testing of VMS features -- on non-VMS systems. diff --git a/gcc/ada/s-vaflop.ads b/gcc/ada/s-vaflop.ads index 9f205d48338..47e991a3b33 100644 --- a/gcc/ada/s-vaflop.ads +++ b/gcc/ada/s-vaflop.ads @@ -6,7 +6,7 @@ -- -- -- S p e c -- -- -- --- Copyright (C) 1997-2005, Free Software Foundation, Inc. -- +-- Copyright (C) 1997-2008, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -175,7 +175,7 @@ package System.Vax_Float_Operations is -- These routines return a decimal C string image of their argument. -- They are provided for implicit use by the debugger, in response to -- the special encoding used for Vax floating-point types (see Exp_Dbug - -- for details). They supercede the above Debug_Output_D/F/G routines + -- for details). They supersede the above Debug_Output_D/F/G routines -- which didn't work properly with GDBTK. procedure pd (Arg : D); diff --git a/gcc/ada/s-valrea.adb b/gcc/ada/s-valrea.adb index ead49f80649..f1d89052a06 100644 --- a/gcc/ada/s-valrea.adb +++ b/gcc/ada/s-valrea.adb @@ -82,7 +82,7 @@ package body System.Val_Real is Num_Saved_Zeroes : Natural := 0; -- This counts zeroes after the decimal point. A non-zero value means - -- that this number of previously scanned digits are zero. if the end + -- that this number of previously scanned digits are zero. If the end -- of the number is reached, these zeroes are simply discarded, which -- ensures that trailing zeroes after the point never affect the value -- (which might otherwise happen as a result of rounding). With this diff --git a/gcc/ada/s-valuti.adb b/gcc/ada/s-valuti.adb index 50be73acd9f..7683d3a9cb8 100644 --- a/gcc/ada/s-valuti.adb +++ b/gcc/ada/s-valuti.adb @@ -294,8 +294,8 @@ package body System.Val_Util is P := P + 1; -- If underscore is at the end of string, then this is an error and - -- we raise Constraint_Error, leaving the pointer past the undescore. - -- This seems a bit strange. It means e,g, that if the field is: + -- we raise Constraint_Error, leaving the pointer past the underscore. + -- This seems a bit strange. It means e.g. that if the field is: -- 345_ diff --git a/gcc/ada/s-valwch.adb b/gcc/ada/s-valwch.adb index 40a2181d821..e65c4df0575 100644 --- a/gcc/ada/s-valwch.adb +++ b/gcc/ada/s-valwch.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 1992-2006, Free Software Foundation, Inc. -- +-- Copyright (C) 1992-2008, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -50,8 +50,8 @@ package body System.Val_WChar is WV : constant Unsigned_32 := Wide_Wide_Character'Pos (WC); begin if WV > 16#FFFF# then - raise Constraint_Error - with "out of range character for Value attribute"; + raise Constraint_Error with + "out of range character for Value attribute"; else return Wide_Character'Val (WV); end if; diff --git a/gcc/ada/s-vxwext-kernel.ads b/gcc/ada/s-vxwext-kernel.ads new file mode 100644 index 00000000000..bb3df913514 --- /dev/null +++ b/gcc/ada/s-vxwext-kernel.ads @@ -0,0 +1,65 @@ +------------------------------------------------------------------------------ +-- -- +-- GNAT RUN-TIME LIBRARY (GNARL) COMPONENTS -- +-- -- +-- S Y S T E M . V X W O R K S . E X T -- +-- -- +-- S p e c -- +-- -- +-- Copyright (C) 2008, Free Software Foundation, Inc. -- +-- -- +-- GNARL is free software; you can redistribute it and/or modify it under -- +-- terms of the GNU General Public License as published by the Free Soft- -- +-- ware Foundation; either version 2, or (at your option) any later ver- -- +-- sion. GNARL is distributed in the hope that it will be useful, but WITH- -- +-- OUT 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 distributed with GNARL; see file COPYING. If not, write -- +-- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, -- +-- Boston, MA 02110-1301, USA. -- +-- -- +-- As a special exception, if other files instantiate generics from this -- +-- unit, or you link this unit with other files to produce an executable, -- +-- this unit does not by itself cause the resulting executable to be -- +-- covered by the GNU General Public License. This exception does not -- +-- however invalidate any other reasons why the executable file might be -- +-- covered by the GNU Public License. -- +-- -- +------------------------------------------------------------------------------ + +-- This package provides vxworks specific support functions needed +-- by System.OS_Interface. + +-- This is the VxWorks 6 kernel version of this package + +with Interfaces.C; + +package System.VxWorks.Ext is + pragma Preelaborate; + + type t_id is new Long_Integer; + subtype int is Interfaces.C.int; + + function Task_Cont (tid : t_id) return int; + pragma Import (C, Task_Cont, "taskCont"); + + function Task_Stop (tid : t_id) return int; + pragma Import (C, Task_Stop, "taskStop"); + + function Int_Lock return int; + pragma Import (C, Int_Lock, "intLock"); + + function Int_Unlock return int; + pragma Import (C, Int_Unlock, "intUnlock"); + + function kill (pid : t_id; sig : int) return int; + pragma Import (C, kill, "kill"); + + function Set_Time_Slice (ticks : int) return int; + pragma Import (C, Set_Time_Slice, "kernelTimeSlice"); + + function getpid return t_id; + pragma Import (C, getpid, "taskIdSelf"); + +end System.VxWorks.Ext; diff --git a/gcc/ada/s-vxwext-rtp.adb b/gcc/ada/s-vxwext-rtp.adb new file mode 100644 index 00000000000..aab05e15ca1 --- /dev/null +++ b/gcc/ada/s-vxwext-rtp.adb @@ -0,0 +1,67 @@ +------------------------------------------------------------------------------ +-- -- +-- GNAT RUN-TIME LIBRARY (GNARL) COMPONENTS -- +-- -- +-- S Y S T E M . V X W O R K S . E X T -- +-- -- +-- B o d y -- +-- -- +-- Copyright (C) 2008, Free Software Foundation, Inc. -- +-- -- +-- GNARL is free software; you can redistribute it and/or modify it under -- +-- terms of the GNU General Public License as published by the Free Soft- -- +-- ware Foundation; either version 2, or (at your option) any later ver- -- +-- sion. GNARL is distributed in the hope that it will be useful, but WITH- -- +-- OUT 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 distributed with GNARL; see file COPYING. If not, write -- +-- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, -- +-- Boston, MA 02110-1301, USA. -- +-- -- +-- As a special exception, if other files instantiate generics from this -- +-- unit, or you link this unit with other files to produce an executable, -- +-- this unit does not by itself cause the resulting executable to be -- +-- covered by the GNU General Public License. This exception does not -- +-- however invalidate any other reasons why the executable file might be -- +-- covered by the GNU Public License. -- +-- -- +------------------------------------------------------------------------------ + +-- This is the VxWorks 6 rtp version of this package + +package body System.VxWorks.Ext is + + function Task_Cont (tid : t_id) return int is + pragma Unreferenced (tid); + begin + -- Operation not allowed in an RTP + return 0; + end Task_Cont; + + function Task_Stop (tid : t_id) return int is + pragma Unreferenced (tid); + begin + -- Operation not allowed in an RTP + return 0; + end Task_Stop; + + function Int_Lock return int is + begin + -- Operation not allowed in an RTP + return 0; + end Int_Lock; + + function Int_Unlock return int is + begin + -- Operation not allowed in an RTP + return 0; + end Int_Unlock; + + function Set_Time_Slice (ticks : int) return int is + pragma Unreferenced (ticks); + begin + return 0; + end Set_Time_Slice; + +end System.VxWorks.Ext; diff --git a/gcc/ada/s-vxwext-rtp.ads b/gcc/ada/s-vxwext-rtp.ads new file mode 100644 index 00000000000..d658e26c194 --- /dev/null +++ b/gcc/ada/s-vxwext-rtp.ads @@ -0,0 +1,65 @@ +------------------------------------------------------------------------------ +-- -- +-- GNAT RUN-TIME LIBRARY (GNARL) COMPONENTS -- +-- -- +-- S Y S T E M . V X W O R K S . E X T -- +-- -- +-- S p e c -- +-- -- +-- Copyright (C) 2008, Free Software Foundation, Inc. -- +-- -- +-- GNARL is free software; you can redistribute it and/or modify it under -- +-- terms of the GNU General Public License as published by the Free Soft- -- +-- ware Foundation; either version 2, or (at your option) any later ver- -- +-- sion. GNARL is distributed in the hope that it will be useful, but WITH- -- +-- OUT 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 distributed with GNARL; see file COPYING. If not, write -- +-- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, -- +-- Boston, MA 02110-1301, USA. -- +-- -- +-- As a special exception, if other files instantiate generics from this -- +-- unit, or you link this unit with other files to produce an executable, -- +-- this unit does not by itself cause the resulting executable to be -- +-- covered by the GNU General Public License. This exception does not -- +-- however invalidate any other reasons why the executable file might be -- +-- covered by the GNU Public License. -- +-- -- +------------------------------------------------------------------------------ + +-- This package provides vxworks specific support functions needed +-- by System.OS_Interface. + +-- This is the VxWorks 6 rtp version of this package + +with Interfaces.C; + +package System.VxWorks.Ext is + pragma Preelaborate; + + type t_id is new Long_Integer; + subtype int is Interfaces.C.int; + + function Task_Cont (tid : t_id) return int; + pragma Inline (Task_Cont); + + function Task_Stop (tid : t_id) return int; + pragma Inline (Task_Stop); + + function Int_Lock return int; + pragma Inline (Int_Lock); + + function Int_Unlock return int; + pragma Inline (Int_Unlock); + + function kill (pid : t_id; sig : int) return int; + pragma Import (C, kill, "taskKill"); + + function Set_Time_Slice (ticks : int) return int; + pragma Inline (Set_Time_Slice); + + function getpid return t_id; + pragma Import (C, getpid, "getpid"); + +end System.VxWorks.Ext; diff --git a/gcc/ada/s-vxwext.ads b/gcc/ada/s-vxwext.ads new file mode 100644 index 00000000000..350aa9c4d8f --- /dev/null +++ b/gcc/ada/s-vxwext.ads @@ -0,0 +1,65 @@ +------------------------------------------------------------------------------ +-- -- +-- GNAT RUN-TIME LIBRARY (GNARL) COMPONENTS -- +-- -- +-- S Y S T E M . V X W O R K S . E X T -- +-- -- +-- S p e c -- +-- -- +-- Copyright (C) 2008, Free Software Foundation, Inc. -- +-- -- +-- GNARL is free software; you can redistribute it and/or modify it under -- +-- terms of the GNU General Public License as published by the Free Soft- -- +-- ware Foundation; either version 2, or (at your option) any later ver- -- +-- sion. GNARL is distributed in the hope that it will be useful, but WITH- -- +-- OUT 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 distributed with GNARL; see file COPYING. If not, write -- +-- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, -- +-- Boston, MA 02110-1301, USA. -- +-- -- +-- As a special exception, if other files instantiate generics from this -- +-- unit, or you link this unit with other files to produce an executable, -- +-- this unit does not by itself cause the resulting executable to be -- +-- covered by the GNU General Public License. This exception does not -- +-- however invalidate any other reasons why the executable file might be -- +-- covered by the GNU Public License. -- +-- -- +------------------------------------------------------------------------------ + +-- This package provides vxworks specific support functions needed +-- by System.OS_Interface. + +-- This is the VxWorks 5 version of this package + +with Interfaces.C; + +package System.VxWorks.Ext is + pragma Preelaborate; + + type t_id is new Long_Integer; + subtype int is Interfaces.C.int; + + function Task_Cont (tid : t_id) return int; + pragma Import (C, Task_Cont, "taskResume"); + + function Task_Stop (tid : t_id) return int; + pragma Import (C, Task_Stop, "taskSuspend"); + + function Int_Lock return int; + pragma Import (C, Int_Lock, "intLock"); + + function Int_Unlock return int; + pragma Import (C, Int_Unlock, "intUnlock"); + + function kill (pid : t_id; sig : int) return int; + pragma Import (C, kill, "kill"); + + function Set_Time_Slice (ticks : int) return int; + pragma Import (C, Set_Time_Slice, "kernelTimeSlice"); + + function getpid return t_id; + pragma Import (C, getpid, "taskIdSelf"); + +end System.VxWorks.Ext; diff --git a/gcc/ada/s-wchstw.adb b/gcc/ada/s-wchstw.adb index 33f6674c6cb..842087f61ce 100644 --- a/gcc/ada/s-wchstw.adb +++ b/gcc/ada/s-wchstw.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 1992-2007, Free Software Foundation, Inc. -- +-- Copyright (C) 1992-2008, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -74,8 +74,7 @@ package body System.WCh_StW is function In_Char return Character is begin if P > S'Last then - raise Constraint_Error - with "badly formed wide character code"; + raise Constraint_Error with "badly formed wide character code"; else P := P + 1; return S (P - 1); @@ -139,8 +138,8 @@ package body System.WCh_StW is Get_Next_Code (S, SP, V, EM); if V > 16#FFFF# then - raise Constraint_Error - with "out of range value for wide character"; + raise Constraint_Error with + "out of range value for wide character"; end if; L := L + 1; diff --git a/gcc/ada/s-wchstw.ads b/gcc/ada/s-wchstw.ads index 7bd3529586d..bdc237c06ac 100644 --- a/gcc/ada/s-wchstw.ads +++ b/gcc/ada/s-wchstw.ads @@ -6,7 +6,7 @@ -- -- -- S p e c -- -- -- --- Copyright (C) 1992-2007, Free Software Foundation, Inc. -- +-- Copyright (C) 1992-2008, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -46,17 +46,18 @@ package System.WCh_StW is EM : System.WCh_Con.WC_Encoding_Method); -- This routine simply takes its argument and converts it to wide string -- format, storing the result in R (1 .. L), with L being set appropriately - -- on return. The caller guarantees that R is long enough to accomodate the - -- result. This is used in the context of the Wide_Image attribute, where - -- the argument is the corresponding 'Image attribute. Any wide character - -- escape sequences in the string are converted to the corresponding wide - -- character value. No syntax checks are made, it is assumed that any such - -- sequences are validly formed (this must be assured by the caller), and - -- results from the fact that Wide_Image is only used on strings that have - -- been built by the compiler, such as images of enumeration literals. If - -- the method for encoding is a shift-in, shift-out convention, then it is - -- assumed that normal (non-wide character) mode holds at the start and end - -- of the argument string. EM indicates the wide character encoding method. + -- on return. The caller guarantees that R is long enough to accommodate + -- the result. This is used in the context of the Wide_Image attribute, + -- where the argument is the corresponding 'Image attribute. Any wide + -- character escape sequences in the string are converted to the + -- corresponding wide character value. No syntax checks are made, it is + -- assumed that any such sequences are validly formed (this must be assured + -- by the caller), and results from the fact that Wide_Image is only used + -- on strings that have been built by the compiler, such as images of + -- enumeration literals. If the method for encoding is a shift-in, + -- shift-out convention, then it is assumed that normal (non-wide + -- character) mode holds at the start and end of the argument string. EM + -- indicates the wide character encoding method. -- Note: in the WCEM_Brackets case, the brackets escape sequence is used -- only for codes greater than 16#FF#. diff --git a/gcc/ada/s-wchwts.adb b/gcc/ada/s-wchwts.adb index 995f5acda0f..ed660fefc0f 100644 --- a/gcc/ada/s-wchwts.adb +++ b/gcc/ada/s-wchwts.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 1992-2005, Free Software Foundation, Inc. -- +-- Copyright (C) 1992-2008, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -101,7 +101,7 @@ package body System.WCh_WtS is end Wide_String_To_String; -------------------------------- - -- Wide_Wide_Sring_To_String -- + -- Wide_Wide_String_To_String -- -------------------------------- function Wide_Wide_String_To_String diff --git a/gcc/ada/s-wchwts.ads b/gcc/ada/s-wchwts.ads index 2359701462c..691a322ea6c 100644 --- a/gcc/ada/s-wchwts.ads +++ b/gcc/ada/s-wchwts.ads @@ -6,7 +6,7 @@ -- -- -- S p e c -- -- -- --- Copyright (C) 1992-2005, Free Software Foundation, Inc. -- +-- Copyright (C) 1992-2008, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -32,7 +32,7 @@ ------------------------------------------------------------------------------ -- This package contains the routine used to convert wide strings and wide --- wide stringsto strings for use by wide and wide wide character attributes +-- wide strings to strings for use by wide and wide wide character attributes -- (value, image etc.) and also by the numeric IO subpackages of -- Ada.Text_IO.Wide_Text_IO and Ada.Text_IO.Wide_Wide_Text_IO. diff --git a/gcc/ada/s-win32.ads b/gcc/ada/s-win32.ads new file mode 100644 index 00000000000..2d2648514b8 --- /dev/null +++ b/gcc/ada/s-win32.ads @@ -0,0 +1,295 @@ +------------------------------------------------------------------------------ +-- -- +-- GNAT RUN-TIME COMPONENTS -- +-- -- +-- S Y S T E M . W I N 3 2 -- +-- -- +-- S p e c -- +-- -- +-- Copyright (C) 2008, Free Software Foundation, Inc. -- +-- -- +-- GNAT is free software; you can redistribute it and/or modify it under -- +-- terms of the GNU General Public License as published by the Free Soft- -- +-- ware Foundation; either version 2, or (at your option) any later ver- -- +-- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- +-- OUT 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 distributed with GNAT; see file COPYING. If not, write -- +-- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, -- +-- Boston, MA 02110-1301, USA. -- +-- -- +-- As a special exception, if other files instantiate generics from this -- +-- unit, or you link this unit with other files to produce an executable, -- +-- this unit does not by itself cause the resulting executable to be -- +-- covered by the GNU General Public License. This exception does not -- +-- however invalidate any other reasons why the executable file might be -- +-- covered by the GNU Public License. -- +-- -- +-- GNAT was originally developed by the GNAT team at New York University. -- +-- Extensive contributions were provided by Ada Core Technologies Inc. -- +-- -- +------------------------------------------------------------------------------ + +-- This package plus its child provide the low level interface to the Win32 +-- API. The core part of the Win32 API (commont to RTX and Win32) is in this +-- package, and an additional part of the Win32 API which is not supported by +-- RTX is in package System.Win33.Ext. + +with Interfaces.C; + +package System.Win32 is + pragma Pure; + + ------------------- + -- General Types -- + ------------------- + + -- The LARGE_INTEGER type is actually a fixed point type + -- that only can represent integers. The reason for this is + -- easier conversion to Duration or other fixed point types. + -- (See Operations.Clock) + + type LARGE_INTEGER is delta 1.0 range -2.0**63 .. 2.0**63 - 1.0; + + subtype PVOID is Address; + + type HANDLE is new Interfaces.C.long; + + INVALID_HANDLE_VALUE : constant HANDLE := -1; + + type DWORD is new Interfaces.C.unsigned_long; + type WORD is new Interfaces.C.unsigned_short; + type BYTE is new Interfaces.C.unsigned_char; + type LONG is new Interfaces.C.long; + type CHAR is new Interfaces.C.char; + + type BOOL is new Interfaces.C.int; + for BOOL'Size use Interfaces.C.int'Size; + + type Bits1 is range 0 .. 2 ** 1 - 1; + type Bits2 is range 0 .. 2 ** 2 - 1; + type Bits17 is range 0 .. 2 ** 17 - 1; + for Bits1'Size use 1; + for Bits2'Size use 2; + for Bits17'Size use 17; + + FALSE : constant := 0; + TRUE : constant := 1; + + function GetLastError return DWORD; + pragma Import (Stdcall, GetLastError, "GetLastError"); + + ----------- + -- Files -- + ----------- + + GENERIC_READ : constant := 16#80000000#; + GENERIC_WRITE : constant := 16#40000000#; + + CREATE_NEW : constant := 1; + CREATE_ALWAYS : constant := 2; + OPEN_EXISTING : constant := 3; + OPEN_ALWAYS : constant := 4; + TRUNCATE_EXISTING : constant := 5; + + FILE_SHARE_DELETE : constant := 16#00000004#; + FILE_SHARE_READ : constant := 16#00000001#; + FILE_SHARE_WRITE : constant := 16#00000002#; + + FILE_BEGIN : constant := 0; + FILE_CURRENT : constant := 1; + FILE_END : constant := 2; + + PAGE_NOACCESS : constant := 16#0001#; + PAGE_READONLY : constant := 16#0002#; + PAGE_READWRITE : constant := 16#0004#; + PAGE_WRITECOPY : constant := 16#0008#; + PAGE_EXECUTE : constant := 16#0010#; + + FILE_MAP_ALL_ACCESS : constant := 16#F001f#; + FILE_MAP_READ : constant := 4; + FILE_MAP_WRITE : constant := 2; + FILE_MAP_COPY : constant := 1; + + FILE_ADD_FILE : constant := 16#0002#; + FILE_ADD_SUBDIRECTORY : constant := 16#0004#; + FILE_APPEND_DATA : constant := 16#0004#; + FILE_CREATE_PIPE_INSTANCE : constant := 16#0004#; + FILE_DELETE_CHILD : constant := 16#0040#; + FILE_EXECUTE : constant := 16#0020#; + FILE_LIST_DIRECTORY : constant := 16#0001#; + FILE_READ_ATTRIBUTES : constant := 16#0080#; + FILE_READ_DATA : constant := 16#0001#; + FILE_READ_EA : constant := 16#0008#; + FILE_TRAVERSE : constant := 16#0020#; + FILE_WRITE_ATTRIBUTES : constant := 16#0100#; + FILE_WRITE_DATA : constant := 16#0002#; + FILE_WRITE_EA : constant := 16#0010#; + STANDARD_RIGHTS_READ : constant := 16#20000#; + STANDARD_RIGHTS_WRITE : constant := 16#20000#; + SYNCHRONIZE : constant := 16#100000#; + + FILE_ATTRIBUTE_READONLY : constant := 16#00000001#; + FILE_ATTRIBUTE_HIDDEN : constant := 16#00000002#; + FILE_ATTRIBUTE_SYSTEM : constant := 16#00000004#; + FILE_ATTRIBUTE_DIRECTORY : constant := 16#00000010#; + FILE_ATTRIBUTE_ARCHIVE : constant := 16#00000020#; + FILE_ATTRIBUTE_DEVICE : constant := 16#00000040#; + FILE_ATTRIBUTE_NORMAL : constant := 16#00000080#; + FILE_ATTRIBUTE_TEMPORARY : constant := 16#00000100#; + FILE_ATTRIBUTE_SPARSE_FILE : constant := 16#00000200#; + FILE_ATTRIBUTE_REPARSE_POINT : constant := 16#00000400#; + FILE_ATTRIBUTE_COMPRESSED : constant := 16#00000800#; + FILE_ATTRIBUTE_OFFLINE : constant := 16#00001000#; + FILE_ATTRIBUTE_NOT_CONTENT_INDEXED : constant := 16#00002000#; + FILE_ATTRIBUTE_ENCRYPTED : constant := 16#00004000#; + FILE_ATTRIBUTE_VALID_FLAGS : constant := 16#00007fb7#; + FILE_ATTRIBUTE_VALID_SET_FLAGS : constant := 16#000031a7#; + + type OVERLAPPED is record + Internal : DWORD; + InternalHigh : DWORD; + Offset : DWORD; + OffsetHigh : DWORD; + hEvent : HANDLE; + end record; + + type SECURITY_ATTRIBUTES is record + nLength : DWORD; + pSecurityDescriptor : PVOID; + bInheritHandle : BOOL; + end record; + + function CreateFile + (lpFileName : Address; + dwDesiredAccess : DWORD; + dwShareMode : DWORD; + lpSecurityAttributes : access SECURITY_ATTRIBUTES; + dwCreationDisposition : DWORD; + dwFlagsAndAttributes : DWORD; + hTemplateFile : HANDLE) return HANDLE; + pragma Import (Stdcall, CreateFile, "CreateFileA"); + + function GetFileSize + (hFile : HANDLE; + lpFileSizeHigh : access DWORD) return BOOL; + pragma Import (Stdcall, GetFileSize, "GetFileSize"); + + function SetFilePointer + (hFile : HANDLE; + lDistanceToMove : LONG; + lpDistanceToMoveHigh : access LONG; + dwMoveMethod : DWORD) return DWORD; + pragma Import (Stdcall, SetFilePointer, "SetFilePointer"); + + function WriteFile + (hFile : HANDLE; + lpBuffer : Address; + nNumberOfBytesToWrite : DWORD; + lpNumberOfBytesWritten : access DWORD; + lpOverlapped : access OVERLAPPED) return BOOL; + pragma Import (Stdcall, WriteFile, "WriteFile"); + + function ReadFile + (hFile : HANDLE; + lpBuffer : Address; + nNumberOfBytesToRead : DWORD; + lpNumberOfBytesRead : access DWORD; + lpOverlapped : access OVERLAPPED) return BOOL; + pragma Import (Stdcall, ReadFile, "ReadFile"); + + function CloseHandle (hObject : HANDLE) return BOOL; + pragma Import (Stdcall, CloseHandle, "CloseHandle"); + + function CreateFileMapping + (hFile : HANDLE; + lpSecurityAttributes : access SECURITY_ATTRIBUTES; + flProtect : DWORD; + dwMaximumSizeHigh : DWORD; + dwMaximumSizeLow : DWORD; + lpName : Address) return HANDLE; + pragma Import (Stdcall, CreateFileMapping, "CreateFileMappingA"); + + function MapViewOfFile + (hFileMappingObject : HANDLE; + dwDesiredAccess : DWORD; + dwFileOffsetHigh : DWORD; + dwFileOffsetLow : DWORD; + dwNumberOfBytesToMap : DWORD) return System.Address; + pragma Import (Stdcall, MapViewOfFile, "MapViewOfFile"); + + function UnmapViewOfFile (lpBaseAddress : System.Address) return BOOL; + pragma Import (Stdcall, UnmapViewOfFile, "UnmapViewOfFile"); + + ------------------------ + -- System Information -- + ------------------------ + + subtype ProcessorId is DWORD; + + type SYSTEM_INFO is record + dwOemId : DWORD; + dwPageSize : DWORD; + lpMinimumApplicationAddress : PVOID; + lpMaximumApplicationAddress : PVOID; + dwActiveProcessorMask : DWORD; + dwNumberOfProcessors : DWORD; + dwProcessorType : DWORD; + dwAllocationGranularity : DWORD; + dwReserved : DWORD; + end record; + + procedure GetSystemInfo (SI : access SYSTEM_INFO); + pragma Import (Stdcall, GetSystemInfo, "GetSystemInfo"); + + --------------------- + -- Time Management -- + --------------------- + + type SYSTEMTIME is record + wYear : WORD; + wMonth : WORD; + wDayOfWeek : WORD; + wDay : WORD; + wHour : WORD; + wMinute : WORD; + wSecond : WORD; + wMilliseconds : WORD; + end record; + + procedure GetSystemTime (pSystemTime : access SYSTEMTIME); + pragma Import (Stdcall, GetSystemTime, "GetSystemTime"); + + procedure GetSystemTimeAsFileTime (lpFileTime : access Long_Long_Integer); + pragma Import (Stdcall, GetSystemTimeAsFileTime, "GetSystemTimeAsFileTime"); + + function FileTimeToSystemTime + (lpFileTime : access Long_Long_Integer; + lpSystemTime : access SYSTEMTIME) return BOOL; + pragma Import (Stdcall, FileTimeToSystemTime, "FileTimeToSystemTime"); + + function SystemTimeToFileTime + (lpSystemTime : access SYSTEMTIME; + lpFileTime : access Long_Long_Integer) return BOOL; + pragma Import (Stdcall, SystemTimeToFileTime, "SystemTimeToFileTime"); + + function FileTimeToLocalFileTime + (lpFileTime : access Long_Long_Integer; + lpLocalFileTime : access Long_Long_Integer) return BOOL; + pragma Import (Stdcall, FileTimeToLocalFileTime, "FileTimeToLocalFileTime"); + + function LocalFileTimeToFileTime + (lpFileTime : access Long_Long_Integer; + lpLocalFileTime : access Long_Long_Integer) return BOOL; + pragma Import (Stdcall, LocalFileTimeToFileTime, "LocalFileTimeToFileTime"); + + procedure Sleep (dwMilliseconds : DWORD); + pragma Import (Stdcall, Sleep, External_Name => "Sleep"); + + function QueryPerformanceCounter + (lpPerformanceCount : access LARGE_INTEGER) return BOOL; + pragma Import + (Stdcall, QueryPerformanceCounter, "QueryPerformanceCounter"); + +end System.Win32; diff --git a/gcc/ada/s-winext.ads b/gcc/ada/s-winext.ads new file mode 100644 index 00000000000..a0091ff74d3 --- /dev/null +++ b/gcc/ada/s-winext.ads @@ -0,0 +1,157 @@ +------------------------------------------------------------------------------ +-- -- +-- GNAT RUN-TIME COMPONENTS -- +-- -- +-- S Y S T E M . W I N 3 2 . E X T -- +-- -- +-- S p e c -- +-- -- +-- Copyright (C) 2008, Free Software Foundation, Inc. -- +-- -- +-- GNAT is free software; you can redistribute it and/or modify it under -- +-- terms of the GNU General Public License as published by the Free Soft- -- +-- ware Foundation; either version 2, or (at your option) any later ver- -- +-- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- +-- OUT 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 distributed with GNAT; see file COPYING. If not, write -- +-- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, -- +-- Boston, MA 02110-1301, USA. -- +-- -- +-- As a special exception, if other files instantiate generics from this -- +-- unit, or you link this unit with other files to produce an executable, -- +-- this unit does not by itself cause the resulting executable to be -- +-- covered by the GNU General Public License. This exception does not -- +-- however invalidate any other reasons why the executable file might be -- +-- covered by the GNU Public License. -- +-- -- +-- GNAT was originally developed by the GNAT team at New York University. -- +-- Extensive contributions were provided by Ada Core Technologies Inc. -- +-- -- +------------------------------------------------------------------------------ + +-- This package provides the part of the low level Win32 interface which is +-- not supported by RTX (but supported by regular Windows platforms). + +package System.Win32.Ext is + pragma Pure; + + --------------------- + -- Time Management -- + --------------------- + + function QueryPerformanceFrequency + (lpFrequency : access LARGE_INTEGER) return Win32.BOOL; + pragma Import + (Stdcall, QueryPerformanceFrequency, "QueryPerformanceFrequency"); + + --------------- + -- Processor -- + --------------- + + function SetThreadIdealProcessor + (hThread : HANDLE; + dwIdealProcessor : ProcessorId) return DWORD; + pragma Import (Stdcall, SetThreadIdealProcessor, "SetThreadIdealProcessor"); + + -------------- + -- Com Port -- + -------------- + + DTR_CONTROL_DISABLE : constant := 16#0#; + RTS_CONTROL_DISABLE : constant := 16#0#; + NOPARITY : constant := 0; + ODDPARITY : constant := 1; + EVENPARITY : constant := 2; + ONESTOPBIT : constant := 0; + TWOSTOPBITS : constant := 2; + + type DCB is record + DCBLENGTH : DWORD; + BaudRate : DWORD; + fBinary : Bits1; + fParity : Bits1; + fOutxCtsFlow : Bits1; + fOutxDsrFlow : Bits1; + fDtrControl : Bits2; + fDsrSensitivity : Bits1; + fTXContinueOnXoff : Bits1; + fOutX : Bits1; + fInX : Bits1; + fErrorChar : Bits1; + fNull : Bits1; + fRtsControl : Bits2; + fAbortOnError : Bits1; + fDummy2 : Bits17; + wReserved : WORD; + XonLim : WORD; + XoffLim : WORD; + ByteSize : BYTE; + Parity : BYTE; + StopBits : BYTE; + XonChar : CHAR; + XoffChar : CHAR; + ErrorChar : CHAR; + EofChar : CHAR; + EvtChar : CHAR; + wReserved1 : WORD; + end record; + pragma Convention (C, DCB); + + for DCB use record + DCBLENGTH at 0 range 0 .. 31; + BaudRate at 4 range 0 .. 31; + fBinary at 8 range 0 .. 0; + fParity at 8 range 1 .. 1; + fOutxCtsFlow at 8 range 2 .. 2; + fOutxDsrFlow at 8 range 3 .. 3; + fDtrControl at 8 range 4 .. 5; + fDsrSensitivity at 8 range 6 .. 6; + fTXContinueOnXoff at 8 range 7 .. 7; + fOutX at 9 range 0 .. 0; + fInX at 9 range 1 .. 1; + fErrorChar at 9 range 2 .. 2; + fNull at 9 range 3 .. 3; + fRtsControl at 9 range 4 .. 5; + fAbortOnError at 9 range 6 .. 6; + fDummy2 at 9 range 7 .. 23; + wReserved at 12 range 0 .. 15; + XonLim at 14 range 0 .. 15; + XoffLim at 16 range 0 .. 15; + ByteSize at 18 range 0 .. 7; + Parity at 19 range 0 .. 7; + StopBits at 20 range 0 .. 7; + XonChar at 21 range 0 .. 7; + XoffChar at 22 range 0 .. 7; + ErrorChar at 23 range 0 .. 7; + EofChar at 24 range 0 .. 7; + EvtChar at 25 range 0 .. 7; + wReserved1 at 26 range 0 .. 15; + end record; + + type COMMTIMEOUTS is record + ReadIntervalTimeout : DWORD; + ReadTotalTimeoutMultiplier : DWORD; + ReadTotalTimeoutConstant : DWORD; + WriteTotalTimeoutMultiplier : DWORD; + WriteTotalTimeoutConstant : DWORD; + end record; + pragma Convention (C, COMMTIMEOUTS); + + function GetCommState + (hFile : HANDLE; + lpDCB : access DCB) return BOOL; + pragma Import (Stdcall, GetCommState, "GetCommState"); + + function SetCommState + (hFile : HANDLE; + lpDCB : access DCB) return BOOL; + pragma Import (Stdcall, SetCommState, "SetCommState"); + + function SetCommTimeouts + (hFile : HANDLE; + lpCommTimeouts : access COMMTIMEOUTS) return BOOL; + pragma Import (Stdcall, SetCommTimeouts, "SetCommTimeouts"); + +end System.Win32.Ext; diff --git a/gcc/ada/scans.ads b/gcc/ada/scans.ads index c838865b477..83cc368dee4 100644 --- a/gcc/ada/scans.ads +++ b/gcc/ada/scans.ads @@ -6,7 +6,7 @@ -- -- -- S p e c -- -- -- --- Copyright (C) 1992-2007, Free Software Foundation, Inc. -- +-- Copyright (C) 1992-2008, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -45,7 +45,7 @@ package Scans is -- The following type is used to identify token types returned by Scan. -- The class column in this table indicates the token classes which - -- apply to the token, as defined by subsquent subtype declarations. + -- apply to the token, as defined by subsequent subtype declarations. -- Note: Namet.Is_Keyword_Name depends on the fact that the first entry in -- this type declaration is *not* for a reserved word. For details on why @@ -65,7 +65,7 @@ package Scans is Tok_Operator_Symbol, -- op symbol Name, Literal, Lit_Or_Name, Desig - Tok_Identifier, -- identifer Name, Lit_Or_Name, Desig + Tok_Identifier, -- identifier Name, Lit_Or_Name, Desig Tok_Double_Asterisk, -- ** @@ -206,7 +206,7 @@ package Scans is Tok_End_Of_Line, -- Represents an end of line. Not used during normal compilation scans -- where end of line is ignored. Active for preprocessor scanning and - -- also when scanning project files (where it is neede because of ???) + -- also when scanning project files (where it is needed because of ???) Tok_Special, -- Used only in preprocessor scanning (to represent one of the diff --git a/gcc/ada/scn.adb b/gcc/ada/scn.adb index 6efbc9f5b28..805caab574e 100644 --- a/gcc/ada/scn.adb +++ b/gcc/ada/scn.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 1992-2007, Free Software Foundation, Inc. -- +-- Copyright (C) 1992-2008, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -329,7 +329,7 @@ package body Scn is Scan; end if; - -- Clear flags for reserved words used as indentifiers + -- Clear flags for reserved words used as identifiers for J in Token_Type loop Used_As_Identifier (J) := False; diff --git a/gcc/ada/scng.adb b/gcc/ada/scng.adb index 8322a249f81..76f63f9353b 100644 --- a/gcc/ada/scng.adb +++ b/gcc/ada/scng.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 1992-2007, Free Software Foundation, Inc. -- +-- Copyright (C) 1992-2008, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -236,7 +236,7 @@ package body Scng is -- Scan_Ptr points to the opening string quote (the checksum for this -- character has not been accumulated yet). On return Scan_Ptr points -- past the closing quote of the string literal, Token and Token_Node - -- are set appropriately, and the checksum is upated. + -- are set appropriately, and the checksum is updated. ----------------------- -- Check_End_Of_Line -- @@ -2066,7 +2066,7 @@ package body Scng is Underline_Found := False; goto Scan_Identifier; - -- Mark character is an error (at start of identifer) + -- Mark character is an error (at start of identifier) elsif Is_UTF_32_Mark (Cat) then Error_Msg @@ -2076,7 +2076,7 @@ package body Scng is Underline_Found := False; goto Scan_Identifier; - -- Other format character is an error (at start of identifer) + -- Other format character is an error (at start of identifier) elsif Is_UTF_32_Other (Cat) then Error_Msg @@ -2108,7 +2108,7 @@ package body Scng is -- Routine to scan line terminator. On entry Scan_Ptr points to a -- character which is one of FF,LR,CR,VT, or one of the wide characters - -- that is treated as a line termiantor. + -- that is treated as a line terminator. <<Scan_Line_Terminator>> @@ -2151,7 +2151,7 @@ package body Scng is -- Identifier scanning routine. On entry, some initial characters of -- the identifier may have already been stored in Name_Buffer. If so, - -- Name_Len has the number of characters stored. otherwise Name_Len is + -- Name_Len has the number of characters stored, otherwise Name_Len is -- set to zero on entry. Underline_Found is also set False on entry. <<Scan_Identifier>> @@ -2189,8 +2189,10 @@ package body Scng is -- is active, so if we find an ESC character we know that we have a -- wide character. - if Identifier_Char (Source (Scan_Ptr)) then - + if Identifier_Char (Source (Scan_Ptr)) + or else (Source (Scan_Ptr) in Upper_Half_Character + and then Upper_Half_Encoding) + then -- Case of underline if Source (Scan_Ptr) = '_' then @@ -2322,7 +2324,7 @@ package body Scng is Underline_Found := True; end if; - -- Wide character in Unicode cateogory "Other, Format" + -- Wide character in Unicode category "Other, Format" -- is accepted in an identifier, but is ignored and not -- stored. It seems reasonable to exclude it from the -- checksum. diff --git a/gcc/ada/seh_init.c b/gcc/ada/seh_init.c index 7b2f093feca..44b0f603175 100644 --- a/gcc/ada/seh_init.c +++ b/gcc/ada/seh_init.c @@ -6,7 +6,7 @@ * * * C Implementation File * * * - * Copyright (C) 2005, Free Software Foundation, Inc. * + * Copyright (C) 2005-2008, Free Software Foundation, Inc. * * * * GNAT is free software; you can redistribute it and/or modify it under * * terms of the GNU General Public License as published by the Free Soft- * @@ -37,7 +37,7 @@ #include "tconfig.h" #include "tsystem.h" -/* We don't have libiberty, so us malloc. */ +/* We don't have libiberty, so use malloc. */ #define xmalloc(S) malloc (S) #else diff --git a/gcc/ada/sem.adb b/gcc/ada/sem.adb index 7fcf2dd2ac7..6b93ab449f1 100644 --- a/gcc/ada/sem.adb +++ b/gcc/ada/sem.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 1992-2007, Free Software Foundation, Inc. -- +-- Copyright (C) 1992-2008, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -547,8 +547,12 @@ package body Sem is -- been any other errors, we just ignore it, otherwise it is -- a real internal error which we complain about. + -- We must also consider the case of call to a runtime function + -- that is not available in the configurable runtime. + when N_Empty => - pragma Assert (Serious_Errors_Detected /= 0); + pragma Assert (Serious_Errors_Detected /= 0 + or else Configurable_Run_Time_Violations /= 0); null; -- A call to analyze the error node is simply ignored, to avoid @@ -1275,14 +1279,14 @@ package body Sem is -- values for these variables, and also that such calls do not -- disturb the settings for units being analyzed at a higher level. + S_Current_Sem_Unit : constant Unit_Number_Type := Current_Sem_Unit; S_Full_Analysis : constant Boolean := Full_Analysis; - S_In_Default_Expr : constant Boolean := In_Default_Expression; + S_GNAT_Mode : constant Boolean := GNAT_Mode; + S_Global_Dis_Names : constant Boolean := Global_Discard_Names; + S_In_Spec_Expr : constant Boolean := In_Spec_Expression; S_Inside_A_Generic : constant Boolean := Inside_A_Generic; S_New_Nodes_OK : constant Int := New_Nodes_OK; S_Outer_Gen_Scope : constant Entity_Id := Outer_Generic_Scope; - S_Sem_Unit : constant Unit_Number_Type := Current_Sem_Unit; - S_GNAT_Mode : constant Boolean := GNAT_Mode; - S_Discard_Names : constant Boolean := Global_Discard_Names; Generic_Main : constant Boolean := Nkind (Unit (Cunit (Main_Unit))) @@ -1356,9 +1360,9 @@ package body Sem is (Operating_Mode = Generate_Code or Debug_Flag_X); end if; - Full_Analysis := True; - Inside_A_Generic := False; - In_Default_Expression := False; + Full_Analysis := True; + Inside_A_Generic := False; + In_Spec_Expression := False; Set_Comes_From_Source_Default (False); Save_Opt_Config_Switches (Save_Config_Switches); @@ -1389,17 +1393,16 @@ package body Sem is -- Restore settings of saved switches to entry values - Current_Sem_Unit := S_Sem_Unit; - Full_Analysis := S_Full_Analysis; - In_Default_Expression := S_In_Default_Expr; - Inside_A_Generic := S_Inside_A_Generic; - New_Nodes_OK := S_New_Nodes_OK; - Outer_Generic_Scope := S_Outer_Gen_Scope; - GNAT_Mode := S_GNAT_Mode; - Global_Discard_Names := S_Discard_Names; + Current_Sem_Unit := S_Current_Sem_Unit; + Full_Analysis := S_Full_Analysis; + Global_Discard_Names := S_Global_Dis_Names; + GNAT_Mode := S_GNAT_Mode; + In_Spec_Expression := S_In_Spec_Expr; + Inside_A_Generic := S_Inside_A_Generic; + New_Nodes_OK := S_New_Nodes_OK; + Outer_Generic_Scope := S_Outer_Gen_Scope; Restore_Opt_Config_Switches (Save_Config_Switches); Expander_Mode_Restore; - end Semantics; end Sem; diff --git a/gcc/ada/sem.ads b/gcc/ada/sem.ads index 3d2206f5a9e..93f0780edf8 100644 --- a/gcc/ada/sem.ads +++ b/gcc/ada/sem.ads @@ -6,7 +6,7 @@ -- -- -- S p e c -- -- -- --- Copyright (C) 1992-2007, Free Software Foundation, Inc. -- +-- Copyright (C) 1992-2008, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -27,8 +27,8 @@ -- Semantic Analysis: General Model -- -------------------------------------- --- Semantic processing involves 3 phases which are highly interwined --- (ie mutually recursive): +-- Semantic processing involves 3 phases which are highly intertwined +-- (i.e. mutually recursive): -- Analysis implements the bulk of semantic analysis such as -- name analysis and type resolution for declarations, @@ -51,7 +51,7 @@ -- recursive calls to itself to resolve operands. -- Expansion if we are not generating code this phase is a no-op. --- otherwise this phase expands, ie transforms, original +-- otherwise this phase expands, i.e. transforms, original -- declaration, expressions or instructions into simpler -- structures that can be handled by the back-end. This -- phase is also in charge of generating code which is @@ -84,31 +84,37 @@ -- Analysis-Resolution-Expansion model for expressions. The most prominent -- examples are the handling of default expressions and aggregates. ----------------------------------------------------- --- Handling of Default and Per-Object Expressions -- ----------------------------------------------------- +----------------------------------------------------------------------- +-- Handling of Default and Per-Object Expressions (Spec-Expressions) -- +----------------------------------------------------------------------- -- The default expressions in component declarations and in procedure --- specifications (but not the ones in object declarations) are quite --- tricky to handle. The problem is that some processing is required --- at the point where the expression appears: +-- specifications (but not the ones in object declarations) are quite tricky +-- to handle. The problem is that some processing is required at the point +-- where the expression appears: -- visibility analysis (including user defined operators) -- freezing of static expressions --- but other processing must be deferred until the enclosing entity --- (record or procedure specification) is frozen: +-- but other processing must be deferred until the enclosing entity (record or +-- procedure specification) is frozen: --- freezing of any other types in the expression --- expansion +-- freezing of any other types in the expression expansion +-- generation of code -- A similar situation occurs with the argument of priority and interrupt -- priority pragmas that appear in task and protected definition specs and -- other cases of per-object expressions (see RM 3.8(18)). --- Expansion has to be deferred since you can't generate code for --- expressions that refernce types that have not been frozen yet. As an --- example, consider the following: +-- Another similar case is the conditions in precondition and postcondition +-- pragmas that appear with subprogram specifications rather than in the body. + +-- Collectively we call these Spec_Expressions. The routine that performs the +-- special analysis is called Analyze_Spec_Expression. + +-- Expansion has to be deferred since you can't generate code for expressions +-- that reference types that have not been frozen yet. As an example, consider +-- the following: -- type x is delta 0.5 range -10.0 .. +10.0; -- ... @@ -118,9 +124,9 @@ -- for x'small use 0.25 --- The expander is in charge of dealing with fixed-point, and of course --- the small declaration, which is not too late, since the declaration of --- type q does *not* freeze type x, definitely affects the expanded code. +-- The expander is in charge of dealing with fixed-point, and of course the +-- small declaration, which is not too late, since the declaration of type q +-- does *not* freeze type x, definitely affects the expanded code. -- Another reason that we cannot expand early is that expansion can generate -- range checks. These range checks need to be inserted not at the point of @@ -132,26 +138,27 @@ -- this is the one case where this model falls down. Here is how we patch -- it up without causing too much distortion to our basic model. --- A switch (sede below) is set to indicate that we are in the initial --- occurence of a default expression. The analyzer is then called on this --- expression with the switch set true. Analysis and resolution proceed --- almost as usual, except that Freeze_Expression will not freeze --- non-static expressions if this switch is set, and the call to Expand at --- the end of resolution is skipped. This also skips the code that normally --- sets the Analyzed flag to True). The result is that when we are done the --- tree is still marked as unanalyzed, but all types for static expressions --- are frozen as required, and all entities of variables have been --- recorded. We then turn off the switch, and later on reanalyze the --- expression with the switch off. The effect is that this second analysis --- freezes the rest of the types as required, and generates code but --- visibility analysis is not repeated since all the entities are marked. +-- A switch (In_Spec_Expression) is set to show that we are in the initial +-- occurrence of a default expression. The analyzer is then called on this +-- expression with the switch set true. Analysis and resolution proceed almost +-- as usual, except that Freeze_Expression will not freeze non-static +-- expressions if this switch is set, and the call to Expand at the end of +-- resolution is skipped. This also skips the code that normally sets the +-- Analyzed flag to True. The result is that when we are done the tree is +-- still marked as unanalyzed, but all types for static expressions are frozen +-- as required, and all entities of variables have been recorded. We then turn +-- off the switch, and later on reanalyze the expression with the switch off. +-- The effect is that this second analysis freezes the rest of the types as +-- required, and generates code but visibility analysis is not repeated since +-- all the entities are marked. -- The second analysis (the one that generates code) is in the context --- where the code is required. For a record field default, this is in --- the initialization procedure for the record and for a subprogram --- default parameter, it is at the point the subprogram is frozen. --- For a priority or storage size pragma it is in the context of the --- Init_Proc for the task or protected object. +-- where the code is required. For a record field default, this is in the +-- initialization procedure for the record and for a subprogram default +-- parameter, it is at the point the subprogram is frozen. For a priority or +-- storage size pragma it is in the context of the Init_Proc for the task or +-- protected object. For a pre/postcondition pragma it is in the body when +-- code for the pragma is generated. ------------------ -- Pre-Analysis -- @@ -164,34 +171,35 @@ -- -- (1 .. 100 => new Thing (Function_Call)) -- --- The normal Analysis-Resolution-Expansion mechanism where expansion --- of the children is performed before expansion of the parent does not --- work if the code generated for the children by the expander needs --- to be evaluated repeatdly (for instance in the above aggregate --- "new Thing (Function_Call)" needs to be called 100 times.) --- The reason why this mecanism does not work is that, the expanded code --- for the children is typically inserted above the parent and thus --- when the father gets expanded no re-evaluation takes place. For instance --- in the case of aggregates if "new Thing (Function_Call)" is expanded --- before of the aggregate the expanded code will be placed outside --- of the aggregate and when expanding the aggregate the loop from 1 to 100 --- will not surround the expanded code for "new Thing (Function_Call)". --- --- To remedy this situation we introduce a new flag which signals whether --- we want a full analysis (ie expansion is enabled) or a pre-analysis --- which performs Analysis and Resolution but no expansion. --- --- After the complete pre-analysis of an expression has been carried out --- we can transform the expression and then carry out the full --- Analyze-Resolve-Expand cycle on the transformed expression top-down --- so that the expansion of inner expressions happens inside the newly --- generated node for the parent expression. --- +-- The normal Analysis-Resolution-Expansion mechanism where expansion of the +-- children is performed before expansion of the parent does not work if the +-- code generated for the children by the expander needs to be evaluated +-- repeatedly (for instance in the above aggregate "new Thing (Function_Call)" +-- needs to be called 100 times.) + +-- The reason why this mechanism does not work is that, the expanded code for +-- the children is typically inserted above the parent and thus when the +-- father gets expanded no re-evaluation takes place. For instance in the case +-- of aggregates if "new Thing (Function_Call)" is expanded before of the +-- aggregate the expanded code will be placed outside of the aggregate and +-- when expanding the aggregate the loop from 1 to 100 will not surround the +-- expanded code for "new Thing (Function_Call)". + +-- To remedy this situation we introduce a new flag which signals whether we +-- want a full analysis (i.e. expansion is enabled) or a pre-analysis which +-- performs Analysis and Resolution but no expansion. + +-- After the complete pre-analysis of an expression has been carried out we +-- can transform the expression and then carry out the full three stage +-- (Analyze-Resolve-Expand) cycle on the transformed expression top-down so +-- that the expansion of inner expressions happens inside the newly generated +-- node for the parent expression. + -- Note that the difference between processing of default expressions and -- pre-analysis of other expressions is that we do carry out freezing in -- the latter but not in the former (except for static scalar expressions). --- The routine that performs pre-analysis is called Pre_Analyze_And_Resolve --- and is in Sem_Res. +-- The routine that performs preanalysis and corresponding resolution is +-- called Preanalyze_And_Resolve and is in Sem_Res. with Alloc; with Einfo; use Einfo; @@ -219,12 +227,12 @@ package Sem is -- expansion phase is skipped. -- -- When this flag is False the flag Expander_Active is also False (the - -- Expander_Activer flag defined in the spec of package Expander tells you + -- Expander_Active flag defined in the spec of package Expander tells you -- whether expansion is currently enabled). You should really regard this -- as a read only flag. - In_Default_Expression : Boolean := False; - -- Switch to indicate that we are in a default expression, as described + In_Spec_Expression : Boolean := False; + -- Switch to indicate that we are in a spec-expression, as described -- above. Note that this must be recursively saved on a Semantics call -- since it is possible for the analysis of an expression to result in a -- recursive call (e.g. to get the entity for System.Address as part of the @@ -252,14 +260,22 @@ package Sem is -- package Expander). Only the generic processing can modify the -- status of this flag, any other client should regard it as read-only. + Inside_Freezing_Actions : Nat := 0; + -- Flag indicating whether we are within a call to Expand_N_Freeze_Actions. + -- Non-zero means we are inside (it is actually a level counter to deal + -- with nested calls). Used to avoid traversing the tree each time a + -- subprogram call is processed to know if we must not clear all constant + -- indications from entities in the current scope. Only the expansion of + -- freezing nodes can modify the status of this flag, any other client + -- should regard it as read-only. + Unloaded_Subunits : Boolean := False; -- This flag is set True if we have subunits that are not loaded. This -- occurs when the main unit is a subunit, and contains lower level -- subunits that are not loaded. We use this flag to suppress warnings -- about unused variables, since these warnings are unreliable in this -- case. We could perhaps do a more accurate job and retain some of the - -- warnings, but it is quite a tricky job. See test 4323-002. - -- Should not reference TN's in the source comments ??? + -- warnings, but it is quite a tricky job. ----------------------------------- -- Handling of Check Suppression -- @@ -270,7 +286,7 @@ package Sem is -- Scope based suppress checks for the predefined checks (from initial -- command line arguments, or from Suppress pragmas not including an entity - -- entity name) are recorded in the Sem.Supress variable, and all that is + -- entity name) are recorded in the Sem.Suppress variable, and all that is -- necessary is to save the state of this variable on scope entry, and -- restore it on scope exit. This mechanism allows for fast checking of -- the scope suppress state without needing complex data structures. @@ -425,7 +441,7 @@ package Sem is -- It is clear in retrospect that all semantic processing and visibility -- structures should have been fully recursive. The rtsfind mechanism, -- and the complexities brought about by subunits and by generic child - -- units and their instantitions, have led to a hybrid model that carries + -- units and their instantiations, have led to a hybrid model that carries -- more state than one would wish. type Scope_Stack_Entry is record @@ -442,6 +458,9 @@ package Sem is Save_Local_Suppress_Stack_Top : Suppress_Stack_Entry_Ptr; -- Save contents of Local_Suppress_Stack on entry to restore on exit + Save_Check_Policy_List : Node_Id; + -- Save contents of Check_Policy_List on entry to restore on exit + Is_Transient : Boolean; -- Marks Transient Scopes (See Exp_Ch7 body for details) diff --git a/gcc/ada/sem_aggr.adb b/gcc/ada/sem_aggr.adb index 33c12941aa2..5c7d9bd7dda 100644 --- a/gcc/ada/sem_aggr.adb +++ b/gcc/ada/sem_aggr.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 1992-2007, Free Software Foundation, Inc. -- +-- Copyright (C) 1992-2008, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -89,6 +89,11 @@ package body Sem_Aggr is -- -- It would be better to pass the proper type for Typ ??? + procedure Check_Expr_OK_In_Limited_Aggregate (Expr : Node_Id); + -- Check that Expr is either not limited or else is one of the cases of + -- expressions allowed for a limited component association (namely, an + -- aggregate, function call, or <> notation). Report error for violations. + ------------------------------------------------------ -- Subprograms used for RECORD AGGREGATE Processing -- ------------------------------------------------------ @@ -197,7 +202,7 @@ package body Sem_Aggr is Component : Node_Id); -- Give possible misspelling diagnostic if Component is likely to be -- a misspelling of one of the components of the Assoc_List. - -- This is called by Resolv_Aggr_Expr after producing + -- This is called by Resolve_Aggr_Expr after producing -- an invalid component error message. procedure Check_Static_Discriminated_Subtype (T : Entity_Id; V : Node_Id); @@ -215,10 +220,10 @@ package body Sem_Aggr is Index : Node_Id; Index_Constr : Node_Id; Component_Typ : Entity_Id; - Others_Allowed : Boolean) - return Boolean; + Others_Allowed : Boolean) return Boolean; -- This procedure performs the semantic checks for an array aggregate. -- True is returned if the aggregate resolution succeeds. + -- -- The procedure works by recursively checking each nested aggregate. -- Specifically, after checking a sub-aggregate nested at the i-th level -- we recursively check all the subaggregates at the i+1-st level (if any). @@ -249,7 +254,7 @@ package body Sem_Aggr is -- appears last in the sub-aggregate. Check that we do not have -- positional and named components in the array sub-aggregate (unless -- the named association is an others choice). Finally if an others - -- choice is present, make sure it is allowed in the aggregate contex. + -- choice is present, make sure it is allowed in the aggregate context. -- -- 2. If the array sub-aggregate contains discrete_choices: -- @@ -412,7 +417,7 @@ package body Sem_Aggr is -- This is really expansion activity, so make sure that expansion -- is on and is allowed. - if not Expander_Active or else In_Default_Expression then + if not Expander_Active or else In_Spec_Expression then return; end if; @@ -680,7 +685,6 @@ package body Sem_Aggr is Set_First_Index (Itype, First (Index_Constraints)); Set_Is_Constrained (Itype, True); Set_Is_Internal (Itype, True); - Init_Size_Align (Itype); -- A simple optimization: purely positional aggregates of static -- components should be passed to gigi unexpanded whenever possible, @@ -698,7 +702,7 @@ package body Sem_Aggr is -- and we must not generate a freeze node for the type, or else it -- will appear incomplete to gigi. - if Is_Packed (Itype) and then not In_Default_Expression + if Is_Packed (Itype) and then not In_Spec_Expression and then Expander_Active then Freeze_Itype (Itype, N); @@ -763,6 +767,23 @@ package body Sem_Aggr is end Check_Misspelled_Component; ---------------------------------------- + -- Check_Expr_OK_In_Limited_Aggregate -- + ---------------------------------------- + + procedure Check_Expr_OK_In_Limited_Aggregate (Expr : Node_Id) is + begin + if Is_Limited_Type (Etype (Expr)) + and then Comes_From_Source (Expr) + and then not In_Instance_Body + then + if not OK_For_Limited_Init (Expr) then + Error_Msg_N ("initialization not allowed for limited types", Expr); + Explain_Limited_Type (Etype (Expr), Expr); + end if; + end if; + end Check_Expr_OK_In_Limited_Aggregate; + + ---------------------------------------- -- Check_Static_Discriminated_Subtype -- ---------------------------------------- @@ -909,18 +930,14 @@ package body Sem_Aggr is -- First a special test, for the case of a positional aggregate -- of characters which can be replaced by a string literal. + -- Do not perform this transformation if this was a string literal -- to start with, whose components needed constraint checks, or if -- the component type is non-static, because it will require those -- checks and be transformed back into an aggregate. if Number_Dimensions (Typ) = 1 - and then - (Root_Type (Component_Type (Typ)) = Standard_Character - or else - Root_Type (Component_Type (Typ)) = Standard_Wide_Character - or else - Root_Type (Component_Type (Typ)) = Standard_Wide_Wide_Character) + and then Is_Standard_Character_Type (Component_Type (Typ)) and then No (Component_Associations (N)) and then not Is_Limited_Composite (Typ) and then not Is_Private_Composite (Typ) @@ -1078,8 +1095,7 @@ package body Sem_Aggr is Index : Node_Id; Index_Constr : Node_Id; Component_Typ : Entity_Id; - Others_Allowed : Boolean) - return Boolean + Others_Allowed : Boolean) return Boolean is Loc : constant Source_Ptr := Sloc (N); @@ -1126,9 +1142,8 @@ package body Sem_Aggr is function Resolve_Aggr_Expr (Expr : Node_Id; - Single_Elmt : Boolean) - return Boolean; - -- Resolves aggregate expression Expr. Returs False if resolution + Single_Elmt : Boolean) return Boolean; + -- Resolves aggregate expression Expr. Returns False if resolution -- fails. If Single_Elmt is set to False, the expression Expr may be -- used to initialize several array aggregate elements (this can -- happen for discrete choices such as "L .. H => Expr" or the others @@ -1377,12 +1392,11 @@ package body Sem_Aggr is function Resolve_Aggr_Expr (Expr : Node_Id; - Single_Elmt : Boolean) - return Boolean + Single_Elmt : Boolean) return Boolean is Nxt_Ind : constant Node_Id := Next_Index (Index); Nxt_Ind_Constr : constant Node_Id := Next_Index (Index_Constr); - -- Index is the current index corresponding to the expresion + -- Index is the current index corresponding to the expression Resolution_OK : Boolean := True; -- Set to False if resolution of the expression failed @@ -1435,9 +1449,10 @@ package body Sem_Aggr is elsif Single_Elmt or else not Expander_Active - or else In_Default_Expression + or else In_Spec_Expression then Analyze_And_Resolve (Expr, Component_Typ); + Check_Expr_OK_In_Limited_Aggregate (Expr); Check_Non_Static_Context (Expr); Aggregate_Constraint_Checks (Expr, Component_Typ); Check_Unset_Reference (Expr); @@ -1560,7 +1575,6 @@ package body Sem_Aggr is -- STEP 2: Process named components if No (Expressions (N)) then - if Others_Present then Case_Table_Size := Nb_Choices - 1; else @@ -1622,6 +1636,8 @@ package body Sem_Aggr is return Failure; end if; + -- Case of subtype indication + elsif Nkind (Choice) = N_Subtype_Indication then Resolve_Discrete_Subtype_Indication (Choice, Index_Base); @@ -1631,7 +1647,9 @@ package body Sem_Aggr is Get_Index_Bounds (Choice, Low, High); Check_Bounds (S_Low, S_High, Low, High); - else -- Choice is a range or an expression + -- Case of range or expression + + else Resolve (Choice, Index_Base); Check_Unset_Reference (Choice); Check_Non_Static_Context (Choice); @@ -1737,7 +1755,6 @@ package body Sem_Aggr is return Failure; elsif not Others_Present then - Hi_Val := Expr_Value (Table (J).Choice_Hi); Lo_Val := Expr_Value (Table (J + 1).Choice_Lo); @@ -1805,10 +1822,123 @@ package body Sem_Aggr is Choices_High := Table (Nb_Discrete_Choices).Choice_Hi; end if; + -- If Others is present, then bounds of aggregate come from the + -- index constraint (not the choices in the aggregate itself). + if Others_Present then Get_Index_Bounds (Index_Constr, Aggr_Low, Aggr_High); + -- No others clause present + else + -- Special processing if others allowed and not present. This + -- means that the bounds of the aggregate come from the index + -- constraint (and the length must match). + + if Others_Allowed then + Get_Index_Bounds (Index_Constr, Aggr_Low, Aggr_High); + + -- If others allowed, and no others present, then the array + -- should cover all index values. If it does not, we will + -- get a length check warning, but there is two cases where + -- an additional warning is useful: + + -- If we have no positional components, and the length is + -- wrong (which we can tell by others being allowed with + -- missing components), and the index type is an enumeration + -- type, then issue appropriate warnings about these missing + -- components. They are only warnings, since the aggregate + -- is fine, it's just the wrong length. We skip this check + -- for standard character types (since there are no literals + -- and it is too much trouble to concoct them), and also if + -- any of the bounds have not-known-at-compile-time values. + + -- Another case warranting a warning is when the length is + -- right, but as above we have an index type that is an + -- enumeration, and the bounds do not match. This is a + -- case where dubious sliding is allowed and we generate + -- a warning that the bounds do not match. + + if No (Expressions (N)) + and then Nkind (Index) = N_Range + and then Is_Enumeration_Type (Etype (Index)) + and then not Is_Standard_Character_Type (Etype (Index)) + and then Compile_Time_Known_Value (Aggr_Low) + and then Compile_Time_Known_Value (Aggr_High) + and then Compile_Time_Known_Value (Choices_Low) + and then Compile_Time_Known_Value (Choices_High) + then + declare + ALo : constant Node_Id := Expr_Value_E (Aggr_Low); + AHi : constant Node_Id := Expr_Value_E (Aggr_High); + CLo : constant Node_Id := Expr_Value_E (Choices_Low); + CHi : constant Node_Id := Expr_Value_E (Choices_High); + + Ent : Entity_Id; + + begin + -- Warning case one, missing values at start/end. Only + -- do the check if the number of entries is too small. + + if (Enumeration_Pos (CHi) - Enumeration_Pos (CLo)) + < + (Enumeration_Pos (AHi) - Enumeration_Pos (ALo)) + then + Error_Msg_N + ("missing index value(s) in array aggregate?", N); + + -- Output missing value(s) at start + + if Chars (ALo) /= Chars (CLo) then + Ent := Prev (CLo); + + if Chars (ALo) = Chars (Ent) then + Error_Msg_Name_1 := Chars (ALo); + Error_Msg_N ("\ %?", N); + else + Error_Msg_Name_1 := Chars (ALo); + Error_Msg_Name_2 := Chars (Ent); + Error_Msg_N ("\ % .. %?", N); + end if; + end if; + + -- Output missing value(s) at end + + if Chars (AHi) /= Chars (CHi) then + Ent := Next (CHi); + + if Chars (AHi) = Chars (Ent) then + Error_Msg_Name_1 := Chars (Ent); + Error_Msg_N ("\ %?", N); + else + Error_Msg_Name_1 := Chars (Ent); + Error_Msg_Name_2 := Chars (AHi); + Error_Msg_N ("\ % .. %?", N); + end if; + end if; + + -- Warning case 2, dubious sliding. The First_Subtype + -- test distinguishes between a constrained type where + -- sliding is not allowed (so we will get a warning + -- later that Constraint_Error will be raised), and + -- the unconstrained case where sliding is permitted. + + elsif (Enumeration_Pos (CHi) - Enumeration_Pos (CLo)) + = + (Enumeration_Pos (AHi) - Enumeration_Pos (ALo)) + and then Chars (ALo) /= Chars (CLo) + and then + not Is_Constrained (First_Subtype (Etype (N))) + then + Error_Msg_N + ("bounds of aggregate do not match target?", N); + end if; + end; + end if; + end if; + + -- If no others, aggregate bounds come from aggegate + Aggr_Low := Choices_Low; Aggr_High := Choices_High; end if; @@ -1976,10 +2106,44 @@ package body Sem_Aggr is I : Interp_Index; It : Interp; + function Valid_Limited_Ancestor (Anc : Node_Id) return Boolean; + -- If the type is limited, verify that the ancestor part is a legal + -- expression (aggregate or function call, including 'Input)) that + -- does not require a copy, as specified in 7.5 (2). + function Valid_Ancestor_Type return Boolean; -- Verify that the type of the ancestor part is a non-private ancestor -- of the expected type. + ---------------------------- + -- Valid_Limited_Ancestor -- + ---------------------------- + + function Valid_Limited_Ancestor (Anc : Node_Id) return Boolean is + begin + if Is_Entity_Name (Anc) + and then Is_Type (Entity (Anc)) + then + return True; + + elsif Nkind_In (Anc, N_Aggregate, N_Function_Call) then + return True; + + elsif Nkind (Anc) = N_Attribute_Reference + and then Attribute_Name (Anc) = Name_Input + then + return True; + + elsif + Nkind (Anc) = N_Qualified_Expression + then + return Valid_Limited_Ancestor (Expression (Anc)); + + else + return False; + end if; + end Valid_Limited_Ancestor; + ------------------------- -- Valid_Ancestor_Type -- ------------------------- @@ -1995,7 +2159,9 @@ package body Sem_Aggr is Imm_Type := Etype (Base_Type (Imm_Type)); end loop; - if Etype (Imm_Type) /= Base_Type (A_Type) then + if Etype (Imm_Type) /= Base_Type (A_Type) + or else Base_Type (Typ) = Base_Type (A_Type) + then Error_Msg_NE ("expect ancestor type of &", A, Typ); return False; else @@ -2020,6 +2186,13 @@ package body Sem_Aggr is Error_Msg_N ("aggregate type cannot be limited", N); Explain_Limited_Type (Typ, N); return; + + elsif Valid_Limited_Ancestor (A) then + null; + + else + Error_Msg_N + ("limited ancestor part must be aggregate or function call", A); end if; elsif Is_Class_Wide_Type (Typ) then @@ -2429,31 +2602,6 @@ package body Sem_Aggr is return Expr; end Get_Value; - procedure Check_Non_Limited_Type (Expr : Node_Id); - -- Relax check to allow the default initialization of limited types. - -- For example: - -- record - -- C : Lim := (..., others => <>); - -- end record; - - ---------------------------- - -- Check_Non_Limited_Type -- - ---------------------------- - - procedure Check_Non_Limited_Type (Expr : Node_Id) is - begin - if Is_Limited_Type (Etype (Expr)) - and then Comes_From_Source (Expr) - and then not In_Instance_Body - then - if not OK_For_Limited_Init (Expr) then - Error_Msg_N - ("initialization not allowed for limited types", N); - Explain_Limited_Type (Etype (Expr), Expr); - end if; - end if; - end Check_Non_Limited_Type; - ----------------------- -- Resolve_Aggr_Expr -- ----------------------- @@ -2504,7 +2652,7 @@ package body Sem_Aggr is Expr_Type := Etype (Component); -- Otherwise we have to pick up the new type of the component from - -- the new costrained subtype of the aggregate. In fact components + -- the new constrained subtype of the aggregate. In fact components -- which are of a composite type might be constrained by a -- discriminant, and we want to resolve Expr against the subtype were -- all discriminant occurrences are replaced with their actual value. @@ -2574,7 +2722,7 @@ package body Sem_Aggr is end if; Analyze_And_Resolve (Expr, Expr_Type); - Check_Non_Limited_Type (Expr); + Check_Expr_OK_In_Limited_Aggregate (Expr); Check_Non_Static_Context (Expr); Check_Unset_Reference (Expr); @@ -2768,11 +2916,11 @@ package body Sem_Aggr is -- in sem_ch3 and here rather than have a copy of the code which is a -- maintenance nightmare. - -- ??? Performace WARNING. The current implementation creates a new + -- ??? Performance WARNING. The current implementation creates a new -- itype for all aggregates whose base type is discriminated. -- This means that for record aggregates nested inside an array -- aggregate we will create a new itype for each record aggregate - -- if the array cmponent type has discriminants. For large aggregates + -- if the array component type has discriminants. For large aggregates -- this may be a problem. What should be done in this case is -- to reuse itypes as much as possible. @@ -3246,7 +3394,18 @@ package body Sem_Aggr is C := First_Component (Typ); while Present (C) loop if Chars (C) = Chars (Selectr) then - exit; + + -- If the context is an extension aggregate, + -- the component must not be inherited from + -- the ancestor part of the aggregate. + + if Nkind (N) /= N_Extension_Aggregate + or else + Scope (Original_Record_Component (C)) /= + Etype (Ancestor_Part (N)) + then + exit; + end if; end if; Next_Component (C); diff --git a/gcc/ada/sem_attr.adb b/gcc/ada/sem_attr.adb index 114df98d073..7550d90655d 100644 --- a/gcc/ada/sem_attr.adb +++ b/gcc/ada/sem_attr.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 1992-2007, Free Software Foundation, Inc. -- +-- Copyright (C) 1992-2008, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -250,7 +250,7 @@ package body Sem_Attr is procedure Check_Enum_Image; -- If the prefix type is an enumeration type, set all its literals -- as referenced, since the image function could possibly end up - -- referencing any of the literals indirectly. + -- referencing any of the literals indirectly. Same for Enum_Val. procedure Check_Fixed_Point_Type; -- Verify that prefix of attribute N is a fixed type @@ -275,8 +275,8 @@ package body Sem_Attr is -- two attribute expressions are present procedure Legal_Formal_Attribute; - -- Common processing for attributes Definite, Has_Access_Values, - -- and Has_Discriminants + -- Common processing for attributes Definite and Has_Discriminants. + -- Checks that prefix is generic indefinite formal type. procedure Check_Integer_Type; -- Verify that prefix of attribute N is an integer type @@ -287,6 +287,10 @@ package body Sem_Attr is procedure Check_Modular_Integer_Type; -- Verify that prefix of attribute N is a modular integer type + procedure Check_Not_CPP_Type; + -- Check that P (the prefix of the attribute) is not an CPP type + -- for which no Ada predefined primitive is available. + procedure Check_Not_Incomplete_Type; -- Check that P (the prefix of the attribute) is not an incomplete -- type or a private type for which no full view has been given. @@ -371,9 +375,9 @@ package body Sem_Attr is -- type that is constructed is returned as the result. procedure Build_Access_Subprogram_Type (P : Node_Id); - -- Build an access to subprogram whose designated type is - -- the type of the prefix. If prefix is overloaded, so it the - -- node itself. The result is stored in Acc_Type. + -- Build an access to subprogram whose designated type is the type of + -- the prefix. If prefix is overloaded, so is the node itself. The + -- result is stored in Acc_Type. function OK_Self_Reference return Boolean; -- An access reference whose prefix is a type can legally appear @@ -392,7 +396,6 @@ package body Sem_Attr is (E_Access_Attribute_Type, Current_Scope, Loc, 'A'); begin Set_Etype (Typ, Typ); - Init_Size_Align (Typ); Set_Is_Itype (Typ); Set_Associated_Node_For_Itype (Typ, N); Set_Directly_Designated_Type (Typ, DT); @@ -451,7 +454,7 @@ package body Sem_Attr is -- Note: This fragment of the tree is temporarily malformed -- because the correct tree requires an E_Subprogram_Type entity -- as the designated type. In most cases this designated type is - -- later overriden by the semantics with the type imposed by the + -- later overridden by the semantics with the type imposed by the -- context during the resolution phase. In the specific case of -- the expression Address!(Prim'Unrestricted_Access), used to -- initialize slots of dispatch tables, this work will be done by @@ -577,14 +580,16 @@ package body Sem_Attr is if Aname = Name_Unrestricted_Access then -- Do not kill values on nodes initializing dispatch tables - -- slots. The construct Address!(Prim'Unrestricted_Access) + -- slots. The construct Prim_Ptr!(Prim'Unrestricted_Access) -- is currently generated by the expander only for this -- purpose. Done to keep the quality of warnings currently -- generated by the compiler (otherwise any declaration of -- a tagged type cleans constant indications from its scope). if Nkind (Parent (N)) = N_Unchecked_Type_Conversion - and then Etype (Parent (N)) = RTE (RE_Address) + and then (Etype (Parent (N)) = RTE (RE_Prim_Ptr) + or else + Etype (Parent (N)) = RTE (RE_Size_Ptr)) and then Is_Dispatching_Operation (Directly_Designated_Type (Etype (N))) then @@ -658,12 +663,12 @@ package body Sem_Attr is ("current instance prefix must be a direct name", P); end if; - -- If a current instance attribute appears within a - -- a component constraint it must appear alone; other - -- contexts (default expressions, within a task body) - -- are not subject to this restriction. + -- If a current instance attribute appears in a component + -- constraint it must appear alone; other contexts (spec- + -- expressions, within a task body) are not subject to this + -- restriction. - if not In_Default_Expression + if not In_Spec_Expression and then not Has_Completion (Scop) and then not Nkind_In (Parent (N), N_Discriminant_Association, @@ -1263,6 +1268,20 @@ package body Sem_Attr is end if; end Check_Modular_Integer_Type; + ------------------------ + -- Check_Not_CPP_Type -- + ------------------------ + + procedure Check_Not_CPP_Type is + begin + if Is_Tagged_Type (Etype (P)) + and then Convention (Etype (P)) = Convention_CPP + and then Is_CPP_Class (Root_Type (Etype (P))) + then + Error_Attr_P ("invalid use of % attribute with CPP tagged type"); + end if; + end Check_Not_CPP_Type; + ------------------------------- -- Check_Not_Incomplete_Type -- ------------------------------- @@ -1323,7 +1342,7 @@ package body Sem_Attr is if not Is_Entity_Name (P) or else not Is_Type (Entity (P)) - or else In_Default_Expression + or else In_Spec_Expression then return; else @@ -1531,6 +1550,8 @@ package body Sem_Attr is Resolve (E2, P_Type); end if; + + Check_Not_CPP_Type; end Check_Stream_Attribute; ----------------------- @@ -1865,6 +1886,7 @@ package body Sem_Attr is and then Aname /= Name_Access and then Aname /= Name_Address and then Aname /= Name_Code_Address + and then Aname /= Name_Result and then Aname /= Name_Unchecked_Access then -- Ada 2005 (AI-345): Since protected and task types have primitive @@ -2055,6 +2077,7 @@ package body Sem_Attr is Check_E0; Check_Not_Incomplete_Type; + Check_Not_CPP_Type; Set_Etype (N, Universal_Integer); --------------- @@ -2082,7 +2105,7 @@ package body Sem_Attr is end if; end if; - Note_Possible_Modification (E2); + Note_Possible_Modification (E2, Sure => True); Set_Etype (N, RTE (RE_Asm_Output_Operand)); --------------- @@ -2109,11 +2132,19 @@ package body Sem_Attr is -- is set True for the entry family case). In the True case, -- makes sure that Is_AST_Entry is set on the entry. + ------------------- + -- Bad_AST_Entry -- + ------------------- + procedure Bad_AST_Entry is begin Error_Attr_P ("prefix for % attribute must be task entry"); end Bad_AST_Entry; + -------------- + -- OK_Entry -- + -------------- + function OK_Entry (E : Entity_Id) return Boolean is Result : Boolean; @@ -2796,6 +2827,38 @@ package body Sem_Attr is Set_Etype (N, Universal_Integer); end Enum_Rep; + -------------- + -- Enum_Val -- + -------------- + + when Attribute_Enum_Val => Enum_Val : begin + Check_E1; + Check_Type; + + if not Is_Enumeration_Type (P_Type) then + Error_Attr_P ("prefix of % attribute must be enumeration type"); + end if; + + -- If the enumeration type has a standard representation, the effect + -- is the same as 'Val, so rewrite the attribute as a 'Val. + + if not Has_Non_Standard_Rep (P_Base_Type) then + Rewrite (N, + Make_Attribute_Reference (Loc, + Prefix => Relocate_Node (Prefix (N)), + Attribute_Name => Name_Val, + Expressions => New_List (Relocate_Node (E1)))); + Analyze_And_Resolve (N, P_Base_Type); + + -- Non-standard representation case (enumeration with holes) + + else + Check_Enum_Image; + Resolve (E1, Any_Integer); + Set_Etype (N, P_Base_Type); + end if; + end Enum_Val; + ------------- -- Epsilon -- ------------- @@ -2901,6 +2964,15 @@ package body Sem_Attr is Set_Etype (N, Standard_Boolean); ----------------------- + -- Has_Tagged_Values -- + ----------------------- + + when Attribute_Has_Tagged_Values => + Check_Type; + Check_E0; + Set_Etype (N, Standard_Boolean); + + ----------------------- -- Has_Discriminants -- ----------------------- @@ -3017,6 +3089,16 @@ package body Sem_Attr is Set_Etype (N, P_Base_Type); + ------------------- + -- Invalid_Value -- + ------------------- + + when Attribute_Invalid_Value => + Check_E0; + Check_Scalar_Type; + Set_Etype (N, P_Base_Type); + Invalid_Value_Used := True; + ----------- -- Large -- ----------- @@ -3390,7 +3472,7 @@ package body Sem_Attr is Check_E0; Set_Etype (N, P_Type); - if not Is_Subprogram (Current_Scope) then + if No (Current_Subprogram) then Error_Attr ("attribute % can only appear within subprogram", N); end if; @@ -3560,6 +3642,69 @@ package body Sem_Attr is ("(Ada 83) % attribute not allowed for scalar type", P); end if; + ------------ + -- Result -- + ------------ + + when Attribute_Result => Result : declare + CS : constant Entity_Id := Current_Scope; + PS : constant Entity_Id := Scope (CS); + + begin + -- If we are in the scope of a function and in Spec_Expression mode, + -- this is likely the prescan of the postcondition pragma, and we + -- just set the proper type. If there is an error it will be caught + -- when the real Analyze call is done. + + if Ekind (CS) = E_Function + and then In_Spec_Expression + then + -- Check OK prefix + + if Chars (CS) /= Chars (P) then + Error_Msg_NE + ("incorrect prefix for % attribute, expected &", P, CS); + Error_Attr; + end if; + + Set_Etype (N, Etype (CS)); + + -- If several functions with that name are visible, + -- the intended one is the current scope. + + if Is_Overloaded (P) then + Set_Entity (P, CS); + Set_Is_Overloaded (P, False); + end if; + + -- Body case, where we must be inside a generated _Postcondition + -- procedure, or the attribute use is definitely misplaced. + + elsif Chars (CS) = Name_uPostconditions + and then Ekind (PS) = E_Function + then + -- Check OK prefix + + if Nkind (P) /= N_Identifier + or else Chars (P) /= Chars (PS) + then + Error_Msg_NE + ("incorrect prefix for % attribute, expected &", P, PS); + Error_Attr; + end if; + + Rewrite (N, + Make_Identifier (Sloc (N), + Chars => Name_uResult)); + Analyze_And_Resolve (N, Etype (PS)); + + else + Error_Attr + ("% attribute can only appear in function Postcondition pragma", + P); + end if; + end Result; + ------------------ -- Range_Length -- ------------------ @@ -3578,7 +3723,7 @@ package body Sem_Attr is Check_Stream_Attribute (TSS_Stream_Read); Set_Etype (N, Standard_Void_Type); Resolve (N, Standard_Void_Type); - Note_Possible_Modification (E2); + Note_Possible_Modification (E2, Sure => True); --------------- -- Remainder -- @@ -3737,6 +3882,7 @@ package body Sem_Attr is end if; Check_Not_Incomplete_Type; + Check_Not_CPP_Type; Set_Etype (N, Universal_Integer); end Size; @@ -5020,7 +5166,7 @@ package body Sem_Attr is -- Definite must be folded if the prefix is not a generic type, -- that is to say if we are within an instantiation. Same processing -- applies to the GNAT attributes Has_Discriminants, Type_Class, - -- and Unconstrained_Array. + -- Has_Tagged_Value, and Unconstrained_Array. elsif (Id = Attribute_Definite or else @@ -5028,6 +5174,8 @@ package body Sem_Attr is or else Id = Attribute_Has_Discriminants or else + Id = Attribute_Has_Tagged_Values + or else Id = Attribute_Type_Class or else Id = Attribute_Unconstrained_Array) @@ -5130,9 +5278,9 @@ package body Sem_Attr is -- since we can't do anything with unconstrained arrays. In addition, -- only the First, Last and Length attributes are possibly static. - -- Definite, Has_Access_Values, Has_Discriminants, Type_Class, and - -- Unconstrained_Array are again exceptions, because they apply as - -- well to unconstrained types. + -- Definite, Has_Access_Values, Has_Discriminants, Has_Tagged_Values, + -- Type_Class, and Unconstrained_Array are again exceptions, because + -- they apply as well to unconstrained types. -- In addition Component_Size is an exception since it is possibly -- foldable, even though it is never static, and it does apply to @@ -5145,6 +5293,8 @@ package body Sem_Attr is or else Id = Attribute_Has_Discriminants or else + Id = Attribute_Has_Tagged_Values + or else Id = Attribute_Type_Class or else Id = Attribute_Unconstrained_Array @@ -5394,7 +5544,7 @@ package body Sem_Attr is ----------------- -- Constrained is never folded for now, there may be cases that - -- could be handled at compile time. to be looked at later. + -- could be handled at compile time. To be looked at later. when Attribute_Constrained => null; @@ -5477,6 +5627,36 @@ package body Sem_Attr is Fold_Uint (N, Expr_Value (E1), Static); end if; + -------------- + -- Enum_Val -- + -------------- + + when Attribute_Enum_Val => Enum_Val : declare + Lit : Node_Id; + + begin + -- We have something like Enum_Type'Enum_Val (23), so search for a + -- corresponding value in the list of Enum_Rep values for the type. + + Lit := First_Literal (P_Base_Type); + loop + if Enumeration_Rep (Lit) = Expr_Value (E1) then + Fold_Uint (N, Enumeration_Pos (Lit), Static); + exit; + end if; + + Next_Literal (Lit); + + if No (Lit) then + Apply_Compile_Time_Constraint_Error + (N, "no representation value matches", + CE_Range_Check_Failed, + Warn => not Static); + exit; + end if; + end loop; + end Enum_Val; + ------------- -- Epsilon -- ------------- @@ -5564,6 +5744,15 @@ package body Sem_Attr is Boolean_Literals (Has_Discriminants (P_Entity)), Loc)); Analyze_And_Resolve (N, Standard_Boolean); + ----------------------- + -- Has_Tagged_Values -- + ----------------------- + + when Attribute_Has_Tagged_Values => + Rewrite (N, New_Occurrence_Of + (Boolean_Literals (Has_Tagged_Component (P_Root_Type)), Loc)); + Analyze_And_Resolve (N, Standard_Boolean); + -------------- -- Identity -- -------------- @@ -5615,9 +5804,21 @@ package body Sem_Attr is -- Integer_Value -- ------------------- + -- We never try to fold Integer_Value (though perhaps we could???) + when Attribute_Integer_Value => null; + ------------------- + -- Invalid_Value -- + ------------------- + + -- Invalid_Value is a scalar attribute that is never static, because + -- the value is by design out of range. + + when Attribute_Invalid_Value => + null; + ----------- -- Large -- ----------- @@ -6454,7 +6655,7 @@ package body Sem_Attr is when Attribute_Small => - -- The floating-point case is present only for Ada 83 compatability. + -- The floating-point case is present only for Ada 83 compatibility. -- Note that strictly this is an illegal addition, since we are -- extending an Ada 95 defined attribute, but we anticipate an -- ARG ruling that will permit this. @@ -6580,7 +6781,7 @@ package body Sem_Attr is -- We treat protected types like task types. It would make more -- sense to have another enumeration value, but after all the -- whole point of this feature is to be exactly DEC compatible, - -- and changing the type Type_Clas would not meet this requirement. + -- and changing the type Type_Class would not meet this requirement. elsif Is_Protected_Type (Typ) then Id := RE_Type_Class_Task; @@ -6785,10 +6986,8 @@ package body Sem_Attr is else declare R : constant Entity_Id := Root_Type (P_Type); - Lo : constant Uint := - Expr_Value (Type_Low_Bound (P_Type)); - Hi : constant Uint := - Expr_Value (Type_High_Bound (P_Type)); + Lo : constant Uint := Expr_Value (Type_Low_Bound (P_Type)); + Hi : constant Uint := Expr_Value (Type_High_Bound (P_Type)); W : Nat; Wt : Nat; T : Uint; @@ -6804,10 +7003,7 @@ package body Sem_Attr is -- Width for types derived from Standard.Character -- and Standard.Wide_[Wide_]Character. - elsif R = Standard_Character - or else R = Standard_Wide_Character - or else R = Standard_Wide_Wide_Character - then + elsif Is_Standard_Character_Type (P_Type) then W := 0; -- Set W larger if needed @@ -6978,6 +7174,7 @@ package body Sem_Attr is Attribute_Position | Attribute_Priority | Attribute_Read | + Attribute_Result | Attribute_Storage_Pool | Attribute_Storage_Size | Attribute_Storage_Unit | @@ -7172,7 +7369,7 @@ package body Sem_Attr is Access_Attribute : begin if Is_Variable (P) then - Note_Possible_Modification (P); + Note_Possible_Modification (P, Sure => False); end if; if Is_Entity_Name (P) then @@ -7202,7 +7399,10 @@ package body Sem_Attr is -- If it is an object, complete its resolution. elsif Is_Overloadable (Entity (P)) then - if not In_Default_Expression then + + -- Avoid insertion of freeze actions in spec expression mode + + if not In_Spec_Expression then Insert_Actions (N, Freeze_Entity (Entity (P), Loc)); end if; @@ -7303,7 +7503,7 @@ package body Sem_Attr is -- that generic unit. This includes any such attribute that -- occurs within the body of a generic unit that is a child -- of the generic unit where the subprogram is declared. - -- The rule also prohibits applying the attibute when the + -- The rule also prohibits applying the attribute when the -- access type is a generic formal access type (since the -- level of the actual type is not known). This restriction -- does not apply when the attribute type is an anonymous @@ -7760,7 +7960,7 @@ package body Sem_Attr is -- it may be modified via this address, so note modification. if Is_Variable (P) then - Note_Possible_Modification (P); + Note_Possible_Modification (P, Sure => False); end if; if Nkind (P) in N_Subexpr @@ -7927,35 +8127,6 @@ package body Sem_Attr is LB : Node_Id; HB : Node_Id; - function Check_Discriminated_Prival - (N : Node_Id) - return Node_Id; - -- The range of a private component constrained by a - -- discriminant is rewritten to make the discriminant - -- explicit. This solves some complex visibility problems - -- related to the use of privals. - - -------------------------------- - -- Check_Discriminated_Prival -- - -------------------------------- - - function Check_Discriminated_Prival - (N : Node_Id) - return Node_Id - is - begin - if Is_Entity_Name (N) - and then Ekind (Entity (N)) = E_In_Parameter - and then not Within_Init_Proc - then - return Make_Identifier (Sloc (N), Chars (Entity (N))); - else - return Duplicate_Subexpr (N); - end if; - end Check_Discriminated_Prival; - - -- Start of processing for Range_Attribute - begin if not Is_Entity_Name (P) or else not Is_Type (Entity (P)) @@ -7963,39 +8134,18 @@ package body Sem_Attr is Resolve (P); end if; - -- Check whether prefix is (renaming of) private component - -- of protected type. + HB := + Make_Attribute_Reference (Loc, + Prefix => + Duplicate_Subexpr (P, Name_Req => True), + Attribute_Name => Name_Last, + Expressions => Expressions (N)); - if Is_Entity_Name (P) - and then Comes_From_Source (N) - and then Is_Array_Type (Etype (P)) - and then Number_Dimensions (Etype (P)) = 1 - and then (Ekind (Scope (Entity (P))) = E_Protected_Type - or else - Ekind (Scope (Scope (Entity (P)))) = - E_Protected_Type) - then - LB := - Check_Discriminated_Prival - (Type_Low_Bound (Etype (First_Index (Etype (P))))); - - HB := - Check_Discriminated_Prival - (Type_High_Bound (Etype (First_Index (Etype (P))))); - - else - HB := - Make_Attribute_Reference (Loc, - Prefix => Duplicate_Subexpr (P), - Attribute_Name => Name_Last, - Expressions => Expressions (N)); - - LB := - Make_Attribute_Reference (Loc, - Prefix => P, - Attribute_Name => Name_First, - Expressions => Expressions (N)); - end if; + LB := + Make_Attribute_Reference (Loc, + Prefix => P, + Attribute_Name => Name_First, + Expressions => Expressions (N)); -- If the original was marked as Must_Not_Freeze (see code -- in Sem_Ch3.Make_Index), then make sure the rewriting @@ -8031,6 +8181,17 @@ package body Sem_Attr is return; end Range_Attribute; + ------------ + -- Result -- + ------------ + + -- We will only come here during the prescan of a spec expression + -- containing a Result attribute. In that case the proper Etype has + -- already been set, and nothing more needs to be done here. + + when Attribute_Result => + null; + ----------------- -- UET_Address -- ----------------- diff --git a/gcc/ada/sem_attr.ads b/gcc/ada/sem_attr.ads index 45cb8e0a6fa..30dda4304e1 100644 --- a/gcc/ada/sem_attr.ads +++ b/gcc/ada/sem_attr.ads @@ -6,7 +6,7 @@ -- -- -- S p e c -- -- -- --- Copyright (C) 1992-2007, Free Software Foundation, Inc. -- +-- Copyright (C) 1992-2008, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -210,6 +210,21 @@ package Sem_Attr is -- absence of an enumeration representation clause. This is a static -- attribute (i.e. the result is static if the argument is static). + -------------- + -- Enum_Val -- + -------------- + + Attribute_Enum_Val => True, + -- For every enumeration subtype S, S'Enum_Val denotes a function + -- with the following specification: + -- + -- function S'Enum_Val (Arg : universal_integer) return S'Base; + -- + -- This function performs the inverse transformation to Enum_Rep. Given + -- a representation value for the type, it returns the corresponding + -- enumeration value. Constraint_Error is raised if no value of the + -- enumeration type corresponds to the given integer value. + ----------------- -- Fixed_Value -- ----------------- @@ -276,6 +291,16 @@ package Sem_Attr is -- attribute is primarily intended for use in implementation of the -- standard input-output functions for fixed-point values. + Attribute_Invalid_Value => True, + -- For every scalar type, S'Invalid_Value designates an undefined value + -- of the type. If possible this value is an invalid value, and in fact + -- is identical to the value that would be set if Initialize_Scalars + -- mode were in effect (including the behavior of its value on + -- environment variables or binder switches). The intended use is + -- to set a value where intialization is required (e.g. as a result of + -- the coding standards in use), but logically no initialization is + -- needed, and the value should never be accessed. + ------------------ -- Machine_Size -- ------------------ @@ -301,7 +326,7 @@ package Sem_Attr is -------------------- Attribute_Mechanism_Code => True, - -- function'Mechanism_Code yeilds an integer code for the mechanism + -- function'Mechanism_Code yields an integer code for the mechanism -- used for the result of function, and subprogram'Mechanism_Code (n) -- yields the mechanism used for formal parameter number n (a static -- integer value, 1 = first parameter). The code returned is: @@ -325,7 +350,7 @@ package Sem_Attr is -- A reference T'Null_Parameter denotes an (imaginary) object of type or -- subtype T allocated at (machine) address zero. The attribute is -- allowed only as the default expression of a formal parameter, or as - -- an actual expression of a subporgram call. In either case, the + -- an actual expression of a subprogram call. In either case, the -- subprogram must be imported. -- -- The identity of the object is represented by the address zero in the @@ -421,7 +446,7 @@ package Sem_Attr is -- to convert this to an address using the same semantics as the -- System.Storage_Elements.To_Address function. The important difference -- is that this is a static attribute so it can be used in - -- initializations in preealborate packages. + -- initializations in preelaborate packages. ---------------- -- Type_Class -- diff --git a/gcc/ada/sem_aux.adb b/gcc/ada/sem_aux.adb new file mode 100755 index 00000000000..58b5b5c0da7 --- /dev/null +++ b/gcc/ada/sem_aux.adb @@ -0,0 +1,62 @@ +------------------------------------------------------------------------------ +-- -- +-- GNAT COMPILER COMPONENTS -- +-- -- +-- S E M _ A U X -- +-- -- +-- B o d y -- +-- -- +-- Copyright (C) 1992-2008, Free Software Foundation, Inc. -- +-- -- +-- GNAT is free software; you can redistribute it and/or modify it under -- +-- terms of the GNU General Public License as published by the Free Soft- -- +-- ware Foundation; either version 3, or (at your option) any later ver- -- +-- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- +-- OUT 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 distributed with GNAT; see file COPYING3. If not, go to -- +-- http://www.gnu.org/licenses for a complete copy of the license. -- +-- -- +-- As a special exception, if other files instantiate generics from this -- +-- unit, or you link this unit with other files to produce an executable, -- +-- this unit does not by itself cause the resulting executable to be -- +-- covered by the GNU General Public License. This exception does not -- +-- however invalidate any other reasons why the executable file might be -- +-- covered by the GNU Public License. -- +-- -- +-- GNAT was originally developed by the GNAT team at New York University. -- +-- Extensive contributions were provided by Ada Core Technologies Inc. -- +-- -- +------------------------------------------------------------------------------ + +package body Sem_Aux is + + ---------------- + -- Initialize -- + ---------------- + + procedure Initialize is + begin + Obsolescent_Warnings.Init; + end Initialize; + + --------------- + -- Tree_Read -- + --------------- + + procedure Tree_Read is + begin + Obsolescent_Warnings.Tree_Read; + end Tree_Read; + + ---------------- + -- Tree_Write -- + ---------------- + + procedure Tree_Write is + begin + Obsolescent_Warnings.Tree_Write; + end Tree_Write; + +end Sem_Aux; diff --git a/gcc/ada/sem_aux.ads b/gcc/ada/sem_aux.ads new file mode 100755 index 00000000000..d9d74821ff1 --- /dev/null +++ b/gcc/ada/sem_aux.ads @@ -0,0 +1,86 @@ +------------------------------------------------------------------------------ +-- -- +-- GNAT COMPILER COMPONENTS -- +-- -- +-- S E M _ A U X -- +-- -- +-- S p e c -- +-- -- +-- Copyright (C) 1992-2008, Free Software Foundation, Inc. -- +-- -- +-- GNAT is free software; you can redistribute it and/or modify it under -- +-- terms of the GNU General Public License as published by the Free Soft- -- +-- ware Foundation; either version 3, or (at your option) any later ver- -- +-- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- +-- OUT 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 distributed with GNAT; see file COPYING3. If not, go to -- +-- http://www.gnu.org/licenses for a complete copy of the license. -- +-- -- +-- As a special exception, if other files instantiate generics from this -- +-- unit, or you link this unit with other files to produce an executable, -- +-- this unit does not by itself cause the resulting executable to be -- +-- covered by the GNU General Public License. This exception does not -- +-- however invalidate any other reasons why the executable file might be -- +-- covered by the GNU Public License. -- +-- -- +-- GNAT was originally developed by the GNAT team at New York University. -- +-- Extensive contributions were provided by Ada Core Technologies Inc. -- +-- -- +------------------------------------------------------------------------------ + +-- Package containing utility procedures used throughout the compiler, +-- and also by ASIS so dependencies are limited to ASIS included packages. + +-- Note: contents are minimal for now, the intent is to move stuff from +-- Sem_Util that meets the ASIS dependency requirements, and also stuff +-- from Einfo, where Einfo had excessive semantic knowledge of the tree. + +with Alloc; use Alloc; +with Table; +with Types; use Types; + +package Sem_Aux is + + -------------------------------- + -- Obsolescent Warnings Table -- + -------------------------------- + + -- This table records entities for which a pragma Obsolescent with a + -- message argument has been processed. + + type OWT_Record is record + Ent : Entity_Id; + -- The entity to which the pragma applies + + Msg : String_Id; + -- The string containing the message + end record; + + package Obsolescent_Warnings is new Table.Table ( + Table_Component_Type => OWT_Record, + Table_Index_Type => Int, + Table_Low_Bound => 0, + Table_Initial => Alloc.Obsolescent_Warnings_Initial, + Table_Increment => Alloc.Obsolescent_Warnings_Increment, + Table_Name => "Obsolescent_Warnings"); + + ----------------- + -- Subprograms -- + ----------------- + + procedure Initialize; + -- Called at the start of compilation of each new main source file to + -- initialize the allocation of the Obsolescent_Warnings table. Note that + -- Initialize must not be called if Tree_Read is used. + + procedure Tree_Read; + -- Initializes internal tables from current tree file using the relevant + -- Table.Tree_Read routines. + + procedure Tree_Write; + -- Writes out internal tables to current tree file using the relevant + -- Table.Tree_Write routines. + +end Sem_Aux; diff --git a/gcc/ada/sem_case.adb b/gcc/ada/sem_case.adb index 3f27a4f1e7b..763144c296b 100644 --- a/gcc/ada/sem_case.adb +++ b/gcc/ada/sem_case.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 1996-2007, Free Software Foundation, Inc. -- +-- Copyright (C) 1996-2008, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -52,7 +52,7 @@ package body Sem_Case is type Sort_Choice_Table_Type is array (Nat range <>) of Choice_Bounds; -- This new array type is used as the actual table type for sorting -- discrete choices. The reason for not using Choice_Table_Type, is that - -- in Sort_Choice_Table_Type we reserve entry 0 for the sorting algortim + -- in Sort_Choice_Table_Type we reserve entry 0 for the sorting algorithm -- (this is not absolutely necessary but it makes the code more -- efficient). @@ -268,10 +268,7 @@ package body Sem_Case is -- For character, or wide [wide] character. If 7-bit ASCII graphic -- range, then build and return appropriate character literal name - if Rtp = Standard_Character - or else Rtp = Standard_Wide_Character - or else Rtp = Standard_Wide_Wide_Character - then + if Is_Standard_Character_Type (Ctype) then C := UI_To_Int (Value); if C in 16#20# .. 16#7E# then @@ -425,12 +422,7 @@ package body Sem_Case is -- of literals to search. Instead, a N_Character_Literal node -- is created with the appropriate Char_Code and Chars fields. - if Root_Type (Choice_Type) = Standard_Character - or else - Root_Type (Choice_Type) = Standard_Wide_Character - or else - Root_Type (Choice_Type) = Standard_Wide_Wide_Character - then + if Is_Standard_Character_Type (Choice_Type) then Set_Character_Literal_Name (Char_Code (UI_To_Int (Value))); Lit := New_Node (N_Character_Literal, Loc); Set_Chars (Lit, Name_Find); diff --git a/gcc/ada/sem_case.ads b/gcc/ada/sem_case.ads index 321d175ce25..dcc72931551 100644 --- a/gcc/ada/sem_case.ads +++ b/gcc/ada/sem_case.ads @@ -6,7 +6,7 @@ -- -- -- S p e c -- -- -- --- Copyright (C) 1996-2007, Free Software Foundation, Inc. -- +-- Copyright (C) 1996-2008, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -46,7 +46,7 @@ package Sem_Case is procedure No_OP (C : Node_Id); -- The no-operation routine. Does absolutely nothing. Can be used - -- in the following generic for the parameter Proces_Empty_Choice. + -- in the following generic for the parameter Process_Empty_Choice. generic with function Get_Alternatives (N : Node_Id) return List_Id; @@ -54,7 +54,7 @@ package Sem_Case is -- alternatives, or array aggregate component associations or -- record variants from which we can then access the actual lists -- of discrete choices. N is the node for the original construct - -- ie a case statement, an array aggregate or a record variant. + -- i.e. a case statement, an array aggregate or a record variant. with function Get_Choices (A : Node_Id) return List_Id; -- Given a case statement alternative, array aggregate component diff --git a/gcc/ada/sem_cat.adb b/gcc/ada/sem_cat.adb index b9dbfb18f94..bbce51f7240 100644 --- a/gcc/ada/sem_cat.adb +++ b/gcc/ada/sem_cat.adb @@ -151,7 +151,7 @@ package body Sem_Cat is -- to apply to the same library unit, in which case the unit has -- all associated categories, so we need to be careful here to -- check pragmas in proper Categorization order in order to - -- return the lowest appplicable value. + -- return the lowest applicable value. -- Ignore Pure specification if set by pragma Pure_Function @@ -194,7 +194,7 @@ package body Sem_Cat is Unit_Category := Get_Categorization (Unit_Entity); With_Category := Get_Categorization (Depended_Entity); - -- These messages are wanings in GNAT mode, to allow it to be + -- These messages are warnings in GNAT mode, to allow it to be -- judiciously turned off. Otherwise it is a real error. Error_Msg_Warn := GNAT_Mode; @@ -219,7 +219,7 @@ package body Sem_Cat is -- unit generating the message is an internal unit. This is the -- situation in which such messages would be ignored in any case, -- so it is convenient not to generate them (since it causes - -- annoying inteference with debugging) + -- annoying interference with debugging). if Is_Internal_File_Name (Unit_File_Name (Current_Sem_Unit)) and then not Is_Internal_File_Name (Unit_File_Name (Main_Unit)) @@ -332,8 +332,21 @@ package body Sem_Cat is Nam : TSS_Name_Type; At_Any_Place : Boolean := False) return Boolean is - Rep_Item : Node_Id; + Rep_Item : Node_Id; + Full_Type : Entity_Id := Typ; + begin + -- In the case of a type derived from a private view, any specified + -- stream attributes will be attached to the derived type's underlying + -- type rather the derived type entity itself (which is itself private). + + if Is_Private_Type (Typ) + and then Is_Derived_Type (Typ) + and then Present (Full_View (Typ)) + then + Full_Type := Underlying_Type (Typ); + end if; + -- We start from the declaration node and then loop until the end of -- the list until we find the requested attribute definition clause. -- In Ada 2005 mode, clauses are ignored if they are not currently @@ -341,7 +354,7 @@ package body Sem_Cat is -- inserted by the expander at the point where the clause occurs), -- unless At_Any_Place is true. - Rep_Item := First_Rep_Item (Typ); + Rep_Item := First_Rep_Item (Full_Type); while Present (Rep_Item) loop if Nkind (Rep_Item) = N_Attribute_Definition_Clause then case Chars (Rep_Item) is @@ -749,7 +762,7 @@ package body Sem_Cat is -- Static_Discriminant_Expr -- ------------------------------ - -- We need to accomodate a Why_Not_Static call somehow here ??? + -- We need to accommodate a Why_Not_Static call somehow here ??? function Static_Discriminant_Expr (L : List_Id) return Boolean is Discriminant_Spec : Node_Id; @@ -950,7 +963,7 @@ package body Sem_Cat is end; -- Child depends on parent; therefore parent should also be categorized - -- and satify the dependency hierarchy. + -- and satisfy the dependency hierarchy. -- Check if N is a child spec @@ -1251,7 +1264,9 @@ package body Sem_Cat is end; end if; - -- Non-static discriminant not allowed in preelaborayted unit + -- Non-static discriminant not allowed in preelaborated unit + -- Controlled object of a type with a user-defined Initialize + -- is forbidden as well. if Is_Record_Type (Etype (Id)) then declare @@ -1274,7 +1289,14 @@ package body Sem_Cat is PEE); end if; end if; + + if Has_Overriding_Initialize (ET) then + Error_Msg_NE + ("controlled type& does not have" + & " preelaborable initialization", N, ET); + end if; end; + end if; end if; @@ -1552,9 +1574,9 @@ package body Sem_Cat is Error_Node); end if; - -- For limited private type parameter, we check only the private + -- For a limited private type parameter, we check only the private -- declaration and ignore full type declaration, unless this is - -- the only declaration for the type, eg. as a limited record. + -- the only declaration for the type, e.g., as a limited record. elsif Is_Limited_Type (Param_Type) and then (Nkind (Type_Decl) = N_Private_Type_Declaration @@ -1569,7 +1591,7 @@ package body Sem_Cat is if No (Full_View (Param_Type)) and then Ekind (Param_Type) /= E_Record_Type then - -- Type does not have completion yet, so if declared in in + -- Type does not have completion yet, so if declared in -- the current RCI scope it is illegal, and will be flagged -- subsequently. @@ -1585,7 +1607,11 @@ package body Sem_Cat is -- contract model for privacy, but we support both semantics -- for now for compatibility (note that ACATS test BXE2009 -- checks a case that conforms to the Ada 95 rules but is - -- illegal in Ada 2005). + -- illegal in Ada 2005). In the Ada 2005 case we check for the + -- possibilities of visible TSS stream subprograms or explicit + -- stream attribute definitions because the TSS subprograms + -- can be hidden in the private part while the attribute + -- definitions are still be available from the visible part. Base_Param_Type := Base_Type (Param_Type); Base_Under_Type := Base_Type (Underlying_Type @@ -1609,7 +1635,13 @@ package body Sem_Cat is or else Is_Hidden (TSS (Base_Param_Type, TSS_Stream_Read)) or else - Is_Hidden (TSS (Base_Param_Type, TSS_Stream_Write)))) + Is_Hidden (TSS (Base_Param_Type, TSS_Stream_Write))) + and then + (not Has_Stream_Attribute_Definition + (Base_Param_Type, TSS_Stream_Read) + or else + not Has_Stream_Attribute_Definition + (Base_Param_Type, TSS_Stream_Write))) then if K = N_Subprogram_Declaration then Error_Node := Param_Spec; @@ -1761,12 +1793,15 @@ package body Sem_Cat is -- This subprogram also enforces the checks in E.2.2(13). A value of -- such type must not be dereferenced unless as controlling operand of - -- a dispatching call. + -- a dispatching call. Explicit dereferences not coming from source are + -- exempted from this checking because the expander produces them in + -- some cases (such as for tag checks on dispatching calls with multiple + -- controlling operands). However we do check in the case of an implicit + -- dereference that is expanded to an explicit dereference (hence the + -- test of whether Original_Node (N) comes from source). elsif K = N_Explicit_Dereference - and then (Comes_From_Source (N) - or else (Nkind (Original_Node (N)) = N_Selected_Component - and then Comes_From_Source (Original_Node (N)))) + and then Comes_From_Source (Original_Node (N)) then E := Etype (Prefix (N)); @@ -1788,9 +1823,12 @@ package body Sem_Cat is -- If we are just within a procedure or function call and the -- dereference has not been analyzed, return because this procedure - -- will be called again from sem_res Resolve_Actuals. + -- will be called again from sem_res Resolve_Actuals. The same can + -- apply in the case of dereference that is the prefix of a selected + -- component, which can be a call given in prefixed form. - if Is_Actual_Parameter (N) + if (Is_Actual_Parameter (N) + or else PK = N_Selected_Component) and then not Analyzed (N) then return; @@ -1806,25 +1844,8 @@ package body Sem_Cat is return; end if; - -- The following code is needed for expansion of RACW Write - -- attribute, since such expressions can appear in the expanded - -- code. - - if not Comes_From_Source (N) - and then - (PK = N_In - or else PK = N_Attribute_Reference - or else - (PK = N_Type_Conversion - and then Present (Parent (N)) - and then Present (Parent (Parent (N))) - and then - Nkind (Parent (Parent (N))) = N_Selected_Component)) - then - return; - end if; - - Error_Msg_N ("incorrect dereference of remote type", N); + Error_Msg_N + ("invalid dereference of a remote access-to-class-wide value", N); end if; end Validate_Remote_Access_To_Class_Wide_Type; diff --git a/gcc/ada/sem_cat.ads b/gcc/ada/sem_cat.ads index 2f4a16fd03f..c86bb3c0cc1 100644 --- a/gcc/ada/sem_cat.ads +++ b/gcc/ada/sem_cat.ads @@ -6,7 +6,7 @@ -- -- -- S p e c -- -- -- --- Copyright (C) 1992-2007, Free Software Foundation, Inc. -- +-- Copyright (C) 1992-2008, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -47,7 +47,7 @@ package Sem_Cat is -- True when there is a attribute definition clause specifying attribute -- Nam for Typ. In Ada 2005 mode, returns True only when the attribute -- definition clause is visible, unless At_Any_Place is True (in which case - -- no visiblity test is made, and True is returned as long as an attribute + -- no visibility test is made, and True is returned as long as an attribute -- is visible at any place). Note that attribute definition clauses -- inherited from parent types are taken into account by this predicate -- (to test for presence of an attribute definition clause for one diff --git a/gcc/ada/sem_ch10.adb b/gcc/ada/sem_ch10.adb index 665c1efb861..637e15351e5 100644 --- a/gcc/ada/sem_ch10.adb +++ b/gcc/ada/sem_ch10.adb @@ -28,6 +28,7 @@ with Debug; use Debug; with Einfo; use Einfo; with Errout; use Errout; with Exp_Util; use Exp_Util; +with Elists; use Elists; with Fname; use Fname; with Fname.UF; use Fname.UF; with Freeze; use Freeze; @@ -488,7 +489,7 @@ package body Sem_Ch10 is -- Avoid checking implicitly generated with clauses, limited -- with clauses or withs that have pragma Elaborate or - -- Elaborate_All apllied. + -- Elaborate_All applied. if Nkind (Clause) = N_With_Clause and then not Implicit_With (Clause) @@ -632,7 +633,7 @@ package body Sem_Ch10 is -- level (i.e. this subunit will be handled on the way down from the -- parent), so at this level we immediately return. If the subunit -- ends up not analyzed, it means that the parent did not contain a - -- stub for it, or that there errors were dectected in some ancestor. + -- stub for it, or that there errors were detected in some ancestor. if Nkind (Unit_Node) = N_Subunit and then not Analyzed (Lib_Unit) @@ -927,7 +928,7 @@ package body Sem_Ch10 is Remove_Unit_From_Visibility (Defining_Entity (Unit_Node)); -- If the unit is an instantiation whose body will be elaborated for - -- inlining purposes, use the the proper entity of the instance. The + -- inlining purposes, use the proper entity of the instance. The -- entity may be missing if the instantiation was illegal. elsif Nkind (Unit_Node) = N_Package_Instantiation @@ -1100,7 +1101,7 @@ package body Sem_Ch10 is or else Is_Preelaborated (Spec_Id) - -- No checks needed if pagma Elaborate_Body present + -- No checks needed if pragma Elaborate_Body present or else Has_Pragma_Elaborate_Body (Spec_Id) @@ -1247,6 +1248,16 @@ package body Sem_Ch10 is Next (Item); end loop; + -- This is the point at which we capture the configuration settings + -- for the unit. At the moment only the Optimize_Alignment setting + -- needs to be captured. Probably more later ??? + + if Optimize_Alignment_Local then + Set_OA_Setting (Current_Sem_Unit, 'L'); + else + Set_OA_Setting (Current_Sem_Unit, Optimize_Alignment); + end if; + -- Loop through actual context items. This is done in two passes: -- a) The first pass analyzes non-limited with-clauses and also any @@ -1264,7 +1275,7 @@ package body Sem_Ch10 is and then not Limited_Present (Item) then -- Skip analyzing with clause if no unit, nothing to do (this - -- happens for a with that references a non-existant unit) + -- happens for a with that references a non-existent unit) if Present (Library_Unit (Item)) then Analyze (Item); @@ -1305,14 +1316,12 @@ package body Sem_Ch10 is if not Implicit_With (Item) then - -- Check compilation unit containing the limited-with clause + -- Verify that the illegal contexts given in 10.1.2 (18/2) + -- are properly rejected, including renaming declarations. if not Nkind_In (Ukind, N_Package_Declaration, - N_Subprogram_Declaration, - N_Package_Renaming_Declaration, - N_Subprogram_Renaming_Declaration) + N_Subprogram_Declaration) and then Ukind not in N_Generic_Declaration - and then Ukind not in N_Generic_Renaming_Declaration and then Ukind not in N_Generic_Instantiation then Error_Msg_N ("limited with_clause not allowed here", Item); @@ -1748,7 +1757,7 @@ package body Sem_Ch10 is begin Check_Stub_Level (N); - -- First occurence of name may have been as an incomplete type + -- First occurrence of name may have been as an incomplete type if Present (Nam) and then Ekind (Nam) = E_Incomplete_Type then Nam := Full_View (Nam); @@ -2156,7 +2165,7 @@ package body Sem_Ch10 is begin Check_Stub_Level (N); - -- First occurence of name may have been as an incomplete type + -- First occurrence of name may have been as an incomplete type if Present (Nam) and then Ekind (Nam) = E_Incomplete_Type then Nam := Full_View (Nam); @@ -2221,12 +2230,21 @@ package body Sem_Ch10 is Cunit_Boolean_Restrictions_Save; begin + U := Unit (Library_Unit (N)); + + -- Several actions are skipped for dummy packages (those supplied for + -- with's where no matching file could be found). Such packages are + -- identified by the Sloc value being set to No_Location. + if Limited_Present (N) then -- Ada 2005 (AI-50217): Build visibility structures but do not -- analyze the unit. - Build_Limited_Views (N); + if Sloc (U) /= No_Location then + Build_Limited_Views (N); + end if; + return; end if; @@ -2256,13 +2274,8 @@ package body Sem_Ch10 is Semantics (Library_Unit (N)); end if; - U := Unit (Library_Unit (N)); Intunit := Is_Internal_File_Name (Unit_File_Name (Current_Sem_Unit)); - -- Following checks are skipped for dummy packages (those supplied for - -- with's where no matching file could be found). Such packages are - -- identified by the Sloc value being set to No_Location - if Sloc (U) /= No_Location then -- Check restrictions, except that we skip the check if this is an @@ -2529,6 +2542,7 @@ package body Sem_Ch10 is if Nkind (Item) = N_With_Clause and then not Implicit_With (Item) + and then not Limited_Present (Item) and then Is_Private_Descendant (Entity (Name (Item))) then Priv_Child := Entity (Name (Item)); @@ -2646,7 +2660,7 @@ package body Sem_Ch10 is P : Node_Id; function Build_Unit_Name (Nam : Node_Id) return Node_Id; - -- Comment requireed here ??? + -- Comment required here ??? --------------------- -- Build_Unit_Name -- @@ -3166,7 +3180,11 @@ package body Sem_Ch10 is -- Check that if a limited_with clause of a given compilation_unit -- mentions a descendant of a private child of some library unit, -- then the given compilation_unit shall be the declaration of a - -- private descendant of that library unit. + -- private descendant of that library unit, or a public descendant + -- of such. The code is analogous to that of Check_Private_Child_Unit + -- but we cannot use entities on the limited with_clauses because + -- their units have not been analyzed, so we have to climb the tree + -- of ancestors looking for private keywords. procedure Expand_Limited_With_Clause (Comp_Unit : Node_Id; @@ -3277,11 +3295,12 @@ package body Sem_Ch10 is procedure Check_Private_Limited_Withed_Unit (Item : Node_Id) is Curr_Parent : Node_Id; Child_Parent : Node_Id; + Curr_Private : Boolean; begin -- Compilation unit of the parent of the withed library unit - Child_Parent := Parent_Spec (Unit (Library_Unit (Item))); + Child_Parent := Library_Unit (Item); -- If the child unit is a public child, then locate its nearest -- private ancestor, if any; Child_Parent will then be set to @@ -3297,18 +3316,21 @@ package body Sem_Ch10 is if No (Child_Parent) then return; end if; - - Child_Parent := Parent_Spec (Unit (Child_Parent)); end if; + Child_Parent := Parent_Spec (Unit (Child_Parent)); + -- Traverse all the ancestors of the current compilation -- unit to check if it is a descendant of named library unit. Curr_Parent := Parent (Item); + Curr_Private := Private_Present (Curr_Parent); + while Present (Parent_Spec (Unit (Curr_Parent))) and then Curr_Parent /= Child_Parent loop Curr_Parent := Parent_Spec (Unit (Curr_Parent)); + Curr_Private := Curr_Private or else Private_Present (Curr_Parent); end loop; if Curr_Parent /= Child_Parent then @@ -3318,12 +3340,18 @@ package body Sem_Ch10 is ("\current unit must also have parent&!", Item, Defining_Unit_Name (Specification (Unit (Child_Parent)))); - elsif not Private_Present (Parent (Item)) - and then not Private_Present (Item) - and then not Nkind_In (Unit (Parent (Item)), N_Package_Body, + elsif Private_Present (Parent (Item)) + or else Curr_Private + or else Private_Present (Item) + or else Nkind_In (Unit (Parent (Item)), N_Package_Body, N_Subprogram_Body, N_Subunit) then + -- Current unit is private, of descendant of a private unit. + + null; + + else Error_Msg_NE ("current unit must also be private descendant of&", Item, Defining_Unit_Name (Specification (Unit (Child_Parent)))); @@ -3722,16 +3750,20 @@ package body Sem_Ch10 is Item := First (Context_Items (N)); while Present (Item) loop - -- Do not install private_with_clauses if the unit is a package - -- declaration, unless it is itself a private child unit. + -- Do not install private_with_clauses declaration, unless + -- unit is itself a private child unit, or is a body. + -- Note that for a subprogram body the private_with_clause does + -- not take effect until after the specification. - if Nkind (Item) = N_With_Clause - and then not Implicit_With (Item) - and then not Limited_Present (Item) - and then - (not Private_Present (Item) - or else Nkind (Unit (N)) /= N_Package_Declaration - or else Private_Present (N)) + if Nkind (Item) /= N_With_Clause + or else Implicit_With (Item) + or else Limited_Present (Item) + then + null; + + elsif not Private_Present (Item) + or else Private_Present (N) + or else Nkind (Unit (N)) = N_Package_Body then Id := Entity (Name (Item)); @@ -3792,15 +3824,26 @@ package body Sem_Ch10 is end loop; end; end if; + + -- If the item is a private with-clause on a child unit, the parent + -- may have been installed already, but the child unit must remain + -- invisible until installed in a private part or body. + + elsif Private_Present (Item) then + Id := Entity (Name (Item)); + + if Is_Child_Unit (Id) then + Set_Is_Visible_Child_Unit (Id, False); + end if; end if; Next (Item); end loop; end Install_Siblings; - ------------------------------- - -- Install_Limited_With_Unit -- - ------------------------------- + --------------------------------- + -- Install_Limited_Withed_Unit -- + --------------------------------- procedure Install_Limited_Withed_Unit (N : Node_Id) is P_Unit : constant Entity_Id := Unit (Library_Unit (N)); @@ -3810,6 +3853,14 @@ package body Sem_Ch10 is Lim_Header : Entity_Id; Lim_Typ : Entity_Id; + procedure Check_Body_Required; + -- A unit mentioned in a limited with_clause may not be mentioned in + -- a regular with_clause, but must still be included in the current + -- partition. We need to determine whether the unit needs a body, so + -- that the binder can determine the name of the file to be compiled. + -- Checking whether a unit needs a body can be done without semantic + -- analysis, by examining the nature of the declarations in the package. + function Has_Limited_With_Clause (C_Unit : Entity_Id; Pack : Entity_Id) return Boolean; @@ -3828,6 +3879,157 @@ package body Sem_Ch10 is -- Check if some package installed though normal with-clauses has a -- renaming declaration of package P. AARM 10.1.2(21/2). + ------------------------- + -- Check_Body_Required -- + ------------------------- + + -- ??? misses pragma Import on subprograms + -- ??? misses pragma Import on renamed subprograms + + procedure Check_Body_Required is + PA : constant List_Id := + Pragmas_After (Aux_Decls_Node (Parent (P_Unit))); + + procedure Check_Declarations (Spec : Node_Id); + -- Recursive procedure that does the work and checks nested packages + + ------------------------ + -- Check_Declarations -- + ------------------------ + + procedure Check_Declarations (Spec : Node_Id) is + Decl : Node_Id; + Incomplete_Decls : constant Elist_Id := New_Elmt_List; + + begin + -- Search for Elaborate Body pragma + + Decl := First (Visible_Declarations (Spec)); + while Present (Decl) + and then Nkind (Decl) = N_Pragma + loop + if Get_Pragma_Id (Decl) = Pragma_Elaborate_Body then + Set_Body_Required (Library_Unit (N)); + return; + end if; + + Next (Decl); + end loop; + + -- Look for declarations that require the presence of a body + + while Present (Decl) loop + + -- Subprogram that comes from source means body required + -- This is where a test for Import is missing ??? + + if Comes_From_Source (Decl) + and then (Nkind_In (Decl, N_Subprogram_Declaration, + N_Generic_Subprogram_Declaration)) + then + Set_Body_Required (Library_Unit (N)); + return; + + -- Package declaration of generic package declaration. We need + -- to recursively examine nested declarations. + + elsif Nkind_In (Decl, N_Package_Declaration, + N_Generic_Package_Declaration) + then + Check_Declarations (Specification (Decl)); + end if; + + Next (Decl); + end loop; + + -- Same set of tests for private part. In addition to subprograms + -- detect the presence of Taft Amendment types (incomplete types + -- completed in the body). + + Decl := First (Private_Declarations (Spec)); + while Present (Decl) loop + if Comes_From_Source (Decl) + and then (Nkind_In (Decl, N_Subprogram_Declaration, + N_Generic_Subprogram_Declaration)) + then + Set_Body_Required (Library_Unit (N)); + + elsif Nkind_In (Decl, N_Package_Declaration, + N_Generic_Package_Declaration) + then + Check_Declarations (Specification (Decl)); + + -- Collect incomplete type declarations for separate pass + + elsif Nkind (Decl) = N_Incomplete_Type_Declaration then + Append_Elmt (Decl, Incomplete_Decls); + end if; + + Next (Decl); + end loop; + + -- Now check incomplete declarations to locate Taft amendment + -- types. This can be done by examing the defining identifiers + -- of type declarations without real semantic analysis. + + declare + Inc : Elmt_Id; + + begin + Inc := First_Elmt (Incomplete_Decls); + while Present (Inc) loop + Decl := Next (Node (Inc)); + while Present (Decl) loop + if Nkind (Decl) = N_Full_Type_Declaration + and then Chars (Defining_Identifier (Decl)) = + Chars (Defining_Identifier (Node (Inc))) + then + exit; + end if; + + Next (Decl); + end loop; + + -- If no completion, this is a TAT, and a body is needed + + if No (Decl) then + Set_Body_Required (Library_Unit (N)); + return; + end if; + + Next_Elmt (Inc); + end loop; + end; + end Check_Declarations; + + -- Start of processing for Check_Body_Required + + begin + -- If this is an imported package (Java and CIL usage) no body is + -- needed. Scan list of pragmas that may follow a compilation unit + -- to look for a relevant pragma Import. + + if Present (PA) then + declare + Prag : Node_Id; + + begin + Prag := First (PA); + while Present (Prag) loop + if Nkind (Prag) = N_Pragma + and then Get_Pragma_Id (Prag) = Pragma_Import + then + return; + end if; + + Next (Prag); + end loop; + end; + end if; + + Check_Declarations (Specification (P_Unit)); + end Check_Body_Required; + ----------------------------- -- Has_Limited_With_Clause -- ----------------------------- @@ -4017,9 +4219,12 @@ package body Sem_Ch10 is -- In case of limited with_clause on subprograms, generics, instances, -- or renamings, the corresponding error was previously posted and we - -- have nothing to do here. + -- have nothing to do here. If the file is missing altogether, it has + -- no source location. - if Nkind (P_Unit) /= N_Package_Declaration then + if Nkind (P_Unit) /= N_Package_Declaration + or else Sloc (P_Unit) = No_Location + then return; end if; @@ -4105,39 +4310,11 @@ package body Sem_Ch10 is -- view of X supersedes its limited view. if Analyzed (P_Unit) - and then (Is_Immediately_Visible (P) - or else (Is_Child_Package - and then Is_Visible_Child_Unit (P))) + and then + (Is_Immediately_Visible (P) + or else + (Is_Child_Package and then Is_Visible_Child_Unit (P))) then - -- Ada 2005 (AI-262): Install the private declarations of P - - if Private_Present (N) - and then not In_Private_Part (P) - then - declare - Id : Entity_Id; - - begin - Id := First_Private_Entity (P); - while Present (Id) loop - if not Is_Internal (Id) - and then not Is_Child_Unit (Id) - then - if not In_Chain (Id) then - Set_Homonym (Id, Current_Entity (Id)); - Set_Current_Entity (Id); - end if; - - Set_Is_Immediately_Visible (Id); - end if; - - Next_Entity (Id); - end loop; - - Set_In_Private_Part (P); - end; - end if; - return; end if; @@ -4296,6 +4473,13 @@ package body Sem_Ch10 is Set_Is_Immediately_Visible (P); Set_Limited_View_Installed (N); + -- If unit has not been analyzed in some previous context, check + -- (imperfectly ???) whether it might need a body. + + if not Analyzed (P_Unit) then + Check_Body_Required; + end if; + -- If the package in the limited_with clause is a child unit, the -- clause is unanalyzed and appears as a selected component. Recast -- it as an expanded name so that the entity can be properly set. Use @@ -4674,12 +4858,24 @@ package body Sem_Ch10 is -- Build corresponding class_wide type, if not previously done - -- Warning: The class-wide entity is shared by the limited-view + -- Note: The class-wide entity is shared by the limited-view -- and the full-view. if No (Class_Wide_Type (T)) then CW := Make_Defining_Identifier (Loc, New_Internal_Name ('S')); + -- Set parent to be the same as the parent of the tagged type. + -- We need a parent field set, and it is supposed to point to + -- the declaration of the type. The tagged type declaration + -- essentially declares two separate types, the tagged type + -- itself and the corresponding class-wide type, so it is + -- reasonable for the parent fields to point to the declaration + -- in both cases. + + Set_Parent (CW, Parent (T)); + + -- Set remaining fields of classwide type + Set_Ekind (CW, E_Class_Wide_Type); Set_Etype (CW, T); Set_Scope (CW, Scop); @@ -4691,6 +4887,8 @@ package body Sem_Ch10 is Set_Equivalent_Type (CW, Empty); Set_From_With_Type (CW, From_With_Type (T)); + -- Link type to its class-wide type + Set_Class_Wide_Type (T, CW); end if; end Decorate_Tagged_Type; @@ -4807,12 +5005,19 @@ package body Sem_Ch10 is Set_Non_Limited_View (Lim_Typ, Comp_Typ); elsif Nkind_In (Decl, N_Private_Type_Declaration, - N_Incomplete_Type_Declaration) + N_Incomplete_Type_Declaration, + N_Task_Type_Declaration, + N_Protected_Type_Declaration) then Comp_Typ := Defining_Identifier (Decl); + Is_Tagged := + Nkind_In (Decl, N_Private_Type_Declaration, + N_Incomplete_Type_Declaration) + and then Tagged_Present (Decl); + if not Analyzed_Unit then - if Tagged_Present (Decl) then + if Is_Tagged then Decorate_Tagged_Type (Sloc (Decl), Comp_Typ, Scope); else Decorate_Incomplete_Type (Comp_Typ, Scope); @@ -4828,7 +5033,7 @@ package body Sem_Ch10 is Set_Parent (Lim_Typ, Parent (Comp_Typ)); Set_From_With_Type (Lim_Typ); - if Tagged_Present (Decl) then + if Is_Tagged then Decorate_Tagged_Type (Sloc (Decl), Lim_Typ, Scope); else Decorate_Incomplete_Type (Lim_Typ, Scope); @@ -4902,13 +5107,11 @@ package body Sem_Ch10 is begin pragma Assert (Limited_Present (N)); - -- A library_item mentioned in a limited_with_clause shall - -- be a package_declaration, not a subprogram_declaration, - -- generic_declaration, generic_instantiation, or - -- package_renaming_declaration + -- A library_item mentioned in a limited_with_clause is a package + -- declaration, not a subprogram declaration, generic declaration, + -- generic instantiation, or package renaming declaration. case Nkind (Unit (Library_Unit (N))) is - when N_Package_Declaration => null; @@ -5274,7 +5477,7 @@ package body Sem_Ch10 is Next_Entity (E); end loop; - -- If the previous search was not sucessful then the entity + -- If the previous search was not successful then the entity -- to be restored in the homonym list is the non-limited view if E = First_Private_Entity (P) then diff --git a/gcc/ada/sem_ch10.ads b/gcc/ada/sem_ch10.ads index 9f6543bd082..066ceecb4bf 100644 --- a/gcc/ada/sem_ch10.ads +++ b/gcc/ada/sem_ch10.ads @@ -6,7 +6,7 @@ -- -- -- S p e c -- -- -- --- Copyright (C) 1992-2007, Free Software Foundation, Inc. -- +-- Copyright (C) 1992-2008, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -56,7 +56,7 @@ package Sem_Ch10 is -- private part of a nested package, even if this package appears in -- the visible part of the enclosing compilation unit. This Ada 2005 -- rule imposes extra steps in order to install/remove the private_with - -- clauses of the an enclosing unit. + -- clauses of an enclosing unit. procedure Load_Needed_Body (N : Node_Id; OK : out Boolean); -- Load and analyze the body of a context unit that is generic, or diff --git a/gcc/ada/sem_ch12.adb b/gcc/ada/sem_ch12.adb index a2019a6e427..e7755c4f534 100644 --- a/gcc/ada/sem_ch12.adb +++ b/gcc/ada/sem_ch12.adb @@ -111,7 +111,7 @@ package body Sem_Ch12 is -- b) Each instantiation copies the original tree, and inserts into it a -- series of declarations that describe the mapping between generic formals -- and actuals. For example, a generic In OUT parameter is an object - -- renaming of the corresponing actual, etc. Generic IN parameters are + -- renaming of the corresponding actual, etc. Generic IN parameters are -- constant declarations. -- c) In order to give the right visibility for these renamings, we use @@ -465,7 +465,7 @@ package body Sem_Ch12 is function Is_Generic_Formal (E : Entity_Id) return Boolean; -- Utility to determine whether a given entity is declared by means of - -- of a formal parameter declaration. Used to set properly the visiblity + -- of a formal parameter declaration. Used to set properly the visibility -- of generic formals of a generic package declared with a box or with -- partial parametrization. @@ -488,11 +488,11 @@ package body Sem_Ch12 is -- and has already been flipped during this phase of instantiation. procedure Hide_Current_Scope; - -- When compiling a generic child unit, the parent context must be + -- When instantiating a generic child unit, the parent context must be -- present, but the instance and all entities that may be generated -- must be inserted in the current scope. We leave the current scope -- on the stack, but make its entities invisible to avoid visibility - -- problems. This is reversed at the end of instantiations. This is + -- problems. This is reversed at the end of the instantiation. This is -- not done for the instantiation of the bodies, which only require the -- instances of the generic parents to be in scope. @@ -666,7 +666,7 @@ package body Sem_Ch12 is -- -- Nodes that are selected components in the parse tree may be rewritten -- as expanded names after resolution, and must be treated as potential - -- entity holders. which is why they also have an Associated_Node. + -- entity holders, which is why they also have an Associated_Node. -- -- Nodes that do not come from source, such as freeze nodes, do not appear -- in the generic tree, and need not have an associated node. @@ -685,7 +685,7 @@ package body Sem_Ch12 is -- at the end of the enclosing generic package, which is semantically -- neutral. - procedure Pre_Analyze_Actuals (N : Node_Id); + procedure Preanalyze_Actuals (N : Node_Id); -- Analyze actuals to perform name resolution. Full resolution is done -- later, when the expected types are known, but names have to be captured -- before installing parents of generics, that are not visible for the @@ -802,7 +802,7 @@ package body Sem_Ch12 is (Pack_Id : Entity_Id; Is_Package : Boolean := True); -- Restore the private views of external types, and unmark the generic - -- renamings of actuals, so that they become comptible subtypes again. + -- renamings of actuals, so that they become compatible subtypes again. -- For subprograms, Pack_Id is the package constructed to hold the -- renamings. @@ -882,7 +882,7 @@ package body Sem_Ch12 is Default_Formals : constant List_Id := New_List; -- If an Other_Choice is present, some of the formals may be defaulted. - -- To simplify the treatement of visibility in an instance, we introduce + -- To simplify the treatment of visibility in an instance, we introduce -- individual defaults for each such formal. These defaults are -- appended to the list of associations and replace the Others_Choice. @@ -1027,6 +1027,8 @@ package body Sem_Ch12 is procedure Process_Default (F : Entity_Id) is Loc : constant Source_Ptr := Sloc (I_Node); + F_Id : constant Entity_Id := Defining_Entity (F); + Decl : Node_Id; Default : Node_Id; Id : Entity_Id; @@ -1036,17 +1038,12 @@ package body Sem_Ch12 is -- new defining identifier for it. Decl := New_Copy_Tree (F); + Id := Make_Defining_Identifier (Sloc (F_Id), Chars => Chars (F_Id)); - if Nkind (F) = N_Formal_Concrete_Subprogram_Declaration then - Id := - Make_Defining_Identifier (Sloc (Defining_Entity (F)), - Chars => Chars (Defining_Entity (F))); + if Nkind (F) in N_Formal_Subprogram_Declaration then Set_Defining_Unit_Name (Specification (Decl), Id); else - Id := - Make_Defining_Identifier (Sloc (Defining_Entity (F)), - Chars => Chars (Defining_Identifier (F))); Set_Defining_Identifier (Decl, Id); end if; @@ -1445,8 +1442,8 @@ package body Sem_Ch12 is end loop; end; - -- If this is a formal package. normalize the parameter list by adding - -- explicit box asssociations for the formals that are covered by an + -- If this is a formal package, normalize the parameter list by adding + -- explicit box associations for the formals that are covered by an -- Others_Choice. if not Is_Empty_List (Default_Formals) then @@ -1652,7 +1649,6 @@ package body Sem_Ch12 is Set_Size_Known_At_Compile_Time (T, Size_Known_At_Compile_Time (Entity (Subtype_Mark (Def)))); - end Analyze_Formal_Derived_Type; ---------------------------------- @@ -1855,7 +1851,7 @@ package body Sem_Ch12 is end if; if Present (E) then - Analyze_Per_Use_Expression (E, T); + Preanalyze_Spec_Expression (E, T); if Is_Limited_Type (T) and then not OK_For_Limited_Init (E) then Error_Msg_N @@ -1971,7 +1967,7 @@ package body Sem_Ch12 is -- The formal package is rewritten so that its parameters are replaced -- with corresponding declarations. For parameters with bona fide -- associations these declarations are created by Analyze_Associations - -- as for aa regular instantiation. For boxed parameters, we preserve + -- as for a regular instantiation. For boxed parameters, we preserve -- the formal declarations and analyze them, in order to introduce -- entities of the right kind in the environment of the formal. @@ -2910,7 +2906,7 @@ package body Sem_Ch12 is end if; Generate_Definition (Act_Decl_Id); - Pre_Analyze_Actuals (N); + Preanalyze_Actuals (N); Init_Env; Env_Installed := True; @@ -3184,7 +3180,7 @@ package body Sem_Ch12 is -- body to instantiate until the enclosing generic is instantiated -- and there is an actual for the formal package. If the formal -- package has parameters, we build a regular package instance for - -- it, that preceeds the original formal package declaration. + -- it, that precedes the original formal package declaration. if In_Open_Scopes (Scope (Scope (Gen_Unit))) then declare @@ -3342,8 +3338,9 @@ package body Sem_Ch12 is -- on current node so context is complete for analysis (including -- nested instantiations). If this is the main unit, the declaration -- eventually replaces the instantiation node. If the instance body - -- is later created, it replaces the instance node, and the declation - -- is attached to it (see Build_Instance_Compilation_Unit_Nodes). + -- is created later, it replaces the instance node, and the + -- declaration is attached to it (see + -- Build_Instance_Compilation_Unit_Nodes). else if Cunit_Entity (Current_Sem_Unit) = Defining_Entity (N) then @@ -3539,7 +3536,7 @@ package body Sem_Ch12 is -- removed previously. -- If current scope is the body of a child unit, remove context of - -- spec as well. If an enclosing scope is an instance body. the + -- spec as well. If an enclosing scope is an instance body, the -- context has already been removed, but the entities in the body -- must be made invisible as well. @@ -3888,9 +3885,7 @@ package body Sem_Ch12 is -- subprogram will be frozen at the point the wrapper package is -- frozen, so it does not need its own freeze node. In fact, if one -- is created, it might conflict with the freezing actions from the - -- wrapper package (see 7206-013). - - -- Should not really reference non-public TN's in comments ??? + -- wrapper package. Set_Has_Delayed_Freeze (Anon_Id, False); @@ -3946,7 +3941,7 @@ package body Sem_Ch12 is -- Make node global for error reporting Instantiation_Node := N; - Pre_Analyze_Actuals (N); + Preanalyze_Actuals (N); Init_Env; Env_Installed := True; @@ -4038,12 +4033,16 @@ package body Sem_Ch12 is Create_Instantiation_Source (N, Gen_Unit, False, S_Adjustment); -- Copy original generic tree, to produce text for instantiation + -- Inherit overriding indicator from instance node. Act_Tree := Copy_Generic_Node (Original_Node (Gen_Decl), Empty, Instantiating => True); Act_Spec := Specification (Act_Tree); + Set_Must_Override (Act_Spec, Must_Override (N)); + Set_Must_Not_Override (Act_Spec, Must_Not_Override (N)); + Renaming_List := Analyze_Associations (N, @@ -4516,7 +4515,7 @@ package body Sem_Ch12 is if No (E1) then return; - -- If the formal entity comes from a formal declaration. it was + -- If the formal entity comes from a formal declaration, it was -- defaulted in the formal package, and no check is needed on it. elsif Nkind (Parent (E2)) = N_Formal_Object_Declaration then @@ -4625,11 +4624,22 @@ package body Sem_Ch12 is elsif Is_Overloadable (E1) then - -- Verify that the names of the entities match. Note that actuals - -- that are attributes are rewritten as subprograms. + -- Verify that the actual subprograms match. Note that actuals + -- that are attributes are rewritten as subprograms. If the + -- subprogram in the formal package is defaulted, no check is + -- needed. Note that this can only happen in Ada2005 when the + -- formal package can be partially parametrized. - Check_Mismatch - (Ekind (E2) /= Ekind (E1) or else (Alias (E1)) /= Alias (E2)); + if Nkind (Unit_Declaration_Node (E1)) = + N_Subprogram_Renaming_Declaration + and then From_Default (Unit_Declaration_Node (E1)) + then + null; + + else + Check_Mismatch + (Ekind (E2) /= Ekind (E1) or else (Alias (E1)) /= Alias (E2)); + end if; else raise Program_Error; @@ -4692,7 +4702,7 @@ package body Sem_Ch12 is begin -- The instantiation appears before the generic body if we are in the -- scope of the unit containing the generic, either in its spec or in - -- the package body. and before the generic body. + -- the package body, and before the generic body. if Ekind (Gen_Comp) = E_Package_Body then Gen_Comp := Spec_Entity (Gen_Comp); @@ -5768,7 +5778,7 @@ package body Sem_Ch12 is -- If we are not instantiating, then this is where we load and -- analyze subunits, i.e. at the point where the stub occurs. A - -- more permissivle system might defer this analysis to the point + -- more permissible system might defer this analysis to the point -- of instantiation, but this seems to complicated for now. if not Instantiating then @@ -5787,7 +5797,7 @@ package body Sem_Ch12 is Error_Node => N); -- If the proper body is not found, a warning message will be - -- emitted when analyzing the stub, or later at the the point + -- emitted when analyzing the stub, or later at the point -- of instantiation. Here we just leave the stub as is. if Unum = No_Unit then @@ -5854,7 +5864,7 @@ package body Sem_Ch12 is -- unit field of N points to the parent unit (which is a compilation -- unit) and need not (and cannot!) be copied. - -- When the proper body of the stub is analyzed, thie library_unit link + -- When the proper body of the stub is analyzed, the library_unit link -- is used to establish the proper context (see sem_ch10). -- The other fields of a compilation unit are copied as usual @@ -6244,7 +6254,7 @@ package body Sem_Ch12 is end loop; end Find_Depth; - -- Start of procesing for Earlier + -- Start of processing for Earlier begin Find_Depth (P1, D1); @@ -6361,7 +6371,7 @@ package body Sem_Ch12 is begin -- If the instance and the generic body appear within the same unit, and - -- the instance preceeds the generic, the freeze node for the instance + -- the instance precedes the generic, the freeze node for the instance -- must appear after that of the generic. If the generic is nested -- within another instance I2, then current instance must be frozen -- after I2. In both cases, the freeze nodes are those of enclosing @@ -6766,7 +6776,7 @@ package body Sem_Ch12 is -- The inherited context is attached to the enclosing compilation -- unit. This is either the main unit, or the declaration for the - -- main unit (in case the instantation appears within the package + -- main unit (in case the instantiation appears within the package -- declaration and the main unit is its body). Current_Unit := Parent (Inst); @@ -7251,7 +7261,7 @@ package body Sem_Ch12 is Actual_Ent : Entity_Id); -- Associates the formal entity with the actual. In the case -- where Formal_Ent is a formal package, this procedure iterates - -- through all of its formals and enters associations betwen the + -- through all of its formals and enters associations between the -- actuals occurring in the formal package's corresponding actual -- package (given by Actual_Ent) and the formal package's formal -- parameters. This procedure recurses if any of the parameters is @@ -7268,7 +7278,7 @@ package body Sem_Ch12 is procedure Map_Entities (Form : Entity_Id; Act : Entity_Id); -- Within the generic part, entities in the formal package are -- visible. To validate subsequent type declarations, indicate - -- the correspondence betwen the entities in the analyzed formal, + -- the correspondence between the entities in the analyzed formal, -- and the entities in the actual package. There are three packages -- involved in the instantiation of a formal package: the parent -- generic P1 which appears in the generic declaration, the fake @@ -8203,7 +8213,7 @@ package body Sem_Ch12 is Resolve (Actual, Ftyp); - if not Is_Variable (Actual) or else Paren_Count (Actual) > 0 then + if not Denotes_Variable (Actual) then Error_Msg_NE ("actual for& must be a variable", Actual, Formal_Id); @@ -8226,7 +8236,7 @@ package body Sem_Ch12 is end if; end if; - Note_Possible_Modification (Actual); + Note_Possible_Modification (Actual, Sure => True); -- Check for instantiation of atomic/volatile actual for -- non-atomic/volatile formal (RM C.6 (12)). @@ -8280,7 +8290,7 @@ package body Sem_Ch12 is Append (Decl_Node, List); -- No need to repeat (pre-)analysis of some expression nodes - -- already handled in Pre_Analyze_Actuals. + -- already handled in Preanalyze_Actuals. if Nkind (Actual) /= N_Allocator then Analyze (Actual); @@ -8306,7 +8316,7 @@ package body Sem_Ch12 is -- a child unit. if Nkind (Actual) = N_Aggregate then - Pre_Analyze_And_Resolve (Actual, Typ); + Preanalyze_And_Resolve (Actual, Typ); end if; if Is_Limited_Type (Typ) @@ -8397,13 +8407,12 @@ package body Sem_Ch12 is Nkind_In (Actual_Decl, N_Formal_Object_Declaration, N_Object_Declaration) and then Nkind (Analyzed_Formal) = N_Formal_Object_Declaration - and then Has_Null_Exclusion (Actual_Decl) - and then not Has_Null_Exclusion (Analyzed_Formal) + and then not Has_Null_Exclusion (Actual_Decl) + and then Has_Null_Exclusion (Analyzed_Formal) then - Error_Msg_Sloc := Sloc (Actual_Decl); + Error_Msg_Sloc := Sloc (Analyzed_Formal); Error_Msg_N - ("`NOT NULL` required in formal, to match actual #", - Analyzed_Formal); + ("actual must exclude null to match generic formal#", Actual); end if; return List; @@ -8613,7 +8622,7 @@ package body Sem_Ch12 is ("cannot find body of generic package &", Inst_Node, Gen_Unit); -- Don't attempt to perform any cleanup actions if some other error - -- was aready detected, since this can cause blowups. + -- was already detected, since this can cause blowups. else return; @@ -8638,7 +8647,7 @@ package body Sem_Ch12 is Build_Elaboration_Entity (Parent (Inst_Node), Act_Decl_Id); -- If the instantiation is not a library unit, then append the - -- declaration to the list of implicitly generated entities. unless + -- declaration to the list of implicitly generated entities, unless -- it is already a list member which means that it was already -- processed @@ -8656,7 +8665,8 @@ package body Sem_Ch12 is --------------------------------- procedure Instantiate_Subprogram_Body - (Body_Info : Pending_Body_Info) + (Body_Info : Pending_Body_Info; + Body_Optional : Boolean := False) is Act_Decl : constant Node_Id := Body_Info.Act_Decl; Inst_Node : constant Node_Id := Body_Info.Inst_Node; @@ -8706,10 +8716,11 @@ package body Sem_Ch12 is Set_Has_Completion (Anon_Id); return; - -- For other cases, commpile the body + -- For other cases, compile the body else - Load_Parent_Of_Generic (Inst_Node, Specification (Gen_Decl)); + Load_Parent_Of_Generic + (Inst_Node, Specification (Gen_Decl), Body_Optional); Gen_Body_Id := Corresponding_Body (Gen_Decl); end if; end if; @@ -8760,7 +8771,7 @@ package body Sem_Ch12 is Check_Generic_Actuals (Pack_Id, False); -- Generate a reference to link the visible subprogram instance to - -- the the generic body, which for navigation purposes is the only + -- the generic body, which for navigation purposes is the only -- available source for the instance. Generate_Reference @@ -8875,7 +8886,10 @@ package body Sem_Ch12 is elsif Serious_Errors_Detected = 0 and then Nkind (Parent (Inst_Node)) /= N_Compilation_Unit then - if Ekind (Anon_Id) = E_Procedure then + if Body_Optional then + return; + + elsif Ekind (Anon_Id) = E_Procedure then Act_Body := Make_Subprogram_Body (Loc, Specification => @@ -9074,11 +9088,10 @@ package body Sem_Ch12 is Desig_Act := Designated_Type (Base_Type (Act_T)); -- The designated type may have been introduced through a limited_ - -- with clause, in which case retrieve the non-limited view. + -- with clause, in which case retrieve the non-limited view. This + -- applies to incomplete types as well as to class-wide types. - if Ekind (Desig_Act) = E_Incomplete_Type - and then From_With_Type (Desig_Act) - then + if From_With_Type (Desig_Act) then Desig_Act := Available_View (Desig_Act); end if; @@ -9374,7 +9387,7 @@ package body Sem_Ch12 is Abandon_Instantiation (Actual); end if; - -- Ada 2005 (AI-443): Synchronized formal derived type ckecks. Note + -- Ada 2005 (AI-443): Synchronized formal derived type checks. Note -- that the formal type declaration has been rewritten as a private -- extension. @@ -9760,6 +9773,22 @@ package body Sem_Ch12 is end loop; end Check_Abstract_Primitives; end if; + + -- Verify that limitedness matches. If parent is a limited + -- interface then the generic formal is not unless declared + -- explicitly so. If not declared limited, the actual cannot be + -- limited (see AI05-0087). + + if Is_Limited_Type (Act_T) + and then not Is_Limited_Type (A_Gen_T) + and then False + then + Error_Msg_NE + ("actual for non-limited & cannot be a limited type", Actual, + Gen_T); + Explain_Limited_Type (Act_T, Actual); + Abandon_Instantiation (Actual); + end if; end Validate_Derived_Type_Instance; -------------------------------------- @@ -10256,7 +10285,8 @@ package body Sem_Ch12 is -- instantiations are available, we must analyze them, to ensure that -- the public symbols generated are the same when the unit is compiled -- to generate code, and when it is compiled in the context of a unit - -- that needs a particular nested instance. + -- that needs a particular nested instance. This process is applied + -- to both package and subprogram instances. -------------------------------- -- Collect_Previous_Instances -- @@ -10284,6 +10314,16 @@ package body Sem_Ch12 is then Append_Elmt (Decl, Previous_Instances); + -- For a subprogram instantiation, omit instantiations of + -- intrinsic operations (Unchecked_Conversions, etc.) that + -- have no bodies. + + elsif Nkind_In (Decl, N_Function_Instantiation, + N_Procedure_Instantiation) + and then not Is_Intrinsic_Subprogram (Entity (Name (Decl))) + then + Append_Elmt (Decl, Previous_Instances); + elsif Nkind (Decl) = N_Package_Declaration then Collect_Previous_Instances (Visible_Declarations (Specification (Decl))); @@ -10416,6 +10456,7 @@ package body Sem_Ch12 is then declare Decl : Elmt_Id; + Info : Pending_Body_Info; Par : Node_Id; begin @@ -10446,18 +10487,40 @@ package body Sem_Ch12 is Decl := First_Elmt (Previous_Instances); while Present (Decl) loop - Instantiate_Package_Body - (Body_Info => - ((Inst_Node => Node (Decl), - Act_Decl => - Instance_Spec (Node (Decl)), - Expander_Status => Exp_Status, - Current_Sem_Unit => - Get_Code_Unit (Sloc (Node (Decl))), - Scope_Suppress => Scope_Suppress, - Local_Suppress_Stack_Top => - Local_Suppress_Stack_Top)), - Body_Optional => True); + Info := + (Inst_Node => Node (Decl), + Act_Decl => + Instance_Spec (Node (Decl)), + Expander_Status => Exp_Status, + Current_Sem_Unit => + Get_Code_Unit (Sloc (Node (Decl))), + Scope_Suppress => Scope_Suppress, + Local_Suppress_Stack_Top => + Local_Suppress_Stack_Top); + + -- Package instance + + if + Nkind (Node (Decl)) = N_Package_Instantiation + then + Instantiate_Package_Body + (Info, Body_Optional => True); + + -- Subprogram instance + + else + -- The instance_spec is the wrapper package, + -- and the subprogram declaration is the last + -- declaration in the wrapper. + + Info.Act_Decl := + Last + (Visible_Declarations + (Specification (Info.Act_Decl))); + + Instantiate_Subprogram_Body + (Info, Body_Optional => True); + end if; Next_Elmt (Decl); end loop; @@ -10474,7 +10537,7 @@ package body Sem_Ch12 is Scope_Suppress => Scope_Suppress, Local_Suppress_Stack_Top => Local_Suppress_Stack_Top)), - Body_Optional => Body_Optional); + Body_Optional => Body_Optional); end; end if; @@ -10634,7 +10697,7 @@ package body Sem_Ch12 is -- Preanalyze_Actuals -- ------------------------ - procedure Pre_Analyze_Actuals (N : Node_Id) is + procedure Preanalyze_Actuals (N : Node_Id) is Assoc : Node_Id; Act : Node_Id; Errs : constant Int := Serious_Errors_Detected; @@ -10647,7 +10710,7 @@ package body Sem_Ch12 is -- Within a nested instantiation, a defaulted actual is an empty -- association, so nothing to analyze. If the subprogram actual - -- isan attribute, analyze prefix only, because actual is not a + -- is an attribute, analyze prefix only, because actual is not a -- complete attribute reference. -- If actual is an allocator, analyze expression only. The full @@ -10724,7 +10787,7 @@ package body Sem_Ch12 is Next (Assoc); end loop; - end Pre_Analyze_Actuals; + end Preanalyze_Actuals; ------------------- -- Remove_Parent -- @@ -10956,7 +11019,7 @@ package body Sem_Ch12 is -- package itself. If the instance is a subprogram, all entities -- in the corresponding package are renamings. If this entity is -- a formal package, make its own formals private as well. The - -- actual in this case is itself the renaming of an instantation. + -- actual in this case is itself the renaming of an instantiation. -- If the entity is not a package renaming, it is the entity -- created to validate formal package actuals: ignore. @@ -11405,7 +11468,7 @@ package body Sem_Ch12 is Next (Act2); end loop; - -- Find the associations added for default suprograms + -- Find the associations added for default subprograms if Present (Act2) then while Nkind (Act2) /= N_Generic_Association diff --git a/gcc/ada/sem_ch12.ads b/gcc/ada/sem_ch12.ads index b81d998560e..7ebb2e88342 100644 --- a/gcc/ada/sem_ch12.ads +++ b/gcc/ada/sem_ch12.ads @@ -6,7 +6,7 @@ -- -- -- S p e c -- -- -- --- Copyright (C) 1992-2007, Free Software Foundation, Inc. -- +-- Copyright (C) 1992-2008, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -100,9 +100,11 @@ package Sem_Ch12 is -- between the current procedure and Load_Parent_Of_Generic. procedure Instantiate_Subprogram_Body - (Body_Info : Pending_Body_Info); + (Body_Info : Pending_Body_Info; + Body_Optional : Boolean := False); -- Called after semantic analysis, to complete the instantiation of - -- function and procedure instances. + -- function and procedure instances. The flag Body_Optional has the + -- same purpose as described for Instantiate_Package_Body. procedure Save_Global_References (N : Node_Id); -- Traverse the original generic unit, and capture all references to @@ -128,7 +130,7 @@ package Sem_Ch12 is -- an inlined body (so that errout can distinguish cases for generating -- error messages, otherwise the treatment is identical). In this call -- N is the subprogram body and E is the defining identifier of the - -- subprogram in quiestion. The resulting Sloc adjustment factor is + -- subprogram in question. The resulting Sloc adjustment factor is -- saved as part of the internal state of the Sem_Ch12 package for use -- in subsequent calls to copy nodes. diff --git a/gcc/ada/sem_ch13.adb b/gcc/ada/sem_ch13.adb index c678d987808..f72ffff6397 100644 --- a/gcc/ada/sem_ch13.adb +++ b/gcc/ada/sem_ch13.adb @@ -29,7 +29,6 @@ with Einfo; use Einfo; with Errout; use Errout; with Exp_Tss; use Exp_Tss; with Exp_Util; use Exp_Util; -with Layout; use Layout; with Lib; use Lib; with Lib.Xref; use Lib.Xref; with Namet; use Namet; @@ -68,13 +67,13 @@ package body Sem_Ch13 is procedure Alignment_Check_For_Esize_Change (Typ : Entity_Id); -- This routine is called after setting the Esize of type entity Typ. - -- The purpose is to deal with the situation where an aligment has been + -- The purpose is to deal with the situation where an alignment has been -- inherited from a derived type that is no longer appropriate for the -- new Esize value. In this case, we reset the Alignment to unknown. procedure Check_Component_Overlap (C1_Ent, C2_Ent : Entity_Id); -- Given two entities for record components or discriminants, checks - -- if they hav overlapping component clauses and issues errors if so. + -- if they have overlapping component clauses and issues errors if so. function Get_Alignment_Value (Expr : Node_Id) return Uint; -- Given the expression for an alignment value, returns the corresponding @@ -119,7 +118,7 @@ package body Sem_Ch13 is -- call to Validate_Unchecked_Conversions does the actual error -- checking and posting of warnings. The reason for this delayed -- processing is to take advantage of back-annotations of size and - -- alignment values peformed by the back end. + -- alignment values performed by the back end. type UC_Entry is record Enode : Node_Id; -- node used for posting warnings @@ -295,7 +294,7 @@ package body Sem_Ch13 is declare Comps : array (0 .. Num_CC) of Entity_Id; - -- Array to collect component and discrimninant entities. The data + -- Array to collect component and discriminant entities. The data -- starts at index 1, the 0'th entry is for the sort routine. function CP_Lt (Op1, Op2 : Natural) return Boolean; @@ -485,7 +484,11 @@ package body Sem_Ch13 is -- definition clause that is the preferred approach in Ada 95. procedure Analyze_At_Clause (N : Node_Id) is + CS : constant Boolean := Comes_From_Source (N); + begin + -- This is an obsolescent feature + Check_Restriction (No_Obsolescent_Features, N); if Warn_On_Obsolescent_Feature then @@ -495,11 +498,21 @@ package body Sem_Ch13 is ("\use address attribute definition clause instead?", N); end if; + -- Rewrite as address clause + Rewrite (N, Make_Attribute_Definition_Clause (Sloc (N), Name => Identifier (N), Chars => Name_Address, Expression => Expression (N))); + + -- We preserve Comes_From_Source, since logically the clause still + -- comes from the source program even though it is changed in form. + + Set_Comes_From_Source (N, CS); + + -- Analyze rewritten clause + Analyze_Attribute_Definition_Clause (N); end Analyze_At_Clause; @@ -529,6 +542,10 @@ package body Sem_Ch13 is -- Common processing for 'Read, 'Write, 'Input and 'Output attribute -- definition clauses. + ----------------------------------- + -- Analyze_Stream_TSS_Definition -- + ----------------------------------- + procedure Analyze_Stream_TSS_Definition (TSS_Nam : TSS_Name_Type) is Subp : Entity_Id := Empty; I : Interp_Index; @@ -588,7 +605,6 @@ package body Sem_Ch13 is return Base_Type (Typ) = Base_Type (Ent) and then No (Next_Formal (F)); - end Has_Good_Profile; -- Start of processing for Analyze_Stream_TSS_Definition @@ -739,6 +755,22 @@ package body Sem_Ch13 is -- Address attribute definition clause when Attribute_Address => Address : begin + + -- A little error check, catch for X'Address use X'Address; + + if Nkind (Nam) = N_Identifier + and then Nkind (Expr) = N_Attribute_Reference + and then Attribute_Name (Expr) = Name_Address + and then Nkind (Prefix (Expr)) = N_Identifier + and then Chars (Nam) = Chars (Prefix (Expr)) + then + Error_Msg_NE + ("address for & is self-referencing", Prefix (Expr), Ent); + return; + end if; + + -- Not that special case, carry on with analysis of expression + Analyze_And_Resolve (Expr, RTE (RE_Address)); if Present (Address_Clause (U_Ent)) then @@ -875,7 +907,7 @@ package body Sem_Ch13 is -- We mark a possible modification of a variable with an -- address clause, since it is likely aliasing is occurring. - Note_Possible_Modification (Nam); + Note_Possible_Modification (Nam, Sure => False); -- Here we are checking for explicit overlap of one variable -- by another, and if we find this then mark the overlapped @@ -920,22 +952,25 @@ package body Sem_Ch13 is -- If the address clause is of the form: - -- for X'Address use Y'Address + -- for Y'Address use X'Address -- or - -- Const : constant Address := Y'Address; + -- Const : constant Address := X'Address; -- ... - -- for X'Address use Const; + -- for Y'Address use Const; -- then we make an entry in the table for checking the size and -- alignment of the overlaying variable. We defer this check -- till after code generation to take full advantage of the -- annotation done by the back end. This entry is only made if -- we have not already posted a warning about size/alignment - -- (some warnings of this type are posted in Checks). + -- (some warnings of this type are posted in Checks), and if + -- the address clause comes from source. - if Address_Clause_Overlay_Warnings then + if Address_Clause_Overlay_Warnings + and then Comes_From_Source (N) + then declare Ent_X : Entity_Id := Empty; Ent_Y : Entity_Id := Empty; @@ -945,7 +980,18 @@ package body Sem_Ch13 is if Present (Ent_Y) and then Is_Entity_Name (Name (N)) then Ent_X := Entity (Name (N)); - Address_Clause_Checks.Append ((N, Ent_X, Ent_Y)); + Address_Clause_Checks.Append ((N, Ent_X, Ent_Y)); + + -- If variable overlays a constant view, and we are + -- warning on overlays, then mark the variable as + -- overlaying a constant (we will give warnings later + -- if this variable is assigned). + + if Is_Constant_Object (Ent_Y) + and then Ekind (Ent_X) = E_Variable + then + Set_Overlays_Constant (Ent_X); + end if; end if; end; end if; @@ -1391,10 +1437,6 @@ package body Sem_Ch13 is Set_Has_Small_Clause (U_Ent); Set_Has_Small_Clause (Implicit_Base); Set_Has_Non_Standard_Rep (Implicit_Base); - - -- Recompute RM_Size, but shouldn't this be done in Freeze??? - - Set_Discrete_RM_Size (U_Ent); end if; end Small; @@ -1439,6 +1481,11 @@ package body Sem_Ch13 is Analyze_And_Resolve (Expr, Class_Wide_Type (RTE (RE_Root_Storage_Pool))); + if not Denotes_Variable (Expr) then + Error_Msg_N ("storage pool must be a variable", Expr); + return; + end if; + if Nkind (Expr) = N_Type_Conversion then T := Etype (Expression (Expr)); else @@ -1448,7 +1495,7 @@ package body Sem_Ch13 is -- The Stack_Bounded_Pool is used internally for implementing -- access types with a Storage_Size. Since it only work -- properly when used on one specific type, we need to check - -- that it is not highjacked improperly: + -- that it is not hijacked improperly: -- type T is access Integer; -- for T'Storage_Size use n; -- type Q is access Float; @@ -1857,10 +1904,7 @@ package body Sem_Ch13 is -- Don't allow rep clause for standard [wide_[wide_]]character - elsif Root_Type (Enumtype) = Standard_Character - or else Root_Type (Enumtype) = Standard_Wide_Character - or else Root_Type (Enumtype) = Standard_Wide_Wide_Character - then + elsif Is_Standard_Character_Type (Enumtype) then Error_Msg_N ("enumeration rep clause not allowed for this type", N); return; @@ -2310,6 +2354,14 @@ package body Sem_Ch13 is Error_Msg_N ("first bit cannot be negative", First_Bit (CC)); + -- The Last_Bit specified in a component clause must not be + -- less than the First_Bit minus one (RM-13.5.1(10)). + + elsif Lbit < Fbit - 1 then + Error_Msg_N + ("last bit cannot be less than first bit minus one", + Last_Bit (CC)); + -- Values look OK, so find the corresponding record component -- Even though the syntax allows an attribute reference for -- implementation-defined components, GNAT does not allow the @@ -2347,7 +2399,7 @@ package body Sem_Ch13 is elsif Present (Component_Clause (Comp)) then - -- Diagose duplicate rep clause, or check consistency + -- Diagnose duplicate rep clause, or check consistency -- if this is an inherited component. In a double fault, -- there may be a duplicate inconsistent clause for an -- inherited component. @@ -2683,7 +2735,7 @@ package body Sem_Ch13 is -- For records longer than System.Storage_Unit, and for those where not -- all components have component clauses, the back end determines the - -- length (it may for example be appopriate to round up the size + -- length (it may for example be appropriate to round up the size -- to some convenient boundary, based on alignment considerations, etc). if Unknown_RM_Size (Rectype) and then Hbit + 1 <= 32 then @@ -3527,7 +3579,7 @@ package body Sem_Ch13 is -- Signed case. Note that we consider types like range 1 .. -1 to be -- signed for the purpose of computing the size, since the bounds have - -- to be accomodated in the base type. + -- to be accommodated in the base type. if Lo < 0 or else Hi < 0 then S := 1; @@ -3728,7 +3780,7 @@ package body Sem_Ch13 is ("representation item must be after full type declaration", N); return True; - -- If the type has incompleted components, a representation clause is + -- If the type has incomplete components, a representation clause is -- illegal but stream attributes and Convention pragmas are correct. elsif Has_Private_Component (T) then @@ -4011,7 +4063,7 @@ package body Sem_Ch13 is -- For enumeration types, we must check each literal to see if the -- representation is the same. Note that we do not permit enumeration - -- reprsentation clauses for Character and Wide_Character, so these + -- representation clauses for Character and Wide_Character, so these -- cases were already dealt with. elsif Is_Enumeration_Type (T1) then diff --git a/gcc/ada/sem_ch13.ads b/gcc/ada/sem_ch13.ads index 3c5681c7bf2..427f836f6e7 100644 --- a/gcc/ada/sem_ch13.ads +++ b/gcc/ada/sem_ch13.ads @@ -6,7 +6,7 @@ -- -- -- S p e c -- -- -- --- Copyright (C) 1992-2007, Free Software Foundation, Inc. -- +-- Copyright (C) 1992-2008, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -99,7 +99,7 @@ package Sem_Ch13 is function Rep_Item_Too_Early (T : Entity_Id; N : Node_Id) return Boolean; -- Called at the start of processing a representation clause or a -- representation pragma. Used to check that the representation item - -- is not being applied to an incompleted type or to a generic formal + -- is not being applied to an incomplete type or to a generic formal -- type or a type derived from a generic formal type. Returns False if -- no such error occurs. If this error does occur, appropriate error -- messages are posted on node N, and True is returned. @@ -121,7 +121,8 @@ package Sem_Ch13 is -- stream attributes, which, although certainly not subtype related -- attributes, clearly should not be subject to the para 10 restrictions -- (see AI95-00137). Similarly, we also skip the para 10 restrictions for - -- the Storage_Size case where they also clearly do not apply. + -- the Storage_Size case where they also clearly do not apply, and for + -- Stream_Convert which is in the same category as the strem attributes. -- -- If the rep item is too late, an appropriate message is output and -- True is returned, which is a signal that the caller should abandon @@ -149,7 +150,7 @@ package Sem_Ch13 is Act_Unit : Entity_Id); -- Validate a call to unchecked conversion. N is the node for the actual -- instantiation, which is used only for error messages. Act_Unit is the - -- entity for the instantiation, from which the actual types etc for this + -- entity for the instantiation, from which the actual types etc. for this -- instantiation can be determined. This procedure makes an entry in a -- table and/or generates an N_Validate_Unchecked_Conversion node. The -- actual checking is done in Validate_Unchecked_Conversions or in the diff --git a/gcc/ada/sem_ch3.adb b/gcc/ada/sem_ch3.adb index 87e256a349d..88ee0d55b18 100644 --- a/gcc/ada/sem_ch3.adb +++ b/gcc/ada/sem_ch3.adb @@ -94,7 +94,7 @@ package body Sem_Ch3 is -- Parent_Type is the entity for the parent type in the derived type -- definition and Derived_Type the actual derived type. Is_Completion must -- be set to False if Derived_Type is the N_Defining_Identifier node in N - -- (ie Derived_Type = Defining_Identifier (N)). In this case N is not the + -- (i.e. Derived_Type = Defining_Identifier (N)). In this case N is not the -- completion of a private type declaration. If Is_Completion is set to -- True, N is the completion of a private type declaration and Derived_Type -- is different from the defining identifier inside N (i.e. Derived_Type /= @@ -236,6 +236,7 @@ package body Sem_Ch3 is -- itype. The Itype_Reference node forces the elaboration of the itype -- in the proper scope. The node is inserted after Nod, which is the -- enclosing declaration that generated Ityp. + -- -- A related mechanism is used during expansion, for itypes created in -- branches of conditionals. See Ensure_Defined in exp_util. -- Could both mechanisms be merged ??? @@ -341,11 +342,11 @@ package body Sem_Ch3 is Constraints : Elist_Id); -- Build the list of entities for a constrained discriminated record -- subtype. If a component depends on a discriminant, replace its subtype - -- using the discriminant values in the discriminant constraint. Subt is - -- the defining identifier for the subtype whose list of constrained - -- entities we will create. Decl_Node is the type declaration node where we - -- will attach all the itypes created. Typ is the base discriminated type - -- for the subtype Subt. Constraints is the list of discriminant + -- using the discriminant values in the discriminant constraint. Subt + -- is the defining identifier for the subtype whose list of constrained + -- entities we will create. Decl_Node is the type declaration node where + -- we will attach all the itypes created. Typ is the base discriminated + -- type for the subtype Subt. Constraints is the list of discriminant -- constraints for Typ. function Constrain_Component_Type @@ -362,6 +363,7 @@ package body Sem_Ch3 is -- Constrained_Typ is the final constrained subtype to which the -- constrained Compon_Type belongs. Related_Node is the node where we will -- attach all the itypes created. + -- -- Above description is confused, what is Compon_Type??? procedure Constrain_Access @@ -504,12 +506,11 @@ package body Sem_Ch3 is (T : Entity_Id; N : Node_Id; Is_Completion : Boolean); - -- Process a derived type declaration. This routine will invoke - -- Build_Derived_Type to process the actual derived type definition. - -- Parameters N and Is_Completion have the same meaning as in - -- Build_Derived_Type. T is the N_Defining_Identifier for the entity - -- defined in the N_Full_Type_Declaration node N, that is T is the derived - -- type. + -- Process a derived type declaration. Build_Derived_Type is invoked + -- to process the actual derived type definition. Parameters N and + -- Is_Completion have the same meaning as in Build_Derived_Type. + -- T is the N_Defining_Identifier for the entity defined in the + -- N_Full_Type_Declaration node N, that is T is the derived type. procedure Enumeration_Type_Declaration (T : Entity_Id; Def : Node_Id); -- Insert each literal in symbol table, as an overloadable identifier. Each @@ -521,7 +522,7 @@ package body Sem_Ch3 is function Expand_To_Stored_Constraint (Typ : Entity_Id; Constraint : Elist_Id) return Elist_Id; - -- Given a Constraint (i.e. a list of expressions) on the discriminants of + -- Given a constraint (i.e. a list of expressions) on the discriminants of -- Typ, expand it into a constraint on the stored discriminants and return -- the new list of expressions constraining the stored discriminants. @@ -532,7 +533,7 @@ package body Sem_Ch3 is -- implicit types generated to Related_Nod procedure Floating_Point_Type_Declaration (T : Entity_Id; Def : Node_Id); - -- Create a new float, and apply the constraint to obtain subtype of it + -- Create a new float and apply the constraint to obtain subtype of it function Has_Range_Constraint (N : Node_Id) return Boolean; -- Given an N_Subtype_Indication node N, return True if a range constraint @@ -582,6 +583,14 @@ package body Sem_Ch3 is -- copying the record declaration for the derived base. In the tagged case -- the value returned is irrelevant. + function Is_Progenitor + (Iface : Entity_Id; + Typ : Entity_Id) return Boolean; + -- Determine whether type Typ implements interface Iface. This requires + -- traversing the list of abstract interfaces of the type, as well as that + -- of the ancestor types. The predicate is used to determine when a formal + -- in the signature of an inherited operation must carry the derived type. + function Is_Valid_Constraint_Kind (T_Kind : Type_Kind; Constraint_Kind : Node_Kind) return Boolean; @@ -632,16 +641,16 @@ package body Sem_Ch3 is -- Similarly, access_to_subprogram types may have a parameter or a return -- type that is an incomplete type, and that must be replaced with the -- full type. - + -- -- If the full type is tagged, subprogram with access parameters that -- designated the incomplete may be primitive operations of the full type, -- and have to be processed accordingly. procedure Process_Real_Range_Specification (Def : Node_Id); - -- Given the type definition for a real type, this procedure processes - -- and checks the real range specification of this type definition if - -- one is present. If errors are found, error messages are posted, and - -- the Real_Range_Specification of Def is reset to Empty. + -- Given the type definition for a real type, this procedure processes and + -- checks the real range specification of this type definition if one is + -- present. If errors are found, error messages are posted, and the + -- Real_Range_Specification of Def is reset to Empty. procedure Record_Type_Declaration (T : Entity_Id; @@ -655,14 +664,14 @@ package body Sem_Ch3 is -- cross-referencing. Otherwise Prev = T. procedure Record_Type_Definition (Def : Node_Id; Prev_T : Entity_Id); - -- This routine is used to process the actual record type definition - -- (both for untagged and tagged records). Def is a record type - -- definition node. This procedure analyzes the components in this - -- record type definition. Prev_T is the entity for the enclosing record - -- type. It is provided so that its Has_Task flag can be set if any of - -- the component have Has_Task set. If the declaration is the completion - -- of an incomplete type declaration, Prev_T is the original incomplete - -- type, whose full view is the record type. + -- This routine is used to process the actual record type definition (both + -- for untagged and tagged records). Def is a record type definition node. + -- This procedure analyzes the components in this record type definition. + -- Prev_T is the entity for the enclosing record type. It is provided so + -- that its Has_Task flag can be set if any of the component have Has_Task + -- set. If the declaration is the completion of an incomplete type + -- declaration, Prev_T is the original incomplete type, whose full view is + -- the record type. procedure Replace_Components (Typ : Entity_Id; Decl : Node_Id); -- Subsidiary to Build_Derived_Record_Type. For untagged records, we @@ -740,7 +749,7 @@ package body Sem_Ch3 is -- formal part is currently being analyzed, but will be the parent scope -- in the case of a parameterless function, and we always want to use -- the function's parent scope. Finally, if the function is a child - -- unit, we must traverse the the tree to retrieve the proper entity. + -- unit, we must traverse the tree to retrieve the proper entity. elsif Nkind (Related_Nod) = N_Function_Specification and then Nkind (Parent (N)) /= N_Parameter_Specification @@ -809,8 +818,20 @@ package body Sem_Ch3 is Set_Directly_Designated_Type (Anon_Type, Desig_Type); Set_Etype (Anon_Type, Anon_Type); - Init_Size_Align (Anon_Type); + + -- Make sure the anonymous access type has size and alignment fields + -- set, as required by gigi. This is necessary in the case of the + -- Task_Body_Procedure. + + if not Has_Private_Component (Desig_Type) then + Layout_Type (Anon_Type); + end if; + + -- ???The following makes no sense, because Anon_Type is an access type + -- and therefore cannot have components, private or otherwise. Hence + -- the assertion. Not sure what was meant, here. Set_Depends_On_Private (Anon_Type, Has_Private_Component (Anon_Type)); + pragma Assert (not Depends_On_Private (Anon_Type)); -- Ada 2005 (AI-231): Ada 2005 semantics for anonymous access differs -- from Ada 95 semantics. In Ada 2005, anonymous access must specify if @@ -1232,6 +1253,13 @@ package body Sem_Ch3 is Set_Has_Task (T, False); Set_Has_Controlled_Component (T, False); + -- Initialize Associated_Final_Chain explicitly to Empty, to avoid + -- problems where an incomplete view of this entity has been previously + -- established by a limited with and an overlaid version of this field + -- (Stored_Constraint) was initialized for the incomplete view. + + Set_Associated_Final_Chain (T, Empty); + -- Ada 2005 (AI-231): Propagate the null-excluding and access-constant -- attributes @@ -1619,7 +1647,7 @@ package body Sem_Ch3 is -- package Sem). if Present (E) then - Analyze_Per_Use_Expression (E, T); + Preanalyze_Spec_Expression (E, T); Check_Initialization (T, E); if Ada_Version >= Ada_05 @@ -2002,7 +2030,7 @@ package body Sem_Ch3 is Set_Primitive_Operations (T, New_Elmt_List); -- Complete the decoration of the class-wide entity if it was already - -- built (ie. during the creation of the limited view) + -- built (i.e. during the creation of the limited view) if Present (CW) then Set_Is_Interface (CW); @@ -2011,6 +2039,17 @@ package body Sem_Ch3 is Set_Is_Synchronized_Interface (CW, Is_Synchronized_Interface (T)); Set_Is_Task_Interface (CW, Is_Task_Interface (T)); end if; + + -- Check runtime support for synchronized interfaces + + if VM_Target = No_VM + and then (Is_Task_Interface (T) + or else Is_Protected_Interface (T) + or else Is_Synchronized_Interface (T)) + and then not RTE_Available (RE_Select_Specific_Data) + then + Error_Msg_CRT ("synchronized interfaces", T); + end if; end Analyze_Interface_Declaration; ----------------------------- @@ -2178,11 +2217,11 @@ package body Sem_Ch3 is Prev_Entity : Entity_Id := Empty; function Count_Tasks (T : Entity_Id) return Uint; - -- This function is called when a library level object of type is - -- declared. It's function is to count the static number of tasks - -- declared within the type (it is only called if Has_Tasks is set for - -- T). As a side effect, if an array of tasks with non-static bounds or - -- a variant record type is encountered, Check_Restrictions is called + -- This function is called when a non-generic library level object of a + -- task type is declared. Its function is to count the static number of + -- tasks declared within the type (it is only called if Has_Tasks is set + -- for T). As a side effect, if an array of tasks with non-static bounds + -- or a variant record type is encountered, Check_Restrictions is called -- indicating the count is unknown. ----------------- @@ -2259,12 +2298,23 @@ package body Sem_Ch3 is if Constant_Present (N) then Prev_Entity := Current_Entity_In_Scope (Id); - -- If homograph is an implicit subprogram, it is overridden by the - -- current declaration. + -- If the homograph is an implicit subprogram, it is overridden by + -- the current declaration. if Present (Prev_Entity) - and then Is_Overloadable (Prev_Entity) - and then Is_Inherited_Operation (Prev_Entity) + and then + ((Is_Overloadable (Prev_Entity) + and then Is_Inherited_Operation (Prev_Entity)) + + -- The current object is a discriminal generated for an entry + -- family index. Even though the index is a constant, in this + -- particular context there is no true contant redeclaration. + -- Enter_Name will handle the visibility. + + or else + (Is_Discriminal (Id) + and then Ekind (Discriminal_Link (Id)) = + E_Entry_Index_Parameter)) then Prev_Entity := Empty; end if; @@ -2425,6 +2475,19 @@ package body Sem_Ch3 is -- Process initialization expression if present and not in error if Present (E) and then E /= Error then + + -- Generate an error in case of CPP class-wide object initialization. + -- Required because otherwise the expansion of the class-wide + -- assignment would try to use 'size to initialize the object + -- (primitive that is not available in CPP tagged types). + + if Is_Class_Wide_Type (Act_T) + and then Convention (Act_T) = Convention_CPP + then + Error_Msg_N + ("predefined assignment not available in CPP tagged types", E); + end if; + Mark_Coextensions (N, E); Analyze (E); @@ -2441,6 +2504,18 @@ package body Sem_Ch3 is Set_Is_True_Constant (Id, True); + -- If we are analyzing a constant declaration, set its completion + -- flag after analyzing and resolving the expression. + + if Constant_Present (N) then + Set_Has_Completion (Id); + end if; + + -- Set type and resolve (type may be overridden later on) + + Set_Etype (Id, T); + Resolve (E, T); + -- If the object is an access to variable, the initialization -- expression cannot be an access to constant. @@ -2454,16 +2529,6 @@ package body Sem_Ch3 is "with an access-to-constant expression", E); end if; - -- If we are analyzing a constant declaration, set its completion - -- flag after analyzing the expression. - - if Constant_Present (N) then - Set_Has_Completion (Id); - end if; - - Set_Etype (Id, T); -- may be overridden later on - Resolve (E, T); - if not Assignment_OK (N) then Check_Initialization (T, E); end if; @@ -2556,6 +2621,21 @@ package body Sem_Ch3 is Error_Msg_N ("unconstrained subtype not allowed (need initialization)", Object_Definition (N)); + + if Is_Record_Type (T) and then Has_Discriminants (T) then + Error_Msg_N + ("\provide initial value or explicit discriminant values", + Object_Definition (N)); + + Error_Msg_NE + ("\or give default discriminant values for type&", + Object_Definition (N), T); + + elsif Is_Array_Type (T) then + Error_Msg_N + ("\provide initial value or explicit array bounds", + Object_Definition (N)); + end if; end if; -- Case of initialization present but in error. Set initial @@ -2685,7 +2765,10 @@ package body Sem_Ch3 is Remove_Side_Effects (E); end if; - if T = Standard_Wide_Character or else T = Standard_Wide_Wide_Character + -- Check No_Wide_Characters restriction + + if T = Standard_Wide_Character + or else T = Standard_Wide_Wide_Character or else Root_Type (T) = Standard_Wide_String or else Root_Type (T) = Standard_Wide_Wide_String then @@ -2721,7 +2804,7 @@ package body Sem_Ch3 is end if; -- Set Has_Initial_Value if initializing expression present. Note - -- that if there is no initializating expression, we leave the state + -- that if there is no initializing expression, we leave the state -- of this flag unchanged (usually it will be False, but notably in -- the case of exception choice variables, it will already be true). @@ -2730,10 +2813,11 @@ package body Sem_Ch3 is end if; end if; - -- Initialize alignment and size + -- Initialize alignment and size and capture alignment setting - Init_Alignment (Id); - Init_Esize (Id); + Init_Alignment (Id); + Init_Esize (Id); + Set_Optimize_Alignment_Flags (Id); -- Deal with aliased case @@ -2853,8 +2937,22 @@ package body Sem_Ch3 is if Has_Task (Etype (Id)) then Check_Restriction (No_Tasking, N); - if Is_Library_Level_Entity (Id) then + -- Deal with counting max tasks + + -- Nothing to do if inside a generic + + if Inside_A_Generic then + null; + + -- If library level entity, then count tasks + + elsif Is_Library_Level_Entity (Id) then Check_Restriction (Max_Tasks, N, Count_Tasks (Etype (Id))); + + -- If not library level entity, then indicate we don't know max + -- tasks and also check task hierarchy restriction and blocking + -- operation (since starting a task is definitely blocking!) + else Check_Restriction (Max_Tasks, N); Check_Restriction (No_Task_Hierarchy, N); @@ -2980,18 +3078,6 @@ package body Sem_Ch3 is null; end Analyze_Others_Choice; - -------------------------------- - -- Analyze_Per_Use_Expression -- - -------------------------------- - - procedure Analyze_Per_Use_Expression (N : Node_Id; T : Entity_Id) is - Save_In_Default_Expression : constant Boolean := In_Default_Expression; - begin - In_Default_Expression := True; - Pre_Analyze_And_Resolve (N, T); - In_Default_Expression := Save_In_Default_Expression; - end Analyze_Per_Use_Expression; - ------------------------------------------- -- Analyze_Private_Extension_Declaration -- ------------------------------------------- @@ -3383,7 +3469,8 @@ package body Sem_Ch3 is Set_Stored_Constraint_From_Discriminant_Constraint (Id); -- This would seem semantically correct, but apparently - -- confuses the back-end (4412-009). To be explained ??? + -- confuses the back-end. To be explained and checked with + -- current version ??? -- Set_Has_Discriminants (Id); end if; @@ -3575,6 +3662,7 @@ package body Sem_Ch3 is end if; end if; + Set_Optimize_Alignment_Flags (Id); Check_Eliminated (Id); end Analyze_Subtype_Declaration; @@ -3886,6 +3974,7 @@ package body Sem_Ch3 is Set_Is_Descendent_Of_Address (Prev); end if; + Set_Optimize_Alignment_Flags (Def_Id); Check_Eliminated (Def_Id); end Analyze_Type_Declaration; @@ -3938,7 +4027,7 @@ package body Sem_Ch3 is end if; end Process_Declarations; - -- Variables local to Analyze_Case_Statement + -- Local Variables Discr_Name : Node_Id; Discr_Type : Entity_Id; @@ -3960,13 +4049,15 @@ package body Sem_Ch3 is Discr_Name := Name (N); Analyze (Discr_Name); - if Etype (Discr_Name) = Any_Type then - - -- Prevent cascaded errors + -- If Discr_Name bad, get out (prevent cascaded errors) + if Etype (Discr_Name) = Any_Type then return; + end if; - elsif Ekind (Entity (Discr_Name)) /= E_Discriminant then + -- Check invalid discriminant in variant part + + if Ekind (Entity (Discr_Name)) /= E_Discriminant then Error_Msg_N ("invalid discriminant name in variant part", Discr_Name); end if; @@ -4136,7 +4227,6 @@ package body Sem_Ch3 is Implicit_Base := Create_Itype (E_Array_Type, P, Related_Id, 'B'); - Init_Size_Align (Implicit_Base); Set_Etype (Implicit_Base, Implicit_Base); Set_Scope (Implicit_Base, Current_Scope); Set_Has_Delayed_Freeze (Implicit_Base); @@ -4281,7 +4371,6 @@ package body Sem_Ch3 is ("the type of a component cannot be abstract", Subtype_Indication (Component_Def)); end if; - end Array_Type_Declaration; ------------------------------------------------------ @@ -4624,9 +4713,13 @@ package body Sem_Ch3 is begin Set_Stored_Constraint (Derived_Type, No_Elist); + -- Copy Storage_Size and Relative_Deadline variables if task case + if Is_Task_Type (Parent_Type) then Set_Storage_Size_Variable (Derived_Type, Storage_Size_Variable (Parent_Type)); + Set_Relative_Deadline_Variable (Derived_Type, + Relative_Deadline_Variable (Parent_Type)); end if; if Present (Discriminant_Specifications (N)) then @@ -4795,10 +4888,7 @@ package body Sem_Ch3 is -- and we construct the same skeletal representation as for the generic -- parent type. - if Root_Type (Parent_Type) = Standard_Character - or else Root_Type (Parent_Type) = Standard_Wide_Character - or else Root_Type (Parent_Type) = Standard_Wide_Wide_Character - then + if Is_Standard_Character_Type (Parent_Type) then Derived_Standard_Character (N, Parent_Type, Derived_Type); elsif Is_Generic_Type (Root_Type (Parent_Type)) then @@ -5232,9 +5322,7 @@ package body Sem_Ch3 is if Ekind (Parent_Type) in Record_Kind or else (Ekind (Parent_Type) in Enumeration_Kind - and then Root_Type (Parent_Type) /= Standard_Character - and then Root_Type (Parent_Type) /= Standard_Wide_Character - and then Root_Type (Parent_Type) /= Standard_Wide_Wide_Character + and then not Is_Standard_Character_Type (Parent_Type) and then not Is_Generic_Type (Root_Type (Parent_Type))) then Full_N := New_Copy_Tree (N); @@ -5881,7 +5969,7 @@ package body Sem_Ch3 is -- which makes the treatment for T1 and T2 identical. -- What we want when inheriting S, is that references to D1 and D2 in R are - -- replaced with references to their correct constraints, ie D1 and D2 in + -- replaced with references to their correct constraints, i.e. D1 and D2 in -- T1 and 1 and X in T2. So all R's discriminant references are replaced -- with either discriminant references in the derived type or expressions. -- This replacement is achieved as follows: before inheriting R's @@ -5961,7 +6049,7 @@ package body Sem_Ch3 is -- The full view of a private extension is handled exactly as described -- above. The model chose for the private view of a private extension is - -- the same for what concerns discriminants (ie they receive the same + -- the same for what concerns discriminants (i.e. they receive the same -- treatment as in the tagged case). However, the private view of the -- private extension always inherits the components of the parent base, -- without replacing any discriminant reference. Strictly speaking this is @@ -6463,7 +6551,10 @@ package body Sem_Ch3 is if Limited_Present (Type_Def) then Set_Is_Limited_Record (Derived_Type); - elsif Is_Limited_Record (Parent_Type) then + elsif Is_Limited_Record (Parent_Type) + or else (Present (Full_View (Parent_Type)) + and then Is_Limited_Record (Full_View (Parent_Type))) + then if not Is_Interface (Parent_Type) or else Is_Synchronized_Interface (Parent_Type) or else Is_Protected_Interface (Parent_Type) @@ -7290,7 +7381,7 @@ package body Sem_Ch3 is -- and therefore when reanalyzing "subtype W is G (D => 1);" -- which really looks like "subtype W is Rec (D => 1);" at -- the point of instantiation, we want to find the discriminant - -- that corresponds to D in Rec, ie X. + -- that corresponds to D in Rec, i.e. X. if Present (Original_Discriminant (Id)) then Discr := Find_Corresponding_Discriminant (Id, T); @@ -8031,16 +8122,17 @@ package body Sem_Ch3 is and then Present (Alias (Subp)) and then not Comes_From_Source (Subp) and then not Is_Abstract_Subprogram (Alias (Subp)) + and then not Is_Access_Type (Etype (Subp)) then null; elsif (Is_Abstract_Subprogram (Subp) - or else Requires_Overriding (Subp) - or else - (Has_Controlling_Result (Subp) - and then Present (Alias_Subp) - and then not Comes_From_Source (Subp) - and then Sloc (Subp) = Sloc (First_Subtype (T)))) + or else Requires_Overriding (Subp) + or else + (Has_Controlling_Result (Subp) + and then Present (Alias_Subp) + and then not Comes_From_Source (Subp) + and then Sloc (Subp) = Sloc (First_Subtype (T)))) and then not Is_TSS (Subp, TSS_Stream_Input) and then not Is_TSS (Subp, TSS_Stream_Output) and then not Is_Abstract_Type (T) @@ -8061,10 +8153,10 @@ package body Sem_Ch3 is if Present (Alias_Subp) then -- Only perform the check for a derived subprogram when the - -- type has an explicit record extension. This avoids - -- incorrectly flagging abstract subprograms for the case of a - -- type without an extension derived from a formal type with a - -- tagged actual (can occur within a private part). + -- type has an explicit record extension. This avoids incorect + -- flagging of abstract subprograms for the case of a type + -- without an extension that is derived from a formal type + -- with a tagged actual (can occur within a private part). -- Ada 2005 (AI-391): In the case of an inherited function with -- a controlling result of the type, the rule does not apply if @@ -9049,6 +9141,12 @@ package body Sem_Ch3 is and then (Ekind (Etype (Prev)) /= E_Anonymous_Access_Type or else Ekind (Etype (New_T)) /= E_Anonymous_Access_Type + or else Is_Access_Constant (Etype (New_T)) /= + Is_Access_Constant (Etype (Prev)) + or else Can_Never_Be_Null (Etype (New_T)) /= + Can_Never_Be_Null (Etype (Prev)) + or else Null_Exclusion_Present (Parent (Prev)) /= + Null_Exclusion_Present (Parent (Id)) or else not Subtypes_Statically_Match (Designated_Type (Etype (Prev)), Designated_Type (Etype (New_T)))) @@ -9058,6 +9156,15 @@ package body Sem_Ch3 is Set_Full_View (Prev, Id); Set_Etype (Id, Any_Type); + elsif + Null_Exclusion_Present (Parent (Prev)) + and then not Null_Exclusion_Present (N) + then + Error_Msg_Sloc := Sloc (Prev); + Error_Msg_N ("null-exclusion does not match declaration#", N); + Set_Full_View (Prev, Id); + Set_Etype (Id, Any_Type); + -- If so, process the full constant declaration else @@ -9086,7 +9193,7 @@ package body Sem_Ch3 is end if; -- Allow incomplete declaration of tags (used to handle forward - -- references to tags). The check on Ada_Tags avoids cicularities + -- references to tags). The check on Ada_Tags avoids circularities -- when rebuilding the compiler. if RTU_Loaded (Ada_Tags) @@ -9922,7 +10029,6 @@ package body Sem_Ch3 is begin Set_Etype (T_Sub, Corr_Rec); - Init_Size_Align (T_Sub); Set_Has_Discriminants (T_Sub, Has_Discriminants (Prot_Subt)); Set_Is_Constrained (T_Sub, True); Set_First_Entity (T_Sub, First_Entity (Corr_Rec)); @@ -11120,12 +11226,12 @@ package body Sem_Ch3 is Set_Fixed_Range (Implicit_Base, Loc, -Bound_Val, Bound_Val); - -- Set size to zero for now, size will be set at freeze time. We have - -- to do this for ordinary fixed-point, because the size depends on - -- the specified small, and we might as well do the same for decimal - -- fixed-point. + -- Note: We leave size as zero for now, size will be set at freeze + -- time. We have to do this for ordinary fixed-point, because the size + -- depends on the specified small, and we might as well do the same for + -- decimal fixed-point. - Init_Size_Align (Implicit_Base); + pragma Assert (Esize (Implicit_Base) = Uint_0); -- If there are bounds given in the declaration use them as the -- bounds of the first named subtype. @@ -11224,7 +11330,6 @@ package body Sem_Ch3 is Iface_Elmt := First_Elmt (Ifaces_List); while Present (Iface_Elmt) loop Elmt := First_Elmt (Primitive_Operations (Node (Iface_Elmt))); - while Present (Elmt) loop Prim := Node (Elmt); @@ -11247,6 +11352,7 @@ package body Sem_Ch3 is function In_List (L : Elist_Id; Subp : Entity_Id) return Boolean is Elmt : Elmt_Id; + begin Elmt := First_Elmt (L); while Present (Elmt) loop @@ -11410,19 +11516,28 @@ package body Sem_Ch3 is Parent_Type : Entity_Id; Actual_Subp : Entity_Id := Empty) is - Formal : Entity_Id; - New_Formal : Entity_Id; + Formal : Entity_Id; + -- Formal parameter of parent primitive operation + + Formal_Of_Actual : Entity_Id; + -- Formal parameter of actual operation, when the derivation is to + -- create a renaming for a primitive operation of an actual in an + -- instantiation. + + New_Formal : Entity_Id; + -- Formal of inherited operation + Visible_Subp : Entity_Id := Parent_Subp; function Is_Private_Overriding return Boolean; - -- If Subp is a private overriding of a visible operation, the in- - -- herited operation derives from the overridden op (even though - -- its body is the overriding one) and the inherited operation is - -- visible now. See sem_disp to see the details of the handling of - -- the overridden subprogram, which is removed from the list of - -- primitive operations of the type. The overridden subprogram is - -- saved locally in Visible_Subp, and used to diagnose abstract - -- operations that need overriding in the derived type. + -- If Subp is a private overriding of a visible operation, the inherited + -- operation derives from the overridden op (even though its body is the + -- overriding one) and the inherited operation is visible now. See + -- sem_disp to see the full details of the handling of the overridden + -- subprogram, which is removed from the list of primitive operations of + -- the type. The overridden subprogram is saved locally in Visible_Subp, + -- and used to diagnose abstract operations that need overriding in the + -- derived type. procedure Replace_Type (Id, New_Id : Entity_Id); -- When the type is an anonymous access type, create a new access type @@ -11583,6 +11698,7 @@ package body Sem_Ch3 is elsif Is_Interface (Etype (Id)) and then not Is_Class_Wide_Type (Etype (Id)) + and then Is_Progenitor (Etype (Id), Derived_Type) then Set_Etype (New_Id, Derived_Type); @@ -11671,10 +11787,29 @@ package body Sem_Ch3 is end if; Set_Parent (New_Subp, Parent (Derived_Type)); - Replace_Type (Parent_Subp, New_Subp); + + if Present (Actual_Subp) then + Replace_Type (Actual_Subp, New_Subp); + else + Replace_Type (Parent_Subp, New_Subp); + end if; + Conditional_Delay (New_Subp, Parent_Subp); + -- If we are creating a renaming for a primitive operation of an + -- actual of a generic derived type, we must examine the signature + -- of the actual primive, not that of the generic formal, which for + -- example may be an interface. However the name and initial value + -- of the inherited operation are those of the formal primitive. + Formal := First_Formal (Parent_Subp); + + if Present (Actual_Subp) then + Formal_Of_Actual := First_Formal (Actual_Subp); + else + Formal_Of_Actual := Empty; + end if; + while Present (Formal) loop New_Formal := New_Copy (Formal); @@ -11684,19 +11819,24 @@ package body Sem_Ch3 is -- original formal's parameter specification in this case. Set_Parent (New_Formal, Parent (Formal)); - Append_Entity (New_Formal, New_Subp); - Replace_Type (Formal, New_Formal); + if Present (Formal_Of_Actual) then + Replace_Type (Formal_Of_Actual, New_Formal); + Next_Formal (Formal_Of_Actual); + else + Replace_Type (Formal, New_Formal); + end if; + Next_Formal (Formal); end loop; -- If this derivation corresponds to a tagged generic actual, then -- primitive operations rename those of the actual. Otherwise the - -- primitive operations rename those of the parent type, If the - -- parent renames an intrinsic operator, so does the new subprogram. - -- We except concatenation, which is always properly typed, and does - -- not get expanded as other intrinsic operations. + -- primitive operations rename those of the parent type, If the parent + -- renames an intrinsic operator, so does the new subprogram. We except + -- concatenation, which is always properly typed, and does not get + -- expanded as other intrinsic operations. if No (Actual_Subp) then if Is_Intrinsic_Subprogram (Parent_Subp) then @@ -11786,10 +11926,10 @@ package body Sem_Ch3 is Set_Is_Abstract_Subprogram (New_Subp); -- Finally, if the parent type is abstract we must verify that all - -- inherited operations are either non-abstract or overridden, or - -- that the derived type itself is abstract (this check is performed - -- at the end of a package declaration, in Check_Abstract_Overriding). - -- A private overriding in the parent type will not be visible in the + -- inherited operations are either non-abstract or overridden, or that + -- the derived type itself is abstract (this check is performed at the + -- end of a package declaration, in Check_Abstract_Overriding). A + -- private overriding in the parent type will not be visible in the -- derivation if we are not in an inner package or in a child unit of -- the parent type, in which case the abstractness of the inherited -- operation is carried to the new subprogram. @@ -13066,6 +13206,8 @@ package body Sem_Ch3 is Typ := Entity (S); end if; + -- Check No_Wide_Characters restriction + if Typ = Standard_Wide_Character or else Typ = Standard_Wide_Wide_Character or else Typ = Standard_Wide_String @@ -13407,6 +13549,8 @@ package body Sem_Ch3 is return Result; end Search_Derivation_Levels; + -- Local Variables + Result : Node_Or_Entity_Id; -- Start of processing for Get_Discriminant_Value @@ -13816,6 +13960,58 @@ package body Sem_Ch3 is end if; end Is_Null_Extension; + -------------------- + -- Is_Progenitor -- + -------------------- + + function Is_Progenitor + (Iface : Entity_Id; + Typ : Entity_Id) return Boolean + is + Iface_Elmt : Elmt_Id; + I_Name : Entity_Id; + + begin + if No (Abstract_Interfaces (Typ)) then + return False; + + else + Iface_Elmt := First_Elmt (Abstract_Interfaces (Typ)); + while Present (Iface_Elmt) loop + I_Name := Node (Iface_Elmt); + if Base_Type (I_Name) = Base_Type (Iface) then + return True; + + elsif Is_Derived_Type (I_Name) + and then Is_Ancestor (Iface, I_Name) + then + return True; + + else + Next_Elmt (Iface_Elmt); + end if; + end loop; + + -- For concurrent record types, they have the interfaces of the + -- parent synchronized type. However these have no ancestors that + -- implement anything, so assume it is a progenitor. + -- Should be cleaned up in Collect_Abstract_Interfaces??? + + if Is_Concurrent_Record_Type (Typ) then + return Present (Abstract_Interfaces (Typ)); + end if; + + -- If type is a derived type, check recursively its ancestors + + if Is_Derived_Type (Typ) then + return Etype (Typ) = Iface + or else Is_Progenitor (Iface, Etype (Typ)); + else + return False; + end if; + end if; + end Is_Progenitor; + ------------------------------ -- Is_Valid_Constraint_Kind -- ------------------------------ @@ -14006,8 +14202,6 @@ package body Sem_Ch3 is Ancestor := Etype (Ancestor); end loop; - - return True; end; end if; end Is_Visible_Component; @@ -14059,7 +14253,6 @@ package body Sem_Ch3 is Set_Is_Abstract_Type (CW_Type, False); Set_Is_Constrained (CW_Type, False); Set_Is_First_Subtype (CW_Type, Is_First_Subtype (T)); - Init_Size_Align (CW_Type); if Ekind (T) = E_Class_Wide_Subtype then Set_Etype (CW_Type, Etype (Base_Type (T))); @@ -14548,7 +14741,6 @@ package body Sem_Ch3 is function OK_For_Limited_Init_In_05 (Exp : Node_Id) return Boolean is begin - -- Ada 2005 (AI-287, AI-318): Relax the strictness of the front end in -- case of limited aggregates (including extension aggregates), and -- function calls. The function call may have been give in prefixed @@ -14697,8 +14889,6 @@ package body Sem_Ch3 is Set_Fixed_Range (Implicit_Base, Loc, Low_Val, High_Val); Set_Fixed_Range (T, Loc, Low_Val, High_Val); - Init_Size_Align (Implicit_Base); - -- Complete definition of first subtype Set_Ekind (T, E_Ordinary_Fixed_Point_Subtype); @@ -14850,7 +15040,7 @@ package body Sem_Ch3 is -- Object Expressions" in spec of package Sem). if Present (Expression (Discr)) then - Analyze_Per_Use_Expression (Expression (Discr), Discr_Type); + Preanalyze_Spec_Expression (Expression (Discr), Discr_Type); if Nkind (N) = N_Formal_Type_Declaration then Error_Msg_N @@ -14915,7 +15105,11 @@ package body Sem_Ch3 is end if; -- Ada 2005 (AI-402): access discriminants of nonlimited types - -- can't have defaults + -- can't have defaults. Synchronized types, or types that are + -- explicitly limited are fine, but special tests apply to derived + -- types in generics: in a generic body we have to assume the + -- worst, and therefore defaults are not allowed if the parent is + -- a generic formal private type (see ACATS B370001). if Is_Access_Type (Discr_Type) then if Ekind (Discr_Type) /= E_Anonymous_Access_Type @@ -14925,7 +15119,19 @@ package body Sem_Ch3 is or else Is_Concurrent_Record_Type (Current_Scope) or else Ekind (Current_Scope) = E_Limited_Private_Type then - null; + if not Is_Derived_Type (Current_Scope) + or else not Is_Generic_Type (Etype (Current_Scope)) + or else not In_Package_Body (Scope (Etype (Current_Scope))) + or else Limited_Present + (Type_Definition (Parent (Current_Scope))) + then + null; + + else + Error_Msg_N ("access discriminants of nonlimited types", + Expression (Discr)); + Error_Msg_N ("\cannot have defaults", Expression (Discr)); + end if; elsif Present (Expression (Discr)) then Error_Msg_N @@ -16290,8 +16496,8 @@ package body Sem_Ch3 is return; else - Inc_T := Make_Defining_Identifier (Loc, Chars (Typ)); - Decl := Make_Incomplete_Type_Declaration (Loc, Inc_T); + Inc_T := Make_Defining_Identifier (Loc, Chars (Typ)); + Decl := Make_Incomplete_Type_Declaration (Loc, Inc_T); -- Type has already been inserted into the current scope. -- Remove it, and add incomplete declaration for type, so @@ -16589,6 +16795,18 @@ package body Sem_Ch3 is end if; end Check_Anonymous_Access_Components; + -------------------------------- + -- Preanalyze_Spec_Expression -- + -------------------------------- + + procedure Preanalyze_Spec_Expression (N : Node_Id; T : Entity_Id) is + Save_In_Spec_Expression : constant Boolean := In_Spec_Expression; + begin + In_Spec_Expression := True; + Preanalyze_And_Resolve (N, T); + In_Spec_Expression := Save_In_Spec_Expression; + end Preanalyze_Spec_Expression; + ----------------------------- -- Record_Type_Declaration -- ----------------------------- diff --git a/gcc/ada/sem_ch3.ads b/gcc/ada/sem_ch3.ads index 3afb0a2b2ab..0dff777a654 100644 --- a/gcc/ada/sem_ch3.ads +++ b/gcc/ada/sem_ch3.ads @@ -6,7 +6,7 @@ -- -- -- S p e c -- -- -- --- Copyright (C) 1992-2007, Free Software Foundation, Inc. -- +-- Copyright (C) 1992-2008, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -71,14 +71,6 @@ package Sem_Ch3 is procedure Analyze_Interface_Declaration (T : Entity_Id; Def : Node_Id); -- Analyze an interface declaration or a formal interface declaration - procedure Analyze_Per_Use_Expression (N : Node_Id; T : Entity_Id); - -- Default and per object expressions do not freeze their components, - -- and must be analyzed and resolved accordingly. The analysis is - -- done by calling the Pre_Analyze_And_Resolve routine and setting - -- the global In_Default_Expression flag. See the documentation section - -- entitled "Handling of Default and Per-Object Expressions" in sem.ads - -- for details. N is the expression to be analyzed, T is the expected type. - procedure Array_Type_Declaration (T : in out Entity_Id; Def : Node_Id); -- Process an array type declaration. If the array is constrained, we -- create an implicit parent array type, with the same index types and @@ -204,6 +196,14 @@ package Sem_Ch3 is -- Always False in Ada 95 mode. Equivalent to OK_For_Limited_Init_In_05 in -- Ada 2005 mode. + procedure Preanalyze_Spec_Expression (N : Node_Id; T : Entity_Id); + -- Default and per object expressions do not freeze their components, and + -- must be analyzed and resolved accordingly. The analysis is done by + -- calling the Preanalyze_And_Resolve routine and setting the global + -- In_Default_Expression flag. See the documentation section entitled + -- "Handling of Default and Per-Object Expressions" in sem.ads for full + -- details. N is the expression to be analyzed, T is the expected type. + procedure Process_Full_View (N : Node_Id; Full_T, Priv_T : Entity_Id); -- Process some semantic actions when the full view of a private type is -- encountered and analyzed. The first action is to create the full views diff --git a/gcc/ada/sem_ch4.adb b/gcc/ada/sem_ch4.adb index e3d45f9e942..60d3cd3f689 100644 --- a/gcc/ada/sem_ch4.adb +++ b/gcc/ada/sem_ch4.adb @@ -73,7 +73,7 @@ package body Sem_Ch4 is -- function, and if so must be converted into an explicit call node -- and analyzed as such. This deproceduring must be done during the first -- pass of overload resolution, because otherwise a procedure call with - -- overloaded actuals may fail to resolve. See 4327-001 for an example. + -- overloaded actuals may fail to resolve. procedure Analyze_Operator_Call (N : Node_Id; Op_Id : Entity_Id); -- Analyze a call of the form "+"(x, y), etc. The prefix of the call @@ -132,7 +132,7 @@ package body Sem_Ch4 is -- an invalid selector error message. function Defined_In_Scope (T : Entity_Id; S : Entity_Id) return Boolean; - -- Verify that type T is declared in scope S. Used to find intepretations + -- Verify that type T is declared in scope S. Used to find interpretations -- for operators given by expanded names. This is abstracted as a separate -- function to handle extensions to System, where S is System, but T is -- declared in the extension. @@ -268,6 +268,11 @@ package body Sem_Ch4 is function Try_Object_Operation (N : Node_Id) return Boolean; -- Ada 2005 (AI-252): Support the object.operation notation + procedure wpo (T : Entity_Id); + pragma Warnings (Off, wpo); + -- Used for debugging: obtain list of primitive operations even if + -- type is not frozen and dispatch table is not built yet. + ------------------------ -- Ambiguous_Operands -- ------------------------ @@ -366,7 +371,6 @@ package body Sem_Ch4 is if Nkind (E) = N_Qualified_Expression then Acc_Type := Create_Itype (E_Allocator_Type, N); Set_Etype (Acc_Type, Acc_Type); - Init_Size_Align (Acc_Type); Find_Type (Subtype_Mark (E)); -- Analyze the qualified expression, and apply the name resolution @@ -491,7 +495,6 @@ package body Sem_Ch4 is Type_Id := Process_Subtype (E, N); Acc_Type := Create_Itype (E_Allocator_Type, N); Set_Etype (Acc_Type, Acc_Type); - Init_Size_Align (Acc_Type); Set_Directly_Designated_Type (Acc_Type, Type_Id); Check_Fully_Declared (Type_Id, N); @@ -971,26 +974,6 @@ package body Sem_Ch4 is End_Interp_List; end if; - - -- Check for not-yet-implemented cases of AI-318. We only need to check - -- for inherently limited types, because other limited types will be - -- returned by copy, which works just fine. - -- If the context is an attribute reference 'Class, this is really a - -- type conversion, which is illegal, and will be caught elsewhere. - - if Ada_Version >= Ada_05 - and then not Debug_Flag_Dot_L - and then Is_Inherently_Limited_Type (Etype (N)) - and then (Nkind_In (Parent (N), N_Selected_Component, - N_Indexed_Component, - N_Slice) - or else - (Nkind (Parent (N)) = N_Attribute_Reference - and then Attribute_Name (Parent (N)) /= Name_Class)) - then - Error_Msg_N ("(Ada 2005) limited function call in this context" & - " is not yet implemented", N); - end if; end Analyze_Call; --------------------------- @@ -1361,7 +1344,7 @@ package body Sem_Ch4 is if not Is_Overloaded (P) then if Is_Access_Type (Etype (P)) then - -- Set the Etype. We need to go thru Is_For_Access_Subtypes to + -- Set the Etype. We need to go through Is_For_Access_Subtypes to -- avoid other problems caused by the Private_Subtype and it is -- safe to go to the Base_Type because this is the same as -- converting the access value to its Base_Type. @@ -1444,7 +1427,6 @@ package body Sem_Ch4 is -- where the prefix might include functions that return access to -- subprograms and others that return a regular type. Disambiguation -- of those has to take place in Resolve. - -- See e.g. 7117-014 and E317-001. New_N := Make_Function_Call (Loc, @@ -2231,7 +2213,7 @@ package body Sem_Ch4 is (N, Nam, Designated_Type (Subp_Type), Must_Skip); -- The prefix can also be a parameterless function that returns an - -- access to subprogram. in which case this is an indirect call. + -- access to subprogram, in which case this is an indirect call. elsif Is_Access_Type (Subp_Type) and then Ekind (Designated_Type (Subp_Type)) = E_Subprogram_Type @@ -2716,7 +2698,10 @@ package body Sem_Ch4 is procedure Check_Common_Type (T1, T2 : Entity_Id) is begin - if Covers (T1, T2) or else Covers (T2, T1) then + if Covers (T1 => T1, T2 => T2) + or else + Covers (T1 => T2, T2 => T1) + then if T1 = Universal_Integer or else T1 = Universal_Real or else T1 = Any_Character @@ -2808,12 +2793,50 @@ package body Sem_Ch4 is procedure Analyze_Reference (N : Node_Id) is P : constant Node_Id := Prefix (N); + E : Entity_Id; + T : Entity_Id; Acc_Type : Entity_Id; + begin Analyze (P); + + -- An interesting error check, if we take the 'Reference of an object + -- for which a pragma Atomic or Volatile has been given, and the type + -- of the object is not Atomic or Volatile, then we are in trouble. The + -- problem is that no trace of the atomic/volatile status will remain + -- for the backend to respect when it deals with the resulting pointer, + -- since the pointer type will not be marked atomic (it is a pointer to + -- the base type of the object). + + -- It is not clear if that can ever occur, but in case it does, we will + -- generate an error message. Not clear if this message can ever be + -- generated, and pretty clear that it represents a bug if it is, still + -- seems worth checking! + + T := Etype (P); + + if Is_Entity_Name (P) + and then Is_Object_Reference (P) + then + E := Entity (P); + T := Etype (P); + + if (Has_Atomic_Components (E) + and then not Has_Atomic_Components (T)) + or else + (Has_Volatile_Components (E) + and then not Has_Volatile_Components (T)) + or else (Is_Atomic (E) and then not Is_Atomic (T)) + or else (Is_Volatile (E) and then not Is_Volatile (T)) + then + Error_Msg_N ("cannot take reference to Atomic/Volatile object", N); + end if; + end if; + + -- Carry on with normal processing + Acc_Type := Create_Itype (E_Allocator_Type, N); - Set_Etype (Acc_Type, Acc_Type); - Init_Size_Align (Acc_Type); + Set_Etype (Acc_Type, Acc_Type); Set_Directly_Designated_Type (Acc_Type, Etype (P)); Set_Etype (N, Acc_Type); end Analyze_Reference; @@ -2845,7 +2868,8 @@ package body Sem_Ch4 is -- It is known that the parent of N denotes a subprogram call. Comp -- is an overloadable component of the concurrent type of the prefix. -- Determine whether all formals of the parent of N and Comp are mode - -- conformant. + -- conformant. If the parent node is not analyzed yet it may be an + -- indexed component rather than a function call. ------------------------------ -- Has_Mode_Conformant_Spec -- @@ -2858,7 +2882,13 @@ package body Sem_Ch4 is begin Comp_Param := First_Formal (Comp); - Param := First (Parameter_Associations (Parent (N))); + + if Nkind (Parent (N)) = N_Indexed_Component then + Param := First (Expressions (Parent (N))); + else + Param := First (Parameter_Associations (Parent (N))); + end if; + while Present (Comp_Param) and then Present (Param) loop @@ -2908,14 +2938,19 @@ package body Sem_Ch4 is -- A RACW object can never be used as prefix of a selected -- component since that means it is dereferenced without -- being a controlling operand of a dispatching operation - -- (RM E.2.2(15)). + -- (RM E.2.2(16/1)). Before reporting an error, we must check + -- whether this is actually a dispatching call in prefix form. if Is_Remote_Access_To_Class_Wide_Type (Prefix_Type) and then Comes_From_Source (N) then - Error_Msg_N - ("invalid dereference of a remote access to class-wide value", - N); + if Try_Object_Operation (N) then + return; + else + Error_Msg_N + ("invalid dereference of a remote access-to-class-wide value", + N); + end if; -- Normal case of selected component applied to access type @@ -2932,6 +2967,27 @@ package body Sem_Ch4 is Prefix_Type := Process_Implicit_Dereference_Prefix (Pent, Name); end if; + + -- If we have an explicit dereference of a remote access-to-class-wide + -- value, then issue an error (see RM-E.2.2(16/1)). However we first + -- have to check for the case of a prefix that is a controlling operand + -- of a prefixed dispatching call, as the dereference is legal in that + -- case. Normally this condition is checked in Validate_Remote_Access_ + -- To_Class_Wide_Type, but we have to defer the checking for selected + -- component prefixes because of the prefixed dispatching call case. + -- Note that implicit dereferences are checked for this just above. + + elsif Nkind (Name) = N_Explicit_Dereference + and then Is_Remote_Access_To_Class_Wide_Type (Etype (Prefix (Name))) + and then Comes_From_Source (N) + then + if Try_Object_Operation (N) then + return; + else + Error_Msg_N + ("invalid dereference of a remote access-to-class-wide value", + N); + end if; end if; -- (Ada 2005): if the prefix is the limited view of a type, and @@ -3139,7 +3195,7 @@ package body Sem_Ch4 is -- If the prefix is a private extension, check only the visible -- components of the partial view. This must include the tag, - -- wich can appear in expanded code in a tag check. + -- which can appear in expanded code in a tag check. if Ekind (Type_To_Use) = E_Record_Type_With_Private and then Chars (Selector_Name (N)) /= Name_uTag @@ -3206,7 +3262,7 @@ package body Sem_Ch4 is Set_Original_Discriminant (Sel, Comp); end if; - -- Before declararing an error, check whether this is tagged + -- Before declaring an error, check whether this is tagged -- private type and a call to a primitive operation. elsif Ada_Version >= Ada_05 @@ -3256,7 +3312,8 @@ package body Sem_Ch4 is if Is_Tagged_Type (Prefix_Type) and then Nkind_In (Parent (N), N_Procedure_Call_Statement, - N_Function_Call) + N_Function_Call, + N_Indexed_Component) and then Has_Mode_Conformant_Spec (Comp) then Has_Candidate := True; @@ -3322,6 +3379,7 @@ package body Sem_Ch4 is -- the controlling formal is implicit ??? elsif Nkind (Parent (N)) /= N_Procedure_Call_Statement + and then Nkind (Parent (N)) /= N_Indexed_Component and then Try_Object_Operation (N) then return; @@ -3899,7 +3957,9 @@ package body Sem_Ch4 is if Is_Numeric_Type (T1) and then Is_Numeric_Type (T2) - and then (Covers (T1, T2) or else Covers (T2, T1)) + and then (Covers (T1 => T1, T2 => T2) + or else + Covers (T1 => T2, T2 => T1)) then Add_One_Interp (N, Op_Id, Specific_Type (T1, T2)); end if; @@ -3938,7 +3998,9 @@ package body Sem_Ch4 is elsif Is_Numeric_Type (T1) and then Is_Numeric_Type (T2) - and then (Covers (T1, T2) or else Covers (T2, T1)) + and then (Covers (T1 => T1, T2 => T2) + or else + Covers (T1 => T2, T2 => T1)) then Add_One_Interp (N, Op_Id, Specific_Type (T1, T2)); @@ -3983,7 +4045,9 @@ package body Sem_Ch4 is -- already set (case of operation constructed by Exp_Fixed). if Is_Integer_Type (T1) - and then (Covers (T1, T2) or else Covers (T2, T1)) + and then (Covers (T1 => T1, T2 => T2) + or else + Covers (T1 => T2, T2 => T1)) then Add_One_Interp (N, Op_Id, Specific_Type (T1, T2)); end if; @@ -4414,7 +4478,7 @@ package body Sem_Ch4 is if Nkind (L) = N_Aggregate and then Nkind (R) /= N_Aggregate then - Find_Comparison_Types (R, L, Op_Id, N); + Find_Comparison_Types (L => R, R => L, Op_Id => Op_Id, N => N); return; end if; @@ -4632,7 +4696,7 @@ package body Sem_Ch4 is if Nkind (L) = N_Aggregate and then Nkind (R) /= N_Aggregate then - Find_Equality_Types (R, L, Op_Id, N); + Find_Equality_Types (L => R, R => L, Op_Id => Op_Id, N => N); return; end if; @@ -5276,8 +5340,8 @@ package body Sem_Ch4 is -- is never appropriate, even when Address is defined as a visible -- Integer type. The reason is that we would really prefer Address -- to behave as a private type, even in this case, which is there - -- only to accomodate oddities of VMS address sizes. If Address is - -- a visible integer type, we get lots of overload ambiguities. + -- only to accommodate oddities of VMS address sizes. If Address + -- is a visible integer type, we get lots of overload ambiguities. if Nkind (N) in N_Binary_Op then declare @@ -5653,8 +5717,8 @@ package body Sem_Ch4 is (Call_Node : Node_Id; Node_To_Replace : Node_Id) is - Formal_Type : constant Entity_Id := - Etype (First_Formal (Entity (Subprog))); + Control : constant Entity_Id := First_Formal (Entity (Subprog)); + Formal_Type : constant Entity_Id := Etype (Control); First_Actual : Node_Id; begin @@ -5716,6 +5780,19 @@ package body Sem_Ch4 is elsif Is_Access_Type (Formal_Type) and then not Is_Access_Type (Etype (Obj)) then + -- A special case: A.all'access is illegal if A is an access to a + -- constant and the context requires an access to a variable. + + if not Is_Access_Constant (Formal_Type) then + if (Nkind (Obj) = N_Explicit_Dereference + and then Is_Access_Constant (Etype (Prefix (Obj)))) + or else not Is_Variable (Obj) + then + Error_Msg_NE + ("actual for& must be a variable", Obj, Control); + end if; + end if; + Rewrite (First_Actual, Make_Attribute_Reference (Loc, Attribute_Name => Name_Access, @@ -6288,10 +6365,10 @@ package body Sem_Ch4 is -- must be identical, and the kind of call indicates the expected -- kind of operation (function or procedure). If the type is a -- (tagged) synchronized type, the primitive ops are attached to the - -- corresponding record type. + -- corresponding record (base) type. if Is_Concurrent_Type (Obj_Type) then - Corr_Type := Corresponding_Record_Type (Obj_Type); + Corr_Type := Base_Type (Corresponding_Record_Type (Obj_Type)); Elmt := First_Elmt (Primitive_Operations (Corr_Type)); elsif not Is_Generic_Type (Obj_Type) then @@ -6480,4 +6557,30 @@ package body Sem_Ch4 is end if; end Try_Object_Operation; + --------- + -- wpo -- + --------- + + procedure wpo (T : Entity_Id) is + Op : Entity_Id; + E : Elmt_Id; + + begin + if not Is_Tagged_Type (T) then + return; + end if; + + E := First_Elmt (Primitive_Operations (Base_Type (T))); + while Present (E) loop + Op := Node (E); + Write_Int (Int (Op)); + Write_Str (" === "); + Write_Name (Chars (Op)); + Write_Str (" in "); + Write_Name (Chars (Scope (Op))); + Next_Elmt (E); + Write_Eol; + end loop; + end wpo; + end Sem_Ch4; diff --git a/gcc/ada/sem_ch5.adb b/gcc/ada/sem_ch5.adb index 3f39aca1307..a1cd552dfe3 100644 --- a/gcc/ada/sem_ch5.adb +++ b/gcc/ada/sem_ch5.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 1992-2007, Free Software Foundation, Inc. -- +-- Copyright (C) 1992-2008, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -118,31 +118,40 @@ package body Sem_Ch5 is -- Some special bad cases of entity names elsif Is_Entity_Name (N) then - if Ekind (Entity (N)) = E_In_Parameter then - Error_Msg_N - ("assignment to IN mode parameter not allowed", N); - - -- Private declarations in a protected object are turned into - -- constants when compiling a protected function. + declare + Ent : constant Entity_Id := Entity (N); - elsif Present (Scope (Entity (N))) - and then Is_Protected_Type (Scope (Entity (N))) - and then - (Ekind (Current_Scope) = E_Function - or else - Ekind (Enclosing_Dynamic_Scope (Current_Scope)) = E_Function) - then - Error_Msg_N - ("protected function cannot modify protected object", N); + begin + if Ekind (Ent) = E_In_Parameter then + Error_Msg_N + ("assignment to IN mode parameter not allowed", N); + + -- Renamings of protected private components are turned into + -- constants when compiling a protected function. In the case + -- of single protected types, the private component appears + -- directly. + + elsif (Is_Prival (Ent) + and then + (Ekind (Current_Scope) = E_Function + or else Ekind (Enclosing_Dynamic_Scope ( + Current_Scope)) = E_Function)) + or else + (Ekind (Ent) = E_Component + and then Is_Protected_Type (Scope (Ent))) + then + Error_Msg_N + ("protected function cannot modify protected object", N); - elsif Ekind (Entity (N)) = E_Loop_Parameter then - Error_Msg_N - ("assignment to loop parameter not allowed", N); + elsif Ekind (Ent) = E_Loop_Parameter then + Error_Msg_N + ("assignment to loop parameter not allowed", N); - else - Error_Msg_N - ("left hand side of assignment must be a variable", N); - end if; + else + Error_Msg_N + ("left hand side of assignment must be a variable", N); + end if; + end; -- For indexed components or selected components, test prefix @@ -430,6 +439,15 @@ package body Sem_Ch5 is ("left hand of assignment must not be limited type", Lhs); Explain_Limited_Type (T1, Lhs); return; + + -- Enforce RM 3.9.3 (8): left-hand side cannot be abstract + + elsif Is_Interface (T1) + and then not Is_Class_Wide_Type (T1) + then + Error_Msg_N + ("target of assignment operation may not be abstract", Lhs); + return; end if; -- Resolution may have updated the subtype, in case the left-hand @@ -469,6 +487,7 @@ package body Sem_Ch5 is -- This is the point at which we check for an unset reference Check_Unset_Reference (Rhs); + Check_Unprotected_Access (Lhs, Rhs); -- Remaining steps are skipped if Rhs was syntactically in error @@ -588,7 +607,7 @@ package body Sem_Ch5 is -- We still mark this as a possible modification, that's necessary -- to reset Is_True_Constant, and desirable for xref purposes. - Note_Possible_Modification (Lhs); + Note_Possible_Modification (Lhs, Sure => True); return; -- If we know the right hand side is non-null, then we convert to the @@ -635,7 +654,7 @@ package body Sem_Ch5 is -- Note: modifications of the Lhs may only be recorded after -- checks have been applied. - Note_Possible_Modification (Lhs); + Note_Possible_Modification (Lhs, Sure => True); -- ??? a real accessibility check is needed when ??? @@ -799,7 +818,7 @@ package body Sem_Ch5 is begin -- Initialize unblocked exit count for statements of begin block - -- plus one for each excption handler that is present. + -- plus one for each exception handler that is present. Unblocked_Exit_Count := 1; @@ -911,7 +930,7 @@ package body Sem_Ch5 is procedure Non_Static_Choice_Error (Choice : Node_Id); -- Error routine invoked by the generic instantiation below when - -- the case statment has a non static choice. + -- the case statement has a non static choice. procedure Process_Statements (Alternative : Node_Id); -- Analyzes all the statements associated to a case alternative. @@ -1901,20 +1920,36 @@ package body Sem_Ch5 is Analyze (Id); Ent := Entity (Id); - Generate_Reference (Ent, Loop_Statement, ' '); - Generate_Definition (Ent); - -- If we found a label, mark its type. If not, ignore it, since it - -- means we have a conflicting declaration, which would already have - -- been diagnosed at declaration time. Set Label_Construct of the - -- implicit label declaration, which is not created by the parser - -- for generic units. + -- Guard against serious error (typically, a scope mismatch when + -- semantic analysis is requested) by creating loop entity to + -- continue analysis. - if Ekind (Ent) = E_Label then - Set_Ekind (Ent, E_Loop); + if No (Ent) then + if Total_Errors_Detected /= 0 then + Ent := + New_Internal_Entity + (E_Loop, Current_Scope, Sloc (Loop_Statement), 'L'); + else + raise Program_Error; + end if; + + else + Generate_Reference (Ent, Loop_Statement, ' '); + Generate_Definition (Ent); - if Nkind (Parent (Ent)) = N_Implicit_Label_Declaration then - Set_Label_Construct (Parent (Ent), Loop_Statement); + -- If we found a label, mark its type. If not, ignore it, since it + -- means we have a conflicting declaration, which would already + -- have been diagnosed at declaration time. Set Label_Construct + -- of the implicit label declaration, which is not created by the + -- parser for generic units. + + if Ekind (Ent) = E_Label then + Set_Ekind (Ent, E_Loop); + + if Nkind (Parent (Ent)) = N_Implicit_Label_Declaration then + Set_Label_Construct (Parent (Ent), Loop_Statement); + end if; end if; end if; @@ -1928,10 +1963,10 @@ package body Sem_Ch5 is Set_Parent (Ent, Loop_Statement); end if; - -- Kill current values on entry to loop, since statements in body - -- of loop may have been executed before the loop is entered. - -- Similarly we kill values after the loop, since we do not know - -- that the body of the loop was executed. + -- Kill current values on entry to loop, since statements in body of + -- loop may have been executed before the loop is entered. Similarly we + -- kill values after the loop, since we do not know that the body of the + -- loop was executed. Kill_Current_Values; Push_Scope (Ent); @@ -1941,6 +1976,13 @@ package body Sem_Ch5 is End_Scope; Kill_Current_Values; Check_Infinite_Loop_Warning (N); + + -- Code after loop is unreachable if the loop has no WHILE or FOR + -- and contains no EXIT statements within the body of the loop. + + if No (Iter) and then not Has_Exit (Ent) then + Check_Unreachable_Code (N); + end if; end Analyze_Loop_Statement; ---------------------------- diff --git a/gcc/ada/sem_ch5.ads b/gcc/ada/sem_ch5.ads index 3f8d2dfb990..4fa2246bee9 100644 --- a/gcc/ada/sem_ch5.ads +++ b/gcc/ada/sem_ch5.ads @@ -6,7 +6,7 @@ -- -- -- S p e c -- -- -- --- Copyright (C) 1992-2007, Free Software Foundation, Inc. -- +-- Copyright (C) 1992-2008, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -47,9 +47,9 @@ package Sem_Ch5 is -- be assumed to be reachable. procedure Check_Unreachable_Code (N : Node_Id); - -- This procedure is called with N being the node for a statement that - -- is an unconditional transfer of control. It checks to see if the - -- statement is followed by some other statement, and if so generates - -- an appropriate warning for unreachable code. + -- This procedure is called with N being the node for a statement that is + -- an unconditional transfer of control or an apparent infinite loop. It + -- checks to see if the statement is followed by some other statement, and + -- if so generates an appropriate warning for unreachable code. end Sem_Ch5; diff --git a/gcc/ada/sem_ch6.adb b/gcc/ada/sem_ch6.adb index 8c038658c54..4d566d76b5f 100644 --- a/gcc/ada/sem_ch6.adb +++ b/gcc/ada/sem_ch6.adb @@ -32,6 +32,7 @@ with Errout; use Errout; with Expander; use Expander; with Exp_Ch6; use Exp_Ch6; with Exp_Ch7; use Exp_Ch7; +with Exp_Ch9; use Exp_Ch9; with Exp_Tss; use Exp_Tss; with Exp_Util; use Exp_Util; with Fname; use Fname; @@ -111,7 +112,7 @@ package body Sem_Ch6 is procedure Build_Body_To_Inline (N : Node_Id; Subp : Entity_Id); -- If a subprogram has pragma Inline and inlining is active, use generic -- machinery to build an unexpanded body for the subprogram. This body is - -- subsequenty used for inline expansions at call sites. If subprogram can + -- subsequently used for inline expansions at call sites. If subprogram can -- be inlined (depending on size and nature of local declarations) this -- function returns true. Otherwise subprogram body is treated normally. -- If proper warnings are enabled and the subprogram contains a construct @@ -138,16 +139,6 @@ package body Sem_Ch6 is -- against a formal access-to-subprogram type so Get_Instance_Of must -- be called. - procedure Check_Overriding_Indicator - (Subp : Entity_Id; - Overridden_Subp : Entity_Id; - Is_Primitive : Boolean); - -- Verify the consistency of an overriding_indicator given for subprogram - -- declaration, body, renaming, or instantiation. Overridden_Subp is set - -- if the scope where we are introducing the subprogram contains a - -- type-conformant subprogram that becomes hidden by the new subprogram. - -- Is_Primitive indicates whether the subprogram is primitive. - procedure Check_Subprogram_Order (N : Node_Id); -- N is the N_Subprogram_Body node for a subprogram. This routine applies -- the alpha ordering rule for N if this ordering requirement applicable. @@ -174,11 +165,6 @@ package body Sem_Ch6 is procedure Install_Entity (E : Entity_Id); -- Make single entity visible. Used for generic formals as well - procedure Install_Formals (Id : Entity_Id); - -- On entry to a subprogram body, make the formals visible. Note that - -- simply placing the subprogram on the scope stack is not sufficient: - -- the formals must become the current entities for their names. - function Is_Non_Overriding_Operation (Prev_E : Entity_Id; New_E : Entity_Id) return Boolean; @@ -196,6 +182,16 @@ package body Sem_Ch6 is -- Flag functions that can be called without parameters, i.e. those that -- have no parameters, or those for which defaults exist for all parameters + procedure Process_PPCs + (N : Node_Id; + Spec_Id : Entity_Id; + Body_Id : Entity_Id); + -- Called from Analyze_Body to deal with scanning post conditions for the + -- body and assembling and inserting the _postconditions procedure. N is + -- the node for the subprogram body and Body_Id/Spec_Id are the entities + -- for the body and separate spec (if there is no separate spec, Spec_Id + -- is Empty). + procedure Set_Formal_Validity (Formal_Id : Entity_Id); -- Formal_Id is an formal parameter entity. This procedure deals with -- setting the proper validity status for this entity, which depends @@ -562,9 +558,22 @@ package body Sem_Ch6 is end if; -- Subtype_indication case; check that the types are the same, and - -- statically match if appropriate: + -- statically match if appropriate. A null exclusion may be present + -- on the return type, on the function specification, on the object + -- declaration or on the subtype itself. elsif Base_Type (R_Stm_Type) = Base_Type (R_Type) then + if Is_Access_Type (R_Type) + and then + (Can_Never_Be_Null (R_Type) + or else Null_Exclusion_Present (Parent (Scope_Id))) /= + Can_Never_Be_Null (R_Stm_Type) + then + Error_Msg_N + ("subtype must statically match function result subtype", + Subtype_Ind); + end if; + if Is_Constrained (R_Type) then if not Subtypes_Statically_Match (R_Stm_Type, R_Type) then Error_Msg_N @@ -653,14 +662,18 @@ package body Sem_Ch6 is end; end if; - -- Case of Expr present (Etype check defends against previous errors) + -- Case of Expr present if Present (Expr) + + -- Defend against previous errors + + and then Nkind (Expr) /= N_Empty and then Present (Etype (Expr)) then -- Apply constraint check. Note that this is done before the implicit -- conversion of the expression done for anonymous access types to - -- ensure correct generation of the null-excluding check asssociated + -- ensure correct generation of the null-excluding check associated -- with null-excluding expressions found in return statements. Apply_Constraint_Check (Expr, R_Type); @@ -676,6 +689,22 @@ package body Sem_Ch6 is Analyze_And_Resolve (Expr, R_Type); end if; + -- If the result type is class-wide, then check that the return + -- expression's type is not declared at a deeper level than the + -- function (RM05-6.5(5.6/2)). + + if Ada_Version >= Ada_05 + and then Is_Class_Wide_Type (R_Type) + then + if Type_Access_Level (Etype (Expr)) > + Subprogram_Access_Level (Scope_Id) + then + Error_Msg_N + ("level of return expression type is deeper than " & + "class-wide function!", Expr); + end if; + end if; + if (Is_Class_Wide_Type (Etype (Expr)) or else Is_Dynamically_Tagged (Expr)) and then not Is_Class_Wide_Type (R_Type) @@ -969,7 +998,7 @@ package body Sem_Ch6 is -- The syntactic construct: PREFIX ACTUAL_PARAMETER_PART can denote -- a procedure call or an entry call. The prefix may denote an access -- to subprogram type, in which case an implicit dereference applies. - -- If the prefix is an indexed component (without implicit defererence) + -- If the prefix is an indexed component (without implicit dereference) -- then the construct denotes a call to a member of an entire family. -- If the prefix is a simple name, it may still denote a call to a -- parameterless member of an entry family. Resolution of these various @@ -1232,14 +1261,33 @@ package body Sem_Ch6 is Body_Id : Entity_Id := Defining_Entity (Body_Spec); Prev_Id : constant Entity_Id := Current_Entity_In_Scope (Body_Id); Body_Deleted : constant Boolean := False; - - HSS : Node_Id; - Spec_Id : Entity_Id; - Spec_Decl : Node_Id := Empty; - Last_Formal : Entity_Id := Empty; Conformant : Boolean; + HSS : Node_Id; Missing_Ret : Boolean; P_Ent : Entity_Id; + Prot_Typ : Entity_Id := Empty; + Spec_Id : Entity_Id; + Spec_Decl : Node_Id := Empty; + + Last_Real_Spec_Entity : Entity_Id := Empty; + -- When we analyze a separate spec, the entity chain ends up containing + -- the formals, as well as any itypes generated during analysis of the + -- default expressions for parameters, or the arguments of associated + -- precondition/postcondition pragmas (which are analyzed in the context + -- of the spec since they have visibility on formals). + -- + -- These entities belong with the spec and not the body. However we do + -- the analysis of the body in the context of the spec (again to obtain + -- visibility to the formals), and all the entities generated during + -- this analysis end up also chained to the entity chain of the spec. + -- But they really belong to the body, and there is circuitry to move + -- them from the spec to the body. + -- + -- However, when we do this move, we don't want to move the real spec + -- entities (first para above) to the body. The Last_Real_Spec_Entity + -- variable points to the last real spec entity, so we only move those + -- chained beyond that point. It is initialized to Empty to deal with + -- the case where there is no separate spec. procedure Check_Anonymous_Return; -- (Ada 2005): if a function returns an access type that denotes a task, @@ -1254,11 +1302,8 @@ package body Sem_Ch6 is -- unconditionally, otherwise only if Front_End_Inlining is requested. -- If the body acts as a spec, and inlining is required, we create a -- subprogram declaration for it, in order to attach the body to inline. - - procedure Copy_Parameter_List (Plist : List_Id); - -- Utility to create a parameter profile for a new subprogram spec, - -- when the subprogram has a body that acts as spec. This is done for - -- some cases of inlining, and for private protected ops. + -- If pragma does not appear after the body, check whether there is + -- an inline pragma before any local declarations. procedure Set_Trivial_Subprogram (N : Node_Id); -- Sets the Is_Trivial_Subprogram flag in both spec and body of the @@ -1323,6 +1368,30 @@ package body Sem_Ch6 is Prag : Node_Id; Plist : List_Id; + function Is_Inline_Pragma (N : Node_Id) return Boolean; + -- Simple predicate, used twice. + + ----------------------- + -- Is_Inline_Pragma -- + ----------------------- + + function Is_Inline_Pragma (N : Node_Id) return Boolean is + begin + return + Nkind (N) = N_Pragma + and then + (Pragma_Name (N) = Name_Inline_Always + or else + (Front_End_Inlining + and then Pragma_Name (N) = Name_Inline)) + and then + Chars + (Expression (First (Pragma_Argument_Associations (N)))) + = Chars (Body_Id); + end Is_Inline_Pragma; + + -- Start of processing for Check_Inline_Pragma + begin if not Expander_Active then return; @@ -1330,25 +1399,16 @@ package body Sem_Ch6 is if Is_List_Member (N) and then Present (Next (N)) - and then Nkind (Next (N)) = N_Pragma + and then Is_Inline_Pragma (Next (N)) then Prag := Next (N); - if Nkind (Prag) = N_Pragma - and then - (Pragma_Name (Prag) = Name_Inline_Always - or else - (Front_End_Inlining - and then Pragma_Name (Prag) = Name_Inline)) - and then - Chars - (Expression (First (Pragma_Argument_Associations (Prag)))) - = Chars (Body_Id) - then - Prag := Next (N); - else - Prag := Empty; - end if; + elsif Nkind (N) /= N_Subprogram_Body_Stub + and then Present (Declarations (N)) + and then Is_Inline_Pragma (First (Declarations (N))) + then + Prag := First (Declarations (N)); + else Prag := Empty; end if; @@ -1374,8 +1434,7 @@ package body Sem_Ch6 is Set_Defining_Unit_Name (Specification (Decl), Subp); if Present (First_Formal (Body_Id)) then - Plist := New_List; - Copy_Parameter_List (Plist); + Plist := Copy_Parameter_List (Body_Id); Set_Parameter_Specifications (Specification (Decl), Plist); end if; @@ -1387,8 +1446,7 @@ package body Sem_Ch6 is if Pragma_Name (Prag) = Name_Inline_Always then Set_Is_Inlined (Subp); - Set_Next_Rep_Item (Prag, First_Rep_Item (Subp)); - Set_First_Rep_Item (Subp, Prag); + Set_Has_Pragma_Inline_Always (Subp); end if; Spec := Subp; @@ -1397,34 +1455,6 @@ package body Sem_Ch6 is end if; end Check_Inline_Pragma; - ------------------------- - -- Copy_Parameter_List -- - ------------------------- - - procedure Copy_Parameter_List (Plist : List_Id) is - Formal : Entity_Id; - - begin - Formal := First_Formal (Body_Id); - - while Present (Formal) loop - Append - (Make_Parameter_Specification (Loc, - Defining_Identifier => - Make_Defining_Identifier (Sloc (Formal), - Chars => Chars (Formal)), - In_Present => In_Present (Parent (Formal)), - Out_Present => Out_Present (Parent (Formal)), - Parameter_Type => - New_Reference_To (Etype (Formal), Loc), - Expression => - New_Copy_Tree (Expression (Parent (Formal)))), - Plist); - - Next_Formal (Formal); - end loop; - end Copy_Parameter_List; - ---------------------------- -- Set_Trivial_Subprogram -- ---------------------------- @@ -1455,11 +1485,16 @@ package body Sem_Ch6 is procedure Verify_Overriding_Indicator is begin - if Must_Override (Body_Spec) - and then not Is_Overriding_Operation (Spec_Id) - then - Error_Msg_NE - ("subprogram& is not overriding", Body_Spec, Spec_Id); + if Must_Override (Body_Spec) then + if Nkind (Spec_Id) = N_Defining_Operator_Symbol + and then Operator_Matches_Spec (Spec_Id, Spec_Id) + then + null; + + elsif not Is_Overriding_Operation (Spec_Id) then + Error_Msg_NE + ("subprogram& is not overriding", Body_Spec, Spec_Id); + end if; elsif Must_Not_Override (Body_Spec) then if Is_Overriding_Operation (Spec_Id) then @@ -1467,6 +1502,13 @@ package body Sem_Ch6 is ("subprogram& overrides inherited operation", Body_Spec, Spec_Id); + elsif Nkind (Spec_Id) = N_Defining_Operator_Symbol + and then Operator_Matches_Spec (Spec_Id, Spec_Id) + then + Error_Msg_NE + ("subprogram & overrides predefined operator ", + Body_Spec, Spec_Id); + -- If this is not a primitive operation the overriding indicator -- is altogether illegal. @@ -1625,14 +1667,11 @@ package body Sem_Ch6 is if Present (Formal) or else Expander_Active then - Plist := New_List; - + Plist := Copy_Parameter_List (Body_Id); else Plist := No_List; end if; - Copy_Parameter_List (Plist); - if Nkind (Body_Spec) = N_Procedure_Specification then New_Spec := Make_Procedure_Specification (Loc, @@ -1715,12 +1754,13 @@ package body Sem_Ch6 is if Is_Abstract_Subprogram (Spec_Id) then Error_Msg_N ("an abstract subprogram cannot have a body", N); return; + else Set_Convention (Body_Id, Convention (Spec_Id)); Set_Has_Completion (Spec_Id); if Is_Protected_Type (Scope (Spec_Id)) then - Set_Privals_Chain (Spec_Id, New_Elmt_List); + Prot_Typ := Scope (Spec_Id); end if; -- If this is a body generated for a renaming, do not check for @@ -1789,8 +1829,8 @@ package body Sem_Ch6 is Present (Abstract_Interfaces (Etype (First_Entity (Spec_Id)))) and then Present - (Corresponding_Concurrent_Type - (Etype (First_Entity (Spec_Id)))) + (Corresponding_Concurrent_Type + (Etype (First_Entity (Spec_Id)))) then declare Typ : constant Entity_Id := Etype (First_Entity (Spec_Id)); @@ -1808,10 +1848,12 @@ package body Sem_Ch6 is end; end if; - -- Make the formals visible, and place subprogram on scope stack + -- Make the formals visible, and place subprogram on scope stack. + -- This is also the point at which we set Last_Real_Spec_Entity + -- to mark the entities which will not be moved to the body. Install_Formals (Spec_Id); - Last_Formal := Last_Entity (Spec_Id); + Last_Real_Spec_Entity := Last_Entity (Spec_Id); Push_Scope (Spec_Id); -- Make sure that the subprogram is immediately visible. For @@ -1931,9 +1973,10 @@ package body Sem_Ch6 is -- Ada 2005 (AI-262): In library subprogram bodies, after the analysis -- if its specification we have to install the private withed units. + -- This holds for child units as well. if Is_Compilation_Unit (Body_Id) - and then Scope (Body_Id) = Standard_Standard + or else Nkind (Parent (N)) = N_Compilation_Unit then Install_Private_With_Clauses (Body_Id); end if; @@ -1961,9 +2004,7 @@ package body Sem_Ch6 is begin while Present (Prot_Ext_Formal) loop pragma Assert (Present (Impl_Ext_Formal)); - Set_Protected_Formal (Prot_Ext_Formal, Impl_Ext_Formal); - Next_Formal_With_Extras (Prot_Ext_Formal); Next_Formal_With_Extras (Impl_Ext_Formal); end loop; @@ -1974,9 +2015,40 @@ package body Sem_Ch6 is HSS := Handled_Statement_Sequence (N); Set_Actual_Subtypes (N, Current_Scope); + + -- Deal with preconditions and postconditions + + Process_PPCs (N, Spec_Id, Body_Id); + + -- Add a declaration for the Protection objcect, renaming declarations + -- for discriminals and privals and finally a declaration for the entry + -- family index (if applicable). This form of early expansion is done + -- when the Expander is active because Install_Private_Data_Declarations + -- references entities which were created during regular expansion. + + if Expander_Active + and then Comes_From_Source (N) + and then Present (Prot_Typ) + and then Present (Spec_Id) + and then not Is_Eliminated (Spec_Id) + then + Install_Private_Data_Declarations + (Sloc (N), Spec_Id, Prot_Typ, N, Declarations (N)); + end if; + + -- Analyze the declarations (this call will analyze the precondition + -- Check pragmas we prepended to the list, as well as the declaration + -- of the _Postconditions procedure). + Analyze_Declarations (Declarations (N)); + + -- Check completion, and analyze the statements + Check_Completion; Analyze (HSS); + + -- Deal with end of scope processing for the body + Process_End_Label (HSS, 't', Current_Scope); End_Scope; Check_Subprogram_Order (N); @@ -2000,14 +2072,35 @@ package body Sem_Ch6 is (Unit_Declaration_Node (Spec_Id), Spec_Id); end if; - if Present (Last_Formal) then - Set_Next_Entity - (Last_Entity (Body_Id), Next_Entity (Last_Formal)); - Set_Next_Entity (Last_Formal, Empty); + -- Here is where we move entities from the spec to the body + + -- Case where there are entities that stay with the spec + + if Present (Last_Real_Spec_Entity) then + + -- No body entities (happens when the only real spec entities + -- come from precondition and postcondition pragmas) + + if No (Last_Entity (Body_Id)) then + Set_First_Entity + (Body_Id, Next_Entity (Last_Real_Spec_Entity)); + + -- Body entities present (formals), so chain stuff past them + + else + Set_Next_Entity + (Last_Entity (Body_Id), Next_Entity (Last_Real_Spec_Entity)); + end if; + + Set_Next_Entity (Last_Real_Spec_Entity, Empty); Set_Last_Entity (Body_Id, Last_Entity (Spec_Id)); - Set_Last_Entity (Spec_Id, Last_Formal); + Set_Last_Entity (Spec_Id, Last_Real_Spec_Entity); + + -- Case where there are no spec entities, in this case there can + -- be no body entities either, so just move everything. else + pragma Assert (No (Last_Entity (Body_Id))); Set_First_Entity (Body_Id, First_Entity (Spec_Id)); Set_Last_Entity (Body_Id, Last_Entity (Spec_Id)); Set_First_Entity (Spec_Id, Empty); @@ -2107,7 +2200,7 @@ package body Sem_Ch6 is if Nkind (Ostm) = N_Raise_Statement then Set_Trivial_Subprogram (Stm); - -- If null statement, and no following statemennts, turn on flag + -- If null statement, and no following statements, turn on flag elsif Nkind (Stm) = N_Null_Statement and then Comes_From_Source (Stm) @@ -2337,9 +2430,9 @@ package body Sem_Ch6 is function Analyze_Subprogram_Specification (N : Node_Id) return Entity_Id is Designator : constant Entity_Id := Defining_Entity (N); + Formals : constant List_Id := Parameter_Specifications (N); Formal : Entity_Id; Formal_Typ : Entity_Id; - Formals : constant List_Id := Parameter_Specifications (N); -- Start of processing for Analyze_Subprogram_Specification @@ -2406,13 +2499,14 @@ package body Sem_Ch6 is if Is_Abstract_Type (Etype (Designator)) and then not Is_Interface (Etype (Designator)) - and then Nkind (Parent (N)) - /= N_Abstract_Subprogram_Declaration - and then (Nkind (Parent (N))) - /= N_Formal_Abstract_Subprogram_Declaration - and then (Nkind (Parent (N)) /= N_Subprogram_Renaming_Declaration - or else not Is_Entity_Name (Name (Parent (N))) - or else not Is_Abstract_Subprogram + and then Nkind (Parent (N)) /= + N_Abstract_Subprogram_Declaration + and then + (Nkind (Parent (N))) /= N_Formal_Abstract_Subprogram_Declaration + and then + (Nkind (Parent (N)) /= N_Subprogram_Renaming_Declaration + or else not Is_Entity_Name (Name (Parent (N))) + or else not Is_Abstract_Subprogram (Entity (Name (Parent (N))))) then Error_Msg_N @@ -2835,7 +2929,11 @@ package body Sem_Ch6 is -- Within an instance, the body to inline must be treated as a nested -- generic, so that the proper global references are preserved. - if In_Instance then + -- Note that we do not do this at the library level, because it is not + -- needed, and furthermore this causes trouble if front end inlining + -- is activated (-gnatN). + + if In_Instance and then Scope (Current_Scope) /= Standard_Standard then Save_Env (Scope (Current_Scope), Scope (Current_Scope)); Original_Body := Copy_Generic_Node (N, Empty, True); else @@ -2883,7 +2981,9 @@ package body Sem_Ch6 is Expander_Mode_Restore; - if In_Instance then + -- Restore environment if previously saved + + if In_Instance and then Scope (Current_Scope) /= Standard_Standard then Restore_Env; end if; @@ -3315,7 +3415,7 @@ package body Sem_Ch6 is if NewD then Push_Scope (New_Id); - Analyze_Per_Use_Expression + Preanalyze_Spec_Expression (Default_Value (New_Formal), Etype (New_Formal)); End_Scope; end if; @@ -3518,7 +3618,7 @@ package body Sem_Ch6 is begin -- The algorithm checks every overriding dispatching operation against -- all the corresponding overridden dispatching operations, detecting - -- differences in coventions. + -- differences in conventions. Prim_Op_Elmt := First_Elmt (Primitive_Operations (Typ)); while Present (Prim_Op_Elmt) loop @@ -3709,7 +3809,7 @@ package body Sem_Ch6 is -- expanded, so expand now to check conformance. if NewD then - Analyze_Per_Use_Expression + Preanalyze_Spec_Expression (Expression (New_Discr), New_Discr_Type); end if; @@ -3852,6 +3952,9 @@ package body Sem_Ch6 is Error_Msg_NE ("subprogram & overrides inherited operation #", Spec, Subp); end if; + + elsif Is_Subprogram (Subp) then + Set_Is_Overriding_Operation (Subp); end if; -- If Subp is an operator, it may override a predefined operation. @@ -3860,26 +3963,38 @@ package body Sem_Ch6 is -- signature of Subp matches that of a predefined operator. Note that -- first argument provides the name of the operator, and the second -- argument the signature that may match that of a standard operation. + -- If the indicator is overriding, then the operator must match a + -- predefined signature, because we know already that there is no + -- explicit overridden operation. - elsif Nkind (Subp) = N_Defining_Operator_Symbol - and then Must_Not_Override (Spec) - then - if Operator_Matches_Spec (Subp, Subp) then - Error_Msg_NE - ("subprogram & overrides predefined operator ", - Spec, Subp); - end if; + elsif Nkind (Subp) = N_Defining_Operator_Symbol then - elsif Must_Override (Spec) then - if Ekind (Subp) = E_Entry then - Error_Msg_NE ("entry & is not overriding", Spec, Subp); + if Must_Not_Override (Spec) then + if not Is_Primitive then + Error_Msg_N + ("overriding indicator only allowed " + & "if subprogram is primitive", Subp); - elsif Nkind (Subp) = N_Defining_Operator_Symbol then - if not Operator_Matches_Spec (Subp, Subp) then + elsif Operator_Matches_Spec (Subp, Subp) then Error_Msg_NE - ("subprogram & is not overriding", Spec, Subp); + ("subprogram & overrides predefined operator ", Spec, Subp); end if; + elsif Is_Overriding_Operation (Subp) then + null; + + elsif Must_Override (Spec) then + if not Operator_Matches_Spec (Subp, Subp) then + Error_Msg_NE ("subprogram & is not overriding", Spec, Subp); + + else + Set_Is_Overriding_Operation (Subp); + end if; + end if; + + elsif Must_Override (Spec) then + if Ekind (Subp) = E_Entry then + Error_Msg_NE ("entry & is not overriding", Spec, Subp); else Error_Msg_NE ("subprogram & is not overriding", Spec, Subp); end if; @@ -3897,7 +4012,6 @@ package body Sem_Ch6 is Error_Msg_N ("overriding indicator only allowed if subprogram is primitive", Subp); - return; end if; end Check_Overriding_Indicator; @@ -4146,8 +4260,8 @@ package body Sem_Ch6 is then null; - -- A loop with no exit statement or iteration scheme if either - -- an inifite loop, or it has some other exit (raise/return). + -- A loop with no exit statement or iteration scheme is either + -- an infinite loop, or it has some other exit (raise/return). -- In either case, no warning is required. else @@ -4964,7 +5078,6 @@ package body Sem_Ch6 is begin Set_Directly_Designated_Type (Formal_Type, Result_Subt); Set_Etype (Formal_Type, Formal_Type); - Init_Size_Align (Formal_Type); Set_Depends_On_Private (Formal_Type, Has_Private_Component (Formal_Type)); Set_Is_Public (Formal_Type, Is_Public (Scope (Formal_Type))); @@ -6416,7 +6529,7 @@ package body Sem_Ch6 is else Error_Msg_Sloc := Sloc (E); - -- Generate message,with useful additionalwarning if in generic + -- Generate message, with useful additional warning if in generic if Is_Generic_Unit (E) then Error_Msg_N ("previous generic unit cannot be overloaded", S); @@ -6467,9 +6580,9 @@ package body Sem_Ch6 is -- There are some cases when both can be implicit, for example -- when both a literal and a function that overrides it are - -- inherited in a derivation, or when an inhertited operation + -- inherited in a derivation, or when an inherited operation -- of a tagged full type overrides the inherited operation of - -- a private extension. Ada 83 had a special rule for the the + -- a private extension. Ada 83 had a special rule for the -- literal case. In Ada95, the later implicit operation hides -- the former, and the literal is always the former. In the -- odd case where both are derived operations declared at the @@ -6838,9 +6951,9 @@ package body Sem_Ch6 is Default : Node_Id; Ptype : Entity_Id; - -- The following are used for setting Is_Only_Out_ Num_Out_Params : Nat := 0; First_Out_Param : Entity_Id := Empty; + -- Used for setting Is_Only_Out_Parameter function Is_Class_Wide_Default (D : Node_Id) return Boolean; -- Check whether the default has a class-wide type. After analysis the @@ -7000,7 +7113,7 @@ package body Sem_Ch6 is -- Do the special preanalysis of the expression (see section on -- "Handling of Default Expressions" in the spec of package Sem). - Analyze_Per_Use_Expression (Default, Formal_Type); + Preanalyze_Spec_Expression (Default, Formal_Type); -- An access to constant cannot be the default for -- an access parameter that is an access to variable. @@ -7098,6 +7211,193 @@ package body Sem_Ch6 is end if; end Process_Formals; + ------------------ + -- Process_PPCs -- + ------------------ + + procedure Process_PPCs + (N : Node_Id; + Spec_Id : Entity_Id; + Body_Id : Entity_Id) + is + Loc : constant Source_Ptr := Sloc (N); + Prag : Node_Id; + Plist : List_Id := No_List; + Subp : Entity_Id; + Parms : List_Id; + + function Grab_PPC (Nam : Name_Id) return Node_Id; + -- Prag contains an analyzed precondition or postcondition pragma. + -- This function copies the pragma, changes it to the corresponding + -- Check pragma and returns the Check pragma as the result. The + -- argument Nam is either Name_Precondition or Name_Postcondition. + + -------------- + -- Grab_PPC -- + -------------- + + function Grab_PPC (Nam : Name_Id) return Node_Id is + CP : constant Node_Id := New_Copy_Tree (Prag); + + begin + -- Set Analyzed to false, since we want to reanalyze the check + -- procedure. Note that it is only at the outer level that we + -- do this fiddling, for the spec cases, the already preanalyzed + -- parameters are not affected. + + Set_Analyzed (CP, False); + + -- Change pragma into corresponding pragma Check + + Prepend_To (Pragma_Argument_Associations (CP), + Make_Pragma_Argument_Association (Sloc (Prag), + Expression => + Make_Identifier (Loc, + Chars => Nam))); + Set_Pragma_Identifier (CP, + Make_Identifier (Sloc (Prag), + Chars => Name_Check)); + + return CP; + end Grab_PPC; + + -- Start of processing for Process_PPCs + + begin + -- Grab preconditions from spec + + if Present (Spec_Id) then + + -- Loop through PPC pragmas from spec. Note that preconditions from + -- the body will be analyzed and converted when we scan the body + -- declarations below. + + Prag := Spec_PPC_List (Spec_Id); + while Present (Prag) loop + if Pragma_Name (Prag) = Name_Precondition + and then PPC_Enabled (Prag) + then + -- Add pragma Check at the start of the declarations of N. + -- Note that this processing reverses the order of the list, + -- which is what we want since new entries were chained to + -- the head of the list. + + Prepend (Grab_PPC (Name_Precondition), Declarations (N)); + end if; + + Prag := Next_Pragma (Prag); + end loop; + end if; + + -- Build postconditions procedure if needed and prepend the following + -- declaration to the start of the declarations for the subprogram. + + -- procedure _postconditions [(_Result : resulttype)] is + -- begin + -- pragma Check (Postcondition, condition [,message]); + -- pragma Check (Postcondition, condition [,message]); + -- ... + -- end; + + -- First we deal with the postconditions in the body + + if Is_Non_Empty_List (Declarations (N)) then + + -- Loop through declarations + + Prag := First (Declarations (N)); + while Present (Prag) loop + if Nkind (Prag) = N_Pragma then + + -- If pragma, capture if enabled postcondition, else ignore + + if Pragma_Name (Prag) = Name_Postcondition + and then Check_Enabled (Name_Postcondition) + then + if Plist = No_List then + Plist := Empty_List; + end if; + + Analyze (Prag); + Append (Grab_PPC (Name_Postcondition), Plist); + end if; + + Next (Prag); + + -- Not a pragma, if comes from source, then end scan + + elsif Comes_From_Source (Prag) then + exit; + + -- Skip stuff not coming from source + + else + Next (Prag); + end if; + end loop; + end if; + + -- Now deal with any postconditions from the spec + + if Present (Spec_Id) then + + -- Loop through PPC pragmas from spec + + Prag := Spec_PPC_List (Spec_Id); + while Present (Prag) loop + if Pragma_Name (Prag) = Name_Postcondition + and then PPC_Enabled (Prag) + then + if Plist = No_List then + Plist := Empty_List; + end if; + + Append (Grab_PPC (Name_Postcondition), Plist); + end if; + + Prag := Next_Pragma (Prag); + end loop; + end if; + + -- If we had any postconditions, build the procedure + + if Present (Plist) then + Subp := Defining_Entity (N); + + if Etype (Subp) /= Standard_Void_Type then + Parms := New_List ( + Make_Parameter_Specification (Loc, + Defining_Identifier => + Make_Defining_Identifier (Loc, + Chars => Name_uResult), + Parameter_Type => New_Occurrence_Of (Etype (Subp), Loc))); + else + Parms := No_List; + end if; + + Prepend_To (Declarations (N), + Make_Subprogram_Body (Loc, + Specification => + Make_Procedure_Specification (Loc, + Defining_Unit_Name => + Make_Defining_Identifier (Loc, + Chars => Name_uPostconditions), + Parameter_Specifications => Parms), + + Declarations => Empty_List, + + Handled_Statement_Sequence => + Make_Handled_Sequence_Of_Statements (Loc, + Statements => Plist))); + + if Present (Spec_Id) then + Set_Has_Postconditions (Spec_Id); + else + Set_Has_Postconditions (Body_Id); + end if; + end if; + end Process_PPCs; + ---------------------------- -- Reference_Body_Formals -- ---------------------------- @@ -7143,7 +7443,7 @@ package body Sem_Ch6 is AS_Needed : Boolean; begin - -- If this is an emtpy initialization procedure, no need to create + -- If this is an empty initialization procedure, no need to create -- actual subtypes (small optimization). if Ekind (Subp) = E_Procedure diff --git a/gcc/ada/sem_ch6.ads b/gcc/ada/sem_ch6.ads index 071aa75c44b..a535bd11883 100644 --- a/gcc/ada/sem_ch6.ads +++ b/gcc/ada/sem_ch6.ads @@ -6,7 +6,7 @@ -- -- -- S p e c -- -- -- --- Copyright (C) 1992-2007, Free Software Foundation, Inc. -- +-- Copyright (C) 1992-2008, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -78,7 +78,7 @@ package Sem_Ch6 is (New_Id : Entity_Id; Old_Id : Entity_Id; Err_Loc : Node_Id := Empty); - -- Check that two callable entitites (subprograms, entries, literals) + -- Check that two callable entities (subprograms, entries, literals) -- are fully conformant, post error message if not (RM 6.3.1(17)) with -- the flag being placed on the Err_Loc node if it is specified, and -- on the appropriate component of the New_Id construct if not. Note: @@ -92,7 +92,7 @@ package Sem_Ch6 is Old_Id : Entity_Id; Err_Loc : Node_Id := Empty; Get_Inst : Boolean := False); - -- Check that two callable entitites (subprograms, entries, literals) + -- Check that two callable entities (subprograms, entries, literals) -- are mode conformant, post error message if not (RM 6.3.1(15)) with -- the flag being placed on the Err_Loc node if it is specified, and -- on the appropriate component of the New_Id construct if not. The @@ -100,11 +100,21 @@ package Sem_Ch6 is -- formal access-to-subprogram type, indicating that mapping of types -- is needed. + procedure Check_Overriding_Indicator + (Subp : Entity_Id; + Overridden_Subp : Entity_Id; + Is_Primitive : Boolean); + -- Verify the consistency of an overriding_indicator given for subprogram + -- declaration, body, renaming, or instantiation. Overridden_Subp is set + -- if the scope where we are introducing the subprogram contains a + -- type-conformant subprogram that becomes hidden by the new subprogram. + -- Is_Primitive indicates whether the subprogram is primitive. + procedure Check_Subtype_Conformant (New_Id : Entity_Id; Old_Id : Entity_Id; Err_Loc : Node_Id := Empty); - -- Check that two callable entitites (subprograms, entries, literals) + -- Check that two callable entities (subprograms, entries, literals) -- are subtype conformant, post error message if not (RM 6.3.1(16)) -- the flag being placed on the Err_Loc node if it is specified, and -- on the appropriate component of the New_Id construct if not. @@ -113,7 +123,7 @@ package Sem_Ch6 is (New_Id : Entity_Id; Old_Id : Entity_Id; Err_Loc : Node_Id := Empty); - -- Check that two callable entitites (subprograms, entries, literals) + -- Check that two callable entities (subprograms, entries, literals) -- are type conformant, post error message if not (RM 6.3.1(14)) with -- the flag being placed on the Err_Loc node if it is specified, and -- on the appropriate component of the New_Id construct if not. @@ -146,18 +156,23 @@ package Sem_Ch6 is function Fully_Conformant_Expressions (Given_E1 : Node_Id; - Given_E2 : Node_Id) - return Boolean; + Given_E2 : Node_Id) return Boolean; -- Determines if two (non-empty) expressions are fully conformant -- as defined by (RM 6.3.1(18-21)) function Fully_Conformant_Discrete_Subtypes (Given_S1 : Node_Id; - Given_S2 : Node_Id) - return Boolean; + Given_S2 : Node_Id) return Boolean; -- Determines if two subtype definitions are fully conformant. Used -- for entry family conformance checks (RM 6.3.1 (24)). + procedure Install_Formals (Id : Entity_Id); + -- On entry to a subprogram body, make the formals visible. Note that + -- simply placing the subprogram on the scope stack is not sufficient: + -- the formals must become the current entities for their names. This + -- procedure is also used to get visibility to the formals when analyzing + -- preconditions and postconditions appearing in the spec. + function Mode_Conformant (New_Id, Old_Id : Entity_Id) return Boolean; -- Determine whether two callable entities (subprograms, entries, -- literals) are mode conformant (RM 6.3.1(15)) diff --git a/gcc/ada/sem_ch7.adb b/gcc/ada/sem_ch7.adb index 2e95a1f5f43..ebeec699183 100644 --- a/gcc/ada/sem_ch7.adb +++ b/gcc/ada/sem_ch7.adb @@ -51,6 +51,7 @@ with Sem_Ch8; use Sem_Ch8; with Sem_Ch10; use Sem_Ch10; with Sem_Ch12; use Sem_Ch12; with Sem_Disp; use Sem_Disp; +with Sem_Prag; use Sem_Prag; with Sem_Util; use Sem_Util; with Sem_Warn; use Sem_Warn; with Snames; use Snames; @@ -757,6 +758,12 @@ package body Sem_Ch7 is -- private_with_clauses, and remove them at the end of the nested -- package. + procedure Analyze_PPCs (Decls : List_Id); + -- Given a list of declarations, go through looking for subprogram + -- specs, and for each one found, analyze any pre/postconditions that + -- are chained to the spec. This is the implementation of the late + -- visibility analysis for preconditions and postconditions in specs. + procedure Clear_Constants (Id : Entity_Id; FE : Entity_Id); -- Clears constant indications (Never_Set_In_Source, Constant_Value, -- and Is_True_Constant) on all variables that are entities of Id, @@ -785,6 +792,33 @@ package body Sem_Ch7 is -- private part rather than being done in Sem_Ch12.Install_Parent -- (which is where the parents' visible declarations are installed). + ------------------ + -- Analyze_PPCs -- + ------------------ + + procedure Analyze_PPCs (Decls : List_Id) is + Decl : Node_Id; + Spec : Node_Id; + Sent : Entity_Id; + Prag : Node_Id; + + begin + Decl := First (Decls); + while Present (Decl) loop + if Nkind (Original_Node (Decl)) = N_Subprogram_Declaration then + Spec := Specification (Original_Node (Decl)); + Sent := Defining_Unit_Name (Spec); + Prag := Spec_PPC_List (Sent); + while Present (Prag) loop + Analyze_PPC_In_Decl_Part (Prag, Sent); + Prag := Next_Pragma (Prag); + end loop; + end if; + + Next (Decl); + end loop; + end Analyze_PPCs; + --------------------- -- Clear_Constants -- --------------------- @@ -937,9 +971,9 @@ package body Sem_Ch7 is begin Inst_Par := Inst_Id; + Gen_Par := Generic_Parent (Specification (Unit_Declaration_Node (Inst_Par))); - while Present (Gen_Par) and then Is_Child_Unit (Gen_Par) loop Inst_Node := Get_Package_Instantiation_Node (Inst_Par); @@ -1017,6 +1051,7 @@ package body Sem_Ch7 is begin if Present (Vis_Decls) then Analyze_Declarations (Vis_Decls); + Analyze_PPCs (Vis_Decls); end if; -- Verify that incomplete types have received full declarations @@ -1152,6 +1187,7 @@ package body Sem_Ch7 is end if; Analyze_Declarations (Priv_Decls); + Analyze_PPCs (Priv_Decls); -- Check the private declarations for incomplete deferred constants @@ -1345,13 +1381,17 @@ package body Sem_Ch7 is Formal : Entity_Id; begin - if Etype (S) = T then + -- If the full view is a scalar type, the type is the anonymous + -- base type, but the operation mentions the first subtype, so + -- check the signature againt the base type. + + if Base_Type (Etype (S)) = Base_Type (T) then return True; else Formal := First_Formal (S); while Present (Formal) loop - if Etype (Formal) = T then + if Base_Type (Etype (Formal)) = Base_Type (T) then return True; end if; @@ -1427,6 +1467,7 @@ package body Sem_Ch7 is Replace_Elmt (Op_Elmt, New_Op); Remove_Elmt (Op_List, Op_Elmt_2); Set_Is_Overriding_Operation (New_Op); + Set_Overridden_Operation (New_Op, Parent_Subp); -- We don't need to inherit its dispatching slot. -- Set_All_DT_Position has previously ensured that @@ -1664,11 +1705,18 @@ package body Sem_Ch7 is -- when the parent type is defined in the parent unit. At this -- point the current type is not private either, and we have to -- install the underlying full view, which is now visible. + -- Save the current full view as well, so that all views can + -- be restored on exit. It may seem that after compiling the + -- child body there are not environments to restore, but the + -- back-end expects those links to be valid, and freeze nodes + -- depend on them. if No (Full_View (Full)) and then Present (Underlying_Full_View (Full)) then Set_Full_View (Id, Underlying_Full_View (Full)); + Set_Underlying_Full_View (Id, Full); + Set_Underlying_Full_View (Full, Empty); Set_Is_Frozen (Full_View (Id)); end if; @@ -2153,7 +2201,8 @@ package body Sem_Ch7 is end if; -- Make private entities invisible and exchange full and private - -- declarations for private types. + -- declarations for private types. Id is now the first private + -- entity in the package. while Present (Id) loop if Debug_Flag_E then @@ -2240,6 +2289,22 @@ package body Sem_Ch7 is Exchange_Declarations (Id); + -- If we have installed an underlying full view for a type + -- derived from a private type in a child unit, restore the + -- proper views of private and full view. See corresponding + -- code in Install_Private_Declarations. + -- After the exchange, Full denotes the private type in the + -- visible part of the package. + + if Is_Private_Base_Type (Full) + and then Present (Full_View (Full)) + and then Present (Underlying_Full_View (Full)) + and then In_Package_Body (Current_Scope) + then + Set_Full_View (Full, Underlying_Full_View (Full)); + Set_Underlying_Full_View (Full, Empty); + end if; + elsif Ekind (Id) = E_Incomplete_Type and then No (Full_View (Id)) then diff --git a/gcc/ada/sem_ch8.adb b/gcc/ada/sem_ch8.adb index b732d507ab9..da77f581327 100644 --- a/gcc/ada/sem_ch8.adb +++ b/gcc/ada/sem_ch8.adb @@ -462,7 +462,7 @@ package body Sem_Ch8 is -- gram in an instance, for which special visibility checks apply. function Has_Implicit_Operator (N : Node_Id) return Boolean; - -- N is an expanded name whose selector is an operator name (eg P."+"). + -- N is an expanded name whose selector is an operator name (e.g. P."+"). -- declarative part contains an implicit declaration of an operator if it -- has a declaration of a type to which one of the predefined operators -- apply. The existence of this routine is an implementation artifact. A @@ -848,10 +848,8 @@ package body Sem_Ch8 is and then Nkind (Nam) in N_Has_Entity then declare - Error_Node : Node_Id; Nam_Decl : Node_Id; Nam_Ent : Entity_Id; - Subtyp_Decl : Node_Id; begin if Nkind (Nam) = N_Attribute_Reference then @@ -861,7 +859,6 @@ package body Sem_Ch8 is end if; Nam_Decl := Parent (Nam_Ent); - Subtyp_Decl := Parent (Etype (Nam_Ent)); if Has_Null_Exclusion (N) and then not Has_Null_Exclusion (Nam_Decl) @@ -876,32 +873,17 @@ package body Sem_Ch8 is if Is_Formal_Object (Nam_Ent) and then In_Generic_Scope (Id) then - if Present (Subtype_Mark (Nam_Decl)) then - Error_Node := Subtype_Mark (Nam_Decl); - else - pragma Assert - (Ada_Version >= Ada_05 - and then Present (Access_Definition (Nam_Decl))); - - Error_Node := Access_Definition (Nam_Decl); - end if; - - Error_Msg_N - ("`NOT NULL` required in formal object declaration", - Error_Node); - Error_Msg_Sloc := Sloc (N); Error_Msg_N - ("\because of renaming # (RM 8.5.4(4))", Error_Node); + ("renamed formal does not exclude `NULL` " + & "(RM 8.5.1(4.6/2))", N); -- Ada 2005 (AI-423): Otherwise, the subtype of the object name -- shall exclude null. - elsif Nkind (Subtyp_Decl) = N_Subtype_Declaration - and then not Has_Null_Exclusion (Subtyp_Decl) - then + elsif not Can_Never_Be_Null (Etype (Nam_Ent)) then Error_Msg_N - ("`NOT NULL` required for subtype & (RM 8.5.1(4.6/2))", - Defining_Identifier (Subtyp_Decl)); + ("renamed object does not exclude `NULL` " + & "(RM 8.5.1(4.6/2))", N); end if; end if; end; @@ -964,6 +946,11 @@ package body Sem_Ch8 is then null; + -- Allow internally generated x'Reference expression + + elsif Nkind (Nam) = N_Reference then + null; + else Error_Msg_N ("expect object name in renaming", Nam); end if; @@ -1444,7 +1431,7 @@ package body Sem_Ch8 is -- in Sub must also have one. Otherwise the subtype of the Sub's -- formal parameter must exclude null. -- - -- If Ren is a renaming of a formal function and its retrun + -- If Ren is a renaming of a formal function and its return -- profile has a null exclusion, then Sub's return profile must -- have one. Otherwise the subtype of Sub's return profile must -- exclude null. @@ -1970,7 +1957,7 @@ package body Sem_Ch8 is if Is_Actual then null; - -- Guard agaisnt previous errors, and omit renamings of predefined + -- Guard against previous errors, and omit renamings of predefined -- operators. elsif Ekind (Old_S) /= E_Function @@ -3205,6 +3192,8 @@ package body Sem_Ch8 is elsif not Redundant_Use (Id) then Set_In_Use (T, False); Set_In_Use (Base_Type (T), False); + Set_Current_Use_Clause (T, Empty); + Set_Current_Use_Clause (Base_Type (T), Empty); Op_List := Collect_Primitive_Operations (T); Elmt := First_Elmt (Op_List); @@ -3582,15 +3571,12 @@ package body Sem_Ch8 is declare Case_Stm : constant Node_Id := Parent (Parent (N)); Case_Typ : constant Entity_Id := Etype (Expression (Case_Stm)); - Case_Rtp : constant Entity_Id := Root_Type (Case_Typ); Lit : Node_Id; begin if Is_Enumeration_Type (Case_Typ) - and then Case_Rtp /= Standard_Character - and then Case_Rtp /= Standard_Wide_Character - and then Case_Rtp /= Standard_Wide_Wide_Character + and then not Is_Standard_Character_Type (Case_Typ) then Lit := First_Literal (Case_Typ); Get_Name_String (Chars (Lit)); @@ -3852,7 +3838,7 @@ package body Sem_Ch8 is All_Overloadable := All_Overloadable and Is_Overloadable (E2); -- Ada 2005 (AI-262): Protect against a form of Beujolais effect - -- that can occurr in private_with clauses. Example: + -- that can occur in private_with clauses. Example: -- with A; -- private with B; package A is @@ -4041,7 +4027,7 @@ package body Sem_Ch8 is -- When distribution features are available (Get_PCS_Name /= -- Name_No_DSA), a remote access-to-subprogram type is converted -- into a record type holding whatever information is needed to - -- perform a remote call on an RCI suprogram. In that case we + -- perform a remote call on an RCI subprogram. In that case we -- rewrite any occurrence of the RAS type into the equivalent record -- type here. 'Access attribute references and RAS dereferences are -- then implemented using specific TSSs. However when distribution is @@ -4121,6 +4107,17 @@ package body Sem_Ch8 is if Is_Object (E) and then Present (Renamed_Object (E)) then Generate_Reference (E, N); + -- If the renamed entity is a private protected component, + -- reference the original component as well. This needs to be + -- done because the private renamings are installed before any + -- analysis has occured. Reference to a private component will + -- resolve to the renaming and the original component will be + -- left unreferenced, hence the following. + + if Is_Prival (E) then + Generate_Reference (Prival_Link (E), N); + end if; + -- One odd case is that we do not want to set the Referenced flag -- if the entity is a label, and the identifier is the label in -- the source, since this is not a reference from the point of @@ -4146,11 +4143,11 @@ package body Sem_Ch8 is -- the entity is unambiguous, because the tree is not -- sufficiently typed at this point for Generate_Reference to -- determine whether this reference modifies the denoted object - -- (because implicit derefences cannot be identified prior to + -- (because implicit dereferences cannot be identified prior to -- full type resolution). -- - -- ??? The Is_Actual_Parameter routine takes care of one of these - -- cases but there are others probably + -- The Is_Actual_Parameter routine takes care of one of these + -- cases but there are others probably ??? else if not Is_Actual_Parameter then @@ -4170,7 +4167,10 @@ package body Sem_Ch8 is -- processing a generic spec or body, because the discriminal -- has not been not generated in this case. - if not In_Default_Expression + -- The replacement is also skipped if we are in special + -- spec-expression mode. Why is this skipped in this case ??? + + if not In_Spec_Expression or else Ekind (E) /= E_Discriminant or else Inside_A_Generic then @@ -4531,7 +4531,7 @@ package body Sem_Ch8 is else Error_Msg_N ("limited withed package can only be used to access " - & " incomplete types", + & "incomplete types", N); end if; end if; @@ -5535,14 +5535,10 @@ package body Sem_Ch8 is end if; Id := First_Entity (P); - while Present (Id) and then Id /= Priv_Id loop - if Is_Character_Type (Id) - and then (Root_Type (Id) = Standard_Character - or else Root_Type (Id) = Standard_Wide_Character - or else Root_Type (Id) = Standard_Wide_Wide_Character) + if Is_Standard_Character_Type (Id) and then Id = Base_Type (Id) then -- We replace the node with the literal itself, resolve as a @@ -6114,7 +6110,7 @@ package body Sem_Ch8 is end if; -- If the new use clause appears in the private part of a parent unit - -- it may appear to be redudant w.r.t. a use clause in a child unit, + -- it may appear to be redundant w.r.t. a use clause in a child unit, -- but the previous use clause was needed in the visible part of the -- child, and no warning should be emitted. @@ -6163,8 +6159,9 @@ package body Sem_Ch8 is Write_Info; end if; - Scope_Suppress := SST.Save_Scope_Suppress; + Scope_Suppress := SST.Save_Scope_Suppress; Local_Suppress_Stack_Top := SST.Save_Local_Suppress_Stack_Top; + Check_Policy_List := SST.Save_Check_Policy_List; if Debug_Flag_W then Write_Str ("--> exiting scope: "); @@ -6236,6 +6233,7 @@ package body Sem_Ch8 is SST.Entity := S; SST.Save_Scope_Suppress := Scope_Suppress; SST.Save_Local_Suppress_Stack_Top := Local_Suppress_Stack_Top; + SST.Save_Check_Policy_List := Check_Policy_List; if Scope_Stack.Last > Scope_Stack.First then SST.Component_Alignment_Default := Scope_Stack.Table @@ -6965,6 +6963,7 @@ package body Sem_Ch8 is elsif not Redundant_Use (Id) then Set_In_Use (T); + Set_Current_Use_Clause (T, Parent (Id)); Op_List := Collect_Primitive_Operations (T); Elmt := First_Elmt (Op_List); @@ -6990,7 +6989,7 @@ package body Sem_Ch8 is -- type T ... use P.T; -- The compilation unit is the body of X. GNAT first compiles the - -- spec of X, then procedes to the body. At that point P is marked + -- spec of X, then proceeds to the body. At that point P is marked -- as use visible. The analysis then reinstalls the spec along with -- its context. The use clause P.T is now recognized as redundant, -- but in the wrong context. Do not emit a warning in such cases. @@ -7000,9 +6999,72 @@ package body Sem_Ch8 is -- The type already has a use clause if In_Use (T) then - Error_Msg_NE - ("& is already use-visible through previous use type clause?", - Id, Id); + if Present (Current_Use_Clause (T)) then + declare + Clause1 : constant Node_Id := Parent (Id); + Clause2 : constant Node_Id := Current_Use_Clause (T); + Err_No : Node_Id; + Unit1 : Node_Id; + Unit2 : Node_Id; + + begin + if Nkind (Parent (Clause1)) = N_Compilation_Unit + and then Nkind (Parent (Clause2)) = N_Compilation_Unit + then + -- There is a redundant use type clause in a child unit. + -- Determine which of the units is more deeply nested. + + Unit1 := Defining_Entity (Unit (Parent (Clause1))); + Unit2 := Defining_Entity (Unit (Parent (Clause2))); + + if Scope (Unit2) = Standard_Standard then + Error_Msg_Sloc := Sloc (Current_Use_Clause (T)); + Err_No := Clause1; + + elsif Scope (Unit1) = Standard_Standard then + Error_Msg_Sloc := Sloc (Id); + Err_No := Clause2; + + else + -- Determine which is the descendant unit + + declare + S1, S2 : Entity_Id; + + begin + S1 := Scope (Unit1); + S2 := Scope (Unit2); + while S1 /= Standard_Standard + and then S2 /= Standard_Standard + loop + S1 := Scope (S1); + S2 := Scope (S2); + end loop; + + if S1 = Standard_Standard then + Error_Msg_Sloc := Sloc (Id); + Err_No := Clause2; + else + Error_Msg_Sloc := Sloc (Current_Use_Clause (T)); + Err_No := Clause1; + end if; + end; + end if; + + Error_Msg_NE + ("& is already use-visible through previous " + & "use_type_clause #?", Err_No, Id); + else + Error_Msg_NE + ("& is already use-visible through previous use type " + & "clause?", Id, Id); + end if; + end; + else + Error_Msg_NE + ("& is already use-visible through previous use type " + & "clause?", Id, Id); + end if; -- The package where T is declared is already used diff --git a/gcc/ada/sem_ch8.ads b/gcc/ada/sem_ch8.ads index 1d887aa03b7..45fb07b32cc 100644 --- a/gcc/ada/sem_ch8.ads +++ b/gcc/ada/sem_ch8.ads @@ -6,7 +6,7 @@ -- -- -- S p e c -- -- -- --- Copyright (C) 1992-2007, Free Software Foundation, Inc. -- +-- Copyright (C) 1992-2008, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -146,7 +146,7 @@ package Sem_Ch8 is -- return, the contents of the scope stack must be made accessible again. -- The flag Handle_Use indicates whether local use clauses must be -- removed/installed. In the case of inlining of instance bodies, the - -- visiblity handling is done fully in Inline_Instance_Body, and use + -- visibility handling is done fully in Inline_Instance_Body, and use -- clauses are handled there. procedure Set_Use (L : List_Id); diff --git a/gcc/ada/sem_ch9.adb b/gcc/ada/sem_ch9.adb index ec4ce80bff1..d9e7ff9ca5a 100644 --- a/gcc/ada/sem_ch9.adb +++ b/gcc/ada/sem_ch9.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 1992-2007, Free Software Foundation, Inc. -- +-- Copyright (C) 1992-2008, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -570,9 +570,9 @@ package body Sem_Ch9 is -- expression is only evaluated if the guard is open. if Nkind (Delay_Statement (N)) = N_Delay_Relative_Statement then - Pre_Analyze_And_Resolve (Expr, Standard_Duration); + Preanalyze_And_Resolve (Expr, Standard_Duration); else - Pre_Analyze_And_Resolve (Expr); + Preanalyze_And_Resolve (Expr); end if; Typ := First_Subtype (Etype (Expr)); @@ -646,8 +646,8 @@ package body Sem_Ch9 is Stats : constant Node_Id := Handled_Statement_Sequence (N); Formals : constant Node_Id := Entry_Body_Formal_Part (N); P_Type : constant Entity_Id := Current_Scope; - Entry_Name : Entity_Id; E : Entity_Id; + Entry_Name : Entity_Id; begin Tasking_Used := True; @@ -765,7 +765,6 @@ package body Sem_Ch9 is Exp_Ch9.Expand_Entry_Barrier (N, Entry_Name); Push_Scope (Entry_Name); - Exp_Ch9.Expand_Entry_Body_Declarations (N); Install_Declarations (Entry_Name); Set_Actual_Subtypes (N, Current_Scope); @@ -783,6 +782,17 @@ package body Sem_Ch9 is Set_Entry_Parameters_Type (Id, Entry_Parameters_Type (Entry_Name)); + -- Add a declaration for the Protection object, renaming declarations + -- for the discriminals and privals and finally a declaration for the + -- entry family index (if applicable). + + if Expander_Active + and then Is_Protected_Type (P_Type) + then + Install_Private_Data_Declarations + (Sloc (N), Entry_Name, P_Type, N, Decls); + end if; + if Present (Decls) then Analyze_Declarations (Decls); end if; @@ -907,7 +917,7 @@ package body Sem_Ch9 is if Nkind (Call) = N_Attribute_Reference then -- Possibly a stream attribute, but definitely illegal. Other - -- illegalitles, such as procedure calls, are diagnosed after + -- illegalities, such as procedure calls, are diagnosed after -- resolution. Error_Msg_N ("entry call alternative requires an entry call", Call); @@ -926,40 +936,40 @@ package body Sem_Ch9 is ------------------------------- procedure Analyze_Entry_Declaration (N : Node_Id) is - Formals : constant List_Id := Parameter_Specifications (N); - Id : constant Entity_Id := Defining_Identifier (N); D_Sdef : constant Node_Id := Discrete_Subtype_Definition (N); + Def_Id : constant Entity_Id := Defining_Identifier (N); + Formals : constant List_Id := Parameter_Specifications (N); begin - Generate_Definition (Id); + Generate_Definition (Def_Id); Tasking_Used := True; if No (D_Sdef) then - Set_Ekind (Id, E_Entry); + Set_Ekind (Def_Id, E_Entry); else - Enter_Name (Id); - Set_Ekind (Id, E_Entry_Family); + Enter_Name (Def_Id); + Set_Ekind (Def_Id, E_Entry_Family); Analyze (D_Sdef); - Make_Index (D_Sdef, N, Id); + Make_Index (D_Sdef, N, Def_Id); end if; - Set_Etype (Id, Standard_Void_Type); - Set_Convention (Id, Convention_Entry); - Set_Accept_Address (Id, New_Elmt_List); + Set_Etype (Def_Id, Standard_Void_Type); + Set_Convention (Def_Id, Convention_Entry); + Set_Accept_Address (Def_Id, New_Elmt_List); if Present (Formals) then - Set_Scope (Id, Current_Scope); - Push_Scope (Id); + Set_Scope (Def_Id, Current_Scope); + Push_Scope (Def_Id); Process_Formals (Formals, N); - Create_Extra_Formals (Id); + Create_Extra_Formals (Def_Id); End_Scope; end if; - if Ekind (Id) = E_Entry then - New_Overloaded_Entity (Id); + if Ekind (Def_Id) = E_Entry then + New_Overloaded_Entity (Def_Id); end if; - Generate_Reference_To_Formals (Id); + Generate_Reference_To_Formals (Def_Id); end Analyze_Entry_Declaration; --------------------------------------- @@ -973,7 +983,7 @@ package body Sem_Ch9 is -- order to make it available to the barrier, we create an additional -- scope, as for a loop, whose only declaration is the index name. This -- loop is not attached to the tree and does not appear as an entity local - -- to the protected type, so its existence need only be knwown to routines + -- to the protected type, so its existence need only be known to routines -- that process entry families. procedure Analyze_Entry_Index_Specification (N : Node_Id) is @@ -1061,7 +1071,7 @@ package body Sem_Ch9 is Set_Has_Completion (Spec_Id); Install_Declarations (Spec_Id); - Exp_Ch9.Expand_Protected_Body_Declarations (N, Spec_Id); + Expand_Protected_Body_Declarations (N, Spec_Id); Last_E := Last_Entity (Spec_Id); @@ -1093,6 +1103,55 @@ package body Sem_Ch9 is E : Entity_Id; L : Entity_Id; + procedure Undelay_Itypes (T : Entity_Id); + -- Itypes created for the private components of a protected type + -- do not receive freeze nodes, because there is no scope in which + -- they can be elaborated, and they can depend on discriminants of + -- the enclosed protected type. Given that the components can be + -- composite types with inner components, we traverse recursively + -- the private components of the protected type, and indicate that + -- all itypes within are frozen. This ensures that no freeze nodes + -- will be generated for them. + -- + -- On the other hand, components of the correesponding record are + -- frozen (or receive itype references) as for other records. + + -------------------- + -- Undelay_Itypes -- + -------------------- + + procedure Undelay_Itypes (T : Entity_Id) is + Comp : Entity_Id; + + begin + if Is_Protected_Type (T) then + Comp := First_Private_Entity (T); + elsif Is_Record_Type (T) then + Comp := First_Entity (T); + else + return; + end if; + + while Present (Comp) loop + if Is_Type (Comp) + and then Is_Itype (Comp) + then + Set_Has_Delayed_Freeze (Comp, False); + Set_Is_Frozen (Comp); + + if Is_Record_Type (Comp) + or else Is_Protected_Type (Comp) + then + Undelay_Itypes (Comp); + end if; + end if; + + Next_Entity (Comp); + end loop; + end Undelay_Itypes; + + -- Start of processing for Analyze_Protected_Definition + begin Tasking_Used := True; Analyze_Declarations (Visible_Declarations (N)); @@ -1127,6 +1186,8 @@ package body Sem_Ch9 is Next_Entity (E); end loop; + Undelay_Itypes (Current_Scope); + Check_Max_Entries (N, Max_Protected_Entries); Process_End_Label (N, 'e', Current_Scope); end Analyze_Protected_Definition; @@ -1151,7 +1212,10 @@ package body Sem_Ch9 is T := Find_Type_Name (N); - if Ekind (T) = E_Incomplete_Type then + -- In the case of an incomplete type, use the full view, unless it's not + -- present (as can occur for an incomplete view from a limited with). + + if Ekind (T) = E_Incomplete_Type and then Present (Full_View (T)) then T := Full_View (T); Set_Completion_Referenced (T); end if; @@ -1776,6 +1840,7 @@ package body Sem_Ch9 is procedure Analyze_Task_Body (N : Node_Id) is Body_Id : constant Entity_Id := Defining_Identifier (N); + Decls : constant List_Id := Declarations (N); HSS : constant Node_Id := Handled_Statement_Sequence (N); Last_E : Entity_Id; @@ -1842,7 +1907,7 @@ package body Sem_Ch9 is Install_Declarations (Spec_Id); Last_E := Last_Entity (Spec_Id); - Analyze_Declarations (Declarations (N)); + Analyze_Declarations (Decls); -- For visibility purposes, all entities in the body are private. Set -- First_Private_Entity accordingly, if there was no private part in the @@ -1946,7 +2011,10 @@ package body Sem_Ch9 is T := Find_Type_Name (N); Generate_Definition (T); - if Ekind (T) = E_Incomplete_Type then + -- In the case of an incomplete type, use the full view, unless it's not + -- present (as can occur for an incomplete view from a limited with). + + if Ekind (T) = E_Incomplete_Type and then Present (Full_View (T)) then T := Full_View (T); Set_Completion_Referenced (T); end if; @@ -2107,7 +2175,7 @@ package body Sem_Ch9 is ("triggering statement must be delay or entry call", Trigger); -- Ada 2005 (AI-345): If a procedure_call_statement is used for a - -- procedure_or_entry_call, the procedure_name or pro- cedure_prefix + -- procedure_or_entry_call, the procedure_name or procedure_prefix -- of the procedure_call_statement shall denote an entry renamed by a -- procedure, or (a view of) a primitive subprogram of a limited -- interface whose first parameter is a controlling parameter. diff --git a/gcc/ada/sem_disp.adb b/gcc/ada/sem_disp.adb index 1652a82fc67..c990800ac56 100644 --- a/gcc/ada/sem_disp.adb +++ b/gcc/ada/sem_disp.adb @@ -31,6 +31,7 @@ with Exp_Disp; use Exp_Disp; with Exp_Ch7; use Exp_Ch7; with Exp_Tss; use Exp_Tss; with Errout; use Errout; +with Lib.Xref; use Lib.Xref; with Namet; use Namet; with Nlists; use Nlists; with Nmake; use Nmake; @@ -790,6 +791,9 @@ package body Sem_Disp is -- if the subprogram is already frozen, we must update -- its dispatching information explicitly here. The -- information is taken from the overridden subprogram. + -- We must also generate a cross-reference entry because + -- references to other primitives were already created + -- when type was frozen. Body_Is_Last_Primitive := True; @@ -819,6 +823,8 @@ package body Sem_Disp is Prim => Subp, Ins_Nod => Subp_Body); end if; + + Generate_Reference (Tagged_Type, Subp, 'p', False); end if; end if; end if; @@ -1543,6 +1549,14 @@ package body Sem_Disp is if VM_Target = No_VM then Expand_Dispatching_Call (Call_Node); + + -- Expansion of a dispatching call results in an indirect call, which in + -- turn causes current values to be killed (see Resolve_Call), so on VM + -- targets we do the call here to ensure consistent warnings between VM + -- and non-VM targets. + + else + Kill_Current_Values; end if; end Propagate_Tag; diff --git a/gcc/ada/sem_dist.ads b/gcc/ada/sem_dist.ads index da64ef858ef..9f9b95d3e69 100644 --- a/gcc/ada/sem_dist.ads +++ b/gcc/ada/sem_dist.ads @@ -6,7 +6,7 @@ -- -- -- S p e c -- -- -- --- Copyright (C) 1992-2007, Free Software Foundation, Inc. -- +-- Copyright (C) 1992-2008, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -31,8 +31,8 @@ with Types; use Types; package Sem_Dist is function Get_PCS_Name return PCS_Names; - -- Return the name of a literal of type System.Partition_Interface. - -- DSA_Implementation_Type indicating what PCS is currently in use. + -- Return the name of a literal of type DSA_Implementation_Name in package + -- System.Partition_Interface indicating what PCS is currently in use. function Get_PCS_Version return Int; -- Return the version number of the PCS API implemented by the PCS. diff --git a/gcc/ada/sem_elab.adb b/gcc/ada/sem_elab.adb index 922a16d53ae..34065991103 100644 --- a/gcc/ada/sem_elab.adb +++ b/gcc/ada/sem_elab.adb @@ -58,11 +58,11 @@ with Uname; use Uname; package body Sem_Elab is - -- The following table records the recursive call chain for output - -- in the Output routine. Each entry records the call node and the - -- entity of the called routine. The number of entries in the table - -- (i.e. the value of Elab_Call.Last) indicates the current depth - -- of recursion and is used to identify the outer level. + -- The following table records the recursive call chain for output in the + -- Output routine. Each entry records the call node and the entity of the + -- called routine. The number of entries in the table (i.e. the value of + -- Elab_Call.Last) indicates the current depth of recursion and is used to + -- identify the outer level. type Elab_Call_Entry is record Cloc : Source_Ptr; @@ -77,10 +77,10 @@ package body Sem_Elab is Table_Increment => 100, Table_Name => "Elab_Call"); - -- This table is initialized at the start of each outer level call. - -- It holds the entities for all subprograms that have been examined - -- for this particular outer level call, and is used to prevent both - -- infinite recursion, and useless reanalysis of bodies already seen + -- This table is initialized at the start of each outer level call. It + -- holds the entities for all subprograms that have been examined for this + -- particular outer level call, and is used to prevent both infinite + -- recursion, and useless reanalysis of bodies already seen package Elab_Visited is new Table.Table ( Table_Component_Type => Entity_Id, @@ -127,9 +127,8 @@ package body Sem_Elab is Table_Name => "Delay_Check"); C_Scope : Entity_Id; - -- Top level scope of current scope. We need to compute this only - -- once at the outer level, i.e. for a call to Check_Elab_Call from - -- outside this unit. + -- Top level scope of current scope. Compute this only once at the outer + -- level, i.e. for a call to Check_Elab_Call from outside this unit. Outer_Level_Sloc : Source_Ptr; -- Save Sloc value for outer level call node for comparisons of source @@ -149,9 +148,9 @@ package body Sem_Elab is Delaying_Elab_Checks : Boolean := True; -- This is set True till the compilation is complete, including the - -- insertion of all instance bodies. Then when Check_Elab_Calls is - -- called, the delay table is used to make the delayed calls and - -- this flag is reset to False, so that the calls are processed + -- insertion of all instance bodies. Then when Check_Elab_Calls is called, + -- the delay table is used to make the delayed calls and this flag is reset + -- to False, so that the calls are processed ----------------------- -- Local Subprograms -- @@ -177,16 +176,15 @@ package body Sem_Elab is Outer_Scope : Entity_Id; Inter_Unit_Only : Boolean; Generate_Warnings : Boolean := True); - -- This is the internal recursive routine that is called to check for - -- a possible elaboration error. The argument N is a subprogram call - -- or generic instantiation to be checked, and E is the entity of - -- the called subprogram, or instantiated generic unit. The flag - -- Outer_Scope is the outer level scope for the original call. - -- Inter_Unit_Only is set if the call is only to be checked in the - -- case where it is to another unit (and skipped if within a unit). - -- Generate_Warnings is set to False to suppress warning messages - -- about missing pragma Elaborate_All's. These messages are not - -- wanted for inner calls in the dynamic model. + -- This is the internal recursive routine that is called to check for a + -- possible elaboration error. The argument N is a subprogram call or + -- generic instantiation to be checked, and E is the entity of the called + -- subprogram, or instantiated generic unit. The flag Outer_Scope is the + -- outer level scope for the original call. Inter_Unit_Only is set if the + -- call is only to be checked in the case where it is to another unit (and + -- skipped if within a unit). Generate_Warnings is set to False to suppress + -- warning messages about missing pragma Elaborate_All's. These messages + -- are not wanted for inner calls in the dynamic model. procedure Check_Bad_Instantiation (N : Node_Id); -- N is a node for an instantiation (if called with any other node kind, @@ -207,14 +205,14 @@ package body Sem_Elab is E : Entity_Id; Outer_Scope : Entity_Id; Orig_Ent : Entity_Id); - -- N is a function call or procedure statement call node and E is - -- the entity of the called function, which is within the current - -- compilation unit (where subunits count as part of the parent). - -- This call checks if this call, or any call within any accessed - -- body could cause an ABE, and if so, outputs a warning. Orig_Ent - -- differs from E only in the case of renamings, and points to the - -- original name of the entity. This is used for error messages. - -- Outer_Scope is the outer level scope for the original call. + -- N is a function call or procedure statement call node and E is the + -- entity of the called function, which is within the current compilation + -- unit (where subunits count as part of the parent). This call checks if + -- this call, or any call within any accessed body could cause an ABE, and + -- if so, outputs a warning. Orig_Ent differs from E only in the case of + -- renamings, and points to the original name of the entity. This is used + -- for error messages. Outer_Scope is the outer level scope for the + -- original call. procedure Check_Internal_Call_Continue (N : Node_Id; @@ -224,10 +222,10 @@ package body Sem_Elab is -- The processing for Check_Internal_Call is divided up into two phases, -- and this represents the second phase. The second phase is delayed if -- Delaying_Elab_Calls is set to True. In this delayed case, the first - -- phase makes an entry in the Delay_Check table, which is processed - -- when Check_Elab_Calls is called. N, E and Orig_Ent are as for the call - -- to Check_Internal_Call. Outer_Scope is the outer level scope for - -- the original call. + -- phase makes an entry in the Delay_Check table, which is processed when + -- Check_Elab_Calls is called. N, E and Orig_Ent are as for the call to + -- Check_Internal_Call. Outer_Scope is the outer level scope for the + -- original call. procedure Set_Elaboration_Constraint (Call : Node_Id; @@ -268,16 +266,16 @@ package body Sem_Elab is -- inevitable, given the optional body semantics of Ada). procedure Insert_Elab_Check (N : Node_Id; C : Node_Id := Empty); - -- Given code for an elaboration check (or unconditional raise if - -- the check is not needed), inserts the code in the appropriate - -- place. N is the call or instantiation node for which the check - -- code is required. C is the test whose failure triggers the raise. + -- Given code for an elaboration check (or unconditional raise if the check + -- is not needed), inserts the code in the appropriate place. N is the call + -- or instantiation node for which the check code is required. C is the + -- test whose failure triggers the raise. procedure Output_Calls (N : Node_Id); - -- Outputs chain of calls stored in the Elab_Call table. The caller - -- has already generated the main warning message, so the warnings - -- generated are all continuation messages. The argument is the - -- call node at which the messages are to be placed. + -- Outputs chain of calls stored in the Elab_Call table. The caller has + -- already generated the main warning message, so the warnings generated + -- are all continuation messages. The argument is the call node at which + -- the messages are to be placed. function Same_Elaboration_Scope (Scop1, Scop2 : Entity_Id) return Boolean; -- Given two scopes, determine whether they are the same scope from an @@ -288,17 +286,16 @@ package body Sem_Elab is -- to be the enclosing compilation unit of this scope. function Spec_Entity (E : Entity_Id) return Entity_Id; - -- Given a compilation unit entity, if it is a spec entity, it is - -- returned unchanged. If it is a body entity, then the spec for - -- the corresponding spec is returned + -- Given a compilation unit entity, if it is a spec entity, it is returned + -- unchanged. If it is a body entity, then the spec for the corresponding + -- spec is returned procedure Supply_Bodies (N : Node_Id); -- Given a node, N, that is either a subprogram declaration or a package -- declaration, this procedure supplies dummy bodies for the subprogram -- or for all subprograms in the package. If the given node is not one -- of these two possibilities, then Supply_Bodies does nothing. The - -- dummy body is supplied by setting the subprogram to be Imported with - -- convention Stubbed. + -- dummy body contains a single Raise statement. procedure Supply_Bodies (L : List_Id); -- Calls Supply_Bodies for all elements of the given list L @@ -480,11 +477,10 @@ package body Sem_Elab is Decl : Node_Id; E_Scope : Entity_Id; - -- Top level scope of entity for called subprogram. This - -- value includes following renamings and derivations, so - -- this scope can be in a non-visible unit. This is the - -- scope that is to be investigated to see whether an - -- elaboration check is required. + -- Top level scope of entity for called subprogram. This value includes + -- following renamings and derivations, so this scope can be in a + -- non-visible unit. This is the scope that is to be investigated to + -- see whether an elaboration check is required. W_Scope : Entity_Id; -- Top level scope of directly called entity for subprogram. This @@ -495,7 +491,7 @@ package body Sem_Elab is -- calls and calls involving object notation) where W_Scope might not -- be in the context of the current unit, and there is an intermediate -- package that is, in which case the Elaborate_All has to be placed - -- on this intedermediate package. These special cases are handled in + -- on this intermediate package. These special cases are handled in -- Set_Elaboration_Constraint. Body_Acts_As_Spec : Boolean; @@ -531,8 +527,8 @@ package body Sem_Elab is return; end if; - -- Go to parent for derived subprogram, or to original subprogram - -- in the case of a renaming (Alias covers both these cases) + -- Go to parent for derived subprogram, or to original subprogram in the + -- case of a renaming (Alias covers both these cases). Ent := E; loop @@ -646,16 +642,16 @@ package body Sem_Elab is return; end if; - -- Nothing to do for a generic instance, because in this case - -- the checking was at the point of instantiation of the generic - -- However, this shortcut is only applicable in static mode. + -- Nothing to do for a generic instance, because in this case the + -- checking was at the point of instantiation of the generic However, + -- this shortcut is only applicable in static mode. if Is_Generic_Instance (Ent) and not Dynamic_Elaboration_Checks then return; end if; - -- Nothing to do if subprogram with no separate spec. However, - -- a call to Deep_Initialize may result in a call to a user-defined + -- Nothing to do if subprogram with no separate spec. However, a + -- call to Deep_Initialize may result in a call to a user-defined -- Initialize procedure, which imposes a body dependency. This -- happens only if the type is controlled and the Initialize -- procedure is not inherited. @@ -762,8 +758,8 @@ package body Sem_Elab is then E_Scope := Spec_Entity (Cunit_Entity (Unit_Caller)); - -- If we don't get a spec entity, just ignore call. Not - -- quite clear why this check is necessary. + -- If we don't get a spec entity, just ignore call. Not quite + -- clear why this check is necessary. ??? if No (E_Scope) then return; @@ -775,16 +771,15 @@ package body Sem_Elab is E_Scope := Scope (E_Scope); end loop; - -- For the case N is not an instance, or a call within instance - -- We recompute E_Scope for the error message, since we - -- do NOT want to go to the unit which has the ultimate - -- declaration in the case of renaming and derivation and - -- we also want to go to the generic unit in the case of - -- an instance, and no further. + -- For the case N is not an instance, or a call within instance, we + -- recompute E_Scope for the error message, since we do NOT want to + -- go to the unit which has the ultimate declaration in the case of + -- renaming and derivation and we also want to go to the generic unit + -- in the case of an instance, and no further. else - -- Loop to carefully follow renamings and derivations - -- one step outside the current unit, but not further. + -- Loop to carefully follow renamings and derivations one step + -- outside the current unit, but not further. if not Inst_Case and then Present (Alias (Ent)) @@ -879,7 +874,7 @@ package body Sem_Elab is if Inst_Case then Elab_Warning ("instantiation of& may raise Program_Error?", - "instantiation of& during elaboration?", Ent); + "info: instantiation of& during elaboration?", Ent); else if Nkind (Name (N)) in N_Has_Entity @@ -888,13 +883,13 @@ package body Sem_Elab is then Elab_Warning ("implicit call to & may raise Program_Error?", - "implicit call to & during elaboration?", + "info: implicit call to & during elaboration?", Ent); else Elab_Warning ("call to & may raise Program_Error?", - "call to & during elaboration?", + "info: call to & during elaboration?", Ent); end if; end if; @@ -904,12 +899,12 @@ package body Sem_Elab is if Nkind (N) in N_Subprogram_Instantiation then Elab_Warning ("\missing pragma Elaborate for&?", - "\implicit pragma Elaborate for& generated?", + "\info: implicit pragma Elaborate for& generated?", W_Scope); else Elab_Warning ("\missing pragma Elaborate_All for&?", - "\implicit pragma Elaborate_All for & generated?", + "\info: implicit pragma Elaborate_All for & generated?", W_Scope); end if; end Generate_Elab_Warnings; @@ -936,8 +931,8 @@ package body Sem_Elab is -- Runtime elaboration check required. Generate check of the -- elaboration Boolean for the unit containing the entity. - -- Note that for this case, we do check the real unit (the - -- one from following renamings, since that is the issue!) + -- Note that for this case, we do check the real unit (the one + -- from following renamings, since that is the issue!) -- Could this possibly miss a useless but required PE??? @@ -952,10 +947,10 @@ package body Sem_Elab is -- Case of static elaboration model else - -- Do not do anything if elaboration checks suppressed. Note - -- that we check Ent here, not E, since we want the real entity - -- for the body to see if checks are suppressed for it, not the - -- dummy entry for renamings or derivations. + -- Do not do anything if elaboration checks suppressed. Note that + -- we check Ent here, not E, since we want the real entity for the + -- body to see if checks are suppressed for it, not the dummy + -- entry for renamings or derivations. if Elaboration_Checks_Suppressed (Ent) or else Elaboration_Checks_Suppressed (E_Scope) @@ -1111,7 +1106,7 @@ package body Sem_Elab is function Get_Called_Ent return Entity_Id; -- Retrieve called entity. If this is a call to a protected subprogram, -- entity is a selected component. The callable entity may be absent, - -- in which case there is no check to perform. This happens with + -- in which case there is no check to perform. This happens with -- non-analyzed calls in nested generics. -------------------- @@ -1201,8 +1196,8 @@ package body Sem_Elab is -- is at the time of the actual call (statically speaking) that we must -- do our static check, not at the time of its initial analysis). - -- However, we have to check calls within component definitions (e.g., a - -- function call that determines an array component bound), so we + -- However, we have to check calls within component definitions (e.g. + -- a function call that determines an array component bound), so we -- terminate the loop in that case. P := Parent (N); @@ -1229,8 +1224,8 @@ package body Sem_Elab is if No (Outer_Scope) then Elab_Visited.Set_Last (0); - -- Nothing to do if current scope is Standard (this is a bit - -- odd, but it happens in the case of generic instantiations). + -- Nothing to do if current scope is Standard (this is a bit odd, but + -- it happens in the case of generic instantiations). C_Scope := Current_Scope; @@ -1243,9 +1238,8 @@ package body Sem_Elab is From_Elab_Code := not In_Subprogram_Or_Concurrent_Unit; if From_Elab_Code then - -- Complain if call that comes from source in preelaborated - -- unit and we are not inside a subprogram (i.e. we are in - -- elab code) + -- Complain if call that comes from source in preelaborated unit + -- and we are not inside a subprogram (i.e. we are in elab code). if Comes_From_Source (N) and then In_Preelaborated_Unit @@ -1456,9 +1450,9 @@ package body Sem_Elab is -- A call to an Init_Proc in elaboration code may bring additional -- dependencies, if some of the record components thereof have - -- initializations that are function calls that come from source. - -- We treat the current node as a call to each of these functions, - -- to check their elaboration impact. + -- initializations that are function calls that come from source. We + -- treat the current node as a call to each of these functions, to check + -- their elaboration impact. if Is_Init_Proc (Ent) and then From_Elab_Code @@ -1521,9 +1515,9 @@ package body Sem_Elab is Pkg_Body : Entity_Id; begin - -- For record or array component, check prefix. If it is an access - -- type, then there is nothing to do (we do not know what is being - -- assigned), but otherwise this is an assignment to the prefix. + -- For record or array component, check prefix. If it is an access type, + -- then there is nothing to do (we do not know what is being assigned), + -- but otherwise this is an assignment to the prefix. if Nkind (N) = N_Indexed_Component or else @@ -1712,10 +1706,10 @@ package body Sem_Elab is procedure Check_Elab_Calls is begin - -- If expansion is disabled, do not generate any checks. Also - -- skip checks if any subunits are missing because in either - -- case we lack the full information that we need, and no object - -- file will be created in any case. + -- If expansion is disabled, do not generate any checks. Also skip + -- checks if any subunits are missing because in either case we lack the + -- full information that we need, and no object file will be created in + -- any case. if not Expander_Active or else Is_Generic_Unit (Cunit_Entity (Main_Unit)) @@ -1801,7 +1795,7 @@ package body Sem_Elab is -- outer level call. -- It is an outer level instantiation from elaboration code, or the - -- instantiated entity is in the same elaboratoin scope. + -- instantiated entity is in the same elaboration scope. -- And in these cases, we will check both the inter-unit case and -- the intra-unit (within a single unit) case. @@ -1822,11 +1816,11 @@ package body Sem_Elab is Set_C_Scope; Check_A_Call (N, Ent, Scope (Ent), Inter_Unit_Only => False); - -- If none of those cases holds, but Dynamic_Elaboration_Checks mode - -- is set, then we will do the check, but only in the inter-unit case - -- (this is to accommodate unguarded elaboration calls from other units - -- in which this same mode is set). We inhibit warnings in this case, - -- since this instantiation is not occurring in elaboration code. + -- If none of those cases holds, but Dynamic_Elaboration_Checks mode is + -- set, then we will do the check, but only in the inter-unit case (this + -- is to accommodate unguarded elaboration calls from other units in + -- which this same mode is set). We inhibit warnings in this case, since + -- this instantiation is not occurring in elaboration code. elsif Dynamic_Elaboration_Checks then Set_C_Scope; @@ -1882,10 +1876,10 @@ package body Sem_Elab is elsif not Full_Analysis then return; - -- Nothing to do if within a default expression, since the call - -- is not actualy being made at this time. + -- Nothing to do if analyzing in special spec-expression mode, since the + -- call is not actually being made at this time. - elsif In_Default_Expression then + elsif In_Spec_Expression then return; -- Nothing to do for call to intrinsic subprogram @@ -1991,16 +1985,16 @@ package body Sem_Elab is Check_Elab_Instantiation (N, Outer_Scope); return OK; - -- Skip subprogram bodies that come from source (wait for - -- call to analyze these). The reason for the come from - -- source test is to avoid catching task bodies. + -- Skip subprogram bodies that come from source (wait for call to + -- analyze these). The reason for the come from source test is to + -- avoid catching task bodies. - -- For task bodies, we should really avoid these too, waiting - -- for the task activation, but that's too much trouble to - -- catch for now, so we go in unconditionally. This is not - -- so terrible, it means the error backtrace is not quite - -- complete, and we are too eager to scan bodies of tasks - -- that are unused, but this is hardly very significant! + -- For task bodies, we should really avoid these too, waiting for the + -- task activation, but that's too much trouble to catch for now, so + -- we go in unconditionally. This is not so terrible, it means the + -- error backtrace is not quite complete, and we are too eager to + -- scan bodies of tasks that are unused, but this is hardly very + -- significant! elsif Nkind (N) = N_Subprogram_Body and then Comes_From_Source (N) @@ -2051,8 +2045,8 @@ package body Sem_Elab is end if; end if; - -- If the body appears after the outer level call or - -- instantiation then we have an error case handled below. + -- If the body appears after the outer level call or instantiation then + -- we have an error case handled below. if Earlier_In_Extended_Unit (Outer_Level_Sloc, Sloc (Sbody)) and then not In_Task_Activation @@ -2065,8 +2059,8 @@ package body Sem_Elab is elsif Inst_Case then return; - -- Otherwise we have a call, so we trace through the called - -- body to see if it has any problems .. + -- Otherwise we have a call, so we trace through the called body to see + -- if it has any problems. else pragma Assert (Nkind (Sbody) = N_Subprogram_Body); @@ -2083,9 +2077,9 @@ package body Sem_Elab is Write_Eol; end if; - -- Now traverse declarations and statements of subprogram body. - -- Note that we cannot simply Traverse (Sbody), since traverse - -- does not normally visit subprogram bodies. + -- Now traverse declarations and statements of subprogram body. Note + -- that we cannot simply Traverse (Sbody), since traverse does not + -- normally visit subprogram bodies. declare Decl : Node_Id; @@ -2103,11 +2097,11 @@ package body Sem_Elab is return; end if; - -- Here is the case of calling a subprogram where the body has - -- not yet been encountered, a warning message is needed. + -- Here is the case of calling a subprogram where the body has not yet + -- been encountered, a warning message is needed. - -- If we have nothing in the call stack, then this is at the - -- outer level, and the ABE is bound to occur. + -- If we have nothing in the call stack, then this is at the outer + -- level, and the ABE is bound to occur. if Elab_Call.Last = 0 then if Inst_Case then @@ -2414,7 +2408,7 @@ package body Sem_Elab is and then not Restriction_Active (No_Entry_Calls_In_Elaboration_Code) then - -- Runtime elaboration check required. generate check of the + -- Runtime elaboration check required. Generate check of the -- elaboration Boolean for the unit containing the entity. Insert_Elab_Check (N, @@ -2477,8 +2471,8 @@ package body Sem_Elab is and then Present (Parameter_Associations (Call)) and then Is_Controlled (Etype (First_Actual (Call))); begin - -- If the unit is mentioned in a with_clause of the current - -- unit, it is visible, and we can set the elaboration flag. + -- If the unit is mentioned in a with_clause of the current unit, it is + -- visible, and we can set the elaboration flag. if Is_Immediately_Visible (Scop) or else (Is_Child_Unit (Scop) and then Is_Visible_Child_Unit (Scop)) @@ -2505,9 +2499,9 @@ package body Sem_Elab is return; end if; - -- If the unit is not in the context, there must be an intermediate - -- unit that is, on which we need to place to elaboration flag. This - -- happens with init proc calls. + -- If the unit is not in the context, there must be an intermediate unit + -- that is, on which we need to place to elaboration flag. This happens + -- with init proc calls. if Is_Init_Proc (Subp) or else Init_Call @@ -2561,30 +2555,29 @@ package body Sem_Elab is function Find_Body_In (E : Entity_Id; N : Node_Id) return Node_Id; -- Determine if the list of nodes headed by N and linked by Next - -- contains a package body for the package spec entity E, and if - -- so return the package body. If not, then returns Empty. + -- contains a package body for the package spec entity E, and if so + -- return the package body. If not, then returns Empty. function Load_Package_Body (Nam : Unit_Name_Type) return Node_Id; -- This procedure is called load the unit whose name is given by Nam. -- This unit is being loaded to see whether it contains an optional - -- generic body. The returned value is the loaded unit, which is - -- always a package body (only package bodies can contain other - -- entities in the sense in which Has_Generic_Body is interested). - -- We only attempt to load bodies if we are generating code. If we - -- are in semantics check only mode, then it would be wrong to load - -- bodies that are not required from a semantic point of view, so - -- in this case we return Empty. The result is that the caller may - -- incorrectly decide that a generic spec does not have a body when - -- in fact it does, but the only harm in this is that some warnings - -- on elaboration problems may be lost in semantic checks only mode, - -- which is not big loss. We also return Empty if we go for a body - -- and it is not there. + -- generic body. The returned value is the loaded unit, which is always + -- a package body (only package bodies can contain other entities in the + -- sense in which Has_Generic_Body is interested). We only attempt to + -- load bodies if we are generating code. If we are in semantics check + -- only mode, then it would be wrong to load bodies that are not + -- required from a semantic point of view, so in this case we return + -- Empty. The result is that the caller may incorrectly decide that a + -- generic spec does not have a body when in fact it does, but the only + -- harm in this is that some warnings on elaboration problems may be + -- lost in semantic checks only mode, which is not big loss. We also + -- return Empty if we go for a body and it is not there. function Locate_Corresponding_Body (PE : Entity_Id) return Node_Id; -- PE is the entity for a package spec. This function locates the - -- corresponding package body, returning Empty if none is found. - -- The package body returned is fully parsed but may not yet be - -- analyzed, so only syntactic fields should be referenced. + -- corresponding package body, returning Empty if none is found. The + -- package body returned is fully parsed but may not yet be analyzed, + -- so only syntactic fields should be referenced. ------------------ -- Find_Body_In -- @@ -2666,17 +2659,17 @@ package body Sem_Elab is begin if Is_Library_Level_Entity (PE) then - -- If package is a library unit that requires a body, we have - -- no choice but to go after that body because it might contain - -- an optional body for the original generic package. + -- If package is a library unit that requires a body, we have no + -- choice but to go after that body because it might contain an + -- optional body for the original generic package. if Unit_Requires_Body (PE) then - -- Load the body. Note that we are a little careful here to - -- use Spec to get the unit number, rather than PE or Decl, - -- since in the case where the package is itself a library - -- level instantiation, Spec will properly reference the - -- generic template, which is what we really want. + -- Load the body. Note that we are a little careful here to use + -- Spec to get the unit number, rather than PE or Decl, since + -- in the case where the package is itself a library level + -- instantiation, Spec will properly reference the generic + -- template, which is what we really want. return Load_Package_Body @@ -3041,8 +3034,55 @@ package body Sem_Elab is declare Ent : constant Entity_Id := Defining_Unit_Name (Specification (N)); begin - Set_Is_Imported (Ent); - Set_Convention (Ent, Convention_Stubbed); + + -- Internal subprograms will already have a generated body, so + -- there is no need to provide a stub for them. + + if No (Corresponding_Body (N)) then + declare + Loc : constant Source_Ptr := Sloc (N); + B : Node_Id; + Formals : constant List_Id := + Copy_Parameter_List (Ent); + Nam : constant Entity_Id := + Make_Defining_Identifier (Loc, Chars (Ent)); + Spec : Node_Id; + Stats : constant List_Id := + New_List + (Make_Raise_Program_Error (Loc, + Reason => PE_Access_Before_Elaboration)); + begin + if Ekind (Ent) = E_Function then + Spec := + Make_Function_Specification (Loc, + Defining_Unit_Name => Nam, + Parameter_Specifications => Formals, + Result_Definition => + New_Copy_Tree + (Result_Definition (Specification (N)))); + + -- We cannot reliably make a return statement for this + -- body, but none is needed because the call raises + -- program error. + + Set_Return_Present (Ent); + + else + Spec := + Make_Procedure_Specification (Loc, + Defining_Unit_Name => Nam, + Parameter_Specifications => Formals); + end if; + + B := Make_Subprogram_Body (Loc, + Specification => Spec, + Declarations => New_List, + Handled_Statement_Sequence => + Make_Handled_Sequence_Of_Statements (Loc, Stats)); + Insert_After (N, B); + Analyze (B); + end; + end if; end; elsif Nkind (N) = N_Package_Declaration then @@ -3075,22 +3115,17 @@ package body Sem_Elab is function Within (E1, E2 : Entity_Id) return Boolean is Scop : Entity_Id; - begin Scop := E1; loop if Scop = E2 then return True; - elsif Scop = Standard_Standard then return False; - else Scop := Scope (Scop); end if; end loop; - - raise Program_Error; end Within; -------------------------- diff --git a/gcc/ada/sem_elab.ads b/gcc/ada/sem_elab.ads index f6529b8241e..7b85b6f886f 100644 --- a/gcc/ada/sem_elab.ads +++ b/gcc/ada/sem_elab.ads @@ -6,7 +6,7 @@ -- -- -- S p e c -- -- -- --- Copyright (C) 1997-2007, Free Software Foundation, Inc. -- +-- Copyright (C) 1997-2008, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -85,7 +85,7 @@ package Sem_Elab is -- Note on pragma Elaborate. The checking here assumes that a pragma -- Elaborate on a with'ed unit guarantees that subprograms within the -- unit can be called without causing an ABE. This is not in fact the - -- case since pragma Elaborate does not guarantee the transititive + -- case since pragma Elaborate does not guarantee the transitive -- coverage guaranteed by Elaborate_All. However, we leave this issue -- up to the binder, which has generates warnings if there are possible -- problems in the use of pragma Elaborate. diff --git a/gcc/ada/sem_elim.ads b/gcc/ada/sem_elim.ads index dfcad41b3d5..ee9f8a10d4c 100644 --- a/gcc/ada/sem_elim.ads +++ b/gcc/ada/sem_elim.ads @@ -6,7 +6,7 @@ -- -- -- S p e c -- -- -- --- Copyright (C) 1997-2007, Free Software Foundation, Inc. -- +-- Copyright (C) 1997-2008, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -30,7 +30,7 @@ with Types; use Types; package Sem_Elim is procedure Initialize; - -- Initialize for new main souce program + -- Initialize for new main source program procedure Process_Eliminate_Pragma (Pragma_Node : Node_Id; @@ -53,7 +53,7 @@ package Sem_Elim is -- flag on the given entity. procedure Eliminate_Error_Msg (N : Node_Id; E : Entity_Id); - -- Called by the back end on encouterning a call to an eliminated + -- Called by the back end on encountering a call to an eliminated -- subprogram. N is the node for the call, and E is the entity of -- the subprogram being eliminated. diff --git a/gcc/ada/sem_eval.adb b/gcc/ada/sem_eval.adb index d7acaa7d884..9801df625e5 100644 --- a/gcc/ada/sem_eval.adb +++ b/gcc/ada/sem_eval.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 1992-2007, Free Software Foundation, Inc. -- +-- Copyright (C) 1992-2008, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -57,7 +57,7 @@ package body Sem_Eval is ----------------------------------------- -- The compile time evaluation of expressions is distributed over several - -- Eval_xxx procedures. These procedures are called immediatedly after + -- Eval_xxx procedures. These procedures are called immediately after -- a subexpression is resolved and is therefore accomplished in a bottom -- up fashion. The flags are synthesized using the following approach. @@ -578,9 +578,7 @@ package body Sem_Eval is if Nkind (Lf) = N_Identifier and then Nkind (Rf) = N_Identifier and then Entity (Lf) = Entity (Rf) and then not Is_Floating_Point_Type (Etype (L)) - and then (Ekind (Entity (Lf)) = E_Constant or else - Ekind (Entity (Lf)) = E_In_Parameter or else - Ekind (Entity (Lf)) = E_Loop_Parameter) + and then Is_Constant_Object (Entity (Lf)) then return True; @@ -1432,9 +1430,7 @@ package body Sem_Eval is Test_Expression_Is_Foldable (N, Left, Right, Stat, Fold); - if (C_Typ = Standard_Character - or else C_Typ = Standard_Wide_Character - or else C_Typ = Standard_Wide_Wide_Character) + if Is_Standard_Character_Type (C_Typ) and then Fold then null; @@ -2269,14 +2265,13 @@ package body Sem_Eval is Fold : Boolean; begin - -- One special case to deal with first. If we can tell that - -- the result will be false because the lengths of one or - -- more index subtypes are compile time known and different, - -- then we can replace the entire result by False. We only - -- do this for one dimensional arrays, because the case of - -- multi-dimensional arrays is rare and too much trouble! - -- If one of the operands is an illegal aggregate, its type - -- might still be an arbitrary composite type, so nothing to do. + -- One special case to deal with first. If we can tell that the result + -- will be false because the lengths of one or more index subtypes are + -- compile time known and different, then we can replace the entire + -- result by False. We only do this for one dimensional arrays, because + -- the case of multi-dimensional arrays is rare and too much trouble! If + -- one of the operands is an illegal aggregate, its type might still be + -- an arbitrary composite type, so nothing to do. if Is_Array_Type (Typ) and then Typ /= Any_Composite @@ -2289,7 +2284,9 @@ package body Sem_Eval is return; end if; - declare + -- OK, we have the case where we may be able to do this fold + + Length_Mismatch : declare procedure Get_Static_Length (Op : Node_Id; Len : out Uint); -- If Op is an expression for a constrained array with a known -- at compile time length, then Len is set to this (non-negative @@ -2303,33 +2300,145 @@ package body Sem_Eval is T : Entity_Id; begin + -- First easy case string literal + if Nkind (Op) = N_String_Literal then Len := UI_From_Int (String_Length (Strval (Op))); + return; + end if; + + -- Second easy case, not constrained subtype, so no length - elsif not Is_Constrained (Etype (Op)) then + if not Is_Constrained (Etype (Op)) then Len := Uint_Minus_1; + return; + end if; - else - T := Etype (First_Index (Etype (Op))); + -- General case - if Is_Discrete_Type (T) - and then - Compile_Time_Known_Value (Type_Low_Bound (T)) - and then - Compile_Time_Known_Value (Type_High_Bound (T)) + T := Etype (First_Index (Etype (Op))); + + -- The simple case, both bounds are known at compile time + + if Is_Discrete_Type (T) + and then + Compile_Time_Known_Value (Type_Low_Bound (T)) + and then + Compile_Time_Known_Value (Type_High_Bound (T)) + then + Len := UI_Max (Uint_0, + Expr_Value (Type_High_Bound (T)) - + Expr_Value (Type_Low_Bound (T)) + 1); + return; + end if; + + -- A more complex case, where the bounds are of the form + -- X [+/- K1] .. X [+/- K2]), where X is an expression that is + -- either A'First or A'Last (with A an entity name), or X is an + -- entity name, and the two X's are the same and K1 and K2 are + -- known at compile time, in this case, the length can also be + -- computed at compile time, even though the bounds are not + -- known. A common case of this is e.g. (X'First..X'First+5). + + Extract_Length : declare + procedure Decompose_Expr + (Expr : Node_Id; + Ent : out Entity_Id; + Kind : out Character; + Cons : out Uint); + -- Given an expression, see if is of the form above, + -- X [+/- K]. If so Ent is set to the entity in X, + -- Kind is 'F','L','E' for 'First/'Last/simple entity, + -- and Cons is the value of K. If the expression is + -- not of the required form, Ent is set to Empty. + + -------------------- + -- Decompose_Expr -- + -------------------- + + procedure Decompose_Expr + (Expr : Node_Id; + Ent : out Entity_Id; + Kind : out Character; + Cons : out Uint) + is + Exp : Node_Id; + + begin + if Nkind (Expr) = N_Op_Add + and then Compile_Time_Known_Value (Right_Opnd (Expr)) + then + Exp := Left_Opnd (Expr); + Cons := Expr_Value (Right_Opnd (Expr)); + + elsif Nkind (Expr) = N_Op_Subtract + and then Compile_Time_Known_Value (Right_Opnd (Expr)) + then + Exp := Left_Opnd (Expr); + Cons := -Expr_Value (Right_Opnd (Expr)); + + else + Exp := Expr; + Cons := Uint_0; + end if; + + -- At this stage Exp is set to the potential X + + if Nkind (Exp) = N_Attribute_Reference then + if Attribute_Name (Exp) = Name_First then + Kind := 'F'; + elsif Attribute_Name (Exp) = Name_Last then + Kind := 'L'; + else + Ent := Empty; + return; + end if; + + Exp := Prefix (Exp); + + else + Kind := 'E'; + end if; + + if Is_Entity_Name (Exp) + and then Present (Entity (Exp)) + then + Ent := Entity (Exp); + else + Ent := Empty; + end if; + end Decompose_Expr; + + -- Local Variables + + Ent1, Ent2 : Entity_Id; + Kind1, Kind2 : Character; + Cons1, Cons2 : Uint; + + -- Start of processing for Extract_Length + + begin + Decompose_Expr (Type_Low_Bound (T), Ent1, Kind1, Cons1); + Decompose_Expr (Type_High_Bound (T), Ent2, Kind2, Cons2); + + if Present (Ent1) + and then Kind1 = Kind2 + and then Ent1 = Ent2 then - Len := UI_Max (Uint_0, - Expr_Value (Type_High_Bound (T)) - - Expr_Value (Type_Low_Bound (T)) + 1); + Len := Cons2 - Cons1 + 1; else Len := Uint_Minus_1; end if; - end if; + end Extract_Length; end Get_Static_Length; + -- Local Variables + Len_L : Uint; Len_R : Uint; + -- Start of processing for Length_Mismatch + begin Get_Static_Length (Left, Len_L); Get_Static_Length (Right, Len_R); @@ -2342,12 +2451,13 @@ package body Sem_Eval is Warn_On_Known_Condition (N); return; end if; - end; + end Length_Mismatch; + end if; -- Another special case: comparisons of access types, where one or both -- operands are known to be null, so the result can be determined. - elsif Is_Access_Type (Typ) then + if Is_Access_Type (Typ) then if Known_Null (Left) then if Known_Null (Right) then Fold_Uint (N, Test (Nkind (N) = N_Op_Eq), False); @@ -3117,7 +3227,7 @@ package body Sem_Eval is return Ureal_0; end if; - -- If we fall through, we have a node that cannot be interepreted + -- If we fall through, we have a node that cannot be interpreted -- as a compile time constant. That is definitely an error. raise Program_Error; @@ -3197,7 +3307,7 @@ package body Sem_Eval is Typ := Full_View (Typ); end if; - -- For a result of type integer, subsitute an N_Integer_Literal node + -- For a result of type integer, substitute an N_Integer_Literal node -- for the result of the compile time evaluation of the expression. if Is_Integer_Type (Typ) then @@ -3387,7 +3497,7 @@ package body Sem_Eval is end if; -- If any exception occurs, it means that we have some bug in the compiler - -- possibly triggered by a previous error, or by some unforseen peculiar + -- possibly triggered by a previous error, or by some unforeseen peculiar -- occurrence. However, this is only an optimization attempt, so there is -- really no point in crashing the compiler. Instead we just decide, too -- bad, we can't figure out the answer in this case after all. @@ -3987,7 +4097,7 @@ package body Sem_Eval is -- To understand the requirement for this test, see RM 4.9.1(1). -- As is made clear in RM 3.5.4(11), type Integer, for example -- is a constrained subtype with constraint bounds matching the - -- bounds of its corresponding uncontrained base type. In this + -- bounds of its corresponding unconstrained base type. In this -- situation, Integer and Integer'Base do not statically match, -- even though they have the same bounds. diff --git a/gcc/ada/sem_eval.ads b/gcc/ada/sem_eval.ads index bb6348b3c22..f0dcd522b15 100644 --- a/gcc/ada/sem_eval.ads +++ b/gcc/ada/sem_eval.ads @@ -6,7 +6,7 @@ -- -- -- S p e c -- -- -- --- Copyright (C) 1992-2007, Free Software Foundation, Inc. -- +-- Copyright (C) 1992-2008, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -56,7 +56,7 @@ package Sem_Eval is -- Raises_Constraint_Error - -- This flag indicatest that it is known at compile time that the + -- This flag indicates that it is known at compile time that the -- evaluation of an expression raises constraint error. If the -- expression is static, and this flag is off, then it is also known at -- compile time that the expression does not raise constraint error @@ -159,7 +159,7 @@ package Sem_Eval is -- An OK static expression is one that is static in the RM definition sense -- and which does not raise constraint error. For most legality checking -- purposes you should use Is_Static_Expression. For those legality checks - -- where the expression N should not raise constaint error use this + -- where the expression N should not raise constraint error use this -- routine. This routine is *not* to be used in contexts where the test is -- for compile time evaluation purposes. Use Compile_Time_Known_Value -- instead (see section on "Compile-Time Known Values" above). @@ -328,7 +328,7 @@ package Sem_Eval is Int_Real : Boolean := False) return Boolean; -- Returns True if it can be guaranteed at compile time that expression is -- known to be in range of the subtype Typ. If the values of N or of either - -- bouds of Type are unknown at compile time, False will always be + -- bounds of Type are unknown at compile time, False will always be -- returned. A result of False does not mean that the expression is out of -- range, merely that it cannot be determined at compile time that it is in -- range. If Typ is a floating point type or Int_Real is set, any integer @@ -339,8 +339,8 @@ package Sem_Eval is -- is True then any fixed-point value is treated as though it was discrete -- value (i.e. the underlying integer value is used). In this case we use -- the corresponding integer value, both for the bounds of Typ, and for the - -- value of the expression N. If Typ is a discret type and Fixed_Int as - -- well as Int_Real are false, intere values are used throughout. + -- value of the expression N. If Typ is a discrete type and Fixed_Int as + -- well as Int_Real are false, integer values are used throughout. function Is_Out_Of_Range (N : Node_Id; diff --git a/gcc/ada/sem_intr.adb b/gcc/ada/sem_intr.adb index 42d78baf7b1..9d7319759b3 100644 --- a/gcc/ada/sem_intr.adb +++ b/gcc/ada/sem_intr.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 1992-2007, Free Software Foundation, Inc. -- +-- Copyright (C) 1992-2008, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -132,7 +132,7 @@ package body Sem_Intr is end if; -- Check for the case of freeing a non-null object which will raise - -- Constaint_Error. Issue warning here, do the expansion in Exp_Intr. + -- Constraint_Error. Issue warning here, do the expansion in Exp_Intr. elsif Cnam = Name_Free and then Can_Never_Be_Null (Etype (Arg1)) @@ -158,7 +158,7 @@ package body Sem_Intr is T2 : Entity_Id; begin - -- Aritnmetic operators + -- Arithmetic operators if Nam = Name_Op_Add or else @@ -304,7 +304,7 @@ package body Sem_Intr is Errint ("unrecognized intrinsic subprogram", E, N); -- We always allow intrinsic specifications in language defined units - -- and in expanded code. We assume that the GNAT implemetors know what + -- and in expanded code. We assume that the GNAT implementors know what -- they are doing, and do not write or generate junk use of intrinsic! elsif not Comes_From_Source (E) diff --git a/gcc/ada/sem_mech.adb b/gcc/ada/sem_mech.adb index 62f9af85b75..177a39ca671 100644 --- a/gcc/ada/sem_mech.adb +++ b/gcc/ada/sem_mech.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 1996-2007, Free Software Foundation, Inc. -- +-- Copyright (C) 1996-2008, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -183,7 +183,7 @@ package body Sem_Mech is is begin -- Right now we only do some checks for functions returning arguments - -- by desctiptor. Probably mode checks need to be added here ??? + -- by descriptor. Probably mode checks need to be added here ??? if Mech in Descriptor_Codes and then not Is_Formal (Ent) then if Is_Record_Type (Etype (Ent)) then @@ -207,7 +207,7 @@ package body Sem_Mech is begin -- Skip this processing if inside a generic template. Not only is - -- it uneccessary (since neither extra formals nor mechanisms are + -- it unnecessary (since neither extra formals nor mechanisms are -- relevant for the template itself), but at least at the moment, -- procedures get frozen early inside a template so attempting to -- look at the formal types does not work too well if they are @@ -241,7 +241,7 @@ package body Sem_Mech is --------- -- Note: all RM defined conventions are treated the same - -- from the point of view of parameter passing mechanims + -- from the point of view of parameter passing mechanism when Convention_Ada | Convention_Intrinsic | diff --git a/gcc/ada/sem_mech.ads b/gcc/ada/sem_mech.ads index 27edf2219cf..1673a671b0e 100644 --- a/gcc/ada/sem_mech.ads +++ b/gcc/ada/sem_mech.ads @@ -6,7 +6,7 @@ -- -- -- S p e c -- -- -- --- Copyright (C) 1996-2007, Free Software Foundation, Inc. -- +-- Copyright (C) 1996-2008, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -144,7 +144,7 @@ package Sem_Mech is -- this call is to set mechanism values for formals and for the -- function return if they have not already been explicitly set by -- a use of an extended Import or Export pragma. The idea is to set - -- mechanism values whereever the semantics is dictated by either + -- mechanism values wherever the semantics is dictated by either -- requirements or implementation advice in the RM, and to leave -- the mechanism set to Default if there is no requirement, so that -- the back-end is free to choose the most efficient method. diff --git a/gcc/ada/sem_prag.adb b/gcc/ada/sem_prag.adb index 251805ddf8e..c238367ba83 100644 --- a/gcc/ada/sem_prag.adb +++ b/gcc/ada/sem_prag.adb @@ -40,7 +40,6 @@ with Exp_Dist; use Exp_Dist; with Lib; use Lib; with Lib.Writ; use Lib.Writ; with Lib.Xref; use Lib.Xref; -with Namet; use Namet; with Namet.Sp; use Namet.Sp; with Nlists; use Nlists; with Nmake; use Nmake; @@ -50,7 +49,9 @@ with Restrict; use Restrict; with Rident; use Rident; with Rtsfind; use Rtsfind; with Sem; use Sem; +with Sem_Aux; use Sem_Aux; with Sem_Ch3; use Sem_Ch3; +with Sem_Ch6; use Sem_Ch6; with Sem_Ch8; use Sem_Ch8; with Sem_Ch13; use Sem_Ch13; with Sem_Dist; use Sem_Dist; @@ -173,6 +174,14 @@ package body Sem_Prag is -- (the original one, following the renaming chain) is returned. -- Otherwise the entity is returned unchanged. Should be in Einfo??? + function Get_Pragma_Arg (Arg : Node_Id) return Node_Id; + -- All the routines that check pragma arguments take either a pragma + -- argument association (in which case the expression of the argument + -- association is checked), or the expression directly. The function + -- Get_Pragma_Arg is a utility used to deal with these two cases. If Arg + -- is a pragma argument association node, then its expression is returned, + -- otherwise Arg is returned unchanged. + procedure rv; -- This is a dummy function called by the processing for pragma Reviewable. -- It is there for assisting front end debugging. By placing a Reviewable @@ -230,6 +239,41 @@ package body Sem_Prag is end if; end Adjust_External_Name_Case; + ------------------------------ + -- Analyze_PPC_In_Decl_Part -- + ------------------------------ + + procedure Analyze_PPC_In_Decl_Part (N : Node_Id; S : Entity_Id) is + Arg1 : constant Node_Id := + First (Pragma_Argument_Associations (N)); + Arg2 : constant Node_Id := Next (Arg1); + + begin + -- Install formals and push subprogram spec onto scope stack + -- so that we can see the formals from the pragma. + + Install_Formals (S); + Push_Scope (S); + + -- Preanalyze the boolean expression, we treat this as a + -- spec expression (i.e. similar to a default expression). + + Preanalyze_Spec_Expression + (Get_Pragma_Arg (Arg1), Standard_Boolean); + + -- If there is a message argument, analyze it the same way + + if Present (Arg2) then + Preanalyze_Spec_Expression + (Get_Pragma_Arg (Arg2), Standard_String); + end if; + + -- Remove the subprogram from the scope stack now that the + -- pre-analysis of the precondition/postcondition is done. + + End_Scope; + end Analyze_PPC_In_Decl_Part; + -------------------- -- Analyze_Pragma -- -------------------- @@ -312,6 +356,7 @@ package body Sem_Prag is procedure Check_Arg_Is_One_Of (Arg : Node_Id; N1, N2 : Name_Id); procedure Check_Arg_Is_One_Of (Arg : Node_Id; N1, N2, N3 : Name_Id); + procedure Check_Arg_Is_One_Of (Arg : Node_Id; N1, N2, N3, N4 : Name_Id); -- Check the specified argument Arg to make sure that it is an -- identifier whose name matches either N1 or N2 (or N3 if present). -- If not then give error and raise Pragma_Exit. @@ -364,7 +409,7 @@ package body Sem_Prag is procedure Check_In_Main_Program; -- Common checks for pragmas that appear within a main program - -- (Priority, Main_Storage, Time_Slice). + -- (Priority, Main_Storage, Time_Slice, Relative_Deadline). procedure Check_Interrupt_Or_Attach_Handler; -- Common processing for first argument of pragma Interrupt_Handler @@ -397,6 +442,30 @@ package body Sem_Prag is -- In this version of the procedure, the identifier name is given as -- a string with lower case letters. + procedure Check_Precondition_Postcondition (In_Body : out Boolean); + -- Called to process a precondition or postcondition pragma. There are + -- three cases: + -- + -- The pragma appears after a subprogram spec + -- + -- If the corresponding check is not enabled, the pragma is analyzed + -- but otherwise ignored and control returns with In_Body set False. + -- + -- If the check is enabled, then the first step is to analyze the + -- pragma, but this is skipped if the subprogram spec appears within + -- a package specification (because this is the case where we delay + -- analysis till the end of the spec). Then (whether or not it was + -- analyzed), the pragma is chained to the subprogram in question + -- (using Spec_PPC_List and Next_Pragma) and control returns to the + -- caller with In_Body set False. + -- + -- The pragma appears at the start of subprogram body declarations + -- + -- In this case an immediate return to the caller is made with + -- In_Body set True, and the pragma is NOT analyzed. + -- + -- In all other cases, an error message for bad placement is given + procedure Check_Static_Constraint (Constr : Node_Id); -- Constr is a constraint from an N_Subtype_Indication node from a -- component constraint in an Unchecked_Union type. This routine checks @@ -452,6 +521,13 @@ package body Sem_Prag is -- reference the identifier. After placing the message, Pragma_Exit -- is raised. + procedure Error_Pragma_Ref (Msg : String; Ref : Entity_Id); + pragma No_Return (Error_Pragma_Ref); + -- Outputs error message for current pragma. The message may contain + -- a % that will be replaced with the pragma name. The parameter Ref + -- must be an entity whose name can be referenced by & and sloc by #. + -- After placing the message, Pragma_Exit is raised. + function Find_Lib_Unit_Name return Entity_Id; -- Used for a library unit pragma to find the entity to which the -- library unit pragma applies, returns the entity found. @@ -484,14 +560,6 @@ package body Sem_Prag is -- optional identifiers when it returns). An entry in Args is Empty -- on return if the corresponding argument is not present. - function Get_Pragma_Arg (Arg : Node_Id) return Node_Id; - -- All the routines that check pragma arguments take either a pragma - -- argument association (in which case the expression of the argument - -- association is checked), or the expression directly. The function - -- Get_Pragma_Arg is a utility used to deal with these two cases. If - -- Arg is a pragma argument association node, then its expression is - -- returned, otherwise Arg is returned unchanged. - procedure GNAT_Pragma; -- Called for all GNAT defined pragmas to check the relevant restriction -- (No_Implementation_Pragmas). @@ -503,7 +571,7 @@ package body Sem_Prag is -- Decls where Decls is the list of declarative items. function Is_Configuration_Pragma return Boolean; - -- Deterermines if the placement of the current pragma is appropriate + -- Determines if the placement of the current pragma is appropriate -- for a configuration pragma. function Is_In_Context_Clause return Boolean; @@ -526,7 +594,7 @@ package body Sem_Prag is -- Common processing for Compile_Time_Error and Compile_Time_Warning procedure Process_Convention (C : out Convention_Id; E : out Entity_Id); - -- Common procesing for Convention, Interface, Import and Export. + -- Common processing for Convention, Interface, Import and Export. -- Checks first two arguments of pragma, and sets the appropriate -- convention value in the specified entity or entities. On return -- C is the convention, E is the referenced entity. @@ -545,7 +613,7 @@ package body Sem_Prag is (Arg_Internal : Node_Id; Arg_External : Node_Id; Arg_Size : Node_Id); - -- Common processing for the pragmass Import/Export_Object. + -- Common processing for the pragmas Import/Export_Object. -- The three arguments correspond to the three named parameters -- of the pragmas. An argument is empty if the corresponding -- parameter is not present in the pragma. @@ -568,7 +636,7 @@ package body Sem_Prag is Arg_First_Optional_Parameter : Node_Id := Empty); -- Common processing for all extended Import and Export pragmas -- applying to subprograms. The caller omits any arguments that do - -- bnot apply to the pragma in question (for example, Arg_Result_Type + -- not apply to the pragma in question (for example, Arg_Result_Type -- can be non-Empty only in the Import_Function and Export_Function -- cases). The argument names correspond to the allowed pragma -- association identifiers. @@ -856,6 +924,24 @@ package body Sem_Prag is end if; end Check_Arg_Is_One_Of; + procedure Check_Arg_Is_One_Of + (Arg : Node_Id; + N1, N2, N3, N4 : Name_Id) + is + Argx : constant Node_Id := Get_Pragma_Arg (Arg); + + begin + Check_Arg_Is_Identifier (Argx); + + if Chars (Argx) /= N1 + and then Chars (Argx) /= N2 + and then Chars (Argx) /= N3 + and then Chars (Argx) /= N4 + then + Error_Pragma_Arg ("invalid argument for pragma%", Argx); + end if; + end Check_Arg_Is_One_Of; + --------------------------------- -- Check_Arg_Is_Queuing_Policy -- --------------------------------- @@ -1256,6 +1342,91 @@ package body Sem_Prag is Check_Optional_Identifier (Arg, Name_Find); end Check_Optional_Identifier; + -------------------------------------- + -- Check_Precondition_Postcondition -- + -------------------------------------- + + procedure Check_Precondition_Postcondition (In_Body : out Boolean) is + P : Node_Id; + S : Entity_Id; + PO : Node_Id; + + begin + if not Is_List_Member (N) then + Pragma_Misplaced; + end if; + + -- Record whether pragma is enabled + + Set_PPC_Enabled (N, Check_Enabled (Pname)); + + -- Search prior declarations + + P := N; + while Present (Prev (P)) loop + P := Prev (P); + PO := Original_Node (P); + + -- Skip past prior pragma + + if Nkind (PO) = N_Pragma then + null; + + -- Skip stuff not coming from source + + elsif not Comes_From_Source (PO) then + null; + + -- Here if we hit a subprogram declaration + + elsif Nkind (PO) = N_Subprogram_Declaration then + S := Defining_Unit_Name (Specification (PO)); + + -- Analyze the pragma unless it appears within a package spec, + -- which is the case where we delay the analysis of the PPC + -- until the end of the package declarations (for details, + -- see Analyze_Package_Specification.Analyze_PPCs). + + if Ekind (Scope (S)) /= E_Package + and then + Ekind (Scope (S)) /= E_Generic_Package + then + Analyze_PPC_In_Decl_Part (N, S); + end if; + + -- Chain spec PPC pragma to list for subprogram + + Set_Next_Pragma (N, Spec_PPC_List (S)); + Set_Spec_PPC_List (S, N); + + -- Return indicating spec case + + In_Body := False; + return; + + -- If we encounter any other declaration moving back, misplaced + + else + Pragma_Misplaced; + end if; + end loop; + + -- If we fall through loop, pragma is at start of list, so see if + -- it is at the start of declarations of a subprogram body. + + if Nkind (Parent (N)) = N_Subprogram_Body + and then List_Containing (N) = Declarations (Parent (N)) + then + In_Body := True; + return; + + -- If not, it was misplaced + + else + Pragma_Misplaced; + end if; + end Check_Precondition_Postcondition; + ----------------------------- -- Check_Static_Constraint -- ----------------------------- @@ -1267,13 +1438,13 @@ package body Sem_Prag is procedure Check_Static_Constraint (Constr : Node_Id) is + procedure Require_Static (E : Node_Id); + -- Require given expression to be static expression + -------------------- -- Require_Static -- -------------------- - procedure Require_Static (E : Node_Id); - -- Require given expression to be static expression - procedure Require_Static (E : Node_Id) is begin if not Is_OK_Static_Expression (E) then @@ -1322,7 +1493,7 @@ package body Sem_Prag is -------------------------------------- -- A configuration pragma must appear in the context clause of a - -- compilation unit, and only other pragmas may preceed it. Note that + -- compilation unit, and only other pragmas may precede it. Note that -- the test also allows use in a configuration pragma file. procedure Check_Valid_Configuration_Pragma is @@ -1536,6 +1707,18 @@ package body Sem_Prag is raise Pragma_Exit; end Error_Pragma_Arg_Ident; + ---------------------- + -- Error_Pragma_Ref -- + ---------------------- + + procedure Error_Pragma_Ref (Msg : String; Ref : Entity_Id) is + begin + Error_Msg_Name_1 := Pname; + Error_Msg_Sloc := Sloc (Ref); + Error_Msg_NE (Msg, N, Ref); + raise Pragma_Exit; + end Error_Pragma_Ref; + ------------------------ -- Find_Lib_Unit_Name -- ------------------------ @@ -1743,19 +1926,6 @@ package body Sem_Prag is end loop; end Gather_Associations; - -------------------- - -- Get_Pragma_Arg -- - -------------------- - - function Get_Pragma_Arg (Arg : Node_Id) return Node_Id is - begin - if Nkind (Arg) = N_Pragma_Argument_Association then - return Expression (Arg); - else - return Arg; - end if; - end Get_Pragma_Arg; - ----------------- -- GNAT_Pragma -- ----------------- @@ -1895,10 +2065,10 @@ package body Sem_Prag is Utyp : Entity_Id; procedure Set_Atomic (E : Entity_Id); - -- Set given type as atomic, and if no explicit alignment was - -- given, set alignment to unknown, since back end knows what - -- the alignment requirements are for atomic arrays. Note that - -- this step is necessary for derived types. + -- Set given type as atomic, and if no explicit alignment was given, + -- set alignment to unknown, since back end knows what the alignment + -- requirements are for atomic arrays. Note: this step is necessary + -- for derived types. ---------------- -- Set_Atomic -- @@ -1946,9 +2116,8 @@ package body Sem_Prag is Set_Atomic (Base_Type (E)); end if; - -- Attribute belongs on the base type. If the - -- view of the type is currently private, it also - -- belongs on the underlying type. + -- Attribute belongs on the base type. If the view of the type is + -- currently private, it also belongs on the underlying type. Set_Is_Volatile (Base_Type (E)); Set_Is_Volatile (Underlying_Type (E)); @@ -1967,10 +2136,9 @@ package body Sem_Prag is if Prag_Id /= Pragma_Volatile then Set_Is_Atomic (E); - -- If the object declaration has an explicit - -- initialization, a temporary may have to be - -- created to hold the expression, to insure - -- that access to the object remain atomic. + -- If the object declaration has an explicit initialization, a + -- temporary may have to be created to hold the expression, to + -- ensure that access to the object remain atomic. if Nkind (Parent (E)) = N_Object_Declaration and then Present (Expression (Parent (E))) @@ -1980,7 +2148,7 @@ package body Sem_Prag is -- An interesting improvement here. If an object of type X -- is declared atomic, and the type X is not atomic, that's - -- a pity, since it may not have appropraite alignment etc. + -- a pity, since it may not have appropriate alignment etc. -- We can rescue this in the special case where the object -- and type are in the same unit by just setting the type -- as atomic, so that the back end will process it as atomic. @@ -2265,6 +2433,10 @@ package body Sem_Prag is if Nkind (Parent (Declaration_Node (E))) = N_Subprogram_Renaming_Declaration then + if Scope (E) /= Scope (Alias (E)) then + Error_Pragma_Ref + ("cannot apply pragma% to non-local renaming&#", E); + end if; E := Alias (E); elsif Nkind (Parent (E)) = N_Full_Type_Declaration @@ -2389,11 +2561,21 @@ package body Sem_Prag is E1 := Homonym (E1); exit when No (E1) or else Scope (E1) /= Current_Scope; + -- Do not set the pragma on inherited operations or on + -- formal subprograms. + if Comes_From_Source (E1) and then Comp_Unit = Get_Source_Unit (E1) + and then not Is_Formal_Subprogram (E1) and then Nkind (Original_Node (Parent (E1))) /= N_Full_Type_Declaration then + if Present (Alias (E1)) + and then Scope (E1) /= Scope (Alias (E1)) + then + Error_Pragma_Ref + ("cannot apply pragma% to non-local renaming&#", E1); + end if; Set_Convention_From_Pragma (E1); if Prag_Id = Pragma_Import then @@ -2617,7 +2799,7 @@ package body Sem_Prag is "\no initialization allowed for & declared#", Arg1); else Set_Imported (Def_Id); - Note_Possible_Modification (Arg_Internal); + Note_Possible_Modification (Arg_Internal, Sure => False); end if; end if; end Process_Extended_Import_Export_Object_Pragma; @@ -2678,7 +2860,7 @@ package body Sem_Prag is end if; -- We have a match if the corresponding argument is of an - -- anonymous access type, and its designicated type matches + -- anonymous access type, and its designated type matches -- the type of the prefix of the access attribute return Ekind (Ftyp) = E_Anonymous_Access_Type @@ -2887,7 +3069,7 @@ package body Sem_Prag is then null; - -- In all other cases, set entit as exported + -- In all other cases, set entity as exported else Set_Exported (Ent, Arg_Internal); @@ -3126,7 +3308,7 @@ package body Sem_Prag is begin Process_Convention (C, Def_Id); Kill_Size_Check_Code (Def_Id); - Note_Possible_Modification (Expression (Arg2)); + Note_Possible_Modification (Expression (Arg2), Sure => False); if Ekind (Def_Id) = E_Variable or else @@ -3382,7 +3564,7 @@ package body Sem_Prag is function Inlining_Not_Possible (Subp : Entity_Id) return Boolean; -- Returns True if it can be determined at this stage that inlining - -- is not possible, for examle if the body is available and contains + -- is not possible, for example if the body is available and contains -- exception handlers, we prevent inlining, since otherwise we can -- get undefined symbols at link time. This function also emits a -- warning if front-end inlining is enabled and the pragma appears @@ -3470,29 +3652,36 @@ package body Sem_Prag is return; -- Here we have a candidate for inlining, but we must exclude - -- derived operations. Otherwise we will end up trying to - -- inline a phantom declaration, and the result would be to - -- drag in a body which has no direct inlining associated with - -- it. That would not only be inefficient but would also result - -- in the backend doing cross-unit inlining in cases where it - -- was definitely inappropriate to do so. - - -- However, a simple Comes_From_Source test is insufficient, - -- since we do want to allow inlining of generic instances, - -- which also do not come from source. Predefined operators do - -- not come from source but are not inlineable either. + -- derived operations. Otherwise we would end up trying to inline + -- a phantom declaration, and the result would be to drag in a + -- body which has no direct inlining associated with it. That + -- would not only be inefficient but would also result in the + -- backend doing cross-unit inlining in cases where it was + -- definitely inappropriate to do so. + + -- However, a simple Comes_From_Source test is insufficient, since + -- we do want to allow inlining of generic instances which also do + -- not come from source. We also need to recognize specs + -- generated by the front-end for bodies that carry the pragma. + -- Finally, predefined operators do not come from source but are + -- not inlineable either. + + elsif Is_Generic_Instance (Subp) + or else Nkind (Parent (Parent (Subp))) = N_Subprogram_Declaration + then + null; elsif not Comes_From_Source (Subp) - and then not Is_Generic_Instance (Subp) and then Scope (Subp) /= Standard_Standard then Applies := True; return; + end if; -- The referenced entity must either be the enclosing entity, -- or an entity declared within the current open scope. - elsif Present (Scope (Subp)) + if Present (Scope (Subp)) and then Scope (Subp) /= Current_Scope and then Subp /= Current_Scope then @@ -3884,13 +4073,40 @@ package body Sem_Prag is (Process_Restriction_Synonyms (Expr)); if R_Id not in All_Boolean_Restrictions then - Error_Pragma_Arg - ("invalid restriction identifier", Arg); + Error_Msg_Name_1 := Pname; + Error_Msg_N + ("invalid restriction identifier&", Get_Pragma_Arg (Arg)); + + -- Check for possible misspelling + + for J in Restriction_Id loop + declare + Rnm : constant String := Restriction_Id'Image (J); + + begin + Name_Buffer (1 .. Rnm'Length) := Rnm; + Name_Len := Rnm'Length; + Set_Casing (All_Lower_Case); + + if Is_Bad_Spelling_Of (Chars (Expr), Name_Enter) then + Set_Casing + (Identifier_Casing (Current_Source_File)); + Error_Msg_String (1 .. Rnm'Length) := + Name_Buffer (1 .. Name_Len); + Error_Msg_Strlen := Rnm'Length; + Error_Msg_N + ("\possible misspelling of ""~""", + Get_Pragma_Arg (Arg)); + exit; + end if; + end; + end loop; + + raise Pragma_Exit; end if; if Implementation_Restriction (R_Id) then - Check_Restriction - (No_Implementation_Restrictions, Arg); + Check_Restriction (No_Implementation_Restrictions, Arg); end if; -- If this is a warning, then set the warning unless we already @@ -4621,7 +4837,7 @@ package body Sem_Prag is end; -- An enumeration type defines the pragmas that are supported by the - -- implementation. Get_Pragma_Id (in package Prag) transorms a name + -- implementation. Get_Pragma_Id (in package Prag) transforms a name -- into the corresponding enumeration value for the following case. case Prag_Id is @@ -4840,7 +5056,7 @@ package body Sem_Prag is when Pragma_Assert => Assert : declare Expr : Node_Id; - Eloc : Source_Ptr; + Newa : List_Id; begin Ada_2005_Pragma; @@ -4849,71 +5065,33 @@ package body Sem_Prag is Check_Arg_Order ((Name_Check, Name_Message)); Check_Optional_Identifier (Arg1, Name_Check); - if Arg_Count > 1 then - Check_Optional_Identifier (Arg2, Name_Message); - Check_Arg_Is_Static_Expression (Arg2, Standard_String); - end if; - - -- If expansion is active and assertions are inactive, then - -- we rewrite the Assertion as: - - -- if False and then condition then - -- null; - -- end if; - - -- The reason we do this rewriting during semantic analysis rather - -- than as part of normal expansion is that we cannot analyze and - -- expand the code for the boolean expression directly, or it may - -- cause insertion of actions that would escape the attempt to - -- suppress the assertion code. + -- We treat pragma Assert as equivalent to: - -- Note that the Sloc for the if statement corresponds to the - -- argument condition, not the pragma itself. The reason for this - -- is that we may generate a warning if the condition is False at - -- compile time, and we do not want to delete this warning when we - -- delete the if statement. + -- pragma Check (Assertion, condition [, msg]); - Expr := Expression (Arg1); - Eloc := Sloc (Expr); + -- So rewrite pragma in this manner, and analyze the result - if Expander_Active and not Assertions_Enabled then - Rewrite (N, - Make_If_Statement (Eloc, - Condition => - Make_And_Then (Eloc, - Left_Opnd => New_Occurrence_Of (Standard_False, Eloc), - Right_Opnd => Expr), - Then_Statements => New_List ( - Make_Null_Statement (Eloc)))); + Expr := Get_Pragma_Arg (Arg1); + Newa := New_List ( + Make_Pragma_Argument_Association (Loc, + Expression => + Make_Identifier (Loc, + Chars => Name_Assertion)), - Analyze (N); + Make_Pragma_Argument_Association (Sloc (Expr), + Expression => Expr)); - -- Otherwise (if assertions are enabled, or if we are not - -- operating with expansion active), then we just analyze - -- and resolve the expression. - - else - Analyze_And_Resolve (Expr, Any_Boolean); + if Arg_Count > 1 then + Check_Optional_Identifier (Arg2, Name_Message); + Analyze_And_Resolve (Get_Pragma_Arg (Arg2), Standard_String); + Append_To (Newa, Relocate_Node (Arg2)); end if; - -- If assertion is of the form (X'First = literal), where X is - -- formal parameter, then set Low_Bound_Known flag on this formal. - - if Nkind (Expr) = N_Op_Eq then - declare - Right : constant Node_Id := Right_Opnd (Expr); - Left : constant Node_Id := Left_Opnd (Expr); - begin - if Nkind (Left) = N_Attribute_Reference - and then Attribute_Name (Left) = Name_First - and then Is_Entity_Name (Prefix (Left)) - and then Is_Formal (Entity (Prefix (Left))) - and then Nkind (Right) = N_Integer_Literal - then - Set_Low_Bound_Known (Entity (Prefix (Left))); - end if; - end; - end if; + Rewrite (N, + Make_Pragma (Loc, + Chars => Name_Check, + Pragma_Argument_Associations => Newa)); + Analyze (N); end Assert; ---------------------- @@ -4922,11 +5100,44 @@ package body Sem_Prag is -- pragma Assertion_Policy (Check | Ignore) - when Pragma_Assertion_Policy => + when Pragma_Assertion_Policy => Assertion_Policy : declare + Policy : Node_Id; + + begin Ada_2005_Pragma; + Check_Valid_Configuration_Pragma; Check_Arg_Count (1); + Check_No_Identifiers; Check_Arg_Is_One_Of (Arg1, Name_Check, Name_Ignore); - Assertions_Enabled := Chars (Expression (Arg1)) = Name_Check; + + -- We treat pragma Assertion_Policy as equivalent to: + + -- pragma Check_Policy (Assertion, policy) + + -- So rewrite the pragma in that manner and link on to the chain + -- of Check_Policy pragmas, marking the pragma as analyzed. + + Policy := Get_Pragma_Arg (Arg1); + + Rewrite (N, + Make_Pragma (Loc, + Chars => Name_Check_Policy, + + Pragma_Argument_Associations => New_List ( + Make_Pragma_Argument_Association (Loc, + Expression => + Make_Identifier (Loc, + Chars => Name_Assertion)), + + Make_Pragma_Argument_Association (Loc, + Expression => + Make_Identifier (Sloc (Policy), + Chars => Chars (Policy)))))); + + Set_Analyzed (N); + Set_Next_Pragma (N, Opt.Check_Policy_List); + Opt.Check_Policy_List := N; + end Assertion_Policy; --------------- -- AST_Entry -- @@ -5237,7 +5448,7 @@ package body Sem_Prag is New_Copy_Tree (Expression (Arg2)); begin Set_Parent (Temp, N); - Pre_Analyze_And_Resolve (Temp, RTE (RE_Interrupt_ID)); + Preanalyze_And_Resolve (Temp, RTE (RE_Interrupt_ID)); end; else @@ -5285,6 +5496,97 @@ package body Sem_Prag is end if; end C_Pass_By_Copy; + ----------- + -- Check -- + ----------- + + -- pragma Check ([Name =>] Identifier, + -- [Check =>] Boolean_Expression + -- [,[Message =>] String_Expression]); + + when Pragma_Check => Check : declare + Expr : Node_Id; + Eloc : Source_Ptr; + + Check_On : Boolean; + -- Set True if category of assertions referenced by Name enabled + + begin + GNAT_Pragma; + Check_At_Least_N_Arguments (2); + Check_At_Most_N_Arguments (3); + Check_Optional_Identifier (Arg1, Name_Name); + Check_Optional_Identifier (Arg2, Name_Check); + + if Arg_Count = 3 then + Check_Optional_Identifier (Arg3, Name_Message); + Analyze_And_Resolve (Get_Pragma_Arg (Arg3), Standard_String); + end if; + + Check_Arg_Is_Identifier (Arg1); + Check_On := Check_Enabled (Chars (Get_Pragma_Arg (Arg1))); + + -- If expansion is active and the check is not enabled then we + -- rewrite the Check as: + + -- if False and then condition then + -- null; + -- end if; + + -- The reason we do this rewriting during semantic analysis rather + -- than as part of normal expansion is that we cannot analyze and + -- expand the code for the boolean expression directly, or it may + -- cause insertion of actions that would escape the attempt to + -- suppress the check code. + + -- Note that the Sloc for the if statement corresponds to the + -- argument condition, not the pragma itself. The reason for this + -- is that we may generate a warning if the condition is False at + -- compile time, and we do not want to delete this warning when we + -- delete the if statement. + + Expr := Expression (Arg2); + + if Expander_Active and then not Check_On then + Eloc := Sloc (Expr); + + Rewrite (N, + Make_If_Statement (Eloc, + Condition => + Make_And_Then (Eloc, + Left_Opnd => New_Occurrence_Of (Standard_False, Eloc), + Right_Opnd => Expr), + Then_Statements => New_List ( + Make_Null_Statement (Eloc)))); + + Analyze (N); + + -- Check is active + + else + Analyze_And_Resolve (Expr, Any_Boolean); + end if; + + -- If assertion is of the form (X'First = literal), where X is + -- a formal, then set Low_Bound_Known flag on this formal. + + if Nkind (Expr) = N_Op_Eq then + declare + Right : constant Node_Id := Right_Opnd (Expr); + Left : constant Node_Id := Left_Opnd (Expr); + begin + if Nkind (Left) = N_Attribute_Reference + and then Attribute_Name (Left) = Name_First + and then Is_Entity_Name (Prefix (Left)) + and then Is_Formal (Entity (Prefix (Left))) + and then Nkind (Right) = N_Integer_Literal + then + Set_Low_Bound_Known (Entity (Prefix (Left))); + end if; + end; + end if; + end Check; + ---------------- -- Check_Name -- ---------------- @@ -5311,6 +5613,38 @@ package body Sem_Prag is Check_Names.Append (Nam); end; + ------------------ + -- Check_Policy -- + ------------------ + + -- pragma Check_Policy ([Name =>] IDENTIFIER, + -- POLICY_IDENTIFIER; + + -- POLICY_IDENTIFIER ::= ON | OFF | CHECK | IGNORE + + -- Note: this is a configuration pragma, but it is allowed to + -- appear anywhere else. + + when Pragma_Check_Policy => + GNAT_Pragma; + Check_Arg_Count (2); + Check_No_Identifier (Arg2); + Check_Optional_Identifier (Arg1, Name_Name); + Check_Arg_Is_One_Of + (Arg2, Name_On, Name_Off, Name_Check, Name_Ignore); + + -- A Check_Policy pragma can appear either as a configuration + -- pragma, or in a declarative part or a package spec (see RM + -- 11.5(5) for rules for Suppress/Unsuppress which are also + -- followed for Check_Policy). + + if not Is_Configuration_Pragma then + Check_Is_In_Decl_Part_Or_Package_Spec; + end if; + + Set_Next_Pragma (N, Opt.Check_Policy_List); + Opt.Check_Policy_List := N; + --------------------- -- CIL_Constructor -- --------------------- @@ -5944,7 +6278,7 @@ package body Sem_Prag is -- compilation unit. If the pragma appears in some unit -- in the context, there might still be a need for an -- Elaborate_All_Desirable from the current compilation - -- to the the named unit, so we keep the check enabled. + -- to the named unit, so we keep the check enabled. if In_Extended_Main_Source_Unit (N) then Set_Suppress_Elaboration_Warnings @@ -5966,7 +6300,7 @@ package body Sem_Prag is end loop Outer; -- Give a warning if operating in static mode with -gnatwl - -- (elaboration warnings eanbled) switch set. + -- (elaboration warnings enabled) switch set. if Elab_Warnings and not Dynamic_Elaboration_Checks then Error_Msg_N @@ -6219,11 +6553,27 @@ package body Sem_Prag is Process_Convention (C, Def_Id); if Ekind (Def_Id) /= E_Constant then - Note_Possible_Modification (Expression (Arg2)); + Note_Possible_Modification (Expression (Arg2), Sure => False); end if; Process_Interface_Name (Def_Id, Arg3, Arg4); Set_Exported (Def_Id, Arg2); + + -- If the entity is a deferred constant, propagate the + -- information to the full view, because gigi elaborates + -- the full view only. + + if Ekind (Def_Id) = E_Constant + and then Present (Full_View (Def_Id)) + then + declare + Id2 : constant Entity_Id := Full_View (Def_Id); + begin + Set_Is_Exported (Id2, Is_Exported (Def_Id)); + Set_First_Rep_Item (Id2, First_Rep_Item (Def_Id)); + Set_Interface_Name (Id2, Einfo.Interface_Name (Def_Id)); + end; + end if; end Export; ---------------------- @@ -6611,7 +6961,7 @@ package body Sem_Prag is Check_At_Least_N_Arguments (2); Check_At_Most_N_Arguments (4); Process_Convention (C, Def_Id); - Note_Possible_Modification (Expression (Arg2)); + Note_Possible_Modification (Expression (Arg2), Sure => False); Process_Interface_Name (Def_Id, Arg3, Arg4); Set_Exported (Def_Id, Arg2); end External; @@ -7431,12 +7781,12 @@ package body Sem_Prag is Def_Id := Entity (Id); end if; - -- Special DEC-compatible processing for the object case, - -- forces object to be imported. + -- Special DEC-compatible processing for the object case, forces + -- object to be imported. if Ekind (Def_Id) = E_Variable then Kill_Size_Check_Code (Def_Id); - Note_Possible_Modification (Id); + Note_Possible_Modification (Id, Sure => False); -- Initialization is not allowed for imported variable @@ -7543,7 +7893,7 @@ package body Sem_Prag is -- described in "Handling of Default and Per-Object -- Expressions" in sem.ads. - Analyze_Per_Use_Expression (Arg, RTE (RE_Interrupt_Priority)); + Preanalyze_Spec_Expression (Arg, RTE (RE_Interrupt_Priority)); end if; if Nkind (P) /= N_Task_Definition @@ -8065,22 +8415,20 @@ package body Sem_Prag is Check_No_Identifiers; Check_Arg_Count (1); Check_Is_In_Decl_Part_Or_Package_Spec; + Check_Arg_Is_Static_Expression (Arg1, Standard_String); + Start_String (Strval (Expr_Value_S (Expression (Arg1)))); + + Arg := Arg2; + while Present (Arg) loop + Check_Arg_Is_Static_Expression (Arg, Standard_String); + Store_String_Char (ASCII.NUL); + Store_String_Chars (Strval (Expr_Value_S (Expression (Arg)))); + Arg := Next (Arg); + end loop; if Operating_Mode = Generate_Code and then In_Extended_Main_Source_Unit (N) then - Check_Arg_Is_Static_Expression (Arg1, Standard_String); - Start_String (Strval (Expr_Value_S (Expression (Arg1)))); - - Arg := Arg2; - while Present (Arg) loop - Check_Arg_Is_Static_Expression (Arg, Standard_String); - Store_String_Char (ASCII.NUL); - Store_String_Chars - (Strval (Expr_Value_S (Expression (Arg)))); - Arg := Next (Arg); - end loop; - Store_Linker_Option_String (End_String); end if; end Linker_Options; @@ -8102,6 +8450,12 @@ package body Sem_Prag is Check_Arg_Is_Library_Level_Local_Name (Arg1); Check_Arg_Is_Static_Expression (Arg2, Standard_String); + -- This pragma does not apply to types + + if Is_Type (Entity (Expression (Arg1))) then + Error_Pragma_Arg ("pragma% cannot apply to type", Arg1); + end if; + -- The only processing required is to link this item on to the -- list of rep items for the given entity. This is accomplished -- by the call to Rep_Item_Too_Late (when no error is detected @@ -8372,7 +8726,7 @@ package body Sem_Prag is -- it was misplaced. when Pragma_No_Body => - Error_Pragma ("misplaced pragma %"); + Pragma_Misplaced; --------------- -- No_Return -- @@ -8549,7 +8903,8 @@ package body Sem_Prag is end if; end loop; - Set_Obsolescent_Warning (Ent, Expression (Arg1)); + Obsolescent_Warnings.Append + ((Ent => Ent, Msg => Strval (Expression (Arg1)))); -- Check for Ada_05 parameter @@ -8681,7 +9036,7 @@ package body Sem_Prag is -- pragma No_Run_Time - -- Note: this pragma is retained for backwards compatibiltiy. + -- Note: this pragma is retained for backwards compatibility. -- See body of Rtsfind for full details on its handling. when Pragma_No_Run_Time => @@ -8760,6 +9115,12 @@ package body Sem_Prag is end case; end; + -- Set indication that mode is set locally. If we are in fact in a + -- configuration pragma file, this setting is harmless since the + -- switch will get reset anyway at the start of each unit. + + Optimize_Alignment_Local := True; + ---------- -- Pack -- ---------- @@ -9019,6 +9380,82 @@ package body Sem_Prag is end if; end Persistent_BSS; + ------------------- + -- Postcondition -- + ------------------- + + -- pragma Postcondition ([Check =>] Boolean_Expression + -- [,[Message =>] String_Expression]); + + when Pragma_Postcondition => Postcondition : declare + In_Body : Boolean; + pragma Warnings (Off, In_Body); + + begin + GNAT_Pragma; + Check_At_Least_N_Arguments (1); + Check_At_Most_N_Arguments (2); + Check_Optional_Identifier (Arg1, Name_Check); + + -- All we need to do here is call the common check procedure, + -- the remainder of the processing is found in Sem_Ch6/Sem_Ch7. + + Check_Precondition_Postcondition (In_Body); + end Postcondition; + + ------------------ + -- Precondition -- + ------------------ + + -- pragma Precondition ([Check =>] Boolean_Expression + -- [,[Message =>] String_Expression]); + + when Pragma_Precondition => Precondition : declare + In_Body : Boolean; + + begin + GNAT_Pragma; + Check_At_Least_N_Arguments (1); + Check_At_Most_N_Arguments (2); + Check_Optional_Identifier (Arg1, Name_Check); + + Check_Precondition_Postcondition (In_Body); + + -- If in spec, nothing to do. If in body, then we convert the + -- pragma to pragma Check (Precondition, cond [, msg]). Note we + -- do this whether or not precondition checks are enabled. That + -- works fine since pragma Check will do this check. + + if In_Body then + if Arg_Count = 2 then + Check_Optional_Identifier (Arg3, Name_Message); + Analyze_And_Resolve (Get_Pragma_Arg (Arg2), Standard_String); + end if; + + Analyze_And_Resolve (Get_Pragma_Arg (Arg1), Standard_Boolean); + + Rewrite (N, + Make_Pragma (Loc, + Chars => Name_Check, + Pragma_Argument_Associations => New_List ( + Make_Pragma_Argument_Association (Loc, + Expression => + Make_Identifier (Loc, + Chars => Name_Precondition)), + + Make_Pragma_Argument_Association (Sloc (Arg1), + Expression => Relocate_Node (Get_Pragma_Arg (Arg1)))))); + + if Arg_Count = 2 then + Append_To (Pragma_Argument_Associations (N), + Make_Pragma_Argument_Association (Sloc (Arg2), + Expression => Relocate_Node (Get_Pragma_Arg (Arg2)))); + end if; + + Analyze (N); + end if; + end Precondition; + ------------------ -- Preelaborate -- ------------------ @@ -9172,7 +9609,7 @@ package body Sem_Prag is -- described in "Handling of Default and Per-Object -- Expressions" in sem.ads. - Analyze_Per_Use_Expression (Arg, Standard_Integer); + Preanalyze_Spec_Expression (Arg, Standard_Integer); if not Is_Static_Expression (Arg) then Check_Restriction (Static_Priorities, Arg); @@ -9339,7 +9776,7 @@ package body Sem_Prag is -- pragma Profile (profile_IDENTIFIER); - -- profile_IDENTIFIER => Protected | Ravenscar + -- profile_IDENTIFIER => Restricted | Ravenscar when Pragma_Profile => Ada_2005_Pragma; @@ -9365,7 +9802,7 @@ package body Sem_Prag is -- pragma Profile_Warnings (profile_IDENTIFIER); - -- profile_IDENTIFIER => Protected | Ravenscar + -- profile_IDENTIFIER => Restricted | Ravenscar when Pragma_Profile_Warnings => GNAT_Pragma; @@ -9699,6 +10136,55 @@ package body Sem_Prag is end if; end; + ----------------------- + -- Relative_Deadline -- + ----------------------- + + -- pragma Relative_Deadline (time_span_EXPRESSION); + + when Pragma_Relative_Deadline => Relative_Deadline : declare + P : constant Node_Id := Parent (N); + Arg : Node_Id; + + begin + Ada_2005_Pragma; + Check_No_Identifiers; + Check_Arg_Count (1); + + Arg := Expression (Arg1); + + -- The expression must be analyzed in the special manner described + -- in "Handling of Default and Per-Object Expressions" in sem.ads. + + Preanalyze_Spec_Expression (Arg, RTE (RE_Time_Span)); + + -- Subprogram case + + if Nkind (P) = N_Subprogram_Body then + Check_In_Main_Program; + + -- Tasks + + elsif Nkind (P) = N_Task_Definition then + null; + + -- Anything else is incorrect + + else + Pragma_Misplaced; + end if; + + if Has_Relative_Deadline_Pragma (P) then + Error_Pragma ("duplicate pragma% not allowed"); + else + Set_Has_Relative_Deadline_Pragma (P, True); + + if Nkind (P) = N_Task_Definition then + Record_Rep_Item (Defining_Identifier (Parent (P)), N); + end if; + end if; + end Relative_Deadline; + --------------------------- -- Remote_Call_Interface -- --------------------------- @@ -9832,6 +10318,7 @@ package body Sem_Prag is -- | restriction_parameter_IDENTIFIER => EXPRESSION when Pragma_Restriction_Warnings => + GNAT_Pragma; Process_Restrictions_Or_Restriction_Warnings (Warn => True); ---------------- @@ -10025,13 +10512,11 @@ package body Sem_Prag is Check_No_Identifiers; Check_Arg_Count (1); - -- The expression must be analyzed in the special manner - -- described in "Handling of Default Expressions" in sem.ads. - - -- Set In_Default_Expression for per-object case ??? + -- The expression must be analyzed in the special manner described + -- in "Handling of Default Expressions" in sem.ads. Arg := Expression (Arg1); - Analyze_Per_Use_Expression (Arg, Any_Integer); + Preanalyze_Spec_Expression (Arg, Any_Integer); if not Is_Static_Expression (Arg) then Check_Restriction (Static_Storage_Size, Arg); @@ -10117,7 +10602,7 @@ package body Sem_Prag is end if; end Check_OK_Stream_Convert_Function; - -- Start of procecessing for Stream_Convert + -- Start of processing for Stream_Convert begin GNAT_Pragma; @@ -10137,24 +10622,35 @@ package body Sem_Prag is Write : constant Entity_Id := Entity (Expression (Arg3)); begin - if Etype (Typ) = Any_Type - or else - Etype (Read) = Any_Type + Check_First_Subtype (Arg1); + + -- Check for too early or too late. Note that we don't enforce + -- the rule about primitive operations in this case, since, as + -- is the case for explicit stream attributes themselves, these + -- restrictions are not appropriate. Note that the chaining of + -- the pragma by Rep_Item_Too_Late is actually the critical + -- processing done for this pragma. + + if Rep_Item_Too_Early (Typ, N) or else - Etype (Write) = Any_Type + Rep_Item_Too_Late (Typ, N, FOnly => True) then return; end if; - Check_First_Subtype (Arg1); + -- Return if previous error - if Rep_Item_Too_Early (Typ, N) + if Etype (Typ) = Any_Type or else - Rep_Item_Too_Late (Typ, N) + Etype (Read) = Any_Type + or else + Etype (Write) = Any_Type then return; end if; + -- Error checks + if Underlying_Type (Etype (Read)) /= Typ then Error_Pragma_Arg ("incorrect return type for function&", Arg2); @@ -10477,8 +10973,6 @@ package body Sem_Prag is -- pragma Task_Name (string_EXPRESSION); when Pragma_Task_Name => Task_Name : declare - -- pragma Priority (EXPRESSION); - P : constant Node_Id := Parent (N); Arg : Node_Id; @@ -11361,6 +11855,39 @@ package body Sem_Prag is when Pragma_Exit => null; end Analyze_Pragma; + ------------------- + -- Check_Enabled -- + ------------------- + + function Check_Enabled (Nam : Name_Id) return Boolean is + PP : Node_Id; + + begin + PP := Opt.Check_Policy_List; + loop + if No (PP) then + return Assertions_Enabled; + + elsif + Nam = Chars (Expression (First (Pragma_Argument_Associations (PP)))) + then + case + Chars (Expression (Last (Pragma_Argument_Associations (PP)))) + is + when Name_On | Name_Check => + return True; + when Name_Off | Name_Ignore => + return False; + when others => + raise Program_Error; + end case; + + else + PP := Next_Pragma (PP); + end if; + end loop; + end Check_Enabled; + --------------------------------- -- Delay_Config_Pragma_Analyze -- --------------------------------- @@ -11396,6 +11923,28 @@ package body Sem_Prag is return Result; end Get_Base_Subprogram; + -------------------- + -- Get_Pragma_Arg -- + -------------------- + + function Get_Pragma_Arg (Arg : Node_Id) return Node_Id is + begin + if Nkind (Arg) = N_Pragma_Argument_Association then + return Expression (Arg); + else + return Arg; + end if; + end Get_Pragma_Arg; + + ---------------- + -- Initialize -- + ---------------- + + procedure Initialize is + begin + Externals.Init; + end Initialize; + ----------------------------- -- Is_Config_Static_String -- ----------------------------- @@ -11448,7 +11997,7 @@ package body Sem_Prag is return True; end Add_Config_Static_String; - -- Start of prorcessing for Is_Config_Static_String + -- Start of processing for Is_Config_Static_String begin @@ -11463,11 +12012,14 @@ package body Sem_Prag is -- This function makes use of the following static table which indicates -- whether a given pragma is significant. A value of -1 in this table -- indicates that the reference is significant. A value of zero indicates - -- than appearence as any argument is insignificant, a positive value - -- indicates that appearence in that parameter position is significant. + -- than appearance as any argument is insignificant, a positive value + -- indicates that appearance in that parameter position is significant. - Sig_Flags : constant array (Pragma_Id) of Int := + -- A value of 99 flags a special case requiring a special check (this is + -- used for cases not covered by this standard encoding, e.g. pragma Check + -- where the first argument is not significant, but the others are). + Sig_Flags : constant array (Pragma_Id) of Int := (Pragma_AST_Entry => -1, Pragma_Abort_Defer => -1, Pragma_Ada_83 => -1, @@ -11482,7 +12034,9 @@ package body Sem_Prag is Pragma_Atomic => 0, Pragma_Atomic_Components => 0, Pragma_Attach_Handler => -1, + Pragma_Check => 99, Pragma_Check_Name => 0, + Pragma_Check_Policy => 0, Pragma_CIL_Constructor => -1, Pragma_CPP_Class => 0, Pragma_CPP_Constructor => 0, @@ -11574,6 +12128,8 @@ package body Sem_Prag is Pragma_Preelaborable_Initialization => -1, Pragma_Polling => -1, Pragma_Persistent_BSS => 0, + Pragma_Postcondition => -1, + Pragma_Precondition => -1, Pragma_Preelaborate => -1, Pragma_Preelaborate_05 => -1, Pragma_Priority => -1, @@ -11587,6 +12143,7 @@ package body Sem_Prag is Pragma_Pure_Function => -1, Pragma_Queuing_Policy => -1, Pragma_Ravenscar => -1, + Pragma_Relative_Deadline => -1, Pragma_Remote_Call_Interface => -1, Pragma_Remote_Types => -1, Pragma_Restricted_Run_Time => -1, @@ -11636,9 +12193,10 @@ package body Sem_Prag is Unknown_Pragma => 0); function Is_Non_Significant_Pragma_Reference (N : Node_Id) return Boolean is - P : Node_Id; - C : Int; - A : Node_Id; + Id : Pragma_Id; + P : Node_Id; + C : Int; + A : Node_Id; begin P := Parent (N); @@ -11647,7 +12205,8 @@ package body Sem_Prag is return False; else - C := Sig_Flags (Get_Pragma_Id (Parent (P))); + Id := Get_Pragma_Id (Parent (P)); + C := Sig_Flags (Id); case C is when -1 => @@ -11656,6 +12215,21 @@ package body Sem_Prag is when 0 => return True; + when 99 => + case Id is + + -- For pragma Check, the first argument is not significant, + -- the second and the third (if present) arguments are + -- significant. + + when Pragma_Check => + return + P = First (Pragma_Argument_Associations (Parent (P))); + + when others => + raise Program_Error; + end case; + when others => A := First (Pragma_Argument_Associations (Parent (P))); for J in 1 .. C - 1 loop @@ -11666,7 +12240,7 @@ package body Sem_Prag is Next (A); end loop; - return A = P; + return A = P; -- is this wrong way round ??? end case; end if; end Is_Non_Significant_Pragma_Reference; @@ -11920,4 +12494,5 @@ package body Sem_Prag is Set_Entity (Pref, Scop); end if; end Set_Unit_Name; + end Sem_Prag; diff --git a/gcc/ada/sem_prag.ads b/gcc/ada/sem_prag.ads index 5da2a9faad0..1bb51150417 100644 --- a/gcc/ada/sem_prag.ads +++ b/gcc/ada/sem_prag.ads @@ -6,7 +6,7 @@ -- -- -- S p e c -- -- -- --- Copyright (C) 1992-2007, Free Software Foundation, Inc. -- +-- Copyright (C) 1992-2008, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -26,13 +26,36 @@ -- Pragma handling is isolated in a separate package -- (logically this processing belongs in chapter 4) +with Namet; use Namet; with Types; use Types; package Sem_Prag is + ----------------- + -- Subprograms -- + ----------------- + + procedure Analyze_PPC_In_Decl_Part (N : Node_Id; S : Entity_Id); + -- Special analyze routine for precondition/postcondition pragma that + -- appears within a declarative part where the pragma is associated + -- with a subprogram specification. N is the pragma node, and S is the + -- entity for the related subprogram. This procedure does a preanalysis + -- of the expressions in the pragma as "spec expressions" (see section + -- in Sem "Handling of Default and Per-Object Expressions..."). + procedure Analyze_Pragma (N : Node_Id); -- Analyze procedure for pragma reference node N + function Check_Enabled (Nam : Name_Id) return Boolean; + -- This function is used in connection with pragmas Assertion, Check, + -- Precondition, and Postcondition to determine if Check pragmas (or + -- corresponding Assert, Precondition, or Postcondition pragmas) are + -- currently active, as determined by the presence of -gnata on the + -- command line (which sets the default), and the appearence of pragmas + -- Check_Policy and Assertion_Policy as configuration pragmas either in + -- a configuration pragma file, or at the start of the current unit. + -- True is returned if the specified check is enabled. + function Delay_Config_Pragma_Analyze (N : Node_Id) return Boolean; -- N is a pragma appearing in a configuration pragma file. Most such -- pragmas are analyzed when the file is read, before parsing and analyzing @@ -43,12 +66,16 @@ package Sem_Prag is -- True have their analysis delayed until after the main program is parsed -- and analyzed. + procedure Initialize; + -- Initializes data structures used for pragma processing. Must be called + -- before analyzing each new main source program. + function Is_Non_Significant_Pragma_Reference (N : Node_Id) return Boolean; -- The node N is a node for an entity and the issue is whether the -- occurrence is a reference for the purposes of giving warnings about -- unreferenced variables. This function returns True if the reference is -- not a reference from this point of view (e.g. the occurrence in a pragma - -- Pack) and False if it is a real reference (e.g. the occcurrence in a + -- Pack) and False if it is a real reference (e.g. the occurrence in a -- pragma Export); function Is_Pragma_String_Literal (Par : Node_Id) return Boolean; diff --git a/gcc/ada/sem_res.adb b/gcc/ada/sem_res.adb index 9e8687daad6..cfa1a8cd0d7 100644 --- a/gcc/ada/sem_res.adb +++ b/gcc/ada/sem_res.adb @@ -68,6 +68,7 @@ with Sinfo; use Sinfo; with Snames; use Snames; with Stand; use Stand; with Stringt; use Stringt; +with Style; use Style; with Targparm; use Targparm; with Tbuild; use Tbuild; with Uintp; use Uintp; @@ -395,9 +396,9 @@ package body Sem_Res is D : Node_Id; begin - -- Any use in a default expression is legal + -- Any use in a a spec-expression is legal - if In_Default_Expression then + if In_Spec_Expression then null; elsif Nkind (PN) = N_Range then @@ -434,10 +435,9 @@ package body Sem_Res is and then Scope (Disc) = Current_Scope and then not (Nkind (Parent (P)) = N_Subtype_Indication - and then - (Nkind (Parent (Parent (P))) = N_Component_Definition - or else - Nkind (Parent (Parent (P))) = N_Subtype_Declaration) + and then + Nkind_In (Parent (Parent (P)), N_Component_Definition, + N_Subtype_Declaration) and then Paren_Count (N) = 0) then Error_Msg_N @@ -554,8 +554,8 @@ package body Sem_Res is -- Legal case is in index or discriminant constraint - elsif Nkind (PN) = N_Index_Or_Discriminant_Constraint - or else Nkind (PN) = N_Discriminant_Association + elsif Nkind_In (PN, N_Index_Or_Discriminant_Constraint, + N_Discriminant_Association) then if Paren_Count (N) > 0 then Error_Msg_N @@ -576,9 +576,9 @@ package body Sem_Res is else D := PN; P := Parent (PN); - while Nkind (P) /= N_Component_Declaration - and then Nkind (P) /= N_Subtype_Indication - and then Nkind (P) /= N_Entry_Declaration + while not Nkind_In (P, N_Component_Declaration, + N_Subtype_Indication, + N_Entry_Declaration) loop D := P; P := Parent (P); @@ -591,10 +591,8 @@ package body Sem_Res is -- is of course a double fault. if (Nkind (P) = N_Subtype_Indication - and then - (Nkind (Parent (P)) = N_Component_Definition - or else - Nkind (Parent (P)) = N_Derived_Type_Definition) + and then Nkind_In (Parent (P), N_Component_Definition, + N_Derived_Type_Definition) and then D = Constraint (P)) -- The constraint itself may be given by a subtype indication, @@ -753,11 +751,10 @@ package body Sem_Res is loop P := Parent (C); exit when Nkind (P) = N_Subprogram_Body; - - if Nkind (P) = N_Or_Else or else - Nkind (P) = N_And_Then or else - Nkind (P) = N_If_Statement or else - Nkind (P) = N_Case_Statement + if Nkind_In (P, N_Or_Else, + N_And_Then, + N_If_Statement, + N_Case_Statement) then return False; @@ -831,7 +828,7 @@ package body Sem_Res is function Uses_SS (T : Entity_Id) return Boolean; -- Check whether the creation of an object of the type will involve -- use of the secondary stack. If T is a record type, this is true - -- if the expression for some component uses the secondary stack, eg. + -- if the expression for some component uses the secondary stack, e.g. -- through a call to a function that returns an unconstrained value. -- False if T is controlled, because cleanups occur elsewhere. @@ -963,25 +960,24 @@ package body Sem_Res is Require_Entity (N); end if; - -- If the context expects a value, and the name is a procedure, - -- this is most likely a missing 'Access. Do not try to resolve - -- the parameterless call, error will be caught when the outer - -- call is analyzed. + -- If the context expects a value, and the name is a procedure, this is + -- most likely a missing 'Access. Don't try to resolve the parameterless + -- call, error will be caught when the outer call is analyzed. if Is_Entity_Name (N) and then Ekind (Entity (N)) = E_Procedure and then not Is_Overloaded (N) and then - (Nkind (Parent (N)) = N_Parameter_Association - or else Nkind (Parent (N)) = N_Function_Call - or else Nkind (Parent (N)) = N_Procedure_Call_Statement) + Nkind_In (Parent (N), N_Parameter_Association, + N_Function_Call, + N_Procedure_Call_Statement) then return; end if; - -- Rewrite as call if overloadable entity that is (or could be, in - -- the overloaded case) a function call. If we know for sure that - -- the entity is an enumeration literal, we do not rewrite it. + -- Rewrite as call if overloadable entity that is (or could be, in the + -- overloaded case) a function call. If we know for sure that the entity + -- is an enumeration literal, we do not rewrite it. if (Is_Entity_Name (N) and then Is_Overloadable (Entity (N)) @@ -989,7 +985,7 @@ package body Sem_Res is or else Is_Overloaded (N))) -- Rewrite as call if it is an explicit deference of an expression of - -- a subprogram access type, and the suprogram type is not that of a + -- a subprogram access type, and the subprogram type is not that of a -- procedure or entry. or else @@ -1386,7 +1382,19 @@ package body Sem_Res is Set_Entity (Op_Node, Op_Id); Generate_Reference (Op_Id, N, ' '); - Rewrite (N, Op_Node); + + -- Do rewrite setting Comes_From_Source on the result if the original + -- call came from source. Although it is not strictly the case that the + -- operator as such comes from the source, logically it corresponds + -- exactly to the function call in the source, so it should be marked + -- this way (e.g. to make sure that validity checks work fine). + + declare + CS : constant Boolean := Comes_From_Source (N); + begin + Rewrite (N, Op_Node); + Set_Comes_From_Source (N, CS); + end; -- If this is an arithmetic operator and the result type is private, -- the operands and the result must be wrapped in conversion to @@ -1487,11 +1495,11 @@ package body Sem_Res is return Kind; end Operator_Kind; - ----------------------------- - -- Pre_Analyze_And_Resolve -- - ----------------------------- + ---------------------------- + -- Preanalyze_And_Resolve -- + ---------------------------- - procedure Pre_Analyze_And_Resolve (N : Node_Id; T : Entity_Id) is + procedure Preanalyze_And_Resolve (N : Node_Id; T : Entity_Id) is Save_Full_Analysis : constant Boolean := Full_Analysis; begin @@ -1506,11 +1514,11 @@ package body Sem_Res is Expander_Mode_Restore; Full_Analysis := Save_Full_Analysis; - end Pre_Analyze_And_Resolve; + end Preanalyze_And_Resolve; -- Version without context type - procedure Pre_Analyze_And_Resolve (N : Node_Id) is + procedure Preanalyze_And_Resolve (N : Node_Id) is Save_Full_Analysis : constant Boolean := Full_Analysis; begin @@ -1522,7 +1530,7 @@ package body Sem_Res is Expander_Mode_Restore; Full_Analysis := Save_Full_Analysis; - end Pre_Analyze_And_Resolve; + end Preanalyze_And_Resolve; ---------------------------------- -- Replace_Actual_Discriminants -- @@ -1647,6 +1655,7 @@ package body Sem_Res is Intval => UR_To_Uint (Realval (N)))); Set_Etype (N, Universal_Integer); Set_Is_Static_Expression (N); + elsif Nkind (N) = N_String_Literal and then Is_Character_Type (Typ) then @@ -1909,8 +1918,8 @@ package body Sem_Res is -- of the arguments is Any_Type, and if so, suppress -- the message, since it is a cascaded error. - if Nkind (N) = N_Function_Call - or else Nkind (N) = N_Procedure_Call_Statement + if Nkind_In (N, N_Function_Call, + N_Procedure_Call_Statement) then declare A : Node_Id; @@ -2079,14 +2088,14 @@ package body Sem_Res is -- with a name that is an explicit dereference, there is -- nothing to be done at this point. - elsif Nkind (N) = N_Explicit_Dereference - or else Nkind (N) = N_Attribute_Reference - or else Nkind (N) = N_And_Then - or else Nkind (N) = N_Indexed_Component - or else Nkind (N) = N_Or_Else - or else Nkind (N) = N_Range - or else Nkind (N) = N_Selected_Component - or else Nkind (N) = N_Slice + elsif Nkind_In (N, N_Explicit_Dereference, + N_Attribute_Reference, + N_And_Then, + N_Indexed_Component, + N_Or_Else, + N_Range, + N_Selected_Component, + N_Slice) or else Nkind (Name (N)) = N_Explicit_Dereference then null; @@ -2094,8 +2103,7 @@ package body Sem_Res is -- For procedure or function calls, set the type of the name, -- and also the entity pointer for the prefix - elsif (Nkind (N) = N_Procedure_Call_Statement - or else Nkind (N) = N_Function_Call) + elsif Nkind_In (N, N_Procedure_Call_Statement, N_Function_Call) and then (Is_Entity_Name (Name (N)) or else Nkind (Name (N)) = N_Operator_Symbol) then @@ -2379,7 +2387,7 @@ package body Sem_Res is end if; end if; - -- A user-defined operator is tranformed into a function call at + -- A user-defined operator is transformed into a function call at -- this point, so that further processing knows that operators are -- really operators (i.e. are predefined operators). User-defined -- operators that are intrinsic are just renamings of the predefined @@ -2398,8 +2406,8 @@ package body Sem_Res is elsif Present (Alias (Entity (N))) and then - Nkind (Parent (Parent (Entity (N)))) - = N_Subprogram_Renaming_Declaration + Nkind (Parent (Parent (Entity (N)))) = + N_Subprogram_Renaming_Declaration then Rewrite_Renamed_Operator (N, Alias (Entity (N)), Typ); @@ -2613,6 +2621,11 @@ package body Sem_Res is Prev : Node_Id := Empty; Orig_A : Node_Id; + procedure Check_Argument_Order; + -- Performs a check for the case where the actuals are all simple + -- identifiers that correspond to the formal names, but in the wrong + -- order, which is considered suspicious and cause for a warning. + procedure Check_Prefixed_Call; -- If the original node is an overloaded call in prefix notation, -- insert an 'Access or a dereference as needed over the first actual. @@ -2630,6 +2643,119 @@ package body Sem_Res is -- common type. Used to enforce the restrictions on array conversions -- of AI95-00246. + -------------------------- + -- Check_Argument_Order -- + -------------------------- + + procedure Check_Argument_Order is + begin + -- Nothing to do if no parameters, or original node is neither a + -- function call nor a procedure call statement (happens in the + -- operator-transformed-to-function call case), or the call does + -- not come from source, or this warning is off. + + if not Warn_On_Parameter_Order + or else + No (Parameter_Associations (N)) + or else + not Nkind_In (Original_Node (N), N_Procedure_Call_Statement, + N_Function_Call) + or else + not Comes_From_Source (N) + then + return; + end if; + + declare + Nargs : constant Nat := List_Length (Parameter_Associations (N)); + + begin + -- Nothing to do if only one parameter + + if Nargs < 2 then + return; + end if; + + -- Here if at least two arguments + + declare + Actuals : array (1 .. Nargs) of Node_Id; + Actual : Node_Id; + Formal : Node_Id; + + Wrong_Order : Boolean := False; + -- Set True if an out of order case is found + + begin + -- Collect identifier names of actuals, fail if any actual is + -- not a simple identifier, and record max length of name. + + Actual := First (Parameter_Associations (N)); + for J in Actuals'Range loop + if Nkind (Actual) /= N_Identifier then + return; + else + Actuals (J) := Actual; + Next (Actual); + end if; + end loop; + + -- If we got this far, all actuals are identifiers and the list + -- of their names is stored in the Actuals array. + + Formal := First_Formal (Nam); + for J in Actuals'Range loop + + -- If we ran out of formals, that's odd, probably an error + -- which will be detected elsewhere, but abandon the search. + + if No (Formal) then + return; + end if; + + -- If name matches and is in order OK + + if Chars (Formal) = Chars (Actuals (J)) then + null; + + else + -- If no match, see if it is elsewhere in list and if so + -- flag potential wrong order if type is compatible. + + for K in Actuals'Range loop + if Chars (Formal) = Chars (Actuals (K)) + and then + Has_Compatible_Type (Actuals (K), Etype (Formal)) + then + Wrong_Order := True; + goto Continue; + end if; + end loop; + + -- No match + + return; + end if; + + <<Continue>> Next_Formal (Formal); + end loop; + + -- If Formals left over, also probably an error, skip warning + + if Present (Formal) then + return; + end if; + + -- Here we give the warning if something was out of order + + if Wrong_Order then + Error_Msg_N + ("actuals for this call may be in wrong order?", N); + end if; + end; + end; + end Check_Argument_Order; + ------------------------- -- Check_Prefixed_Call -- ------------------------- @@ -2743,7 +2869,7 @@ package body Sem_Res is Set_Parent (Actval, N); -- Resolve aggregates with their base type, to avoid scope - -- anomalies: the subtype was first built in the suprogram + -- anomalies: the subtype was first built in the subprogram -- declaration, and the current call may be nested. if Nkind (Actval) = N_Aggregate @@ -2866,6 +2992,8 @@ package body Sem_Res is -- Start of processing for Resolve_Actuals begin + Check_Argument_Order; + if Present (First_Actual (N)) then Check_Prefixed_Call; end if; @@ -2889,7 +3017,7 @@ package body Sem_Res is -- Case where actual is present - -- If the actual is an entity, generate a reference to it now. We + -- If the actual is an entity, generate a reference to it now. We -- do this before the actual is resolved, because a formal of some -- protected subprogram, or a task discriminant, will be rewritten -- during expansion, and the reference to the source entity may @@ -2906,7 +3034,6 @@ package body Sem_Res is and then Ekind (F) /= E_In_Parameter then Generate_Reference (Orig_A, A, 'm'); - elsif not Is_Overloaded (A) then Generate_Reference (Orig_A, A); end if; @@ -2918,6 +3045,14 @@ package body Sem_Res is or else Chars (Selector_Name (Parent (A))) = Chars (F)) then + -- If style checking mode on, check match of formal name + + if Style_Check then + if Nkind (Parent (A)) = N_Parameter_Association then + Check_Identifier (Selector_Name (Parent (A)), F); + end if; + end if; + -- If the formal is Out or In_Out, do not resolve and expand the -- conversion, because it is subsequently expanded into explicit -- temporaries and assignments. However, the object of the @@ -2941,32 +3076,51 @@ package body Sem_Res is if Has_Aliased_Components (Etype (Expression (A))) /= Has_Aliased_Components (Etype (F)) then - if Ada_Version < Ada_05 then - Error_Msg_N - ("both component types in a view conversion must be" - & " aliased, or neither", A); - -- Ada 2005: rule is relaxed (see AI-363) + -- In a view conversion, the conversion must be legal in + -- both directions, and thus both component types must be + -- aliased, or neither (4.6 (8)). - elsif Has_Aliased_Components (Etype (F)) - and then - not Has_Aliased_Components (Etype (Expression (A))) + -- The additional rule 4.6 (24.9.2) seems unduly + -- restrictive: the privacy requirement should not + -- apply to generic types, and should be checked in + -- an instance. ARG query is in order. + + Error_Msg_N + ("both component types in a view conversion must be" + & " aliased, or neither", A); + + elsif + not Same_Ancestor (Etype (F), Etype (Expression (A))) + then + if Is_By_Reference_Type (Etype (F)) + or else Is_By_Reference_Type (Etype (Expression (A))) then Error_Msg_N - ("view conversion operand must have aliased " & - "components", N); - Error_Msg_N - ("\since target type has aliased components", N); + ("view conversion between unrelated by reference " & + "array types not allowed (\'A'I-00246)", A); + else + declare + Comp_Type : constant Entity_Id := + Component_Type + (Etype (Expression (A))); + begin + if Comes_From_Source (A) + and then Ada_Version >= Ada_05 + and then + ((Is_Private_Type (Comp_Type) + and then not Is_Generic_Type (Comp_Type)) + or else Is_Tagged_Type (Comp_Type) + or else Is_Volatile (Comp_Type)) + then + Error_Msg_N + ("component type of a view conversion cannot" + & " be private, tagged, or volatile" + & " (RM 4.6 (24))", + Expression (A)); + end if; + end; end if; - - elsif not Same_Ancestor (Etype (F), Etype (Expression (A))) - and then - (Is_By_Reference_Type (Etype (F)) - or else Is_By_Reference_Type (Etype (Expression (A)))) - then - Error_Msg_N - ("view conversion between unrelated by reference " & - "array types not allowed (\'A'I-00246)", A); end if; end if; @@ -3024,14 +3178,15 @@ package body Sem_Res is declare DDT : constant Entity_Id := Directly_Designated_Type (Base_Type (Etype (F))); + New_Itype : Entity_Id; + begin if Is_Class_Wide_Type (DDT) and then Is_Interface (DDT) then New_Itype := Create_Itype (E_Anonymous_Access_Type, A); - Set_Etype (New_Itype, Etype (A)); - Init_Size_Align (New_Itype); + Set_Etype (New_Itype, Etype (A)); Set_Directly_Designated_Type (New_Itype, Directly_Designated_Type (Etype (A))); Set_Etype (A, New_Itype); @@ -3043,8 +3198,7 @@ package body Sem_Res is -- enabled only, otherwise the transient scope will not -- be removed in the expansion of the wrapped construct. - if (Is_Controlled (DDT) - or else Has_Task (DDT)) + if (Is_Controlled (DDT) or else Has_Task (DDT)) and then Expander_Active then Establish_Transient_Scope (A, False); @@ -3056,9 +3210,13 @@ package body Sem_Res is -- a tagged synchronized type, declared outside of the type. -- In this case the controlling actual must be converted to -- its corresponding record type, which is the formal type. + -- The actual may be a subtype, either because of a constraint + -- or because it is a generic actual, so use base type to + -- locate concurrent type. if Is_Concurrent_Type (Etype (A)) - and then Etype (F) = Corresponding_Record_Type (Etype (A)) + and then Etype (F) = + Corresponding_Record_Type (Base_Type (Etype (A))) then Rewrite (A, Unchecked_Convert_To @@ -3130,14 +3288,14 @@ package body Sem_Res is if Ekind (F) /= E_In_Parameter then -- For an Out parameter, check for useless assignment. Note - -- that we can't set Last_Assignment this early, because we - -- may kill current values in Resolve_Call, and that call - -- would clobber the Last_Assignment field. + -- that we can't set Last_Assignment this early, because we may + -- kill current values in Resolve_Call, and that call would + -- clobber the Last_Assignment field. - -- Note: call Warn_On_Useless_Assignment before doing the - -- check below for Is_OK_Variable_For_Out_Formal so that the - -- setting of Referenced_As_LHS/Referenced_As_Out_Formal - -- properly reflects the last assignment, not this one! + -- Note: call Warn_On_Useless_Assignment before doing the check + -- below for Is_OK_Variable_For_Out_Formal so that the setting + -- of Referenced_As_LHS/Referenced_As_Out_Formal properly + -- reflects the last assignment, not this one! if Ekind (F) = E_Out_Parameter then if Warn_On_Modified_As_Out_Parameter (F) @@ -3258,8 +3416,8 @@ package body Sem_Res is end if; -- An actual associated with an access parameter is implicitly - -- converted to the anonymous access type of the formal and - -- must satisfy the legality checks for access conversions. + -- converted to the anonymous access type of the formal and must + -- satisfy the legality checks for access conversions. if Ekind (F_Typ) = E_Anonymous_Access_Type then if not Valid_Conversion (A, F_Typ, A) then @@ -3427,7 +3585,7 @@ package body Sem_Res is -- 1) Analyze Top_Record -- 2) Analyze Level_1_Coextension -- 3) Analyze Level_2_Coextension - -- 4) Resolve Level_2_Coextnesion. The allocator is marked as a + -- 4) Resolve Level_2_Coextension. The allocator is marked as a -- coextension. -- 5) Expand Level_2_Coextension. A temporary variable Temp_1 is -- generated to capture the allocated object. Temp_1 is attached @@ -3500,8 +3658,7 @@ package body Sem_Res is function In_Dispatching_Context return Boolean is Par : constant Node_Id := Parent (N); begin - return (Nkind (Par) = N_Function_Call - or else Nkind (Par) = N_Procedure_Call_Statement) + return Nkind_In (Par, N_Function_Call, N_Procedure_Call_Statement) and then Is_Entity_Name (Name (Par)) and then Is_Dispatching_Operation (Entity (Name (Par))); end In_Dispatching_Context; @@ -3518,7 +3675,7 @@ package body Sem_Res is function Process_Allocator (Nod : Node_Id) return Traverse_Result; -- Recognize an allocator or a rewritten allocator node and add it - -- allong with its nested coextensions to the list of Root. + -- along with its nested coextensions to the list of Root. --------------- -- Copy_List -- @@ -3676,7 +3833,7 @@ package body Sem_Res is -- A special accessibility check is needed for allocators that -- constrain access discriminants. The level of the type of the -- expression used to constrain an access discriminant cannot be - -- deeper than the type of the allocator (in constrast to access + -- deeper than the type of the allocator (in contrast to access -- parameters, where the level of the actual can be arbitrary). -- We can't use Valid_Conversion to perform this check because @@ -3691,10 +3848,7 @@ package body Sem_Res is Aggr := Original_Node (Expression (E)); if Has_Discriminants (Subtyp) - and then - (Nkind (Aggr) = N_Aggregate - or else - Nkind (Aggr) = N_Extension_Aggregate) + and then Nkind_In (Aggr, N_Aggregate, N_Extension_Aggregate) then Discrim := First_Discriminant (Base_Type (Subtyp)); @@ -3758,7 +3912,7 @@ package body Sem_Res is -- A special accessibility check is needed for allocators that -- constrain access discriminants. The level of the type of the -- expression used to constrain an access discriminant cannot be - -- deeper than the type of the allocator (in constrast to access + -- deeper than the type of the allocator (in contrast to access -- parameters, where the level of the actual can be arbitrary). -- We can't use Valid_Conversion to perform this check because -- in general the type of the allocator is unrelated to the type @@ -3938,18 +4092,18 @@ package body Sem_Res is -- N is the expression after "delta" in a fixed_point_definition; -- see RM-3.5.9(6): - return Nkind (Parent (N)) = N_Ordinary_Fixed_Point_Definition - or else Nkind (Parent (N)) = N_Decimal_Fixed_Point_Definition + return Nkind_In (Parent (N), N_Ordinary_Fixed_Point_Definition, + N_Decimal_Fixed_Point_Definition, -- N is one of the bounds in a real_range_specification; -- see RM-3.5.7(5): - or else Nkind (Parent (N)) = N_Real_Range_Specification + N_Real_Range_Specification, -- N is the expression of a delta_constraint; -- see RM-J.3(3): - or else Nkind (Parent (N)) = N_Delta_Constraint; + N_Delta_Constraint); end Expected_Type_Is_Any_Real; ----------------------------- @@ -4143,8 +4297,7 @@ package body Sem_Res is -- conversion to a specific fixed-point type (instead the expander -- takes care of the case). - elsif (B_Typ = Universal_Integer - or else B_Typ = Universal_Real) + elsif (B_Typ = Universal_Integer or else B_Typ = Universal_Real) and then Present (Universal_Interpretation (L)) and then Present (Universal_Interpretation (R)) then @@ -4153,15 +4306,14 @@ package body Sem_Res is Set_Etype (N, B_Typ); elsif (B_Typ = Universal_Real - or else Etype (N) = Universal_Fixed - or else (Etype (N) = Any_Fixed - and then Is_Fixed_Point_Type (B_Typ)) - or else (Is_Fixed_Point_Type (B_Typ) - and then (Is_Integer_Or_Universal (L) - or else - Is_Integer_Or_Universal (R)))) - and then (Nkind (N) = N_Op_Multiply or else - Nkind (N) = N_Op_Divide) + or else Etype (N) = Universal_Fixed + or else (Etype (N) = Any_Fixed + and then Is_Fixed_Point_Type (B_Typ)) + or else (Is_Fixed_Point_Type (B_Typ) + and then (Is_Integer_Or_Universal (L) + or else + Is_Integer_Or_Universal (R)))) + and then Nkind_In (N, N_Op_Multiply, N_Op_Divide) then if TL = Universal_Integer or else TR = Universal_Integer then Check_For_Visible_Operator (N, B_Typ); @@ -4189,38 +4341,36 @@ package body Sem_Res is Set_Mixed_Mode_Operand (R, TL); end if; - -- Check the rule in RM05-4.5.5(19.1/2) disallowing the - -- universal_fixed multiplying operators from being used when the - -- expected type is also universal_fixed. Note that B_Typ will be - -- Universal_Fixed in some cases where the expected type is actually - -- Any_Real; Expected_Type_Is_Any_Real takes care of that case. + -- Check the rule in RM05-4.5.5(19.1/2) disallowing universal_fixed + -- multiplying operators from being used when the expected type is + -- also universal_fixed. Note that B_Typ will be Universal_Fixed in + -- some cases where the expected type is actually Any_Real; + -- Expected_Type_Is_Any_Real takes care of that case. if Etype (N) = Universal_Fixed or else Etype (N) = Any_Fixed then if B_Typ = Universal_Fixed and then not Expected_Type_Is_Any_Real (N) - and then Nkind (Parent (N)) /= N_Type_Conversion - and then Nkind (Parent (N)) /= N_Unchecked_Type_Conversion + and then not Nkind_In (Parent (N), N_Type_Conversion, + N_Unchecked_Type_Conversion) then - Error_Msg_N - ("type cannot be determined from context!", N); - Error_Msg_N - ("\explicit conversion to result type required", N); + Error_Msg_N ("type cannot be determined from context!", N); + Error_Msg_N ("\explicit conversion to result type required", N); Set_Etype (L, Any_Type); Set_Etype (R, Any_Type); else if Ada_Version = Ada_83 - and then Etype (N) = Universal_Fixed - and then Nkind (Parent (N)) /= N_Type_Conversion - and then Nkind (Parent (N)) /= N_Unchecked_Type_Conversion + and then Etype (N) = Universal_Fixed + and then not + Nkind_In (Parent (N), N_Type_Conversion, + N_Unchecked_Type_Conversion) then Error_Msg_N - ("(Ada 83) fixed-point operation " & - "needs explicit conversion", - N); + ("(Ada 83) fixed-point operation " + & "needs explicit conversion", N); end if; -- The expected type is "any real type" in contexts like @@ -4239,8 +4389,7 @@ package body Sem_Res is and then (Is_Integer_Or_Universal (L) or else Nkind (L) = N_Real_Literal or else Nkind (R) = N_Real_Literal - or else - Is_Integer_Or_Universal (R)) + or else Is_Integer_Or_Universal (R)) then Set_Etype (N, B_Typ); @@ -4254,7 +4403,8 @@ package body Sem_Res is else if (TL = Universal_Integer or else TL = Universal_Real) - and then (TR = Universal_Integer or else TR = Universal_Real) + and then + (TR = Universal_Integer or else TR = Universal_Real) then Check_For_Visible_Operator (N, B_Typ); end if; @@ -4263,9 +4413,7 @@ package body Sem_Res is -- universal fixed, this is an error, unless there is only one -- applicable fixed_point type (usually duration). - if B_Typ = Universal_Fixed - and then Etype (L) = Universal_Fixed - then + if B_Typ = Universal_Fixed and then Etype (L) = Universal_Fixed then T := Unique_Fixed_Point_Type (N); if T = Any_Type then @@ -4306,19 +4454,17 @@ package body Sem_Res is -- Give warning if explicit division by zero - if (Nkind (N) = N_Op_Divide - or else Nkind (N) = N_Op_Rem - or else Nkind (N) = N_Op_Mod) + if Nkind_In (N, N_Op_Divide, N_Op_Rem, N_Op_Mod) and then not Division_Checks_Suppressed (Etype (N)) then Rop := Right_Opnd (N); if Compile_Time_Known_Value (Rop) and then ((Is_Integer_Type (Etype (Rop)) - and then Expr_Value (Rop) = Uint_0) + and then Expr_Value (Rop) = Uint_0) or else (Is_Real_Type (Etype (Rop)) - and then Expr_Value_R (Rop) = Ureal_0)) + and then Expr_Value_R (Rop) = Ureal_0)) then -- Specialize the warning message according to the operation @@ -4351,6 +4497,38 @@ package body Sem_Res is Activate_Division_Check (N); end if; end if; + + -- If Restriction No_Implicit_Conditionals is active, then it is + -- violated if either operand can be negative for mod, or for rem + -- if both operands can be negative. + + if Restrictions.Set (No_Implicit_Conditionals) + and then Nkind_In (N, N_Op_Rem, N_Op_Mod) + then + declare + Lo : Uint; + Hi : Uint; + OK : Boolean; + + LNeg : Boolean; + RNeg : Boolean; + -- Set if corresponding operand might be negative + + begin + Determine_Range (Left_Opnd (N), OK, Lo, Hi); + LNeg := (not OK) or else Lo < 0; + + Determine_Range (Right_Opnd (N), OK, Lo, Hi); + RNeg := (not OK) or else Lo < 0; + + if (Nkind (N) = N_Op_Rem and then (LNeg and RNeg)) + or else + (Nkind (N) = N_Op_Mod and then (LNeg or RNeg)) + then + Check_Restriction (No_Implicit_Conditionals, N); + end if; + end; + end if; end if; Check_Unset_Reference (L); @@ -4426,8 +4604,7 @@ package body Sem_Res is -- operations use the same circuitry because the name in the call -- can be an arbitrary expression with special resolution rules. - elsif Nkind (Subp) = N_Selected_Component - or else Nkind (Subp) = N_Indexed_Component + elsif Nkind_In (Subp, N_Selected_Component, N_Indexed_Component) or else (Is_Entity_Name (Subp) and then Ekind (Entity (Subp)) = E_Entry) then @@ -4474,11 +4651,16 @@ package body Sem_Res is P := N; loop P := Parent (P); - exit when No (P); + + -- Exclude calls that occur within the default of a formal + -- parameter of the entry, since those are evaluated outside + -- of the body. + + exit when No (P) or else Nkind (P) = N_Parameter_Specification; if Nkind (P) = N_Entry_Body or else (Nkind (P) = N_Subprogram_Body - and then Is_Entry_Barrier_Function (P)) + and then Is_Entry_Barrier_Function (P)) then Rtype := Etype (N); Error_Msg_NE @@ -4540,7 +4722,7 @@ package body Sem_Res is Error_Msg_N ("\cannot call operation that may modify it", N); end if; - -- Freeze the subprogram name if not in default expression. Note that we + -- Freeze the subprogram name if not in a spec-expression. Note that we -- freeze procedure calls as well as function calls. Procedure calls are -- not frozen according to the rules (RM 13.14(14)) because it is -- impossible to have a procedure call to a non-frozen procedure in pure @@ -4548,7 +4730,7 @@ package body Sem_Res is -- needs extending because we can generate procedure calls that need -- freezing. - if Is_Entity_Name (Subp) and then not In_Default_Expression then + if Is_Entity_Name (Subp) and then not In_Spec_Expression then Freeze_Expression (Subp); end if; @@ -4803,12 +4985,14 @@ package body Sem_Res is -- If the subprogram is marked Inline_Always, then even if it returns -- an unconstrained type the call does not require use of the secondary - -- stack. + -- stack. However, inlining will only take place if the body to inline + -- is already present. It may not be available if e.g. the subprogram is + -- declared in a child instance. if Is_Inlined (Nam) - and then Present (First_Rep_Item (Nam)) - and then Nkind (First_Rep_Item (Nam)) = N_Pragma - and then Pragma_Name (First_Rep_Item (Nam)) = Name_Inline_Always + and then Has_Pragma_Inline_Always (Nam) + and then Nkind (Unit_Declaration_Node (Nam)) = N_Subprogram_Declaration + and then Present (Body_To_Inline (Unit_Declaration_Node (Nam))) then null; @@ -4883,8 +5067,14 @@ package body Sem_Res is -- way we still take advantage of the current value information while -- scanning the actuals. - if (not Is_Library_Level_Entity (Nam) - or else Suppress_Value_Tracking_On_Call (Current_Scope)) + -- We suppress killing values if we are processing the nodes associated + -- with N_Freeze_Entity nodes. Otherwise the declaration of a tagged + -- type kills all the values as part of analyzing the code that + -- initializes the dispatch tables. + + if Inside_Freezing_Actions = 0 + and then (not Is_Library_Level_Entity (Nam) + or else Suppress_Value_Tracking_On_Call (Current_Scope)) and then (Comes_From_Source (Nam) or else (Present (Alias (Nam)) and then Comes_From_Source (Alias (Nam)))) @@ -5291,7 +5481,7 @@ package body Sem_Res is and then Comes_From_Source (E) and then No (Constant_Value (E)) and then Is_Frozen (Etype (E)) - and then not In_Default_Expression + and then not In_Spec_Expression and then not Is_Imported (E) then @@ -5852,6 +6042,7 @@ package body Sem_Res is (Corresponding_Equality (Entity (N))) then Eval_Relational_Op (N); + elsif Nkind (N) = N_Op_Ne and then Is_Abstract_Subprogram (Entity (N)) then @@ -6058,7 +6249,7 @@ package body Sem_Res is end if; -- If name was overloaded, set component type correctly now - -- If a misplaced call to an entry family (which has no index typs) + -- If a misplaced call to an entry family (which has no index types) -- return. Error will be diagnosed from calling context. if Is_Array_Type (Array_Type) then @@ -6382,9 +6573,8 @@ package body Sem_Res is -- In the common case of a call which uses an explicitly null -- value for an access parameter, give specialized error msg - if Nkind (Parent (N)) = N_Procedure_Call_Statement - or else - Nkind (Parent (N)) = N_Function_Call + if Nkind_In (Parent (N), N_Procedure_Call_Statement, + N_Function_Call) then Error_Msg_N ("null is not allowed as argument for an access parameter", N); @@ -6642,7 +6832,7 @@ package body Sem_Res is B_Typ : constant Entity_Id := Base_Type (Typ); begin - -- Catch attempts to do fixed-point exponentation with universal + -- Catch attempts to do fixed-point exponentiation with universal -- operands, which is a case where the illegality is not caught during -- normal operator analysis. @@ -6749,7 +6939,7 @@ package body Sem_Res is B_Typ := Base_Type (Typ); end if; - -- Straigtforward case of incorrect arguments + -- Straightforward case of incorrect arguments if not Valid_Boolean_Arg (Typ) then Error_Msg_N ("invalid operand type for operator&", N); @@ -6999,7 +7189,7 @@ package body Sem_Res is -- sequences that otherwise fail to notice the modification. if Is_Entity_Name (P) and then Treat_As_Volatile (Entity (P)) then - Note_Possible_Modification (P); + Note_Possible_Modification (P, Sure => False); end if; end Resolve_Reference; @@ -7223,8 +7413,8 @@ package body Sem_Res is Resolve (L, B_Typ); Resolve (R, B_Typ); - -- Check for issuing warning for always False assert, this happens - -- when assertions are turned off, in which case the pragma Assert + -- Check for issuing warning for always False assert/check, this happens + -- when assertions are turned off, in which case the pragma Assert/Check -- was transformed into: -- if False and then <condition> then ... @@ -7241,6 +7431,7 @@ package body Sem_Res is then declare Orig : constant Node_Id := Original_Node (Parent (N)); + begin if Nkind (Orig) = N_Pragma and then Pragma_Name (Orig) = Name_Assert @@ -7269,6 +7460,29 @@ package body Sem_Res is Error_Msg_N ("?assertion would fail at run-time", Orig); end if; end; + + -- Similar processing for Check pragma + + elsif Nkind (Orig) = N_Pragma + and then Pragma_Name (Orig) = Name_Check + then + -- Don't want to warn if original condition is explicit False + + declare + Expr : constant Node_Id := + Original_Node + (Expression + (Next (First + (Pragma_Argument_Associations (Orig))))); + begin + if Is_Entity_Name (Expr) + and then Entity (Expr) = Standard_False + then + null; + else + Error_Msg_N ("?check would fail at run-time", Orig); + end if; + end; end if; end; end if; @@ -7477,16 +7691,17 @@ package body Sem_Res is elsif Nkind (Parent (N)) = N_Op_Concat and then not Need_Check - and then Nkind (Original_Node (N)) /= N_Character_Literal - and then Nkind (Original_Node (N)) /= N_Attribute_Reference - and then Nkind (Original_Node (N)) /= N_Qualified_Expression - and then Nkind (Original_Node (N)) /= N_Type_Conversion + and then not Nkind_In (Original_Node (N), N_Character_Literal, + N_Attribute_Reference, + N_Qualified_Expression, + N_Type_Conversion) then Subtype_Id := Typ; -- Otherwise we must create a string literal subtype. Note that the -- whole idea of string literal subtypes is simply to avoid the need -- for building a full fledged array subtype for each literal. + else Set_String_Literal_Subtype (N, Typ); Subtype_Id := Etype (N); @@ -7520,8 +7735,8 @@ package body Sem_Res is elsif R_Typ = Any_Character then return; - -- If the type is bit-packed, then we always tranform the string literal - -- into a full fledged aggregate. + -- If the type is bit-packed, then we always transform the string + -- literal into a full fledged aggregate. elsif Is_Bit_Packed_Array (Typ) then null; @@ -7607,10 +7822,8 @@ package body Sem_Res is -- corresponding character aggregate and let the aggregate -- code do the checking. - if R_Typ = Standard_Character - or else R_Typ = Standard_Wide_Character - or else R_Typ = Standard_Wide_Wide_Character - then + if Is_Standard_Character_Type (R_Typ) then + -- Check for the case of full range, where we are definitely OK if Component_Type (Typ) = Base_Type (Component_Type (Typ)) then @@ -7730,10 +7943,10 @@ package body Sem_Res is Set_Etype (Operand, Universal_Real); elsif Is_Numeric_Type (Typ) - and then (Nkind (Operand) = N_Op_Multiply - or else Nkind (Operand) = N_Op_Divide) + and then Nkind_In (Operand, N_Op_Multiply, N_Op_Divide) and then (Etype (Right_Opnd (Operand)) = Universal_Real - or else Etype (Left_Opnd (Operand)) = Universal_Real) + or else + Etype (Left_Opnd (Operand)) = Universal_Real) then -- Return if expression is ambiguous @@ -8039,15 +8252,11 @@ package body Sem_Res is Rorig := Original_Node (Right_Opnd (Norig)); -- We are looking for cases where the right operand is not - -- parenthesized, and is a bianry operator, multiply, divide, or + -- parenthesized, and is a binary operator, multiply, divide, or -- mod. These are the cases where the grouping can affect results. if Paren_Count (Rorig) = 0 - and then (Nkind (Rorig) = N_Op_Mod - or else - Nkind (Rorig) = N_Op_Multiply - or else - Nkind (Rorig) = N_Op_Divide) + and then Nkind_In (Rorig, N_Op_Mod, N_Op_Multiply, N_Op_Divide) then -- For mod, we always give the warning, since the value is -- affected by the parenthesization (e.g. (-5) mod 315 /= @@ -8129,9 +8338,7 @@ package body Sem_Res is -- overflow is impossible (divisor > 1) or we have a case of -- division by zero in any case. - if (Nkind (Rorig) = N_Op_Divide - or else - Nkind (Rorig) = N_Op_Rem) + if Nkind_In (Rorig, N_Op_Divide, N_Op_Rem) and then Compile_Time_Known_Value (Right_Opnd (Rorig)) and then UI_Abs (Expr_Value (Right_Opnd (Rorig))) /= 1 then @@ -8334,7 +8541,6 @@ package body Sem_Res is Set_First_Index (Slice_Subtype, Index); Set_Etype (Slice_Subtype, Base_Type (Etype (N))); Set_Is_Constrained (Slice_Subtype, True); - Init_Size_Align (Slice_Subtype); Check_Compile_Time_Size (Slice_Subtype); @@ -8349,7 +8555,9 @@ package body Sem_Res is -- call to Check_Compile_Time_Size could be eliminated, which would -- be nice, because then that routine could be made private to Freeze. - if Is_Packed (Slice_Subtype) and not In_Default_Expression then + -- Why the test for In_Spec_Expression here ??? + + if Is_Packed (Slice_Subtype) and not In_Spec_Expression then Freeze_Itype (Slice_Subtype, N); end if; @@ -8435,7 +8643,6 @@ package body Sem_Res is Set_First_Index (Array_Subtype, Index); Set_Etype (Array_Subtype, Base_Type (Typ)); Set_Is_Constrained (Array_Subtype, True); - Init_Size_Align (Array_Subtype); Rewrite (N, Make_Unchecked_Type_Conversion (Loc, @@ -8573,7 +8780,6 @@ package body Sem_Res is if Nkind (N) = N_Real_Literal then Error_Msg_NE ("?real literal interpreted as }!", N, T1); - else Error_Msg_NE ("?universal_fixed expression interpreted as }!", N, T1); end if; @@ -8736,11 +8942,12 @@ package body Sem_Res is return False; end if; - -- Check that component subtypes statically match + -- Check that component subtypes statically match. For numeric + -- types this means that both must be either constrained or + -- unconstrained. For enumeration types the bounds must match. + -- All of this is checked in Subtypes_Statically_Match. - if Is_Constrained (Target_Comp_Type) /= - Is_Constrained (Opnd_Comp_Type) - or else not Subtypes_Statically_Match + if not Subtypes_Statically_Match (Target_Comp_Type, Opnd_Comp_Type) then Error_Msg_N @@ -8913,7 +9120,7 @@ package body Sem_Res is -- Also no need to check when in an instance or inlined body, because -- the legality has been established when the template was analyzed. -- Furthermore, numeric conversions may occur where only a private - -- view of the operand type is visible at the instanciation point. + -- view of the operand type is visible at the instantiation point. -- This results in a spurious error if we check that the operand type -- is a numeric type. @@ -8993,7 +9200,7 @@ package body Sem_Res is if Nkind (Operand) = N_Selected_Component and then Object_Access_Level (Operand) > - Type_Access_Level (Target_Type) + Type_Access_Level (Target_Type) then -- In an instance, this is a run-time check, but one we -- know will fail, so generate an appropriate warning. @@ -9016,7 +9223,7 @@ package body Sem_Res is -- The case of a reference to an access discriminant from -- within a limited type declaration (which will appear as -- a discriminal) is always illegal because the level of the - -- discriminant is considered to be deeper than any (namable) + -- discriminant is considered to be deeper than any (nameable) -- access type. if Is_Entity_Name (Operand) @@ -9102,8 +9309,8 @@ package body Sem_Res is -- handles checking the prefix of the operand for this case.) if Nkind (Operand) = N_Selected_Component - and then Object_Access_Level (Operand) - > Type_Access_Level (Target_Type) + and then Object_Access_Level (Operand) > + Type_Access_Level (Target_Type) then -- In an instance, this is a run-time check, but one we -- know will fail, so generate an appropriate warning. @@ -9128,7 +9335,7 @@ package body Sem_Res is -- The case of a reference to an access discriminant from -- within a limited type declaration (which will appear as -- a discriminal) is always illegal because the level of the - -- discriminant is considered to be deeper than any (namable) + -- discriminant is considered to be deeper than any (nameable) -- access type. if Is_Entity_Name (Operand) diff --git a/gcc/ada/sem_res.ads b/gcc/ada/sem_res.ads index 926ccbe8b0b..70b534bf50c 100644 --- a/gcc/ada/sem_res.ads +++ b/gcc/ada/sem_res.ads @@ -6,7 +6,7 @@ -- -- -- S p e c -- -- -- --- Copyright (C) 1992-2007, Free Software Foundation, Inc. -- +-- Copyright (C) 1992-2008, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -103,7 +103,7 @@ package Sem_Res is -- Several forms of names can denote calls to entities without para- -- meters. The context determines whether the name denotes the entity -- or a call to it. When it is a call, the node must be rebuilt - -- accordingly and renalyzed to obtain possible interpretations. + -- accordingly and reanalyzed to obtain possible interpretations. -- -- The name may be that of an overloadable construct, or it can be an -- explicit dereference of a prefix that denotes an access to subprogram. @@ -113,13 +113,13 @@ package Sem_Res is -- -- The parameter T is the Typ for the corresponding resolve call. - procedure Pre_Analyze_And_Resolve (N : Node_Id; T : Entity_Id); - -- Performs a pre-analysis of expression node N. During pre-analysis + procedure Preanalyze_And_Resolve (N : Node_Id; T : Entity_Id); + -- Performs a pre-analysis of expression node N. During pre-analysis, -- N is analyzed and then resolved against type T, but no expansion -- is carried out for N or its children. For more info on pre-analysis -- read the spec of Sem. - procedure Pre_Analyze_And_Resolve (N : Node_Id); + procedure Preanalyze_And_Resolve (N : Node_Id); -- Same, but use type of node because context does not impose a single type private diff --git a/gcc/ada/sem_type.adb b/gcc/ada/sem_type.adb index bff22c411bc..b118c37034a 100644 --- a/gcc/ada/sem_type.adb +++ b/gcc/ada/sem_type.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 1992-2007, Free Software Foundation, Inc. -- +-- Copyright (C) 1992-2008, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -932,7 +932,7 @@ package body Sem_Type is -- The context can be a remote access type, and the expression the -- corresponding source type declared in a categorized package, or - -- viceversa. + -- vice versa. elsif Is_Record_Type (T1) and then (Is_Remote_Call_Interface (T1) @@ -1515,8 +1515,8 @@ package body Sem_Type is end if; -- Check for overloaded CIL convention stuff because the CIL libraries - -- do sick things like Console.Write_Line where it matches - -- two different overloads, so just pick the first ??? + -- do sick things like Console.Write_Line where it matches two different + -- overloads, so just pick the first ??? if Convention (Nam1) = Convention_CIL and then Convention (Nam2) = Convention_CIL diff --git a/gcc/ada/sem_util.adb b/gcc/ada/sem_util.adb index c36805838e6..fd797ca6079 100644 --- a/gcc/ada/sem_util.adb +++ b/gcc/ada/sem_util.adb @@ -205,8 +205,10 @@ package body Sem_Util is Rep : Boolean := True; Warn : Boolean := False) is - Stat : constant Boolean := Is_Static_Expression (N); - Rtyp : Entity_Id; + Stat : constant Boolean := Is_Static_Expression (N); + R_Stat : constant Node_Id := + Make_Raise_Constraint_Error (Sloc (N), Reason => Reason); + Rtyp : Entity_Id; begin if No (Typ) then @@ -225,10 +227,9 @@ package body Sem_Util is -- Now we replace the node by an N_Raise_Constraint_Error node -- This does not need reanalyzing, so set it as analyzed now. - Rewrite (N, - Make_Raise_Constraint_Error (Sloc (N), - Reason => Reason)); + Rewrite (N, R_Stat); Set_Analyzed (N, True); + Set_Etype (N, Rtyp); Set_Raises_Constraint_Error (N); @@ -486,9 +487,13 @@ package body Sem_Util is -- Start of processing for Build_Actual_Subtype_Of_Component begin - if In_Default_Expression then + -- Why the test for Spec_Expression mode here??? + + if In_Spec_Expression then return Empty; + -- More commments for the rest of this body would be good ??? + elsif Nkind (N) = N_Explicit_Dereference then if Is_Composite_Type (T) and then not Is_Constrained (T) @@ -1010,11 +1015,12 @@ package body Sem_Util is ("premature usage of incomplete}", N, First_Subtype (T)); end if; + -- Need comments for these tests ??? + elsif Has_Private_Component (T) and then not Is_Generic_Type (Root_Type (T)) - and then not In_Default_Expression + and then not In_Spec_Expression then - -- Special case: if T is the anonymous type created for a single -- task or protected object, use the name of the source object. @@ -1045,6 +1051,8 @@ package body Sem_Util is -- Currently only enabled for VM back-ends for efficiency, should we -- enable it more systematically ??? + -- Check for Is_Imported needs commenting below ??? + if VM_Target /= No_VM and then (Ekind (Ent) = E_Variable or else @@ -1053,6 +1061,7 @@ package body Sem_Util is Ekind (Ent) = E_Loop_Parameter) and then Scope (Ent) /= Empty and then not Is_Library_Level_Entity (Ent) + and then not Is_Imported (Ent) then if Is_Subprogram (Scop) or else Is_Generic_Subprogram (Scop) @@ -1103,6 +1112,117 @@ package body Sem_Util is end loop; end Check_Potentially_Blocking_Operation; + ------------------------------ + -- Check_Unprotected_Access -- + ------------------------------ + + procedure Check_Unprotected_Access + (Context : Node_Id; + Expr : Node_Id) + is + Cont_Encl_Typ : Entity_Id; + Pref_Encl_Typ : Entity_Id; + + function Enclosing_Protected_Type (Obj : Node_Id) return Entity_Id; + -- Check whether Obj is a private component of a protected object. + -- Return the protected type where the component resides, Empty + -- otherwise. + + function Is_Public_Operation return Boolean; + -- Verify that the enclosing operation is callable from outside the + -- protected object, to minimize false positives. + + ------------------------------ + -- Enclosing_Protected_Type -- + ------------------------------ + + function Enclosing_Protected_Type (Obj : Node_Id) return Entity_Id is + begin + if Is_Entity_Name (Obj) then + declare + Ent : Entity_Id := Entity (Obj); + + begin + -- The object can be a renaming of a private component, use + -- the original record component. + + if Is_Prival (Ent) then + Ent := Prival_Link (Ent); + end if; + + if Is_Protected_Type (Scope (Ent)) then + return Scope (Ent); + end if; + end; + end if; + + -- For indexed and selected components, recursively check the prefix + + if Nkind_In (Obj, N_Indexed_Component, N_Selected_Component) then + return Enclosing_Protected_Type (Prefix (Obj)); + + -- The object does not denote a protected component + + else + return Empty; + end if; + end Enclosing_Protected_Type; + + ------------------------- + -- Is_Public_Operation -- + ------------------------- + + function Is_Public_Operation return Boolean is + S : Entity_Id; + E : Entity_Id; + + begin + S := Current_Scope; + while Present (S) + and then S /= Pref_Encl_Typ + loop + if Scope (S) = Pref_Encl_Typ then + E := First_Entity (Pref_Encl_Typ); + while Present (E) + and then E /= First_Private_Entity (Pref_Encl_Typ) + loop + if E = S then + return True; + end if; + Next_Entity (E); + end loop; + end if; + + S := Scope (S); + end loop; + + return False; + end Is_Public_Operation; + + -- Start of processing for Check_Unprotected_Access + + begin + if Nkind (Expr) = N_Attribute_Reference + and then Attribute_Name (Expr) = Name_Unchecked_Access + then + Cont_Encl_Typ := Enclosing_Protected_Type (Context); + Pref_Encl_Typ := Enclosing_Protected_Type (Prefix (Expr)); + + -- Check whether we are trying to export a protected component to a + -- context with an equal or lower access level. + + if Present (Pref_Encl_Typ) + and then No (Cont_Encl_Typ) + and then Is_Public_Operation + and then Scope_Depth (Pref_Encl_Typ) >= + Object_Access_Level (Context) + then + Error_Msg_N + ("?possible unprotected access to protected data", Expr); + end if; + end if; + end Check_Unprotected_Access; + --------------- -- Check_VMS -- --------------- @@ -1772,6 +1892,42 @@ package body Sem_Util is end if; end Conditional_Delay; + ------------------------- + -- Copy_Parameter_List -- + ------------------------- + + function Copy_Parameter_List (Subp_Id : Entity_Id) return List_Id is + Loc : constant Source_Ptr := Sloc (Subp_Id); + Plist : List_Id; + Formal : Entity_Id; + + begin + if No (First_Formal (Subp_Id)) then + return No_List; + else + Plist := New_List; + Formal := First_Formal (Subp_Id); + while Present (Formal) loop + Append + (Make_Parameter_Specification (Loc, + Defining_Identifier => + Make_Defining_Identifier (Sloc (Formal), + Chars => Chars (Formal)), + In_Present => In_Present (Parent (Formal)), + Out_Present => Out_Present (Parent (Formal)), + Parameter_Type => + New_Reference_To (Etype (Formal), Loc), + Expression => + New_Copy_Tree (Expression (Parent (Formal)))), + Plist); + + Next_Formal (Formal); + end loop; + end if; + + return Plist; + end Copy_Parameter_List; + -------------------- -- Current_Entity -- -------------------- @@ -1987,6 +2143,15 @@ package body Sem_Util is end Denotes_Discriminant; + ---------------------- + -- Denotes_Variable -- + ---------------------- + + function Denotes_Variable (N : Node_Id) return Boolean is + begin + return Is_Variable (N) and then Paren_Count (N) = 0; + end Denotes_Variable; + ----------------------------- -- Depends_On_Discriminant -- ----------------------------- @@ -2259,26 +2424,6 @@ package body Sem_Util is E : constant Entity_Id := Current_Entity_In_Scope (Def_Id); S : constant Entity_Id := Current_Scope; - function Is_Private_Component_Renaming (N : Node_Id) return Boolean; - -- Recognize a renaming declaration that is introduced for private - -- components of a protected type. We treat these as weak declarations - -- so that they are overridden by entities with the same name that - -- come from source, such as formals or local variables of a given - -- protected declaration. - - ----------------------------------- - -- Is_Private_Component_Renaming -- - ----------------------------------- - - function Is_Private_Component_Renaming (N : Node_Id) return Boolean is - begin - return not Comes_From_Source (N) - and then not Comes_From_Source (Current_Scope) - and then Nkind (N) = N_Object_Renaming_Declaration; - end Is_Private_Component_Renaming; - - -- Start of processing for Enter_Name - begin Generate_Definition (Def_Id); @@ -2402,7 +2547,29 @@ package body Sem_Util is then return; - elsif Is_Private_Component_Renaming (Parent (Def_Id)) then + -- If the homograph is a protected component renaming, it should not + -- be hiding the current entity. Such renamings are treated as weak + -- declarations. + + elsif Is_Prival (E) then + Set_Is_Immediately_Visible (E, False); + + -- In this case the current entity is a protected component renaming. + -- Perform minimal decoration by setting the scope and return since + -- the prival should not be hiding other visible entities. + + elsif Is_Prival (Def_Id) then + Set_Scope (Def_Id, Current_Scope); + return; + + -- Analogous to privals, the discriminal generated for an entry + -- index parameter acts as a weak declaration. Perform minimal + -- decoration to avoid bogus errors. + + elsif Is_Discriminal (Def_Id) + and then Ekind (Discriminal_Link (Def_Id)) = E_Entry_Index_Parameter + then + Set_Scope (Def_Id, Current_Scope); return; -- In the body or private part of an instance, a type extension @@ -2411,7 +2578,7 @@ package body Sem_Util is -- of the full type with two components of the same name are not -- clear at this point ??? - elsif In_Instance_Not_Visible then + elsif In_Instance_Not_Visible then null; -- When compiling a package body, some child units may have become @@ -2446,21 +2613,19 @@ package body Sem_Util is and then Nkind (Parent (Def_Id)) = N_Private_Type_Declaration then Error_Msg_N - ("incomplete type cannot be completed" & - " with a private declaration", - Parent (Def_Id)); + ("incomplete type cannot be completed with a private " & + "declaration", Parent (Def_Id)); Set_Is_Immediately_Visible (E, False); Set_Full_View (E, Def_Id); + -- An inherited component of a record conflicts with a new + -- discriminant. The discriminant is inserted first in the scope, + -- but the error should be posted on it, not on the component. + elsif Ekind (E) = E_Discriminant and then Present (Scope (Def_Id)) and then Scope (Def_Id) /= Current_Scope then - -- An inherited component of a record conflicts with - -- a new discriminant. The discriminant is inserted first - -- in the scope, but the error should be posted on it, not - -- on the component. - Error_Msg_Sloc := Sloc (Def_Id); Error_Msg_N ("& conflicts with declaration#", E); return; @@ -2490,8 +2655,8 @@ package body Sem_Util is end if; end if; - if Nkind (Parent (Parent (Def_Id))) - = N_Generic_Subprogram_Declaration + if Nkind (Parent (Parent (Def_Id))) = + N_Generic_Subprogram_Declaration and then Def_Id = Defining_Entity (Specification (Parent (Parent (Def_Id)))) then @@ -2575,7 +2740,7 @@ package body Sem_Util is and then Length_Of_Name (Chars (C)) /= 1 - -- Don't warn for non-source eneities + -- Don't warn for non-source entities and then Comes_From_Source (C) and then Comes_From_Source (Def_Id) @@ -2843,7 +3008,7 @@ package body Sem_Util is (Prim_Params : List_Id; Iface_Params : List_Id) return Boolean; -- Determine whether a subprogram's parameter profile Prim_Params - -- matches that of a potentially overriden interface subprogram + -- matches that of a potentially overridden interface subprogram -- Iface_Params. Also determine if the type of first parameter of -- Iface_Params is an implemented interface. @@ -2922,10 +3087,17 @@ package body Sem_Util is begin Iface_Param := First (Iface_Params); - Iface_Typ := Find_Parameter_Type (Iface_Param); + + if Nkind (Parameter_Type (Iface_Param)) = N_Access_Definition then + Iface_Typ := + Designated_Type (Etype (Defining_Identifier (Iface_Param))); + else + Iface_Typ := Etype (Defining_Identifier (Iface_Param)); + end if; + Prim_Param := First (Prim_Params); - -- The first parameter of the potentially overriden subprogram + -- The first parameter of the potentially overridden subprogram -- must be an interface implemented by Prim. if not Is_Interface (Iface_Typ) @@ -3010,7 +3182,7 @@ package body Sem_Util is return Empty; end if; - -- Traverse the homonym chain, looking at a potentially overriden + -- Traverse the homonym chain, looking at a potentially overridden -- subprogram that belongs to an implemented interface. Hom := First_Hom; @@ -3126,8 +3298,12 @@ package body Sem_Util is if Nkind (Param) /= N_Parameter_Specification then return Empty; + -- For an access parameter, obtain the type from the formal entity + -- itself, because access to subprogram nodes do not carry a type. + -- Shouldn't we always use the formal entity ??? + elsif Nkind (Parameter_Type (Param)) = N_Access_Definition then - return Etype (Subtype_Mark (Parameter_Type (Param))); + return Etype (Defining_Identifier (Param)); else return Etype (Parameter_Type (Param)); @@ -3293,7 +3469,7 @@ package body Sem_Util is begin Res := Internal_Full_Qualified_Name (E); - Store_String_Char (Get_Char_Code (ASCII.nul)); + Store_String_Char (Get_Char_Code (ASCII.NUL)); return End_String; end Full_Qualified_Name; @@ -3541,9 +3717,9 @@ package body Sem_Util is and then not Has_Unknown_Discriminants (Utyp) and then not (Ekind (Utyp) = E_String_Literal_Subtype) then - -- Nothing to do if in default expression + -- Nothing to do if in spec expression (why not???) - if In_Default_Expression then + if In_Spec_Expression then return Typ; elsif Is_Private_Type (Typ) @@ -3661,10 +3837,7 @@ package body Sem_Util is -- literals to search. Instead, an N_Character_Literal node is created -- with the appropriate Char_Code and Chars fields. - if Root_Type (T) = Standard_Character - or else Root_Type (T) = Standard_Wide_Character - or else Root_Type (T) = Standard_Wide_Wide_Character - then + if Is_Standard_Character_Type (T) then Set_Character_Literal_Name (UI_To_CC (Pos)); return Make_Character_Literal (Loc, @@ -3902,7 +4075,7 @@ package body Sem_Util is function Get_Task_Body_Procedure (E : Entity_Id) return Node_Id is begin -- Note: A task type may be the completion of a private type with - -- discriminants. when performing elaboration checks on a task + -- discriminants. When performing elaboration checks on a task -- declaration, the current view of the type may be the private one, -- and the procedure that holds the body of the task is held in its -- underlying type. @@ -4018,9 +4191,17 @@ package body Sem_Util is Comp : Entity_Id; begin + -- Loop to Check components + Comp := First_Component_Or_Discriminant (Typ); while Present (Comp) loop - if Has_Access_Values (Etype (Comp)) then + + -- Check for access component, tag field does not count, even + -- though it is implemented internally using an access type. + + if Has_Access_Values (Etype (Comp)) + and then Chars (Comp) /= Name_uTag + then return True; end if; @@ -4300,7 +4481,7 @@ package body Sem_Util is Set_Result (Unknown); -- Now check size of Expr object. Any size that is not an - -- even multiple of Maxiumum_Alignment is also worrisome + -- even multiple of Maximum_Alignment is also worrisome -- since it may cause the alignment of the object to be less -- than the alignment of the type. @@ -4526,6 +4707,59 @@ package body Sem_Util is end if; end Has_Null_Extension; + ------------------------------- + -- Has_Overriding_Initialize -- + ------------------------------- + + function Has_Overriding_Initialize (T : Entity_Id) return Boolean is + BT : constant Entity_Id := Base_Type (T); + Comp : Entity_Id; + P : Elmt_Id; + + begin + if Is_Controlled (BT) then + + -- For derived types, check immediate ancestor, excluding + -- Controlled itself. + + if Is_Derived_Type (BT) + and then not In_Predefined_Unit (Etype (BT)) + and then Has_Overriding_Initialize (Etype (BT)) + then + return True; + + elsif Present (Primitive_Operations (BT)) then + P := First_Elmt (Primitive_Operations (BT)); + while Present (P) loop + if Chars (Node (P)) = Name_Initialize + and then Comes_From_Source (Node (P)) + then + return True; + end if; + + Next_Elmt (P); + end loop; + end if; + + return False; + + elsif Has_Controlled_Component (BT) then + Comp := First_Component (BT); + while Present (Comp) loop + if Has_Overriding_Initialize (Etype (Comp)) then + return True; + end if; + + Next_Component (Comp); + end loop; + + return False; + + else + return False; + end if; + end Has_Overriding_Initialize; + -------------------------------------- -- Has_Preelaborable_Initialization -- -------------------------------------- @@ -4717,7 +4951,7 @@ package body Sem_Util is then -- Get default expression if any. If there is no declaration -- node, it means we have an internal entity. The parent and - -- tag fields are examples of such entitires. For these cases, + -- tag fields are examples of such entities. For these cases, -- we just test the type of the entity. if Present (Declaration_Node (Ent)) then @@ -4810,24 +5044,9 @@ package body Sem_Util is if Has_PE and then Is_Controlled (E) - and then Present (Primitive_Operations (E)) + and then Has_Overriding_Initialize (E) then - declare - P : Elmt_Id; - - begin - P := First_Elmt (Primitive_Operations (E)); - while Present (P) loop - if Chars (Node (P)) = Name_Initialize - and then Comes_From_Source (Node (P)) - then - Has_PE := False; - exit; - end if; - - Next_Elmt (P); - end loop; - end; + Has_PE := False; end if; -- Record type has PI if it is non private and all components have PI @@ -5131,9 +5350,9 @@ package body Sem_Util is return False; end In_Instance_Visible_Part; - ---------------------- - -- In_Packiage_Body -- - ---------------------- + --------------------- + -- In_Package_Body -- + --------------------- function In_Package_Body return Boolean is S : Entity_Id; @@ -5757,8 +5976,6 @@ package body Sem_Util is T := Base_Type (Etyp); end loop; end if; - - raise Program_Error; end Is_Descendent_Of; -------------- @@ -5920,13 +6137,13 @@ package body Sem_Util is or else No (Expression (Parent (Ent)))) and then not Is_Fully_Initialized_Type (Etype (Ent)) - -- Special VM case for uTag component, which needs to be - -- defined in this case, but is never initialized as VMs + -- Special VM case for tag components, which need to be + -- defined in this case, but are never initialized as VMs -- are using other dispatching mechanisms. Ignore this - -- uninitialized case. + -- uninitialized case. Note that this applies both to the + -- uTag entry and the main vtable pointer (CPP_Class case). - and then (VM_Target = No_VM - or else Chars (Ent) /= Name_uTag) + and then (VM_Target = No_VM or else not Is_Tag (Ent)) then return False; end if; @@ -6176,7 +6393,7 @@ package body Sem_Util is function Is_OK_Variable_For_Out_Formal (AV : Node_Id) return Boolean is begin - Note_Possible_Modification (AV); + Note_Possible_Modification (AV, Sure => True); -- We must reject parenthesized variable names. The check for -- Comes_From_Source is present because there are currently @@ -6220,7 +6437,7 @@ package body Sem_Util is if Is_Variable (Expression (AV)) and then Paren_Count (Expression (AV)) = 0 then - Note_Possible_Modification (Expression (AV)); + Note_Possible_Modification (Expression (AV), Sure => True); return True; -- We also allow a non-parenthesized expression that raises @@ -6408,7 +6625,7 @@ package body Sem_Util is Indx : Node_Id; begin - -- For private type, test corrresponding full type + -- For private type, test corresponding full type if Is_Private_Type (T) then return Is_Potentially_Persistent_Type (Full_View (T)); @@ -7274,7 +7491,7 @@ package body Sem_Util is when N_Type_Conversion => return Known_To_Be_Assigned (P); - -- All other references are definitely not knwon to be modifications + -- All other references are definitely not known to be modifications when others => return False; @@ -7403,7 +7620,7 @@ package body Sem_Util is when N_Type_Conversion => return May_Be_Lvalue (P); - -- Test for appearence in object renaming declaration + -- Test for appearance in object renaming declaration when N_Object_Renaming_Declaration => return True; @@ -7877,7 +8094,7 @@ package body Sem_Util is -- Note_Possible_Modification -- -------------------------------- - procedure Note_Possible_Modification (N : Node_Id) is + procedure Note_Possible_Modification (N : Node_Id; Sure : Boolean) is Modification_Comes_From_Source : constant Boolean := Comes_From_Source (Parent (N)); @@ -7993,6 +8210,35 @@ package body Sem_Util is end if; Kill_Checks (Ent); + + -- If we are sure this is a modification from source, and we know + -- this modifies a constant, then give an appropriate warning. + + if Overlays_Constant (Ent) + and then Modification_Comes_From_Source + and then Sure + then + declare + A : constant Node_Id := Address_Clause (Ent); + begin + if Present (A) then + declare + Exp : constant Node_Id := Expression (A); + begin + if Nkind (Exp) = N_Attribute_Reference + and then Attribute_Name (Exp) = Name_Address + and then Is_Entity_Name (Prefix (Exp)) + then + Error_Msg_Sloc := Sloc (A); + Error_Msg_NE + ("constant& may be modified via address clause#?", + N, Entity (Prefix (Exp))); + end if; + end; + end if; + end; + end if; + return; end if; end loop; @@ -8045,6 +8291,10 @@ package body Sem_Util is if Is_Entity_Name (Obj) then E := Entity (Obj); + if Is_Prival (E) then + E := Prival_Link (E); + end if; + -- If E is a type then it denotes a current instance. For this case -- we add one to the normal accessibility level of the type to ensure -- that current instances are treated as always being deeper than @@ -8578,7 +8828,7 @@ package body Sem_Util is function Clear_Analyzed (N : Node_Id) return Traverse_Result; -- Function used to reset Analyzed flags in tree. Note that we do -- not reset Analyzed flags in entities, since there is no need to - -- renalalyze entities, and indeed, it is wrong to do so, since it + -- reanalyze entities, and indeed, it is wrong to do so, since it -- can result in generating auxiliary stuff more than once. -------------------- @@ -8881,7 +9131,7 @@ package body Sem_Util is -- Scope_Is_Transient -- ------------------------ - function Scope_Is_Transient return Boolean is + function Scope_Is_Transient return Boolean is begin return Scope_Stack.Table (Scope_Stack.Last).Is_Transient; end Scope_Is_Transient; @@ -9113,6 +9363,19 @@ package body Sem_Util is end if; end Set_Next_Actual; + ---------------------------------- + -- Set_Optimize_Alignment_Flags -- + ---------------------------------- + + procedure Set_Optimize_Alignment_Flags (E : Entity_Id) is + begin + if Optimize_Alignment = 'S' then + Set_Optimize_Alignment_Space (E); + elsif Optimize_Alignment = 'T' then + Set_Optimize_Alignment_Time (E); + end if; + end Set_Optimize_Alignment_Flags; + ----------------------- -- Set_Public_Status -- ----------------------- @@ -9120,6 +9383,34 @@ package body Sem_Util is procedure Set_Public_Status (Id : Entity_Id) is S : constant Entity_Id := Current_Scope; + function Within_HSS_Or_If (E : Entity_Id) return Boolean; + -- Determines if E is defined within handled statement sequence or + -- an if statement, returns True if so, False otherwise. + + ---------------------- + -- Within_HSS_Or_If -- + ---------------------- + + function Within_HSS_Or_If (E : Entity_Id) return Boolean is + N : Node_Id; + begin + N := Declaration_Node (E); + loop + N := Parent (N); + + if No (N) then + return False; + + elsif Nkind_In (N, N_Handled_Sequence_Of_Statements, + N_If_Statement) + then + return True; + end if; + end loop; + end Within_HSS_Or_If; + + -- Start of processing for Set_Public_Status + begin -- Everything in the scope of Standard is public @@ -9131,14 +9422,15 @@ package body Sem_Util is elsif not Is_Public (S) then return; - -- An object declaration that occurs in a handled sequence of statements - -- is the declaration for a temporary object generated by the expander. - -- It never needs to be made public and furthermore, making it public - -- can cause back end problems if it is of variable size. + -- An object or function declaration that occurs in a handled sequence + -- of statements or within an if statement is the declaration for a + -- temporary object or local subprogram generated by the expander. It + -- never needs to be made public and furthermore, making it public can + -- cause back end problems. - elsif Nkind (Parent (Id)) = N_Object_Declaration - and then - Nkind (Parent (Parent (Id))) = N_Handled_Sequence_Of_Statements + elsif Nkind_In (Parent (Id), N_Object_Declaration, + N_Function_Specification) + and then Within_HSS_Or_If (Id) then return; @@ -9424,7 +9716,7 @@ package body Sem_Util is Btyp := Root_Type (Btyp); - -- The accessibility level of anonymous acccess types associated with + -- The accessibility level of anonymous access types associated with -- discriminants is that of the current instance of the type, and -- that's deeper than the type itself (AARM 3.10.2 (12.3.21)). diff --git a/gcc/ada/sem_util.ads b/gcc/ada/sem_util.ads index b48c8a95446..a5cb1db6694 100644 --- a/gcc/ada/sem_util.ads +++ b/gcc/ada/sem_util.ads @@ -139,6 +139,13 @@ package Sem_Util is -- N is one of the statement forms that is a potentially blocking -- operation. If it appears within a protected action, emit warning. + procedure Check_Unprotected_Access + (Context : Node_Id; + Expr : Node_Id); + -- Check whether the expression is a pointer to a protected component, + -- and the context is external to the protected operation, to warn against + -- a possible unlocked access to data. + procedure Check_VMS (Construct : Node_Id); -- Check that this the target is OpenVMS, and if so, return with -- no effect, otherwise post an error noting this can only be used @@ -196,6 +203,12 @@ package Sem_Util is -- Sets the Has_Delayed_Freeze flag of New if the Delayed_Freeze flag -- of Old is set and Old has no yet been Frozen (i.e. Is_Frozen is false); + function Copy_Parameter_List (Subp_Id : Entity_Id) return List_Id; + -- Utility to create a parameter profile for a new subprogram spec, + -- when the subprogram has a body that acts as spec. This is done for + -- some cases of inlining, and for private protected ops. Also used + -- to create bodies for stubbed subprograms. + function Current_Entity (N : Node_Id) return Entity_Id; -- Find the currently visible definition for a given identifier, that is to -- say the first entry in the visibility chain for the Chars of N. @@ -232,6 +245,9 @@ package Sem_Util is -- components of protected types, and constraint checks on entry -- families constrained by discriminants. + function Denotes_Variable (N : Node_Id) return Boolean; + -- Returns True if node N denotes a single variable without parentheses. + function Depends_On_Discriminant (N : Node_Id) return Boolean; -- Returns True if N denotes a discriminant or if N is a range, a subtype -- indication or a scalar subtype where one of the bounds is a @@ -425,7 +441,7 @@ package Sem_Util is Pos : Uint; Loc : Source_Ptr) return Entity_Id; -- This function obtains the E_Enumeration_Literal entity for the - -- specified value from the enumneration type or subtype T. The + -- specified value from the enumeration type or subtype T. The -- second argument is the Pos value, which is assumed to be in range. -- The third argument supplies a source location for constructed -- nodes returned by this function. @@ -474,11 +490,13 @@ package Sem_Util is -- declaration. function Has_Access_Values (T : Entity_Id) return Boolean; - -- Returns true if type or subtype T is an access type, or has a - -- component (at any recursive level) that is an access type. This - -- is a conservative predicate, if it is not known whether or not - -- T contains access values (happens for generic formals in some - -- cases), then False is returned. + -- Returns true if type or subtype T is an access type, or has a component + -- (at any recursive level) that is an access type. This is a conservative + -- predicate, if it is not known whether or not T contains access values + -- (happens for generic formals in some cases), then False is returned. + -- Note that tagged types return False. Even though the tag is implemented + -- as an access type internally, this function tests only for access types + -- known to the programmer. See also Has_Tagged_Component. function Has_Abstract_Interfaces (T : Entity_Id; @@ -527,8 +545,12 @@ package Sem_Util is function Has_Null_Exclusion (N : Node_Id) return Boolean; -- Determine whether node N has a null exclusion + function Has_Overriding_Initialize (T : Entity_Id) return Boolean; + -- Predicate to determine whether a controlled type has a user-defined + -- initialize procedure, which makes the type not preelaborable. + function Has_Preelaborable_Initialization (E : Entity_Id) return Boolean; - -- Return True iff type E has preelaborable initialiation as defined in + -- Return True iff type E has preelaborable initialisation as defined in -- Ada 2005 (see AI-161 for details of the definition of this attribute). function Has_Private_Component (Type_Id : Entity_Id) return Boolean; @@ -544,8 +566,11 @@ package Sem_Util is -- if there is no underlying type). function Has_Tagged_Component (Typ : Entity_Id) return Boolean; - -- Typ must be a composite type (array or record). This function is used - -- to check if '=' has to be expanded into a bunch component comparaisons. + -- Returns True if Typ is a composite type (array or record) which is + -- either itself a tagged type, or has a component (recursively) which is + -- a tagged type. Returns False for non-composite type, or if no tagged + -- component is present. This function is used to check if '=' has to be + -- expanded into a bunch component comparisons. function In_Instance return Boolean; -- Returns True if the current scope is within a generic instance @@ -668,7 +693,7 @@ package Sem_Util is -- i.e. a library unit or an entity declared in a library package. function Is_Local_Variable_Reference (Expr : Node_Id) return Boolean; - -- Determines whether Expr is a refeference to a variable or IN OUT + -- Determines whether Expr is a reference to a variable or IN OUT -- mode parameter of the current enclosing subprogram. -- Why are OUT parameters not considered here ??? @@ -725,7 +750,7 @@ package Sem_Util is function Is_Selector_Name (N : Node_Id) return Boolean; -- Given an N_Identifier node N, determines if it is a Selector_Name. -- As described in Sinfo, Selector_Names are special because they - -- represent use of the N_Identifier node for a true identifer, when + -- represent use of the N_Identifier node for a true identifier, when -- normally such nodes represent a direct name. function Is_Statement (N : Node_Id) return Boolean; @@ -773,14 +798,15 @@ package Sem_Util is -- entities in the current scope and in any parent scopes if the current -- scope is a block or a package (and that recursion continues to the top -- scope that is not a block or a package). This is used when the - -- sequential flow-of-control assumption is violated (occurence of a label, - -- head of a loop, or start of an exception handler). The effect of the - -- call is to clear the Constant_Value field (but we do not need to clear - -- the Is_True_Constant flag, since that only gets reset if there really is - -- an assignment somewhere in the entity scope). This procedure also calls - -- Kill_All_Checks, since this is a special case of needing to forget saved - -- values. This procedure also clears Is_Known_Non_Null flags in variables, - -- constants or parameters since these are also not known to be valid. + -- sequential flow-of-control assumption is violated (occurrence of a + -- label, head of a loop, or start of an exception handler). The effect of + -- the call is to clear the Constant_Value field (but we do not need to + -- clear the Is_True_Constant flag, since that only gets reset if there + -- really is an assignment somewhere in the entity scope). This procedure + -- also calls Kill_All_Checks, since this is a special case of needing to + -- forget saved values. This procedure also clears Is_Known_Non_Null flags + -- in variables, constants or parameters since these are also not known to + -- be valid. -- -- The Last_Assignment_Only flag is set True to clear only Last_Assignment -- fields and leave other fields unchanged. This is used when we encounter @@ -801,10 +827,10 @@ package Sem_Util is -- set if you want to clear only the Last_Assignment field (see above). procedure Kill_Size_Check_Code (E : Entity_Id); - -- Called when an address clause or pragma Import is applied to an - -- entity. If the entity is a variable or a constant, and size check - -- code is present, this size check code is killed, since the object - -- will not be allocated by the program. + -- Called when an address clause or pragma Import is applied to an entity. + -- If the entity is a variable or a constant, and size check code is + -- present, this size check code is killed, since the object will not + -- be allocated by the program. function Known_To_Be_Assigned (N : Node_Id) return Boolean; -- The node N is an entity reference. This function determines whether the @@ -889,7 +915,7 @@ package Sem_Util is -- next entry of the Parameter_Associations list. The argument is an -- actual previously returned by a call to First_Actual or Next_Actual. -- Note that the result produced is always an expression, not a parameter - -- assciation node, even if named notation was used. + -- association node, even if named notation was used. procedure Normalize_Actuals (N : Node_Id; @@ -897,16 +923,20 @@ package Sem_Util is Report : Boolean; Success : out Boolean); -- Reorders lists of actuals according to names of formals, value returned - -- in Success indicates sucess of reordering. For more details, see body. + -- in Success indicates success of reordering. For more details, see body. -- Errors are reported only if Report is set to True. - procedure Note_Possible_Modification (N : Node_Id); + procedure Note_Possible_Modification (N : Node_Id; Sure : Boolean); -- This routine is called if the sub-expression N maybe the target of -- an assignment (e.g. it is the left side of an assignment, used as -- an out parameters, or used as prefixes of access attributes). It -- sets May_Be_Modified in the associated entity if there is one, -- taking into account the rule that in the case of renamed objects, -- it is the flag in the renamed object that must be set. + -- + -- The parameter Sure is set True if the modification is sure to occur + -- (e.g. target of assignment, or out parameter), and to False if the + -- modification is only potential (e.g. address of entity taken). function Object_Access_Level (Obj : Node_Id) return Uint; -- Return the accessibility level of the view of the object Obj. @@ -993,7 +1023,7 @@ package Sem_Util is function Same_Object (Node1, Node2 : Node_Id) return Boolean; -- Determine if Node1 and Node2 are known to designate the same object. - -- This is a semantic test and both nodesmust be fully analyzed. A result + -- This is a semantic test and both nodes must be fully analyzed. A result -- of True is decisively correct. A result of False does not necessarily -- mean that different objects are designated, just that this could not -- be reliably determined at compile time. @@ -1057,6 +1087,10 @@ package Sem_Util is -- parameters are already members of a list, and do not need to be -- chained separately. See also First_Actual and Next_Actual. + procedure Set_Optimize_Alignment_Flags (E : Entity_Id); + pragma Inline (Set_Optimize_Alignment_Flags); + -- Sets Optimize_Aliignment_Space/Time flags in E from current settings + procedure Set_Public_Status (Id : Entity_Id); -- If an entity (visible or otherwise) is defined in a library -- package, or a package that is itself public, then this subprogram diff --git a/gcc/ada/sem_warn.adb b/gcc/ada/sem_warn.adb index 81d866f5645..5fe97432e05 100644 --- a/gcc/ada/sem_warn.adb +++ b/gcc/ada/sem_warn.adb @@ -36,6 +36,7 @@ with Opt; use Opt; with Rtsfind; use Rtsfind; with Sem; use Sem; with Sem_Ch8; use Sem_Ch8; +with Sem_Aux; use Sem_Aux; with Sem_Eval; use Sem_Eval; with Sem_Util; use Sem_Util; with Sinfo; use Sinfo; @@ -61,10 +62,10 @@ package body Sem_Warn is -- The following table collects potential warnings for IN OUT parameters -- that are referenced but not modified. These warnings are processed when - -- the front end calls the procedure Output_Non_Modifed_In_Out_Warnings. + -- the front end calls the procedure Output_Non_Modified_In_Out_Warnings. -- The reason that we defer output of these messages is that we want to -- detect the case where the relevant procedure is used as a generic actual - -- in an instantation, since we suppress the warnings in this case. The + -- in an instantiation, since we suppress the warnings in this case. The -- flag Used_As_Generic_Actual will be set in this case, but only at the -- point of usage. Similarly, we suppress the message if the address of the -- procedure is taken, where the flag Address_Taken may be set later. @@ -97,7 +98,7 @@ package body Sem_Warn is -- Instead the following is preferred - -- if somme-other-predicate-on-E + -- if some-other-predicate-on-E -- and then Has_Warnings_Off (E) -- This way if some-other-predicate is false, we avoid a false indication @@ -610,7 +611,7 @@ package body Sem_Warn is (E : Entity_Id; Accept_Statement : Node_Id) return Entity_Id; -- For an entry formal entity from an entry declaration, find the - -- corrsesponding body formal from the given accept statement. + -- corresponding body formal from the given accept statement. function Missing_Subunits return Boolean; -- We suppress warnings when there are missing subunits, because this @@ -1066,7 +1067,7 @@ package body Sem_Warn is -- actual, or its address/access is taken. In these two -- cases, we suppress the warning because the context may -- force use of IN OUT, even if in this particular case - -- the formal is not modifed. + -- the formal is not modified. else In_Out_Warnings.Append (E1); @@ -1173,7 +1174,7 @@ package body Sem_Warn is -- If the selected component comes from expansion, all -- we know is that the entity is not fully initialized -- at the point of the reference. Locate a random - -- unintialized component to get a better message. + -- uninitialized component to get a better message. elsif Nkind (Parent (UR)) = N_Selected_Component then Error_Msg_Node_2 := Selector_Name (Parent (UR)); @@ -1428,7 +1429,7 @@ package body Sem_Warn is end if; -- Recurse into nested package or block. Do not recurse into a - -- formal package, because the correponding body is not analyzed. + -- formal package, because the corresponding body is not analyzed. <<Continue>> if ((Ekind (E1) = E_Package or else Ekind (E1) = E_Generic_Package) @@ -1538,7 +1539,7 @@ package body Sem_Warn is case Nkind (N) is - -- For identifier or exanded name, examine the entity involved + -- For identifier or expanded name, examine the entity involved when N_Identifier | N_Expanded_Name => declare @@ -1635,7 +1636,7 @@ package body Sem_Warn is function Process (N : Node_Id) return Traverse_Result; - -- Process function for instantation of Traverse + -- Process function for instantiation of Traverse -- below. Checks if N contains reference to other -- than a dereference. @@ -1881,7 +1882,7 @@ package body Sem_Warn is -- The only reference to a context unit may be in a renaming -- declaration. If this renaming declares a visible entity, do -- not warn that the context clause could be moved to the body, - -- because the renaming may be intented to re-export the unit. + -- because the renaming may be intended to re-export the unit. ------------------------- -- Check_Inner_Package -- @@ -2513,7 +2514,7 @@ package body Sem_Warn is end if; end No_Warn_On_In_Out; - -- Start of processing for Output_Non_Modifed_In_Out_Warnings + -- Start of processing for Output_Non_Modified_In_Out_Warnings begin -- Loop through entities for which a warning may be needed @@ -2680,31 +2681,15 @@ package body Sem_Warn is -- Output additional warning if present - declare - W : constant Node_Id := Obsolescent_Warning (E); - - begin - if Present (W) then - - -- This is a warning continuation to start on a new line - Name_Buffer (1) := '\'; - Name_Buffer (2) := '\'; - Name_Buffer (3) := '?'; - Name_Len := 3; - - -- Add characters to message, and output message. Note that - -- we quote every character of the message since we don't - -- want to process any insertions. - - for J in 1 .. String_Length (Strval (W)) loop - Add_Char_To_Name_Buffer ('''); - Add_Char_To_Name_Buffer - (Get_Character (Get_String_Char (Strval (W), J))); - end loop; - - Error_Msg_N (Name_Buffer (1 .. Name_Len), N); + for J in Obsolescent_Warnings.First .. Obsolescent_Warnings.Last loop + if Obsolescent_Warnings.Table (J).Ent = E then + String_To_Name_Buffer (Obsolescent_Warnings.Table (J).Msg); + Error_Msg_Strlen := Name_Len; + Error_Msg_String (1 .. Name_Len) := Name_Buffer (1 .. Name_Len); + Error_Msg_N ("\\?~", N); + exit; end if; - end; + end loop; end Output_Obsolescent_Entity_Warnings; ---------------------------------- @@ -2838,12 +2823,50 @@ package body Sem_Warn is when 'C' => Warn_On_Unrepped_Components := False; + when 'e' => + Address_Clause_Overlay_Warnings := True; + Check_Unreferenced := True; + Check_Unreferenced_Formals := True; + Check_Withs := True; + Constant_Condition_Warnings := True; + Elab_Warnings := True; + Implementation_Unit_Warnings := True; + Ineffective_Inline_Warnings := True; + Warn_On_Ada_2005_Compatibility := True; + Warn_On_All_Unread_Out_Parameters := True; + Warn_On_Assertion_Failure := True; + Warn_On_Assumed_Low_Bound := True; + Warn_On_Bad_Fixed_Value := True; + Warn_On_Constant := True; + Warn_On_Deleted_Code := True; + Warn_On_Dereference := True; + Warn_On_Export_Import := True; + Warn_On_Hiding := True; + Ineffective_Inline_Warnings := True; + Warn_On_Modified_Unread := True; + Warn_On_No_Value_Assigned := True; + Warn_On_Non_Local_Exception := True; + Warn_On_Object_Renames_Function := True; + Warn_On_Obsolescent_Feature := True; + Warn_On_Questionable_Missing_Parens := True; + Warn_On_Redundant_Constructs := True; + Warn_On_Unchecked_Conversion := True; + Warn_On_Unrecognized_Pragma := True; + Warn_On_Unrepped_Components := True; + Warn_On_Warnings_Off := True; + when 'o' => Warn_On_All_Unread_Out_Parameters := True; when 'O' => Warn_On_All_Unread_Out_Parameters := False; + when 'p' => + Warn_On_Parameter_Order := True; + + when 'P' => + Warn_On_Parameter_Order := False; + when 'r' => Warn_On_Object_Renames_Function := True; @@ -2892,10 +2915,11 @@ package body Sem_Warn is Warn_On_Modified_Unread := True; Warn_On_No_Value_Assigned := True; Warn_On_Non_Local_Exception := True; + Warn_On_Object_Renames_Function := True; Warn_On_Obsolescent_Feature := True; + Warn_On_Parameter_Order := True; Warn_On_Questionable_Missing_Parens := True; Warn_On_Redundant_Constructs := True; - Warn_On_Object_Renames_Function := True; Warn_On_Unchecked_Conversion := True; Warn_On_Unrecognized_Pragma := True; Warn_On_Unrepped_Components := True; @@ -2922,6 +2946,7 @@ package body Sem_Warn is Warn_On_Non_Local_Exception := False; Warn_On_Obsolescent_Feature := False; Warn_On_All_Unread_Out_Parameters := False; + Warn_On_Parameter_Order := False; Warn_On_Questionable_Missing_Parens := False; Warn_On_Redundant_Constructs := False; Warn_On_Object_Renames_Function := False; @@ -3174,13 +3199,15 @@ package body Sem_Warn is then return; - -- Don't warn in assert pragma, since presumably tests in such - -- a context are very definitely intended, and might well be + -- Don't warn in assert or check pragma, since presumably tests in + -- such a context are very definitely intended, and might well be -- known at compile time. Note that we have to test the original -- node, since assert pragmas get rewritten at analysis time. elsif Nkind (Original_Node (P)) = N_Pragma - and then Pragma_Name (Original_Node (P)) = Name_Assert + and then (Pragma_Name (Original_Node (P)) = Name_Assert + or else + Pragma_Name (Original_Node (P)) = Name_Check) then return; end if; @@ -3265,7 +3292,7 @@ package body Sem_Warn is -- to this lower bound. If not, False is returned, and Low_Bound is -- undefined on return. -- - -- For now, we limite this to standard string types, so any other + -- For now, we limit this to standard string types, so any other -- unconstrained types return False. We may change our minds on this -- later on, but strings seem the most important case. @@ -3342,7 +3369,7 @@ package body Sem_Warn is begin -- Nothing to do if subscript does not come from source (we don't -- want to give garbage warnings on compiler expanded code, e.g. the - -- loops generated for slice assignments. Sucb junk warnings would + -- loops generated for slice assignments. Such junk warnings would -- be placed on source constructs with no subscript in sight!) if not Comes_From_Source (Original_Node (X)) then @@ -3384,7 +3411,7 @@ package body Sem_Warn is -- Tref (Sref) is used to scan the subscript Pctr : Natural; - -- Paretheses counter when scanning subscript + -- Parentheses counter when scanning subscript begin -- Tref (Sref) points to start of subscript @@ -3575,7 +3602,7 @@ package body Sem_Warn is Next_Formal (Form2); end loop; - -- Here all conditionas are met, record possible unset reference + -- Here all conditions are met, record possible unset reference Set_Unset_Reference (Form, Return_Node); end if; @@ -3604,7 +3631,7 @@ package body Sem_Warn is -- Case of variable that is assigned but not read. We suppress -- the message if the variable is volatile, has an address - -- clause, is aliasied, or is a renaming, or is imported. + -- clause, is aliased, or is a renaming, or is imported. if Referenced_As_LHS_Check_Spec (E) and then No (Address_Clause (E)) @@ -3852,7 +3879,7 @@ package body Sem_Warn is -- If we are not at the top level, we regard an inner -- exception handler as a decisive indicator that we should -- not generate the warning, since the variable in question - -- may be acceessed after an exception in the outer block. + -- may be accessed after an exception in the outer block. if Nkind (Parent (P)) /= N_Subprogram_Body and then Nkind (Parent (P)) /= N_Package_Body diff --git a/gcc/ada/sem_warn.ads b/gcc/ada/sem_warn.ads index d78bba96eca..e3daef471ab 100644 --- a/gcc/ada/sem_warn.ads +++ b/gcc/ada/sem_warn.ads @@ -169,7 +169,7 @@ package Sem_Warn is -- should be given for a possible infinite loop, and if so issues it. procedure Warn_On_Known_Condition (C : Node_Id); - -- C is a node for a boolean expression resluting from a relational + -- C is a node for a boolean expression resulting from a relational -- or membership operation. If the expression has a compile time known -- value, then a warning is output if all the following conditions hold: -- diff --git a/gcc/ada/sfn_scan.adb b/gcc/ada/sfn_scan.adb index d3d3dd4904f..538fb5dde8e 100644 --- a/gcc/ada/sfn_scan.adb +++ b/gcc/ada/sfn_scan.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 2000-2005, Free Software Foundation, Inc. -- +-- Copyright (C) 2000-2008, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -40,7 +40,7 @@ package body SFN_Scan is EOF : constant Character := ASCII.SUB; -- The character SUB (16#1A#) is used in DOS and other systems derived - -- from DOS (OS/2, NT etc) to signal the end of a text file. If this + -- from DOS (OS/2, NT etc.) to signal the end of a text file. If this -- character appears as the last character of a file scanned by a call -- to Scan_SFN_Pragmas, then it is ignored, otherwise it is treated as -- an illegal character. @@ -601,7 +601,7 @@ package body SFN_Scan is end if; end loop Skip_Loop; - -- We successfuly skipped to semicolon, so skip past it + -- We successfully skipped to semicolon, so skip past it P := P + 1; end if; diff --git a/gcc/ada/sfn_scan.ads b/gcc/ada/sfn_scan.ads index db086fa9f08..bc9cbcaa555 100644 --- a/gcc/ada/sfn_scan.ads +++ b/gcc/ada/sfn_scan.ads @@ -6,7 +6,7 @@ -- -- -- S p e c -- -- -- --- Copyright (C) 2000-2007, Free Software Foundation, Inc. -- +-- Copyright (C) 2000-2008, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -29,12 +29,12 @@ -- overhead of the full compiler scanner and parser. -- Note that neither the package spec, nor the package body, of this --- unit contains any with statements at all. This is a compeltely +-- unit contains any with statements at all. This is a completely -- independent package, suitable for incorporation into tools that do -- not access any other units in the GNAT compiler or tools sources. -- This package is NOT task safe, so multiple tasks that may call the --- Scan_SFN_Pragmas procedure at the same time are responsibible for +-- Scan_SFN_Pragmas procedure at the same time are responsible for -- avoiding such multiple calls by appropriate synchronization. package SFN_Scan is @@ -91,6 +91,6 @@ package SFN_Scan is -- that includes only pragmas and comments. It does not do a full -- syntax correctness scan by any means, but if it does find anything -- that it can tell is wrong it will immediately raise the exception - -- to indicate the aproximate location of the error + -- to indicate the approximate location of the error end SFN_Scan; diff --git a/gcc/ada/sinfo.adb b/gcc/ada/sinfo.adb index 528d7f43a40..534023f1cab 100644 --- a/gcc/ada/sinfo.adb +++ b/gcc/ada/sinfo.adb @@ -1415,6 +1415,15 @@ package body Sinfo is return Flag11 (N); end Has_Private_View; + function Has_Relative_Deadline_Pragma + (N : Node_Id) return Boolean is + begin + pragma Assert (False + or else NT (N).Nkind = N_Subprogram_Body + or else NT (N).Nkind = N_Task_Definition); + return Flag9 (N); + end Has_Relative_Deadline_Pragma; + function Has_Self_Reference (N : Node_Id) return Boolean is begin @@ -1980,6 +1989,14 @@ package body Sinfo is return Node4 (N); end Next_Named_Actual; + function Next_Pragma + (N : Node_Id) return Node_Id is + begin + pragma Assert (False + or else NT (N).Nkind = N_Pragma); + return Node1 (N); + end Next_Pragma; + function Next_Rep_Item (N : Node_Id) return Node_Id is begin @@ -2184,6 +2201,14 @@ package body Sinfo is return Node4 (N); end Parent_Spec; + function PPC_Enabled + (N : Node_Id) return Boolean is + begin + pragma Assert (False + or else NT (N).Nkind = N_Pragma); + return Flag5 (N); + end PPC_Enabled; + function Position (N : Node_Id) return Node_Id is begin @@ -4154,6 +4179,15 @@ package body Sinfo is Set_Flag11 (N, Val); end Set_Has_Private_View; + procedure Set_Has_Relative_Deadline_Pragma + (N : Node_Id; Val : Boolean := True) is + begin + pragma Assert (False + or else NT (N).Nkind = N_Subprogram_Body + or else NT (N).Nkind = N_Task_Definition); + Set_Flag9 (N, Val); + end Set_Has_Relative_Deadline_Pragma; + procedure Set_Has_Self_Reference (N : Node_Id; Val : Boolean := True) is begin @@ -4719,6 +4753,14 @@ package body Sinfo is Set_Node4 (N, Val); -- semantic field, no parent set end Set_Next_Named_Actual; + procedure Set_Next_Pragma + (N : Node_Id; Val : Node_Id) is + begin + pragma Assert (False + or else NT (N).Nkind = N_Pragma); + Set_Node1 (N, Val); -- semantic field, no parent set + end Set_Next_Pragma; + procedure Set_Next_Rep_Item (N : Node_Id; Val : Node_Id) is begin @@ -4923,6 +4965,14 @@ package body Sinfo is Set_Node4 (N, Val); -- semantic field, no parent set end Set_Parent_Spec; + procedure Set_PPC_Enabled + (N : Node_Id; Val : Boolean := True) is + begin + pragma Assert (False + or else NT (N).Nkind = N_Pragma); + Set_Flag5 (N, Val); + end Set_PPC_Enabled; + procedure Set_Position (N : Node_Id; Val : Node_Id) is begin diff --git a/gcc/ada/sinfo.ads b/gcc/ada/sinfo.ads index 5c131465a92..bcf4eb8a49b 100644 --- a/gcc/ada/sinfo.ads +++ b/gcc/ada/sinfo.ads @@ -384,7 +384,7 @@ package Sinfo is -- In the following node definitions, all fields, both syntactic and -- semantic, are documented. The one exception is in the case of entities - -- (defining indentifiers, character literals and operator symbols), where + -- (defining identifiers, character literals and operator symbols), where -- the usage of the fields depends on the entity kind. Entity fields are -- fully documented in the separate package Einfo. @@ -525,7 +525,7 @@ package Sinfo is -- Present in N_Freeze_Entity nodes for Incomplete or private types. -- Contains the list of access types which may require specific treatment -- when the nature of the type completion is completely known. An example - -- of such treatement is the generation of the associated_final_chain. + -- of such treatment is the generation of the associated_final_chain. -- Actions (List1-Sem) -- This field contains a sequence of actions that are associated with the @@ -581,47 +581,47 @@ package Sinfo is -- elements. -- All_Others (Flag11-Sem) - -- Present in an N_Others_Choice node. This flag is set in the case of an - -- others exception where all exceptions are to be caught, even those - -- that are not normally handled (in particular the tasking abort - -- signal). This is used for translation of the at end handler into a - -- normal exception handler. + -- Present in an N_Others_Choice node. This flag is set for an others + -- exception where all exceptions are to be caught, even those that are + -- not normally handled (in particular the tasking abort signal). This + -- is used for translation of the at end handler into a normal exception + -- handler. -- Assignment_OK (Flag15-Sem) -- This flag is set in a subexpression node for an object, indicating -- that the associated object can be modified, even if this would not -- normally be permissible (either by direct assignment, or by being -- passed as an out or in-out parameter). This is used by the expander - -- for a number of purposes, including initialzation of constants and + -- for a number of purposes, including initialization of constants and -- limited type objects (such as tasks), setting discriminant fields, -- setting tag values, etc. N_Object_Declaration nodes also have this -- flag defined. Here it is used to indicate that an initialization - -- expression is valid, even where it would normally not be allowed (e.g. - -- where the type involved is limited). + -- expression is valid, even where it would normally not be allowed + -- (e.g. where the type involved is limited). -- Associated_Node (Node4-Sem) -- Present in nodes that can denote an entity: identifiers, character -- literals, operator symbols, expanded names, operator nodes, and - -- attribute reference nodes (all these nodes have an Entity field). This - -- field is also present in N_Aggregate, N_Selected_Component, and + -- attribute reference nodes (all these nodes have an Entity field). + -- This field is also present in N_Aggregate, N_Selected_Component, and -- N_Extension_Aggregate nodes. This field is used in generic processing - -- to create links between the generic template and the generic copy. See - -- Sem_Ch12.Get_Associated_Node for full details. Note that this field - -- overlaps Entity, which is fine, since, as explained in Sem_Ch12, the - -- normal function of Entity is not required at the point where the + -- to create links between the generic template and the generic copy. + -- See Sem_Ch12.Get_Associated_Node for full details. Note that this + -- field overlaps Entity, which is fine, since, as explained in Sem_Ch12, + -- the normal function of Entity is not required at the point where the -- Associated_Node is set. Note also, that in generic templates, this -- means that the Entity field does not necessarily point to an Entity. -- Since the back end is expected to ignore generic templates, this is -- harmless. -- At_End_Proc (Node1) - -- This field is present in an N_Handled_Sequence_Of_Statements node. It - -- contains an identifier reference for the cleanup procedure to be + -- This field is present in an N_Handled_Sequence_Of_Statements node. + -- It contains an identifier reference for the cleanup procedure to be -- called. See description of this node for further details. -- Backwards_OK (Flag6-Sem) - -- A flag present in the N_Assignment_Statement node. It is used only if - -- the type being assigned is an array type, and is set if analysis + -- A flag present in the N_Assignment_Statement node. It is used only + -- if the type being assigned is an array type, and is set if analysis -- determines that it is definitely safe to do the copy backwards, i.e. -- starting at the highest addressed element. Note that if neither of the -- flags Forwards_OK or Backwards_OK is set, it means that the front end @@ -637,8 +637,8 @@ package Sinfo is -- which is used directly in later calls to the original subprogram. -- Body_Required (Flag13-Sem) - -- A flag that appears in the N_Compilation_Unit node indicating that the - -- corresponding unit requires a body. For the package case, this + -- A flag that appears in the N_Compilation_Unit node indicating that + -- the corresponding unit requires a body. For the package case, this -- indicates that a completion is required. In Ada 95, if the flag is not -- set for the package case, then a body may not be present. In Ada 83, -- if the flag is not set for the package case, then body is optional. @@ -647,10 +647,9 @@ package Sinfo is -- permitted (in Ada 83 or Ada 95). -- By_Ref (Flag5-Sem) - -- A flag present in N_Simple_Return_Statement and - -- N_Extended_Return_Statement. - -- It is set when the returned expression is already allocated on the - -- secondary stack and thus the result is passed by reference rather + -- Present in N_Simple_Return_Statement and N_Extended_Return_Statement, + -- this flag is set when the returned expression is already allocated on + -- the secondary stack and thus the result is passed by reference rather -- than copied another time. -- Check_Address_Alignment (Flag11-Sem) @@ -668,8 +667,8 @@ package Sinfo is -- Comes_From_Extended_Return_Statement (Flag18-Sem) -- Present in N_Simple_Return_Statement nodes. True if this node was - -- constructed as part of the expansion of an - -- N_Extended_Return_Statement. + -- constructed as part of the N_Extended_Return_Statement expansion. + -- . -- Compile_Time_Known_Aggregate (Flag18-Sem) -- Present in N_Aggregate nodes. Set for aggregates which can be fully @@ -681,28 +680,28 @@ package Sinfo is -- Condition_Actions (List3-Sem) -- This field appears in else-if nodes and in the iteration scheme node -- for while loops. This field is only used during semantic processing to - -- temporarily hold actions inserted into the tree. In the tree passed to - -- gigi, the condition actions field is always set to No_List. For + -- temporarily hold actions inserted into the tree. In the tree passed + -- to gigi, the condition actions field is always set to No_List. For -- details on how this field is used, see the routine Insert_Actions in -- package Exp_Util, and also the expansion routines for the relevant -- nodes. -- Controlling_Argument (Node1-Sem) - -- This field is set in procedure and function call nodes if the call is - -- a dispatching call (it is Empty for a non-dispatching call). It + -- This field is set in procedure and function call nodes if the call + -- is a dispatching call (it is Empty for a non-dispatching call). It -- indicates the source of the call's controlling tag. For procedure -- calls, the Controlling_Argument is one of the actuals. For function -- that has a dispatching result, it is an entity in the context of the - -- call that can provide a tag, or else it is the tag of the root type of - -- the class. It can also specify a tag directly rather than being a + -- call that can provide a tag, or else it is the tag of the root type + -- of the class. It can also specify a tag directly rather than being a -- tagged object. The latter is needed by the implementations of AI-239 -- and AI-260. -- Conversion_OK (Flag14-Sem) - -- A flag set on type conversion nodes to indicate that the conversion is - -- to be considered as being valid, even though it is the case that the - -- conversion is not valid Ada. This is used for Enum_Rep, Fixed_Value - -- and Integer_Value attributes, for internal conversions done for + -- A flag set on type conversion nodes to indicate that the conversion + -- is to be considered as being valid, even though it is the case that + -- the conversion is not valid Ada. This is used for attributes Enum_Rep, + -- Fixed_Value and Integer_Value, for internal conversions done for -- fixed-point operations, and for certain conversions for calls to -- initialization procedures. If Conversion_OK is set, then Etype must be -- set (the analyzer assumes that Etype has been set). For the case of @@ -740,15 +739,15 @@ package Sinfo is -- Corresponding_Spec (Node5-Sem) -- This field is set in subprogram, package, task, and protected body -- nodes, where it points to the defining entity in the corresponding - -- spec. The attribute is also set in N_With_Clause nodes, where it - -- points to the defining entity for the with'ed spec, and in a - -- subprogram renaming declaration when it is a Renaming_As_Body. The - -- field is Empty if there is no corresponding spec, as in the case of a - -- subprogram body that serves as its own spec. + -- spec. The attribute is also set in N_With_Clause nodes where it points + -- to the defining entity for the with'ed spec, and in a subprogram + -- renaming declaration when it is a Renaming_As_Body. The field is Empty + -- if there is no corresponding spec, as in the case of a subprogram body + -- that serves as its own spec. -- Corresponding_Stub (Node3-Sem) -- This field is present in an N_Subunit node. It holds the node in - -- the parent unit that is the stub declaration for the subunit. it is + -- the parent unit that is the stub declaration for the subunit. It is -- set when analysis of the stub forces loading of the proper body. If -- expansion of the proper body creates new declarative nodes, they are -- inserted at the point of the corresponding_stub. @@ -812,10 +811,9 @@ package Sinfo is -- range. -- Do_Range_Check (Flag9-Sem) - -- This flag is set on an expression which appears in a context where - -- a range check is required. The target type is clear from the - -- context. The contexts in which this flag can appear are limited to - -- the following. + -- This flag is set on an expression which appears in a context where a + -- range check is required. The target type is clear from the context. + -- The contexts in which this flag can appear are the following: -- Right side of an assignment. In this case the target type is -- taken from the left side of the assignment, which is referenced @@ -885,11 +883,11 @@ package Sinfo is -- desirable for correct elaboration for this unit. -- Elaboration_Boolean (Node2-Sem) - -- This field is present in function and procedure specification - -- nodes. If set, it points to the entity for a Boolean flag that - -- must be tested for certain calls to check for access before - -- elaboration. See body of Sem_Elab for further details. This - -- field is Empty if no elaboration boolean is required. + -- This field is present in function and procedure specification nodes. + -- If set, it points to the entity for a Boolean flag that must be tested + -- for certain calls to check for access before elaboration. See body of + -- Sem_Elab for further details. This field is Empty if no elaboration + -- boolean is required. -- Else_Actions (List3-Sem) -- This field is present in conditional expression nodes. During code @@ -903,10 +901,10 @@ package Sinfo is -- always set to No_List. -- Enclosing_Variant (Node2-Sem) - -- This field is present in the N_Variant node and identifies the - -- Node_Id corresponding to the immediately enclosing variant when - -- the variant is nested, and N_Empty otherwise. Set during semantic - -- processing of the variant part of a record type. + -- This field is present in the N_Variant node and identifies the Node_Id + -- corresponding to the immediately enclosing variant when the variant is + -- nested, and N_Empty otherwise. Set during semantic processing of the + -- variant part of a record type. -- Entity (Node4-Sem) -- Appears in all direct names (identifiers, character literals, and @@ -989,11 +987,11 @@ package Sinfo is -- left-hand side of individual assignment to each sub-component. -- First_Inlined_Subprogram (Node3-Sem) - -- Present in the N_Compilation_Unit node for the main program. Points to - -- a chain of entities for subprograms that are to be inlined. The + -- Present in the N_Compilation_Unit node for the main program. Points + -- to a chain of entities for subprograms that are to be inlined. The -- Next_Inlined_Subprogram field of these entities is used as a link - -- pointer with Empty marking the end of the list. This field is Empty if - -- there are no inlined subprograms or inlining is not active. + -- pointer with Empty marking the end of the list. This field is Empty + -- if there are no inlined subprograms or inlining is not active. -- First_Named_Actual (Node4-Sem) -- Present in procedure call statement and function call nodes, and also @@ -1014,8 +1012,8 @@ package Sinfo is -- First_Subtype_Link (Node5-Sem) -- Present in N_Freeze_Entity node for an anonymous base type that is - -- implicitly created by the declaration of a first subtype. It points to - -- the entity for the first subtype. + -- implicitly created by the declaration of a first subtype. It points + -- to the entity for the first subtype. -- Float_Truncate (Flag11-Sem) -- A flag present in type conversion nodes. This is used for float to @@ -1024,8 +1022,8 @@ package Sinfo is -- with rounding (see Expand_N_Type_Conversion). -- Forwards_OK (Flag5-Sem) - -- A flag present in the N_Assignment_Statement node. It is used only if - -- the type being assigned is an array type, and is set if analysis + -- A flag present in the N_Assignment_Statement node. It is used only + -- if the type being assigned is an array type, and is set if analysis -- determines that it is definitely safe to do the copy forwards, i.e. -- starting at the lowest addressed element. Note that if neither of the -- flags Forwards_OK or Backwards_OK is set, it means that the front end @@ -1103,6 +1101,10 @@ package Sinfo is -- declarations if the visibility at instantiation is different from the -- visibility at generic definition. + -- Has_Relative_Deadline_Pragma (Flag9-Sem) + -- A flag present in N_Subprogram_Body and N_Task_Definition nodes to + -- flag the presence of a pragma Relative_Deadline. + -- Has_Self_Reference (Flag13-Sem) -- Present in N_Aggregate and N_Extension_Aggregate. Indicates that one -- of the expressions contains an access attribute reference to the @@ -1140,7 +1142,7 @@ package Sinfo is -- Includes_Infinities (Flag11-Sem) -- This flag is present in N_Range nodes. It is set for the range of -- unconstrained float types defined in Standard, which include not only - -- the given range of values, but also legtitimately can include infinite + -- the given range of values, but also legitimately can include infinite -- values. This flag is false for any float type for which an explicit -- range is given by the programmer, even if that range is identical to -- the range for Float. @@ -1189,7 +1191,7 @@ package Sinfo is -- that the reference occurs within a discriminant check. The -- significance is that optimizations based on assuming that the -- discriminant check has a correct value cannot be performed in this - -- case (or the disriminant check may be optimized away!) + -- case (or the discriminant check may be optimized away!) -- Is_Machine_Number (Flag11-Sem) -- This flag is set in an N_Real_Literal node to indicate that the value @@ -1209,7 +1211,7 @@ package Sinfo is -- Is_Power_Of_2_For_Shift (Flag13-Sem) -- A flag present only in N_Op_Expon nodes. It is set when the - -- exponentiation is of the forma 2 ** N, where the type of N is an + -- exponentiation is of the form 2 ** N, where the type of N is an -- unsigned integral subtype whose size does not exceed the size of -- Standard_Integer (i.e. a type that can be safely converted to -- Natural), and the exponentiation appears as the right operand of an @@ -1221,7 +1223,7 @@ package Sinfo is -- Is_Protected_Subprogram_Body (Flag7-Sem) -- A flag set in a Subprogram_Body block to indicate that it is the - -- implemenation of a protected subprogram. Such a body needs cleanup + -- implementation of a protected subprogram. Such a body needs cleanup -- handler to make sure that the associated protected object is unlocked -- when the subprogram completes. @@ -1242,7 +1244,7 @@ package Sinfo is -- A flag set in a Block_Statement node to indicate that it is the -- expansion of a task allocator, or the allocator of an object -- containing tasks. Such a block requires a cleanup handler to call - -- Expunge_Unactivted_Tasks to complete any tasks that have been + -- Expunge_Unactivated_Tasks to complete any tasks that have been -- allocated but not activated when the allocator completes abnormally. -- Is_Task_Master (Flag5-Sem) @@ -1365,6 +1367,17 @@ package Sinfo is -- points to the explicit actual parameter itself, not to the -- N_Parameter_Association node (its parent). + -- Next_Pragma (Node1-Sem) + -- Present in N_Pragma nodes. Used to create a linked list of pragma + -- nodes. Curently used for two purposes: + -- + -- Create a list of linked Check_Policy pragmas. The head of this list + -- is stored in Opt.Check_Policy_List (which has further details). + -- + -- Used by processing for Pre/Postcondition pragmas to store a list of + -- pragmas associated with the spec of a subprogram (see Sem_Prag for + -- details). + -- Next_Rep_Item (Node5-Sem) -- Present in pragma nodes and attribute definition nodes. Used to link -- representation items that apply to an entity. See description of @@ -1380,7 +1393,7 @@ package Sinfo is -- No_Ctrl_Actions (Flag7-Sem) -- Present in N_Assignment_Statement to indicate that no finalize nor nor - -- adjust should take place on this assignment eventhough the rhs is + -- adjust should take place on this assignment even though the rhs is -- controlled. This is used in init procs and aggregate expansions where -- the generated assignments are more initialisations than real -- assignments. @@ -1467,6 +1480,11 @@ package Sinfo is -- package specification. This field is Empty for library bodies (the -- parent spec in this case can be found from the corresponding spec). + -- PPC_Enabled (Flag5-Sem) + -- Present in N_Pragma nodes. This flag is relevant only for precondition + -- and postcondition nodes. It is true if the check corresponding to the + -- pragma type is enabled at the point where the pragma appears. + -- Present_Expr (Uint3-Sem) -- Present in an N_Variant node. This has a meaningful value only after -- Gigi has back annotated the tree with representation information. At @@ -1600,10 +1618,10 @@ package Sinfo is -- on fixed-point operands. It indicates that the operands are to be -- treated as integer values, ignoring small values. This flag is only -- set as a result of expansion of fixed-point operations. Typically a - -- fixed-point multplication in the source generates subsidiary + -- fixed-point multiplication in the source generates subsidiary -- multiplication and division operations that work with the underlying -- integer values and have this flag set. Note that this flag is not - -- needed on other arithmetic operations (add, neg, subtract etc) since + -- needed on other arithmetic operations (add, neg, subtract etc.) since -- in these cases it is always the case that fixed is treated as integer. -- The Etype field MUST be set if this flag is set. The analyzer knows to -- leave such nodes alone, and whoever makes them must set the correct @@ -1634,7 +1652,7 @@ package Sinfo is -- Zero_Cost_Handling (Flag5-Sem) -- This flag is set in all handled sequence of statement and exception - -- handler nodes if eceptions are to be handled using the zero-cost + -- handler nodes if exceptions are to be handled using the zero-cost -- mechanism (see Ada.Exceptions and System.Exceptions in files -- a-except.ads/adb and s-except.ads for full details). What gigi needs -- to do for such a handler is simply to put the code in the handler @@ -1883,10 +1901,12 @@ package Sinfo is -- N_Pragma -- Sloc points to pragma identifier + -- Next_Pragma (Node1-Sem) -- Pragma_Argument_Associations (List2) (set to No_List if none) -- Debug_Statement (Node3) (set to Empty if not Debug, Assert) -- Pragma_Identifier (Node4) -- Next_Rep_Item (Node5-Sem) + -- PPC_Enabled (Flag5-Sem) -- Note: we should have a section on what pragmas are passed on to -- the back end to be processed. This section should note that pragma @@ -2123,7 +2143,7 @@ package Sinfo is -- the Expression may not have the form of an aggregate (since this -- might cause the back end to generate separate assignments). It -- also cannot be a reference to an object marked as a true constant - -- (Is_True_Constant flag set), where the object is itself initalized + -- (Is_True_Constant flag set), where the object is itself initialized -- with an aggregate. If necessary the front end must generate an -- extra temporary (with Is_True_Constant set False), and initialize -- this temporary as required (the temporary itself is not atomic). @@ -3093,7 +3113,7 @@ package Sinfo is -- limited types for which no stream routines exist officially. In such -- case, the result is to use the stream attribute for the underlying -- full type, or in the case of a protected type, the components - -- (including any disriminants) are merely streamed in order. + -- (including any discriminants) are merely streamed in order. -- See Exp_Attr for a complete description of which attributes are -- passed onto Gigi, and which are handled entirely by the front end. @@ -3245,9 +3265,9 @@ package Sinfo is -- node (which appears as a singleton list). Box_Present gives support -- to Ada 2005 (AI-287). - ----------------------------------- - -- 4.3.1 Commponent Choice List -- - ----------------------------------- + ---------------------------------- + -- 4.3.1 Cmmponent Choice List -- + ---------------------------------- -- COMPONENT_CHOICE_LIST ::= -- component_SELECTOR_NAME {| component_SELECTOR_NAME} @@ -3342,7 +3362,7 @@ package Sinfo is -- No nodes are generated for any of these constructs. Instead, the -- node for the operator appears directly. When we refer to an -- expression in this description, we mean any of the possible - -- consistuent components of an expression (e.g. identifier is + -- constituent components of an expression (e.g. identifier is -- an example of an expression). ------------------ @@ -3374,8 +3394,8 @@ package Sinfo is -- subexpression node (it is actually present in all nodes, but only -- used in subexpression nodes). This count records the number of -- levels of parentheses. If the number of levels in the source exceeds - -- the maximum accomodated by this count, then the count is simply left - -- at the maximum value. This means that there are some pathalogical + -- the maximum accommodated by this count, then the count is simply left + -- at the maximum value. This means that there are some pathological -- cases of failure to detect conformance failures (e.g. an expression -- with 500 levels of parens will conform with one with 501 levels), -- but we do not need to lose sleep over this. @@ -3712,7 +3732,7 @@ package Sinfo is -- Note: Although the parser will not accept a declaration as a -- statement, the semantic analyzer may insert declarations (e.g. -- declarations of implicit types needed for execution of other - -- statements) into a sequence of statements, so the code genmerator + -- statements) into a sequence of statements, so the code generator -- should be prepared to accept a declaration where a statement is -- expected. Note also that pragmas can appear as statements. @@ -3780,7 +3800,7 @@ package Sinfo is -- 5.1 Statement Identifier -- ------------------------------- - -- STATEMENT_INDENTIFIER ::= DIRECT_NAME + -- STATEMENT_IDENTIFIER ::= DIRECT_NAME -- The IDENTIFIER of a STATEMENT_IDENTIFIER shall be an identifier -- (not an OPERATOR_SYMBOL) @@ -3811,7 +3831,7 @@ package Sinfo is -- the Expression may not have the form of an aggregate (since this -- might cause the back end to generate separate assignments). It -- also cannot be a reference to an object marked as a true constant - -- (Is_True_Constant flag set), where the object is itself initalized + -- (Is_True_Constant flag set), where the object is itself initialized -- with an aggregate. If necessary the front end must generate an -- extra temporary (with Is_True_Constant set False), and initialize -- this temporary as required (the temporary itself is not atomic). @@ -4274,6 +4294,7 @@ package Sinfo is -- Is_Entry_Barrier_Function (Flag8-Sem) -- Is_Task_Master (Flag5-Sem) -- Was_Originally_Stub (Flag13-Sem) + -- Has_Relative_Deadline_Pragma (Flag9-Sem) ----------------------------------- -- 6.4 Procedure Call Statement -- @@ -4683,7 +4704,7 @@ package Sinfo is -- TASK_TYPE_DECLARATION ::= -- task type DEFINING_IDENTIFIER [KNOWN_DISCRIMINANT_PART] - -- [is [new INTERFACE_LIST with] TASK_DEFINITITION]; + -- [is [new INTERFACE_LIST with] TASK_DEFINITION]; -- N_Task_Type_Declaration -- Sloc points to TASK @@ -4700,7 +4721,7 @@ package Sinfo is -- SINGLE_TASK_DECLARATION ::= -- task DEFINING_IDENTIFIER - -- [is [new INTERFACE_LIST with] TASK_DEFINITITION]; + -- [is [new INTERFACE_LIST with] TASK_DEFINITION]; -- N_Single_Task_Declaration -- Sloc points to TASK @@ -4730,6 +4751,7 @@ package Sinfo is -- Has_Storage_Size_Pragma (Flag5-Sem) -- Has_Task_Info_Pragma (Flag7-Sem) -- Has_Task_Name_Pragma (Flag8-Sem) + -- Has_Relative_Deadline_Pragma (Flag9-Sem) -------------------- -- 9.1 Task Item -- @@ -5088,7 +5110,7 @@ package Sinfo is -- GUARD ::= when CONDITION => -- As noted above, the CONDITION that is part of a GUARD is included - -- in the node for the select alernative for convenience. + -- in the node for the select alternative for convenience. ------------------------------- -- 9.7.1 Select Alternative -- @@ -5284,7 +5306,7 @@ package Sinfo is -- CONTEXT_CLAUSE LIBRARY_ITEM -- | CONTEXT_CLAUSE SUBUNIT - -- The N_Compilation_Unit node itself respresents the above syntax. + -- The N_Compilation_Unit node itself represents the above syntax. -- However, there are two additional items not reflected in the above -- syntax. First we have the global declarations that are added by the -- code generator. These are outer level declarations (so they cannot @@ -5346,17 +5368,17 @@ package Sinfo is -- the declaration or body, and the flag for private if present, -- appear in the N_Compilation_Unit clause. - ---------------------------------------- - -- 10.1.1 Library Unit Declararation -- - ---------------------------------------- + -------------------------------------- + -- 10.1.1 Library Unit Declaration -- + -------------------------------------- -- LIBRARY_UNIT_DECLARATION ::= -- SUBPROGRAM_DECLARATION | PACKAGE_DECLARATION -- | GENERIC_DECLARATION | GENERIC_INSTANTIATION - ------------------------------------------------- - -- 10.1.1 Library Unit Renaming Declararation -- - ------------------------------------------------- + ----------------------------------------------- + -- 10.1.1 Library Unit Renaming Declaration -- + ----------------------------------------------- -- LIBRARY_UNIT_RENAMING_DECLARATION ::= -- PACKAGE_RENAMING_DECLARATION @@ -5525,10 +5547,10 @@ package Sinfo is -- EXCEPTION_DECLARATION ::= DEFINING_IDENTIFIER_LIST : exception; - -- For consistency with object declarations etc, the parser converts + -- For consistency with object declarations etc., the parser converts -- the case of multiple identifiers being declared to a series of -- declarations in which the expression is copied, using the More_Ids - -- and Prev_Ids flags to remember the souce form as described in the + -- and Prev_Ids flags to remember the source form as described in the -- section on "Handling of Defining Identifier Lists". -- N_Exception_Declaration @@ -6582,7 +6604,7 @@ package Sinfo is -- the exception to be raised (i.e. it is equivalent to a raise -- statement that raises the corresponding exception). This use -- is distinguished by the fact that the Etype in this case is - -- Standard_Void_Type, In the subexprssion case, the Etype is the + -- Standard_Void_Type, In the subexpression case, the Etype is the -- same as the type of the subexpression which it replaces. -- If Condition is empty, then the raise is unconditional. If the @@ -6867,7 +6889,7 @@ package Sinfo is -- The following is the definition of the Node_Kind type. As previously -- discussed, this is separated off to allow rearrangement of the order - -- to facilitiate definition of subtype ranges. The comments show the + -- to facilitate definition of subtype ranges. The comments show the -- subtype classes which apply to each set of node kinds. The first -- entry in the comment characterizes the following list of nodes. @@ -7130,7 +7152,7 @@ package Sinfo is N_Null_Statement, N_Raise_Statement, N_Requeue_Statement, - N_Return_Statement, -- renamed as N_Simple_Return_Statement in Sem_Util + N_Return_Statement, -- renamed as N_Simple_Return_Statement below N_Extended_Return_Statement, N_Selective_Accept, N_Timed_Entry_Call, @@ -7848,6 +7870,9 @@ package Sinfo is function Has_Private_View (N : Node_Id) return Boolean; -- Flag11 + function Has_Relative_Deadline_Pragma + (N : Node_Id) return Boolean; -- Flag9 + function Has_Self_Reference (N : Node_Id) return Boolean; -- Flag13 @@ -8028,6 +8053,9 @@ package Sinfo is function Next_Named_Actual (N : Node_Id) return Node_Id; -- Node4 + function Next_Pragma + (N : Node_Id) return Node_Id; -- Node1 + function Next_Rep_Item (N : Node_Id) return Node_Id; -- Node5 @@ -8088,6 +8116,9 @@ package Sinfo is function Parent_Spec (N : Node_Id) return Node_Id; -- Node4 + function PPC_Enabled + (N : Node_Id) return Boolean; -- Flag5 + function Position (N : Node_Id) return Node_Id; -- Node2 @@ -8718,6 +8749,9 @@ package Sinfo is procedure Set_Has_Private_View (N : Node_Id; Val : Boolean := True); -- Flag11 + procedure Set_Has_Relative_Deadline_Pragma + (N : Node_Id; Val : Boolean := True); -- Flag9 + procedure Set_Has_Self_Reference (N : Node_Id; Val : Boolean := True); -- Flag13 @@ -8898,6 +8932,9 @@ package Sinfo is procedure Set_Next_Named_Actual (N : Node_Id; Val : Node_Id); -- Node4 + procedure Set_Next_Pragma + (N : Node_Id; Val : Node_Id); -- Node1 + procedure Set_Next_Rep_Item (N : Node_Id; Val : Node_Id); -- Node5 @@ -8958,6 +8995,9 @@ package Sinfo is procedure Set_Parent_Spec (N : Node_Id; Val : Node_Id); -- Node4 + procedure Set_PPC_Enabled + (N : Node_Id; Val : Boolean := True); -- Flag5 + procedure Set_Position (N : Node_Id; Val : Node_Id); -- Node2 @@ -9180,7 +9220,7 @@ package Sinfo is -- Node_Kind Membership Tests -- -------------------------------- - -- The following functions allow a convenient notation for testing wheter + -- The following functions allow a convenient notation for testing whether -- a Node_Kind value matches any one of a list of possible values. In each -- case True is returned if the given T argument is equal to any of the V -- arguments. Note that there is a similar set of functions defined in @@ -9304,7 +9344,7 @@ package Sinfo is 5 => False), -- Etype (Node5-Sem) N_Pragma => - (1 => True, -- Chars (Name1) + (1 => False, -- Next_Pragma (Node1-Sem) 2 => True, -- Pragma_Argument_Associations (List2) 3 => True, -- Debug_Statement (Node3) 4 => True, -- Pragma_Identifier (Node4) @@ -10941,6 +10981,7 @@ package Sinfo is pragma Inline (Has_No_Elaboration_Code); pragma Inline (Has_Priority_Pragma); pragma Inline (Has_Private_View); + pragma Inline (Has_Relative_Deadline_Pragma); pragma Inline (Has_Storage_Size_Pragma); pragma Inline (Has_Task_Info_Pragma); pragma Inline (Has_Task_Name_Pragma); @@ -11000,6 +11041,7 @@ package Sinfo is pragma Inline (Names); pragma Inline (Next_Entity); pragma Inline (Next_Named_Actual); + pragma Inline (Next_Pragma); pragma Inline (Next_Rep_Item); pragma Inline (Next_Use_Clause); pragma Inline (No_Ctrl_Actions); @@ -11020,6 +11062,7 @@ package Sinfo is pragma Inline (Parameter_List_Truncated); pragma Inline (Parameter_Type); pragma Inline (Parent_Spec); + pragma Inline (PPC_Enabled); pragma Inline (Position); pragma Inline (Pragma_Argument_Associations); pragma Inline (Pragma_Identifier); @@ -11227,6 +11270,7 @@ package Sinfo is pragma Inline (Set_Has_No_Elaboration_Code); pragma Inline (Set_Has_Priority_Pragma); pragma Inline (Set_Has_Private_View); + pragma Inline (Set_Has_Relative_Deadline_Pragma); pragma Inline (Set_Has_Storage_Size_Pragma); pragma Inline (Set_Has_Task_Info_Pragma); pragma Inline (Set_Has_Task_Name_Pragma); @@ -11287,6 +11331,8 @@ package Sinfo is pragma Inline (Set_Names); pragma Inline (Set_Next_Entity); pragma Inline (Set_Next_Named_Actual); + pragma Inline (Set_Next_Pragma); + pragma Inline (Set_Next_Rep_Item); pragma Inline (Set_Next_Use_Clause); pragma Inline (Set_No_Ctrl_Actions); pragma Inline (Set_No_Elaboration_Check); @@ -11306,6 +11352,7 @@ package Sinfo is pragma Inline (Set_Parameter_List_Truncated); pragma Inline (Set_Parameter_Type); pragma Inline (Set_Parent_Spec); + pragma Inline (Set_PPC_Enabled); pragma Inline (Set_Position); pragma Inline (Set_Pragma_Argument_Associations); pragma Inline (Set_Pragma_Identifier); diff --git a/gcc/ada/sinput-d.ads b/gcc/ada/sinput-d.ads index 92a186e2890..138743347d2 100644 --- a/gcc/ada/sinput-d.ads +++ b/gcc/ada/sinput-d.ads @@ -6,7 +6,7 @@ -- -- -- S p e c -- -- -- --- Copyright (C) 2001-2007, Free Software Foundation, Inc. -- +-- Copyright (C) 2001-2008, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -48,7 +48,7 @@ package Sinput.D is -- an end of line character). On entry Loc is the Sloc value previously -- returned by Create_Debug_Source or Write_Debug_Line, and on exit, -- Sloc is updated to point to the start of the next line to be written, - -- taking into account the length of the ternminator that was written by + -- taking into account the length of the terminator that was written by -- Write_Debug_Info. procedure Close_Debug_Source; diff --git a/gcc/ada/sinput-l.adb b/gcc/ada/sinput-l.adb index 79ad7f4043c..eee61f664e0 100644 --- a/gcc/ada/sinput-l.adb +++ b/gcc/ada/sinput-l.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 1992-2007, Free Software Foundation, Inc. -- +-- Copyright (C) 1992-2008, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -55,7 +55,7 @@ package body Sinput.L is -- When a file is to be preprocessed and the options to list symbols -- has been selected (switch -s), Prep.List_Symbols is called with a - -- "foreword", a single line indicationg what source the symbols apply to. + -- "foreword", a single line indicating what source the symbols apply to. -- The following two constant String are the start and the end of this -- foreword. @@ -581,7 +581,7 @@ package body Sinput.L is Source_File.Table (X).Source_Last := Hi; -- Reset Last_Line to 1, because the lines do not - -- have neccessarily the same starts and lengths. + -- have necessarily the same starts and lengths. Source_File.Table (X).Last_Source_Line := 1; end; diff --git a/gcc/ada/sinput-l.ads b/gcc/ada/sinput-l.ads index 270da597474..a72237bab47 100644 --- a/gcc/ada/sinput-l.ads +++ b/gcc/ada/sinput-l.ads @@ -6,7 +6,7 @@ -- -- -- S p e c -- -- -- --- Copyright (C) 1992-2007, Free Software Foundation, Inc. -- +-- Copyright (C) 1992-2008, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -94,7 +94,7 @@ package Sinput.L is -- Inst_Node is the instantiation node, and Template_Id is the defining -- identifier of the generic declaration or body unit as appropriate. -- A is set to an adjustment factor to be used in subsequent calls to - -- Adjust_Instantiation_Sloc. The instantiation mechnaism is also used + -- Adjust_Instantiation_Sloc. The instantiation mechanism is also used -- for inlined function and procedure calls. The parameter Inlined_Body -- is set to True in such cases, and False for a generic instantiation. -- This is used for generating error messages that distinguish these diff --git a/gcc/ada/sinput.adb b/gcc/ada/sinput.adb index bafde45281e..957dfae2625 100644 --- a/gcc/ada/sinput.adb +++ b/gcc/ada/sinput.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 1992-2007, Free Software Foundation, Inc. -- +-- Copyright (C) 1992-2008, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -221,8 +221,6 @@ package body Sinput is Ptr : Source_Ptr; begin - Name_Len := 0; - -- Loop through instantiations Ptr := Loc; @@ -765,17 +763,20 @@ package body Sinput is null; else + -- Free the buffer, we use Free here, because we used malloc + -- or realloc directly to allocate the tables. That is + -- because we were playing the big array trick. We need to + -- suppress the warning for freeing from an empty pool! + -- We have to recreate a proper pointer to the actual array -- from the zero origin pointer stored in the source table. Tmp1 := To_Source_Buffer_Ptr (S.Source_Text (S.Source_First)'Address); + pragma Warnings (Off); Free_Ptr (Tmp1); - - -- Note: we are using free here, because we used malloc - -- or realloc directly to allocate the tables. That is - -- because we were playing the big array trick. + pragma Warnings (On); if S.Lines_Table /= null then Memory.Free (To_Address (S.Lines_Table)); diff --git a/gcc/ada/sinput.ads b/gcc/ada/sinput.ads index db240ff5be1..6d3144092cf 100644 --- a/gcc/ada/sinput.ads +++ b/gcc/ada/sinput.ads @@ -6,7 +6,7 @@ -- -- -- S p e c -- -- -- --- Copyright (C) 1992-2007, Free Software Foundation, Inc. -- +-- Copyright (C) 1992-2008, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -60,7 +60,7 @@ -- reasonable to include this case for consistency. In addition, we recognize -- any of these sequences in any of the operating systems, for better -- behavior in treating foreign files (e.g. a Unix file with LF terminators --- transferred to a DOS system). Finally, wide character codes in cagtegories +-- transferred to a DOS system). Finally, wide character codes in categories -- Separator, Line and Separator, Paragraph are considered to be physical -- line terminators. @@ -162,7 +162,7 @@ package Sinput is -- Note: fields marked read-only are set by Sinput or one of its child -- packages when a source file table entry is created, and cannot be - -- subsqently modified, or alternatively are set only by very special + -- subsequently modified, or alternatively are set only by very special -- circumstances, documented in the comments. -- File_Name : File_Name_Type (read-only) @@ -236,7 +236,7 @@ package Sinput is -- later on in this spec for a description of the checksum algorithm. -- Last_Source_Line : Physical_Line_Number; - -- Physical line number of last source line. Whlie a file is being + -- Physical line number of last source line. While a file is being -- read, this refers to the last line scanned. Once a file has been -- completely scanned, it is the number of the last line in the file, -- and hence also gives the number of source lines in the file. @@ -465,13 +465,13 @@ package Sinput is -- that there definitely is a previous line in the source buffer. procedure Build_Location_String (Loc : Source_Ptr); - -- This function builds a string literal of the form "name:line", - -- where name is the file name corresponding to Loc, and line is - -- the line number. In the event that instantiations are involved, - -- additional suffixes of the same form are appended after the - -- separating string " instantiated at ". The returned string is - -- stored in Name_Buffer, terminated by ASCII.Nul, with Name_Length - -- indicating the length not including the terminating Nul. + -- This function builds a string literal of the form "name:line", where + -- name is the file name corresponding to Loc, and line is the line number. + -- In the event that instantiations are involved, additional suffixes of + -- the same form are appended after the separating string " instantiated at + -- ". The returned string is appended to the Name_Buffer, terminated by + -- ASCII.NUL, with Name_Length indicating the length not including the + -- terminating Nul. function Get_Column_Number (P : Source_Ptr) return Column_Number; -- The ones-origin column number of the specified Source_Ptr value is @@ -517,7 +517,7 @@ package Sinput is function Num_Source_Lines (S : Source_File_Index) return Nat; -- Returns the number of source lines (this is equivalent to reading - -- the value of Last_Source_Line, but returns Nat rathern than a + -- the value of Last_Source_Line, but returns Nat rather than a -- physical line number. procedure Register_Source_Ref_Pragma @@ -703,7 +703,7 @@ private Sloc_Adjust : Source_Ptr; -- A value to be added to Sloc values for this file to reference the -- corresponding lines table. This is zero for the non-instantiation - -- case, and set so that the adition references the ultimate template + -- case, and set so that the addition references the ultimate template -- for the instantiation case. See Sinput-L for further details. Lines_Table : Lines_Table_Ptr; diff --git a/gcc/ada/snames.adb b/gcc/ada/snames.adb index 95fc9b1e4f2..3132f23ebde 100644 --- a/gcc/ada/snames.adb +++ b/gcc/ada/snames.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 1992-2007, Free Software Foundation, Inc. -- +-- Copyright (C) 1992-2008, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -78,8 +78,11 @@ package body Snames is "_local_final_list#" & "_master#" & "_object#" & + "_postconditions#" & "_priority#" & "_process_atsd#" & + "_relative_deadline#" & + "_result#" & "_secondary_stack#" & "_service#" & "_size#" & @@ -145,7 +148,6 @@ package body Snames is "_call#" & "rci_name#" & "receiver#" & - "result#" & "rpc#" & "subp_id#" & "operation#" & @@ -182,6 +184,7 @@ package body Snames is "assertion_policy#" & "c_pass_by_copy#" & "check_name#" & + "check_policy#" & "compile_time_error#" & "compile_time_warning#" & "compiler_unit#" & @@ -207,8 +210,8 @@ package body Snames is "no_strict_aliasing#" & "normalize_scalars#" & "optimize_alignment#" & - "polling#" & "persistent_bss#" & + "polling#" & "priority_specific_dispatching#" & "profile#" & "profile_warnings#" & @@ -239,6 +242,7 @@ package body Snames is "atomic#" & "atomic_components#" & "attach_handler#" & + "check#" & "cil_constructor#" & "comment#" & "common_object#" & @@ -299,6 +303,8 @@ package body Snames is "pack#" & "page#" & "passive#" & + "postcondition#" & + "precondition#" & "preelaborable_initialization#" & "preelaborate#" & "preelaborate_05#" & @@ -306,6 +312,7 @@ package body Snames is "pure#" & "pure_05#" & "pure_function#" & + "relative_deadline#" & "remote_call_interface#" & "remote_types#" & "share_generic#" & @@ -351,10 +358,10 @@ package body Snames is "dll#" & "win32#" & "as_is#" & + "assertion#" & "attribute_name#" & "body_file_name#" & "boolean_entry_barriers#" & - "check#" & "casing#" & "code#" & "component#" & @@ -458,6 +465,7 @@ package body Snames is "emax#" & "enabled#" & "enum_rep#" & + "enum_val#" & "epsilon#" & "exponent#" & "external_tag#" & @@ -468,9 +476,11 @@ package body Snames is "fore#" & "has_access_values#" & "has_discriminants#" & + "has_tagged_values#" & "identity#" & "img#" & "integer_value#" & + "invalid_value#" & "large#" & "last#" & "last_bit#" & @@ -505,6 +515,7 @@ package body Snames is "priority#" & "range#" & "range_length#" & + "result#" & "round#" & "safe_emax#" & "safe_first#" & @@ -576,6 +587,7 @@ package body Snames is "priority_queuing#" & "edf_across_priorities#" & "fifo_within_priorities#" & + "non_preemptive_within_priorities#" & "round_robin_within_priorities#" & "access_check#" & "accessibility_check#" & @@ -679,7 +691,9 @@ package body Snames is "tagged#" & "raise_exception#" & "ada_roots#" & + "aggregate#" & "archive_builder#" & + "archive_builder_append_option#" & "archive_indexer#" & "archive_suffix#" & "binder#" & @@ -695,6 +709,7 @@ package body Snames is "config_file_unique#" & "config_spec_file_name#" & "config_spec_file_name_pattern#" & + "configuration#" & "cross_reference#" & "default_language#" & "default_switches#" & @@ -720,9 +735,11 @@ package body Snames is "include_switches#" & "include_path#" & "include_path_file#" & + "inherit_source_path#" & "language_kind#" & "language_processing#" & "languages#" & + "library#" & "library_ali_dir#" & "library_auto_init#" & "library_auto_init_supported#" & @@ -941,6 +958,8 @@ package body Snames is return Pragma_Interface; elsif N = Name_Priority then return Pragma_Priority; + elsif N = Name_Relative_Deadline then + return Pragma_Relative_Deadline; elsif N = Name_Storage_Size then return Pragma_Storage_Size; elsif N = Name_Storage_Unit then @@ -1130,6 +1149,7 @@ package body Snames is or else N = Name_AST_Entry or else N = Name_Fast_Math or else N = Name_Interface + or else N = Name_Relative_Deadline or else N = Name_Priority or else N = Name_Storage_Size or else N = Name_Storage_Unit; diff --git a/gcc/ada/snames.ads b/gcc/ada/snames.ads index 6a6d0ceb316..4d2a11ecb3e 100644 --- a/gcc/ada/snames.ads +++ b/gcc/ada/snames.ads @@ -6,7 +6,7 @@ -- -- -- S p e c -- -- -- --- Copyright (C) 1992-2007, Free Software Foundation, Inc. -- +-- Copyright (C) 1992-2008, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -161,152 +161,154 @@ package Snames is Name_uLocal_Final_List : constant Name_Id := N + 017; Name_uMaster : constant Name_Id := N + 018; Name_uObject : constant Name_Id := N + 019; - Name_uPriority : constant Name_Id := N + 020; - Name_uProcess_ATSD : constant Name_Id := N + 021; - Name_uSecondary_Stack : constant Name_Id := N + 022; - Name_uService : constant Name_Id := N + 023; - Name_uSize : constant Name_Id := N + 024; - Name_uStack : constant Name_Id := N + 025; - Name_uTags : constant Name_Id := N + 026; - Name_uTask : constant Name_Id := N + 027; - Name_uTask_Id : constant Name_Id := N + 028; - Name_uTask_Info : constant Name_Id := N + 029; - Name_uTask_Name : constant Name_Id := N + 030; - Name_uTrace_Sp : constant Name_Id := N + 031; + Name_uPostconditions : constant Name_Id := N + 020; + Name_uPriority : constant Name_Id := N + 021; + Name_uProcess_ATSD : constant Name_Id := N + 022; + Name_uRelative_Deadline : constant Name_Id := N + 023; + Name_uResult : constant Name_Id := N + 024; + Name_uSecondary_Stack : constant Name_Id := N + 025; + Name_uService : constant Name_Id := N + 026; + Name_uSize : constant Name_Id := N + 027; + Name_uStack : constant Name_Id := N + 028; + Name_uTags : constant Name_Id := N + 029; + Name_uTask : constant Name_Id := N + 030; + Name_uTask_Id : constant Name_Id := N + 031; + Name_uTask_Info : constant Name_Id := N + 032; + Name_uTask_Name : constant Name_Id := N + 033; + Name_uTrace_Sp : constant Name_Id := N + 034; -- Names of predefined primitives used in the expansion of dispatching -- requeue and select statements, Abort, 'Callable and 'Terminated. - Name_uDisp_Asynchronous_Select : constant Name_Id := N + 032; - Name_uDisp_Conditional_Select : constant Name_Id := N + 033; - Name_uDisp_Get_Prim_Op_Kind : constant Name_Id := N + 034; - Name_uDisp_Get_Task_Id : constant Name_Id := N + 035; - Name_uDisp_Requeue : constant Name_Id := N + 036; - Name_uDisp_Timed_Select : constant Name_Id := N + 037; + Name_uDisp_Asynchronous_Select : constant Name_Id := N + 035; + Name_uDisp_Conditional_Select : constant Name_Id := N + 036; + Name_uDisp_Get_Prim_Op_Kind : constant Name_Id := N + 037; + Name_uDisp_Get_Task_Id : constant Name_Id := N + 038; + Name_uDisp_Requeue : constant Name_Id := N + 039; + Name_uDisp_Timed_Select : constant Name_Id := N + 040; -- Names of routines in Ada.Finalization, needed by expander - Name_Initialize : constant Name_Id := N + 038; - Name_Adjust : constant Name_Id := N + 039; - Name_Finalize : constant Name_Id := N + 040; + Name_Initialize : constant Name_Id := N + 041; + Name_Adjust : constant Name_Id := N + 042; + Name_Finalize : constant Name_Id := N + 043; -- Names of fields declared in System.Finalization_Implementation, -- needed by the expander when generating code for finalization. - Name_Next : constant Name_Id := N + 041; - Name_Prev : constant Name_Id := N + 042; + Name_Next : constant Name_Id := N + 044; + Name_Prev : constant Name_Id := N + 045; -- Names of TSS routines for implementation of DSA over PolyORB - Name_uTypeCode : constant Name_Id := N + 043; - Name_uFrom_Any : constant Name_Id := N + 044; - Name_uTo_Any : constant Name_Id := N + 045; + Name_uTypeCode : constant Name_Id := N + 046; + Name_uFrom_Any : constant Name_Id := N + 047; + Name_uTo_Any : constant Name_Id := N + 048; -- Names of allocation routines, also needed by expander - Name_Allocate : constant Name_Id := N + 046; - Name_Deallocate : constant Name_Id := N + 047; - Name_Dereference : constant Name_Id := N + 048; + Name_Allocate : constant Name_Id := N + 049; + Name_Deallocate : constant Name_Id := N + 050; + Name_Dereference : constant Name_Id := N + 051; -- Names of Text_IO generic subpackages (see Rtsfind.Text_IO_Kludge) - First_Text_IO_Package : constant Name_Id := N + 049; - Name_Decimal_IO : constant Name_Id := N + 049; - Name_Enumeration_IO : constant Name_Id := N + 050; - Name_Fixed_IO : constant Name_Id := N + 051; - Name_Float_IO : constant Name_Id := N + 052; - Name_Integer_IO : constant Name_Id := N + 053; - Name_Modular_IO : constant Name_Id := N + 054; - Last_Text_IO_Package : constant Name_Id := N + 054; + First_Text_IO_Package : constant Name_Id := N + 052; + Name_Decimal_IO : constant Name_Id := N + 052; + Name_Enumeration_IO : constant Name_Id := N + 053; + Name_Fixed_IO : constant Name_Id := N + 054; + Name_Float_IO : constant Name_Id := N + 055; + Name_Integer_IO : constant Name_Id := N + 056; + Name_Modular_IO : constant Name_Id := N + 057; + Last_Text_IO_Package : constant Name_Id := N + 057; subtype Text_IO_Package_Name is Name_Id range First_Text_IO_Package .. Last_Text_IO_Package; -- Some miscellaneous names used for error detection/recovery - Name_Const : constant Name_Id := N + 055; - Name_Error : constant Name_Id := N + 056; - Name_Go : constant Name_Id := N + 057; - Name_Put : constant Name_Id := N + 058; - Name_Put_Line : constant Name_Id := N + 059; - Name_To : constant Name_Id := N + 060; + Name_Const : constant Name_Id := N + 058; + Name_Error : constant Name_Id := N + 059; + Name_Go : constant Name_Id := N + 060; + Name_Put : constant Name_Id := N + 061; + Name_Put_Line : constant Name_Id := N + 062; + Name_To : constant Name_Id := N + 063; -- Names for packages that are treated specially by the compiler - Name_Exception_Traces : constant Name_Id := N + 061; - Name_Finalization : constant Name_Id := N + 062; - Name_Finalization_Root : constant Name_Id := N + 063; - Name_Interfaces : constant Name_Id := N + 064; - Name_Most_Recent_Exception : constant Name_Id := N + 065; - Name_Standard : constant Name_Id := N + 066; - Name_System : constant Name_Id := N + 067; - Name_Text_IO : constant Name_Id := N + 068; - Name_Wide_Text_IO : constant Name_Id := N + 069; - Name_Wide_Wide_Text_IO : constant Name_Id := N + 070; + Name_Exception_Traces : constant Name_Id := N + 064; + Name_Finalization : constant Name_Id := N + 065; + Name_Finalization_Root : constant Name_Id := N + 066; + Name_Interfaces : constant Name_Id := N + 067; + Name_Most_Recent_Exception : constant Name_Id := N + 068; + Name_Standard : constant Name_Id := N + 069; + Name_System : constant Name_Id := N + 070; + Name_Text_IO : constant Name_Id := N + 071; + Name_Wide_Text_IO : constant Name_Id := N + 072; + Name_Wide_Wide_Text_IO : constant Name_Id := N + 073; -- Names of implementations of the distributed systems annex - First_PCS_Name : constant Name_Id := N + 071; - Name_No_DSA : constant Name_Id := N + 071; - Name_GARLIC_DSA : constant Name_Id := N + 072; - Name_PolyORB_DSA : constant Name_Id := N + 073; - Last_PCS_Name : constant Name_Id := N + 073; + First_PCS_Name : constant Name_Id := N + 074; + Name_No_DSA : constant Name_Id := N + 074; + Name_GARLIC_DSA : constant Name_Id := N + 075; + Name_PolyORB_DSA : constant Name_Id := N + 076; + Last_PCS_Name : constant Name_Id := N + 076; subtype PCS_Names is Name_Id range First_PCS_Name .. Last_PCS_Name; -- Names of identifiers used in expanding distribution stubs - Name_Addr : constant Name_Id := N + 074; - Name_Async : constant Name_Id := N + 075; - Name_Get_Active_Partition_ID : constant Name_Id := N + 076; - Name_Get_RCI_Package_Receiver : constant Name_Id := N + 077; - Name_Get_RCI_Package_Ref : constant Name_Id := N + 078; - Name_Origin : constant Name_Id := N + 079; - Name_Params : constant Name_Id := N + 080; - Name_Partition : constant Name_Id := N + 081; - Name_Partition_Interface : constant Name_Id := N + 082; - Name_Ras : constant Name_Id := N + 083; - Name_uCall : constant Name_Id := N + 084; - Name_RCI_Name : constant Name_Id := N + 085; - Name_Receiver : constant Name_Id := N + 086; - Name_Result : constant Name_Id := N + 087; - Name_Rpc : constant Name_Id := N + 088; - Name_Subp_Id : constant Name_Id := N + 089; - Name_Operation : constant Name_Id := N + 090; - Name_Argument : constant Name_Id := N + 091; - Name_Arg_Modes : constant Name_Id := N + 092; - Name_Handler : constant Name_Id := N + 093; - Name_Target : constant Name_Id := N + 094; - Name_Req : constant Name_Id := N + 095; - Name_Obj_TypeCode : constant Name_Id := N + 096; - Name_Stub : constant Name_Id := N + 097; + Name_Addr : constant Name_Id := N + 077; + Name_Async : constant Name_Id := N + 078; + Name_Get_Active_Partition_ID : constant Name_Id := N + 079; + Name_Get_RCI_Package_Receiver : constant Name_Id := N + 080; + Name_Get_RCI_Package_Ref : constant Name_Id := N + 081; + Name_Origin : constant Name_Id := N + 082; + Name_Params : constant Name_Id := N + 083; + Name_Partition : constant Name_Id := N + 084; + Name_Partition_Interface : constant Name_Id := N + 085; + Name_Ras : constant Name_Id := N + 086; + Name_uCall : constant Name_Id := N + 087; + Name_RCI_Name : constant Name_Id := N + 088; + Name_Receiver : constant Name_Id := N + 089; + Name_Rpc : constant Name_Id := N + 090; + Name_Subp_Id : constant Name_Id := N + 091; + Name_Operation : constant Name_Id := N + 092; + Name_Argument : constant Name_Id := N + 093; + Name_Arg_Modes : constant Name_Id := N + 094; + Name_Handler : constant Name_Id := N + 095; + Name_Target : constant Name_Id := N + 096; + Name_Req : constant Name_Id := N + 097; + Name_Obj_TypeCode : constant Name_Id := N + 098; + Name_Stub : constant Name_Id := N + 099; -- Operator Symbol entries. The actual names have an upper case O at -- the start in place of the Op_ prefix (e.g. the actual name that -- corresponds to Name_Op_Abs is "Oabs". - First_Operator_Name : constant Name_Id := N + 098; - Name_Op_Abs : constant Name_Id := N + 098; -- "abs" - Name_Op_And : constant Name_Id := N + 099; -- "and" - Name_Op_Mod : constant Name_Id := N + 100; -- "mod" - Name_Op_Not : constant Name_Id := N + 101; -- "not" - Name_Op_Or : constant Name_Id := N + 102; -- "or" - Name_Op_Rem : constant Name_Id := N + 103; -- "rem" - Name_Op_Xor : constant Name_Id := N + 104; -- "xor" - Name_Op_Eq : constant Name_Id := N + 105; -- "=" - Name_Op_Ne : constant Name_Id := N + 106; -- "/=" - Name_Op_Lt : constant Name_Id := N + 107; -- "<" - Name_Op_Le : constant Name_Id := N + 108; -- "<=" - Name_Op_Gt : constant Name_Id := N + 109; -- ">" - Name_Op_Ge : constant Name_Id := N + 110; -- ">=" - Name_Op_Add : constant Name_Id := N + 111; -- "+" - Name_Op_Subtract : constant Name_Id := N + 112; -- "-" - Name_Op_Concat : constant Name_Id := N + 113; -- "&" - Name_Op_Multiply : constant Name_Id := N + 114; -- "*" - Name_Op_Divide : constant Name_Id := N + 115; -- "/" - Name_Op_Expon : constant Name_Id := N + 116; -- "**" - Last_Operator_Name : constant Name_Id := N + 116; + First_Operator_Name : constant Name_Id := N + 100; + Name_Op_Abs : constant Name_Id := N + 100; -- "abs" + Name_Op_And : constant Name_Id := N + 101; -- "and" + Name_Op_Mod : constant Name_Id := N + 102; -- "mod" + Name_Op_Not : constant Name_Id := N + 103; -- "not" + Name_Op_Or : constant Name_Id := N + 104; -- "or" + Name_Op_Rem : constant Name_Id := N + 105; -- "rem" + Name_Op_Xor : constant Name_Id := N + 106; -- "xor" + Name_Op_Eq : constant Name_Id := N + 107; -- "=" + Name_Op_Ne : constant Name_Id := N + 108; -- "/=" + Name_Op_Lt : constant Name_Id := N + 109; -- "<" + Name_Op_Le : constant Name_Id := N + 110; -- "<=" + Name_Op_Gt : constant Name_Id := N + 111; -- ">" + Name_Op_Ge : constant Name_Id := N + 112; -- ">=" + Name_Op_Add : constant Name_Id := N + 113; -- "+" + Name_Op_Subtract : constant Name_Id := N + 114; -- "-" + Name_Op_Concat : constant Name_Id := N + 115; -- "&" + Name_Op_Multiply : constant Name_Id := N + 116; -- "*" + Name_Op_Divide : constant Name_Id := N + 117; -- "/" + Name_Op_Expon : constant Name_Id := N + 118; -- "**" + Last_Operator_Name : constant Name_Id := N + 118; -- Names for all pragmas recognized by GNAT. The entries with the comment -- "Ada 83" are pragmas that are defined in Ada 83, but not in Ada 95. @@ -329,31 +331,31 @@ package Snames is -- only in GNAT for the AAMP. They are ignored in other versions with -- appropriate warnings. - First_Pragma_Name : constant Name_Id := N + 117; + First_Pragma_Name : constant Name_Id := N + 119; -- Configuration pragmas are grouped at start - Name_Ada_83 : constant Name_Id := N + 117; -- GNAT - Name_Ada_95 : constant Name_Id := N + 118; -- GNAT - Name_Ada_05 : constant Name_Id := N + 119; -- GNAT - Name_Ada_2005 : constant Name_Id := N + 120; -- GNAT - Name_Assertion_Policy : constant Name_Id := N + 121; -- Ada 05 - Name_C_Pass_By_Copy : constant Name_Id := N + 122; -- GNAT - Name_Check_Name : constant Name_Id := N + 123; -- GNAT - Name_Compile_Time_Error : constant Name_Id := N + 124; -- GNAT - Name_Compile_Time_Warning : constant Name_Id := N + 125; -- GNAT - Name_Compiler_Unit : constant Name_Id := N + 126; -- GNAT - Name_Component_Alignment : constant Name_Id := N + 127; -- GNAT - Name_Convention_Identifier : constant Name_Id := N + 128; -- GNAT - Name_Debug_Policy : constant Name_Id := N + 129; -- GNAT - Name_Detect_Blocking : constant Name_Id := N + 130; -- Ada 05 - Name_Discard_Names : constant Name_Id := N + 131; - Name_Elaboration_Checks : constant Name_Id := N + 132; -- GNAT - Name_Eliminate : constant Name_Id := N + 133; -- GNAT - Name_Extend_System : constant Name_Id := N + 134; -- GNAT - Name_Extensions_Allowed : constant Name_Id := N + 135; -- GNAT - Name_External_Name_Casing : constant Name_Id := N + 136; -- GNAT - Name_Favor_Top_Level : constant Name_Id := N + 137; -- GNAT + Name_Ada_83 : constant Name_Id := N + 119; -- GNAT + Name_Ada_95 : constant Name_Id := N + 120; -- GNAT + Name_Ada_05 : constant Name_Id := N + 121; -- GNAT + Name_Ada_2005 : constant Name_Id := N + 122; -- GNAT + Name_Assertion_Policy : constant Name_Id := N + 123; -- Ada 05 + Name_C_Pass_By_Copy : constant Name_Id := N + 124; -- GNAT + Name_Check_Name : constant Name_Id := N + 125; -- GNAT + Name_Check_Policy : constant Name_Id := N + 126; -- GNAT + Name_Compile_Time_Error : constant Name_Id := N + 127; -- GNAT + Name_Compile_Time_Warning : constant Name_Id := N + 128; -- GNAT + Name_Compiler_Unit : constant Name_Id := N + 129; -- GNAT + Name_Component_Alignment : constant Name_Id := N + 130; -- GNAT + Name_Convention_Identifier : constant Name_Id := N + 131; -- GNAT + Name_Debug_Policy : constant Name_Id := N + 132; -- GNAT + Name_Detect_Blocking : constant Name_Id := N + 133; -- Ada 05 + Name_Discard_Names : constant Name_Id := N + 134; + Name_Elaboration_Checks : constant Name_Id := N + 135; -- GNAT + Name_Eliminate : constant Name_Id := N + 136; -- GNAT + Name_Extend_System : constant Name_Id := N + 137; -- GNAT + Name_Extensions_Allowed : constant Name_Id := N + 138; -- GNAT + Name_External_Name_Casing : constant Name_Id := N + 139; -- GNAT -- Note: Fast_Math is not in this list because its name matches -- GNAT -- the name of the corresponding attribute. However, it is @@ -361,48 +363,49 @@ package Snames is -- functions Get_Pragma_Id, Is_[Configuration_]Pragma_Id, and -- correctly recognize and process Fast_Math. - Name_Float_Representation : constant Name_Id := N + 138; -- GNAT - Name_Implicit_Packing : constant Name_Id := N + 139; -- GNAT - Name_Initialize_Scalars : constant Name_Id := N + 140; -- GNAT - Name_Interrupt_State : constant Name_Id := N + 141; -- GNAT - Name_License : constant Name_Id := N + 142; -- GNAT - Name_Locking_Policy : constant Name_Id := N + 143; - Name_Long_Float : constant Name_Id := N + 144; -- VMS - Name_No_Run_Time : constant Name_Id := N + 145; -- GNAT - Name_No_Strict_Aliasing : constant Name_Id := N + 146; -- GNAT - Name_Normalize_Scalars : constant Name_Id := N + 147; - Name_Optimize_Alignment : constant Name_Id := N + 148; -- GNAT - Name_Polling : constant Name_Id := N + 149; -- GNAT - Name_Persistent_BSS : constant Name_Id := N + 150; -- GNAT - Name_Priority_Specific_Dispatching : constant Name_Id := N + 151; -- Ada 05 - Name_Profile : constant Name_Id := N + 152; -- Ada 05 - Name_Profile_Warnings : constant Name_Id := N + 153; -- GNAT - Name_Propagate_Exceptions : constant Name_Id := N + 154; -- GNAT - Name_Queuing_Policy : constant Name_Id := N + 155; - Name_Ravenscar : constant Name_Id := N + 156; -- GNAT - Name_Restricted_Run_Time : constant Name_Id := N + 157; -- GNAT - Name_Restrictions : constant Name_Id := N + 158; - Name_Restriction_Warnings : constant Name_Id := N + 159; -- GNAT - Name_Reviewable : constant Name_Id := N + 160; - Name_Source_File_Name : constant Name_Id := N + 161; -- GNAT - Name_Source_File_Name_Project : constant Name_Id := N + 162; -- GNAT - Name_Style_Checks : constant Name_Id := N + 163; -- GNAT - Name_Suppress : constant Name_Id := N + 164; - Name_Suppress_Exception_Locations : constant Name_Id := N + 165; -- GNAT - Name_Task_Dispatching_Policy : constant Name_Id := N + 166; - Name_Universal_Data : constant Name_Id := N + 167; -- AAMP - Name_Unsuppress : constant Name_Id := N + 168; -- GNAT - Name_Use_VADS_Size : constant Name_Id := N + 169; -- GNAT - Name_Validity_Checks : constant Name_Id := N + 170; -- GNAT - Name_Warnings : constant Name_Id := N + 171; -- GNAT - Name_Wide_Character_Encoding : constant Name_Id := N + 172; -- GNAT - Last_Configuration_Pragma_Name : constant Name_Id := N + 172; + Name_Favor_Top_Level : constant Name_Id := N + 140; -- GNAT + Name_Float_Representation : constant Name_Id := N + 141; -- GNAT + Name_Implicit_Packing : constant Name_Id := N + 142; -- GNAT + Name_Initialize_Scalars : constant Name_Id := N + 143; -- GNAT + Name_Interrupt_State : constant Name_Id := N + 144; -- GNAT + Name_License : constant Name_Id := N + 145; -- GNAT + Name_Locking_Policy : constant Name_Id := N + 146; + Name_Long_Float : constant Name_Id := N + 147; -- VMS + Name_No_Run_Time : constant Name_Id := N + 148; -- GNAT + Name_No_Strict_Aliasing : constant Name_Id := N + 149; -- GNAT + Name_Normalize_Scalars : constant Name_Id := N + 150; + Name_Optimize_Alignment : constant Name_Id := N + 151; -- GNAT + Name_Persistent_BSS : constant Name_Id := N + 152; -- GNAT + Name_Polling : constant Name_Id := N + 153; -- GNAT + Name_Priority_Specific_Dispatching : constant Name_Id := N + 154; -- Ada 05 + Name_Profile : constant Name_Id := N + 155; -- Ada 05 + Name_Profile_Warnings : constant Name_Id := N + 156; -- GNAT + Name_Propagate_Exceptions : constant Name_Id := N + 157; -- GNAT + Name_Queuing_Policy : constant Name_Id := N + 158; + Name_Ravenscar : constant Name_Id := N + 159; -- GNAT + Name_Restricted_Run_Time : constant Name_Id := N + 160; -- GNAT + Name_Restrictions : constant Name_Id := N + 161; + Name_Restriction_Warnings : constant Name_Id := N + 162; -- GNAT + Name_Reviewable : constant Name_Id := N + 163; + Name_Source_File_Name : constant Name_Id := N + 164; -- GNAT + Name_Source_File_Name_Project : constant Name_Id := N + 165; -- GNAT + Name_Style_Checks : constant Name_Id := N + 166; -- GNAT + Name_Suppress : constant Name_Id := N + 167; + Name_Suppress_Exception_Locations : constant Name_Id := N + 168; -- GNAT + Name_Task_Dispatching_Policy : constant Name_Id := N + 169; + Name_Universal_Data : constant Name_Id := N + 170; -- AAMP + Name_Unsuppress : constant Name_Id := N + 171; -- GNAT + Name_Use_VADS_Size : constant Name_Id := N + 172; -- GNAT + Name_Validity_Checks : constant Name_Id := N + 173; -- GNAT + Name_Warnings : constant Name_Id := N + 174; -- GNAT + Name_Wide_Character_Encoding : constant Name_Id := N + 175; -- GNAT + Last_Configuration_Pragma_Name : constant Name_Id := N + 175; -- Remaining pragma names - Name_Abort_Defer : constant Name_Id := N + 173; -- GNAT - Name_All_Calls_Remote : constant Name_Id := N + 174; - Name_Annotate : constant Name_Id := N + 175; -- GNAT + Name_Abort_Defer : constant Name_Id := N + 176; -- GNAT + Name_All_Calls_Remote : constant Name_Id := N + 177; + Name_Annotate : constant Name_Id := N + 178; -- GNAT -- Note: AST_Entry is not in this list because its name matches -- VMS -- the name of the corresponding attribute. However, it is @@ -410,74 +413,77 @@ package Snames is -- functions Get_Pragma_Id and Is_Pragma_Id correctly recognize -- and process Name_AST_Entry. - Name_Assert : constant Name_Id := N + 176; -- Ada 05 - Name_Asynchronous : constant Name_Id := N + 177; - Name_Atomic : constant Name_Id := N + 178; - Name_Atomic_Components : constant Name_Id := N + 179; - Name_Attach_Handler : constant Name_Id := N + 180; - Name_CIL_Constructor : constant Name_Id := N + 181; -- GNAT - Name_Comment : constant Name_Id := N + 182; -- GNAT - Name_Common_Object : constant Name_Id := N + 183; -- GNAT - Name_Complete_Representation : constant Name_Id := N + 184; -- GNAT - Name_Complex_Representation : constant Name_Id := N + 185; -- GNAT - Name_Controlled : constant Name_Id := N + 186; - Name_Convention : constant Name_Id := N + 187; - Name_CPP_Class : constant Name_Id := N + 188; -- GNAT - Name_CPP_Constructor : constant Name_Id := N + 189; -- GNAT - Name_CPP_Virtual : constant Name_Id := N + 190; -- GNAT - Name_CPP_Vtable : constant Name_Id := N + 191; -- GNAT - Name_Debug : constant Name_Id := N + 192; -- GNAT - Name_Elaborate : constant Name_Id := N + 193; -- Ada 83 - Name_Elaborate_All : constant Name_Id := N + 194; - Name_Elaborate_Body : constant Name_Id := N + 195; - Name_Export : constant Name_Id := N + 196; - Name_Export_Exception : constant Name_Id := N + 197; -- VMS - Name_Export_Function : constant Name_Id := N + 198; -- GNAT - Name_Export_Object : constant Name_Id := N + 199; -- GNAT - Name_Export_Procedure : constant Name_Id := N + 200; -- GNAT - Name_Export_Value : constant Name_Id := N + 201; -- GNAT - Name_Export_Valued_Procedure : constant Name_Id := N + 202; -- GNAT - Name_External : constant Name_Id := N + 203; -- GNAT - Name_Finalize_Storage_Only : constant Name_Id := N + 204; -- GNAT - Name_Ident : constant Name_Id := N + 205; -- VMS - Name_Implemented_By_Entry : constant Name_Id := N + 206; -- Ada 05 - Name_Import : constant Name_Id := N + 207; - Name_Import_Exception : constant Name_Id := N + 208; -- VMS - Name_Import_Function : constant Name_Id := N + 209; -- GNAT - Name_Import_Object : constant Name_Id := N + 210; -- GNAT - Name_Import_Procedure : constant Name_Id := N + 211; -- GNAT - Name_Import_Valued_Procedure : constant Name_Id := N + 212; -- GNAT - Name_Inline : constant Name_Id := N + 213; - Name_Inline_Always : constant Name_Id := N + 214; -- GNAT - Name_Inline_Generic : constant Name_Id := N + 215; -- GNAT - Name_Inspection_Point : constant Name_Id := N + 216; - Name_Interface_Name : constant Name_Id := N + 217; -- GNAT - Name_Interrupt_Handler : constant Name_Id := N + 218; - Name_Interrupt_Priority : constant Name_Id := N + 219; - Name_Java_Constructor : constant Name_Id := N + 220; -- GNAT - Name_Java_Interface : constant Name_Id := N + 221; -- GNAT - Name_Keep_Names : constant Name_Id := N + 222; -- GNAT - Name_Link_With : constant Name_Id := N + 223; -- GNAT - Name_Linker_Alias : constant Name_Id := N + 224; -- GNAT - Name_Linker_Constructor : constant Name_Id := N + 225; -- GNAT - Name_Linker_Destructor : constant Name_Id := N + 226; -- GNAT - Name_Linker_Options : constant Name_Id := N + 227; - Name_Linker_Section : constant Name_Id := N + 228; -- GNAT - Name_List : constant Name_Id := N + 229; - Name_Machine_Attribute : constant Name_Id := N + 230; -- GNAT - Name_Main : constant Name_Id := N + 231; -- GNAT - Name_Main_Storage : constant Name_Id := N + 232; -- GNAT - Name_Memory_Size : constant Name_Id := N + 233; -- Ada 83 - Name_No_Body : constant Name_Id := N + 234; -- GNAT - Name_No_Return : constant Name_Id := N + 235; -- GNAT - Name_Obsolescent : constant Name_Id := N + 236; -- GNAT - Name_Optimize : constant Name_Id := N + 237; - Name_Pack : constant Name_Id := N + 238; - Name_Page : constant Name_Id := N + 239; - Name_Passive : constant Name_Id := N + 240; -- GNAT - Name_Preelaborable_Initialization : constant Name_Id := N + 241; -- Ada 05 - Name_Preelaborate : constant Name_Id := N + 242; - Name_Preelaborate_05 : constant Name_Id := N + 243; -- GNAT + Name_Assert : constant Name_Id := N + 179; -- Ada 05 + Name_Asynchronous : constant Name_Id := N + 180; + Name_Atomic : constant Name_Id := N + 181; + Name_Atomic_Components : constant Name_Id := N + 182; + Name_Attach_Handler : constant Name_Id := N + 183; + Name_Check : constant Name_Id := N + 184; -- GNAT + Name_CIL_Constructor : constant Name_Id := N + 185; -- GNAT + Name_Comment : constant Name_Id := N + 186; -- GNAT + Name_Common_Object : constant Name_Id := N + 187; -- GNAT + Name_Complete_Representation : constant Name_Id := N + 188; -- GNAT + Name_Complex_Representation : constant Name_Id := N + 189; -- GNAT + Name_Controlled : constant Name_Id := N + 190; + Name_Convention : constant Name_Id := N + 191; + Name_CPP_Class : constant Name_Id := N + 192; -- GNAT + Name_CPP_Constructor : constant Name_Id := N + 193; -- GNAT + Name_CPP_Virtual : constant Name_Id := N + 194; -- GNAT + Name_CPP_Vtable : constant Name_Id := N + 195; -- GNAT + Name_Debug : constant Name_Id := N + 196; -- GNAT + Name_Elaborate : constant Name_Id := N + 197; -- Ada 83 + Name_Elaborate_All : constant Name_Id := N + 198; + Name_Elaborate_Body : constant Name_Id := N + 199; + Name_Export : constant Name_Id := N + 200; + Name_Export_Exception : constant Name_Id := N + 201; -- VMS + Name_Export_Function : constant Name_Id := N + 202; -- GNAT + Name_Export_Object : constant Name_Id := N + 203; -- GNAT + Name_Export_Procedure : constant Name_Id := N + 204; -- GNAT + Name_Export_Value : constant Name_Id := N + 205; -- GNAT + Name_Export_Valued_Procedure : constant Name_Id := N + 206; -- GNAT + Name_External : constant Name_Id := N + 207; -- GNAT + Name_Finalize_Storage_Only : constant Name_Id := N + 208; -- GNAT + Name_Ident : constant Name_Id := N + 209; -- VMS + Name_Implemented_By_Entry : constant Name_Id := N + 210; -- Ada 05 + Name_Import : constant Name_Id := N + 211; + Name_Import_Exception : constant Name_Id := N + 212; -- VMS + Name_Import_Function : constant Name_Id := N + 213; -- GNAT + Name_Import_Object : constant Name_Id := N + 214; -- GNAT + Name_Import_Procedure : constant Name_Id := N + 215; -- GNAT + Name_Import_Valued_Procedure : constant Name_Id := N + 216; -- GNAT + Name_Inline : constant Name_Id := N + 217; + Name_Inline_Always : constant Name_Id := N + 218; -- GNAT + Name_Inline_Generic : constant Name_Id := N + 219; -- GNAT + Name_Inspection_Point : constant Name_Id := N + 220; + Name_Interface_Name : constant Name_Id := N + 221; -- GNAT + Name_Interrupt_Handler : constant Name_Id := N + 222; + Name_Interrupt_Priority : constant Name_Id := N + 223; + Name_Java_Constructor : constant Name_Id := N + 224; -- GNAT + Name_Java_Interface : constant Name_Id := N + 225; -- GNAT + Name_Keep_Names : constant Name_Id := N + 226; -- GNAT + Name_Link_With : constant Name_Id := N + 227; -- GNAT + Name_Linker_Alias : constant Name_Id := N + 228; -- GNAT + Name_Linker_Constructor : constant Name_Id := N + 229; -- GNAT + Name_Linker_Destructor : constant Name_Id := N + 230; -- GNAT + Name_Linker_Options : constant Name_Id := N + 231; + Name_Linker_Section : constant Name_Id := N + 232; -- GNAT + Name_List : constant Name_Id := N + 233; + Name_Machine_Attribute : constant Name_Id := N + 234; -- GNAT + Name_Main : constant Name_Id := N + 235; -- GNAT + Name_Main_Storage : constant Name_Id := N + 236; -- GNAT + Name_Memory_Size : constant Name_Id := N + 237; -- Ada 83 + Name_No_Body : constant Name_Id := N + 238; -- GNAT + Name_No_Return : constant Name_Id := N + 239; -- GNAT + Name_Obsolescent : constant Name_Id := N + 240; -- GNAT + Name_Optimize : constant Name_Id := N + 241; + Name_Pack : constant Name_Id := N + 242; + Name_Page : constant Name_Id := N + 243; + Name_Passive : constant Name_Id := N + 244; -- GNAT + Name_Postcondition : constant Name_Id := N + 245; -- GNAT + Name_Precondition : constant Name_Id := N + 246; -- GNAT + Name_Preelaborable_Initialization : constant Name_Id := N + 247; -- Ada 05 + Name_Preelaborate : constant Name_Id := N + 248; + Name_Preelaborate_05 : constant Name_Id := N + 249; -- GNAT -- Note: Priority is not in this list because its name matches -- the name of the corresponding attribute. However, it is @@ -485,15 +491,16 @@ package Snames is -- functions Get_Pragma_Id and Is_Pragma_Id correctly recognize -- and process Priority. Priority is a standard Ada 95 pragma. - Name_Psect_Object : constant Name_Id := N + 244; -- VMS - Name_Pure : constant Name_Id := N + 245; - Name_Pure_05 : constant Name_Id := N + 246; -- GNAT - Name_Pure_Function : constant Name_Id := N + 247; -- GNAT - Name_Remote_Call_Interface : constant Name_Id := N + 248; - Name_Remote_Types : constant Name_Id := N + 249; - Name_Share_Generic : constant Name_Id := N + 250; -- GNAT - Name_Shared : constant Name_Id := N + 251; -- Ada 83 - Name_Shared_Passive : constant Name_Id := N + 252; + Name_Psect_Object : constant Name_Id := N + 250; -- VMS + Name_Pure : constant Name_Id := N + 251; + Name_Pure_05 : constant Name_Id := N + 252; -- GNAT + Name_Pure_Function : constant Name_Id := N + 253; -- GNAT + Name_Relative_Deadline : constant Name_Id := N + 254; -- Ada 05 + Name_Remote_Call_Interface : constant Name_Id := N + 255; + Name_Remote_Types : constant Name_Id := N + 256; + Name_Share_Generic : constant Name_Id := N + 257; -- GNAT + Name_Shared : constant Name_Id := N + 258; -- Ada 83 + Name_Shared_Passive : constant Name_Id := N + 259; -- Note: Storage_Size is not in this list because its name -- matches the name of the corresponding attribute. However, @@ -504,30 +511,30 @@ package Snames is -- Note: Storage_Unit is also omitted from the list because -- of a clash with an attribute name, and is treated similarly. - Name_Source_Reference : constant Name_Id := N + 253; -- GNAT - Name_Static_Elaboration_Desired : constant Name_Id := N + 254; -- GNAT - Name_Stream_Convert : constant Name_Id := N + 255; -- GNAT - Name_Subtitle : constant Name_Id := N + 256; -- GNAT - Name_Suppress_All : constant Name_Id := N + 257; -- GNAT - Name_Suppress_Debug_Info : constant Name_Id := N + 258; -- GNAT - Name_Suppress_Initialization : constant Name_Id := N + 259; -- GNAT - Name_System_Name : constant Name_Id := N + 260; -- Ada 83 - Name_Task_Info : constant Name_Id := N + 261; -- GNAT - Name_Task_Name : constant Name_Id := N + 262; -- GNAT - Name_Task_Storage : constant Name_Id := N + 263; -- VMS - Name_Time_Slice : constant Name_Id := N + 264; -- GNAT - Name_Title : constant Name_Id := N + 265; -- GNAT - Name_Unchecked_Union : constant Name_Id := N + 266; -- GNAT - Name_Unimplemented_Unit : constant Name_Id := N + 267; -- GNAT - Name_Universal_Aliasing : constant Name_Id := N + 268; -- GNAT - Name_Unmodified : constant Name_Id := N + 269; -- GNAT - Name_Unreferenced : constant Name_Id := N + 270; -- GNAT - Name_Unreferenced_Objects : constant Name_Id := N + 271; -- GNAT - Name_Unreserve_All_Interrupts : constant Name_Id := N + 272; -- GNAT - Name_Volatile : constant Name_Id := N + 273; - Name_Volatile_Components : constant Name_Id := N + 274; - Name_Weak_External : constant Name_Id := N + 275; -- GNAT - Last_Pragma_Name : constant Name_Id := N + 275; + Name_Source_Reference : constant Name_Id := N + 260; -- GNAT + Name_Static_Elaboration_Desired : constant Name_Id := N + 261; -- GNAT + Name_Stream_Convert : constant Name_Id := N + 262; -- GNAT + Name_Subtitle : constant Name_Id := N + 263; -- GNAT + Name_Suppress_All : constant Name_Id := N + 264; -- GNAT + Name_Suppress_Debug_Info : constant Name_Id := N + 265; -- GNAT + Name_Suppress_Initialization : constant Name_Id := N + 266; -- GNAT + Name_System_Name : constant Name_Id := N + 267; -- Ada 83 + Name_Task_Info : constant Name_Id := N + 268; -- GNAT + Name_Task_Name : constant Name_Id := N + 269; -- GNAT + Name_Task_Storage : constant Name_Id := N + 270; -- VMS + Name_Time_Slice : constant Name_Id := N + 271; -- GNAT + Name_Title : constant Name_Id := N + 272; -- GNAT + Name_Unchecked_Union : constant Name_Id := N + 273; -- GNAT + Name_Unimplemented_Unit : constant Name_Id := N + 274; -- GNAT + Name_Universal_Aliasing : constant Name_Id := N + 275; -- GNAT + Name_Unmodified : constant Name_Id := N + 276; -- GNAT + Name_Unreferenced : constant Name_Id := N + 277; -- GNAT + Name_Unreferenced_Objects : constant Name_Id := N + 278; -- GNAT + Name_Unreserve_All_Interrupts : constant Name_Id := N + 279; -- GNAT + Name_Volatile : constant Name_Id := N + 280; + Name_Volatile_Components : constant Name_Id := N + 281; + Name_Weak_External : constant Name_Id := N + 282; -- GNAT + Last_Pragma_Name : constant Name_Id := N + 282; -- Language convention names for pragma Convention/Export/Import/Interface -- Note that Name_C is not included in this list, since it was already @@ -538,119 +545,119 @@ package Snames is -- Entry and Protected, this is because these conventions cannot be -- specified by a pragma. - First_Convention_Name : constant Name_Id := N + 276; - Name_Ada : constant Name_Id := N + 276; - Name_Assembler : constant Name_Id := N + 277; - Name_CIL : constant Name_Id := N + 278; - Name_COBOL : constant Name_Id := N + 279; - Name_CPP : constant Name_Id := N + 280; - Name_Fortran : constant Name_Id := N + 281; - Name_Intrinsic : constant Name_Id := N + 282; - Name_Java : constant Name_Id := N + 283; - Name_Stdcall : constant Name_Id := N + 284; - Name_Stubbed : constant Name_Id := N + 285; - Last_Convention_Name : constant Name_Id := N + 285; + First_Convention_Name : constant Name_Id := N + 283; + Name_Ada : constant Name_Id := N + 283; + Name_Assembler : constant Name_Id := N + 284; + Name_CIL : constant Name_Id := N + 285; + Name_COBOL : constant Name_Id := N + 286; + Name_CPP : constant Name_Id := N + 287; + Name_Fortran : constant Name_Id := N + 288; + Name_Intrinsic : constant Name_Id := N + 289; + Name_Java : constant Name_Id := N + 290; + Name_Stdcall : constant Name_Id := N + 291; + Name_Stubbed : constant Name_Id := N + 292; + Last_Convention_Name : constant Name_Id := N + 292; -- The following names are preset as synonyms for Assembler - Name_Asm : constant Name_Id := N + 286; - Name_Assembly : constant Name_Id := N + 287; + Name_Asm : constant Name_Id := N + 293; + Name_Assembly : constant Name_Id := N + 294; -- The following names are preset as synonyms for C - Name_Default : constant Name_Id := N + 288; - -- Name_Exernal (previously defined as pragma) + Name_Default : constant Name_Id := N + 295; + -- Name_External (previously defined as pragma) -- The following names are preset as synonyms for CPP - Name_C_Plus_Plus : constant Name_Id := N + 289; + Name_C_Plus_Plus : constant Name_Id := N + 296; -- The following names are present as synonyms for Stdcall - Name_DLL : constant Name_Id := N + 290; - Name_Win32 : constant Name_Id := N + 291; + Name_DLL : constant Name_Id := N + 297; + Name_Win32 : constant Name_Id := N + 298; -- Other special names used in processing pragmas - Name_As_Is : constant Name_Id := N + 292; - Name_Attribute_Name : constant Name_Id := N + 293; - Name_Body_File_Name : constant Name_Id := N + 294; - Name_Boolean_Entry_Barriers : constant Name_Id := N + 295; - Name_Check : constant Name_Id := N + 296; - Name_Casing : constant Name_Id := N + 297; - Name_Code : constant Name_Id := N + 298; - Name_Component : constant Name_Id := N + 299; - Name_Component_Size_4 : constant Name_Id := N + 300; - Name_Copy : constant Name_Id := N + 301; - Name_D_Float : constant Name_Id := N + 302; - Name_Descriptor : constant Name_Id := N + 303; - Name_Dot_Replacement : constant Name_Id := N + 304; - Name_Dynamic : constant Name_Id := N + 305; - Name_Entity : constant Name_Id := N + 306; - Name_Entry_Count : constant Name_Id := N + 307; - Name_External_Name : constant Name_Id := N + 308; - Name_First_Optional_Parameter : constant Name_Id := N + 309; - Name_Form : constant Name_Id := N + 310; - Name_G_Float : constant Name_Id := N + 311; - Name_Gcc : constant Name_Id := N + 312; - Name_Gnat : constant Name_Id := N + 313; - Name_GPL : constant Name_Id := N + 314; - Name_IEEE_Float : constant Name_Id := N + 315; - Name_Ignore : constant Name_Id := N + 316; - Name_Info : constant Name_Id := N + 317; - Name_Internal : constant Name_Id := N + 318; - Name_Link_Name : constant Name_Id := N + 319; - Name_Lowercase : constant Name_Id := N + 320; - Name_Max_Entry_Queue_Depth : constant Name_Id := N + 321; - Name_Max_Entry_Queue_Length : constant Name_Id := N + 322; - Name_Max_Size : constant Name_Id := N + 323; - Name_Mechanism : constant Name_Id := N + 324; - Name_Message : constant Name_Id := N + 325; - Name_Mixedcase : constant Name_Id := N + 326; - Name_Modified_GPL : constant Name_Id := N + 327; - Name_Name : constant Name_Id := N + 328; - Name_NCA : constant Name_Id := N + 329; - Name_No : constant Name_Id := N + 330; - Name_No_Dependence : constant Name_Id := N + 331; - Name_No_Dynamic_Attachment : constant Name_Id := N + 332; - Name_No_Dynamic_Interrupts : constant Name_Id := N + 333; - Name_No_Requeue : constant Name_Id := N + 334; - Name_No_Requeue_Statements : constant Name_Id := N + 335; - Name_No_Task_Attributes : constant Name_Id := N + 336; - Name_No_Task_Attributes_Package : constant Name_Id := N + 337; - Name_On : constant Name_Id := N + 338; - Name_Parameter_Types : constant Name_Id := N + 339; - Name_Reference : constant Name_Id := N + 340; - Name_Restricted : constant Name_Id := N + 341; - Name_Result_Mechanism : constant Name_Id := N + 342; - Name_Result_Type : constant Name_Id := N + 343; - Name_Runtime : constant Name_Id := N + 344; - Name_SB : constant Name_Id := N + 345; - Name_Secondary_Stack_Size : constant Name_Id := N + 346; - Name_Section : constant Name_Id := N + 347; - Name_Semaphore : constant Name_Id := N + 348; - Name_Simple_Barriers : constant Name_Id := N + 349; - Name_Spec_File_Name : constant Name_Id := N + 350; - Name_State : constant Name_Id := N + 351; - Name_Static : constant Name_Id := N + 352; - Name_Stack_Size : constant Name_Id := N + 353; - Name_Subunit_File_Name : constant Name_Id := N + 354; - Name_Task_Stack_Size_Default : constant Name_Id := N + 355; - Name_Task_Type : constant Name_Id := N + 356; - Name_Time_Slicing_Enabled : constant Name_Id := N + 357; - Name_Top_Guard : constant Name_Id := N + 358; - Name_UBA : constant Name_Id := N + 359; - Name_UBS : constant Name_Id := N + 360; - Name_UBSB : constant Name_Id := N + 361; - Name_Unit_Name : constant Name_Id := N + 362; - Name_Unknown : constant Name_Id := N + 363; - Name_Unrestricted : constant Name_Id := N + 364; - Name_Uppercase : constant Name_Id := N + 365; - Name_User : constant Name_Id := N + 366; - Name_VAX_Float : constant Name_Id := N + 367; - Name_VMS : constant Name_Id := N + 368; - Name_Vtable_Ptr : constant Name_Id := N + 369; - Name_Working_Storage : constant Name_Id := N + 370; + Name_As_Is : constant Name_Id := N + 299; + Name_Assertion : constant Name_Id := N + 300; + Name_Attribute_Name : constant Name_Id := N + 301; + Name_Body_File_Name : constant Name_Id := N + 302; + Name_Boolean_Entry_Barriers : constant Name_Id := N + 303; + Name_Casing : constant Name_Id := N + 304; + Name_Code : constant Name_Id := N + 305; + Name_Component : constant Name_Id := N + 306; + Name_Component_Size_4 : constant Name_Id := N + 307; + Name_Copy : constant Name_Id := N + 308; + Name_D_Float : constant Name_Id := N + 309; + Name_Descriptor : constant Name_Id := N + 310; + Name_Dot_Replacement : constant Name_Id := N + 311; + Name_Dynamic : constant Name_Id := N + 312; + Name_Entity : constant Name_Id := N + 313; + Name_Entry_Count : constant Name_Id := N + 314; + Name_External_Name : constant Name_Id := N + 315; + Name_First_Optional_Parameter : constant Name_Id := N + 316; + Name_Form : constant Name_Id := N + 317; + Name_G_Float : constant Name_Id := N + 318; + Name_Gcc : constant Name_Id := N + 319; + Name_Gnat : constant Name_Id := N + 320; + Name_GPL : constant Name_Id := N + 321; + Name_IEEE_Float : constant Name_Id := N + 322; + Name_Ignore : constant Name_Id := N + 323; + Name_Info : constant Name_Id := N + 324; + Name_Internal : constant Name_Id := N + 325; + Name_Link_Name : constant Name_Id := N + 326; + Name_Lowercase : constant Name_Id := N + 327; + Name_Max_Entry_Queue_Depth : constant Name_Id := N + 328; + Name_Max_Entry_Queue_Length : constant Name_Id := N + 329; + Name_Max_Size : constant Name_Id := N + 330; + Name_Mechanism : constant Name_Id := N + 331; + Name_Message : constant Name_Id := N + 332; + Name_Mixedcase : constant Name_Id := N + 333; + Name_Modified_GPL : constant Name_Id := N + 334; + Name_Name : constant Name_Id := N + 335; + Name_NCA : constant Name_Id := N + 336; + Name_No : constant Name_Id := N + 337; + Name_No_Dependence : constant Name_Id := N + 338; + Name_No_Dynamic_Attachment : constant Name_Id := N + 339; + Name_No_Dynamic_Interrupts : constant Name_Id := N + 340; + Name_No_Requeue : constant Name_Id := N + 341; + Name_No_Requeue_Statements : constant Name_Id := N + 342; + Name_No_Task_Attributes : constant Name_Id := N + 343; + Name_No_Task_Attributes_Package : constant Name_Id := N + 344; + Name_On : constant Name_Id := N + 345; + Name_Parameter_Types : constant Name_Id := N + 346; + Name_Reference : constant Name_Id := N + 347; + Name_Restricted : constant Name_Id := N + 348; + Name_Result_Mechanism : constant Name_Id := N + 349; + Name_Result_Type : constant Name_Id := N + 350; + Name_Runtime : constant Name_Id := N + 351; + Name_SB : constant Name_Id := N + 352; + Name_Secondary_Stack_Size : constant Name_Id := N + 353; + Name_Section : constant Name_Id := N + 354; + Name_Semaphore : constant Name_Id := N + 355; + Name_Simple_Barriers : constant Name_Id := N + 356; + Name_Spec_File_Name : constant Name_Id := N + 357; + Name_State : constant Name_Id := N + 358; + Name_Static : constant Name_Id := N + 359; + Name_Stack_Size : constant Name_Id := N + 360; + Name_Subunit_File_Name : constant Name_Id := N + 361; + Name_Task_Stack_Size_Default : constant Name_Id := N + 362; + Name_Task_Type : constant Name_Id := N + 363; + Name_Time_Slicing_Enabled : constant Name_Id := N + 364; + Name_Top_Guard : constant Name_Id := N + 365; + Name_UBA : constant Name_Id := N + 366; + Name_UBS : constant Name_Id := N + 367; + Name_UBSB : constant Name_Id := N + 368; + Name_Unit_Name : constant Name_Id := N + 369; + Name_Unknown : constant Name_Id := N + 370; + Name_Unrestricted : constant Name_Id := N + 371; + Name_Uppercase : constant Name_Id := N + 372; + Name_User : constant Name_Id := N + 373; + Name_VAX_Float : constant Name_Id := N + 374; + Name_VMS : constant Name_Id := N + 375; + Name_Vtable_Ptr : constant Name_Id := N + 376; + Name_Working_Storage : constant Name_Id := N + 377; -- Names of recognized attributes. The entries with the comment "Ada 83" -- are attributes that are defined in Ada 83, but not in Ada 95. These @@ -664,171 +671,175 @@ package Snames is -- The entries marked VMS are recognized only in OpenVMS implementations -- of GNAT, and are treated as illegal in all other contexts. - First_Attribute_Name : constant Name_Id := N + 371; - Name_Abort_Signal : constant Name_Id := N + 371; -- GNAT - Name_Access : constant Name_Id := N + 372; - Name_Address : constant Name_Id := N + 373; - Name_Address_Size : constant Name_Id := N + 374; -- GNAT - Name_Aft : constant Name_Id := N + 375; - Name_Alignment : constant Name_Id := N + 376; - Name_Asm_Input : constant Name_Id := N + 377; -- GNAT - Name_Asm_Output : constant Name_Id := N + 378; -- GNAT - Name_AST_Entry : constant Name_Id := N + 379; -- VMS - Name_Bit : constant Name_Id := N + 380; -- GNAT - Name_Bit_Order : constant Name_Id := N + 381; - Name_Bit_Position : constant Name_Id := N + 382; -- GNAT - Name_Body_Version : constant Name_Id := N + 383; - Name_Callable : constant Name_Id := N + 384; - Name_Caller : constant Name_Id := N + 385; - Name_Code_Address : constant Name_Id := N + 386; -- GNAT - Name_Component_Size : constant Name_Id := N + 387; - Name_Compose : constant Name_Id := N + 388; - Name_Constrained : constant Name_Id := N + 389; - Name_Count : constant Name_Id := N + 390; - Name_Default_Bit_Order : constant Name_Id := N + 391; -- GNAT - Name_Definite : constant Name_Id := N + 392; - Name_Delta : constant Name_Id := N + 393; - Name_Denorm : constant Name_Id := N + 394; - Name_Digits : constant Name_Id := N + 395; - Name_Elaborated : constant Name_Id := N + 396; -- GNAT - Name_Emax : constant Name_Id := N + 397; -- Ada 83 - Name_Enabled : constant Name_Id := N + 398; -- GNAT - Name_Enum_Rep : constant Name_Id := N + 399; -- GNAT - Name_Epsilon : constant Name_Id := N + 400; -- Ada 83 - Name_Exponent : constant Name_Id := N + 401; - Name_External_Tag : constant Name_Id := N + 402; - Name_Fast_Math : constant Name_Id := N + 403; -- GNAT - Name_First : constant Name_Id := N + 404; - Name_First_Bit : constant Name_Id := N + 405; - Name_Fixed_Value : constant Name_Id := N + 406; -- GNAT - Name_Fore : constant Name_Id := N + 407; - Name_Has_Access_Values : constant Name_Id := N + 408; -- GNAT - Name_Has_Discriminants : constant Name_Id := N + 409; -- GNAT - Name_Identity : constant Name_Id := N + 410; - Name_Img : constant Name_Id := N + 411; -- GNAT - Name_Integer_Value : constant Name_Id := N + 412; -- GNAT - Name_Large : constant Name_Id := N + 413; -- Ada 83 - Name_Last : constant Name_Id := N + 414; - Name_Last_Bit : constant Name_Id := N + 415; - Name_Leading_Part : constant Name_Id := N + 416; - Name_Length : constant Name_Id := N + 417; - Name_Machine_Emax : constant Name_Id := N + 418; - Name_Machine_Emin : constant Name_Id := N + 419; - Name_Machine_Mantissa : constant Name_Id := N + 420; - Name_Machine_Overflows : constant Name_Id := N + 421; - Name_Machine_Radix : constant Name_Id := N + 422; - Name_Machine_Rounding : constant Name_Id := N + 423; -- Ada 05 - Name_Machine_Rounds : constant Name_Id := N + 424; - Name_Machine_Size : constant Name_Id := N + 425; -- GNAT - Name_Mantissa : constant Name_Id := N + 426; -- Ada 83 - Name_Max_Size_In_Storage_Elements : constant Name_Id := N + 427; - Name_Maximum_Alignment : constant Name_Id := N + 428; -- GNAT - Name_Mechanism_Code : constant Name_Id := N + 429; -- GNAT - Name_Mod : constant Name_Id := N + 430; -- Ada 05 - Name_Model_Emin : constant Name_Id := N + 431; - Name_Model_Epsilon : constant Name_Id := N + 432; - Name_Model_Mantissa : constant Name_Id := N + 433; - Name_Model_Small : constant Name_Id := N + 434; - Name_Modulus : constant Name_Id := N + 435; - Name_Null_Parameter : constant Name_Id := N + 436; -- GNAT - Name_Object_Size : constant Name_Id := N + 437; -- GNAT - Name_Old : constant Name_Id := N + 438; -- GNAT - Name_Partition_ID : constant Name_Id := N + 439; - Name_Passed_By_Reference : constant Name_Id := N + 440; -- GNAT - Name_Pool_Address : constant Name_Id := N + 441; - Name_Pos : constant Name_Id := N + 442; - Name_Position : constant Name_Id := N + 443; - Name_Priority : constant Name_Id := N + 444; -- Ada 05 - Name_Range : constant Name_Id := N + 445; - Name_Range_Length : constant Name_Id := N + 446; -- GNAT - Name_Round : constant Name_Id := N + 447; - Name_Safe_Emax : constant Name_Id := N + 448; -- Ada 83 - Name_Safe_First : constant Name_Id := N + 449; - Name_Safe_Large : constant Name_Id := N + 450; -- Ada 83 - Name_Safe_Last : constant Name_Id := N + 451; - Name_Safe_Small : constant Name_Id := N + 452; -- Ada 83 - Name_Scale : constant Name_Id := N + 453; - Name_Scaling : constant Name_Id := N + 454; - Name_Signed_Zeros : constant Name_Id := N + 455; - Name_Size : constant Name_Id := N + 456; - Name_Small : constant Name_Id := N + 457; - Name_Storage_Size : constant Name_Id := N + 458; - Name_Storage_Unit : constant Name_Id := N + 459; -- GNAT - Name_Stream_Size : constant Name_Id := N + 460; -- Ada 05 - Name_Tag : constant Name_Id := N + 461; - Name_Target_Name : constant Name_Id := N + 462; -- GNAT - Name_Terminated : constant Name_Id := N + 463; - Name_To_Address : constant Name_Id := N + 464; -- GNAT - Name_Type_Class : constant Name_Id := N + 465; -- GNAT - Name_UET_Address : constant Name_Id := N + 466; -- GNAT - Name_Unbiased_Rounding : constant Name_Id := N + 467; - Name_Unchecked_Access : constant Name_Id := N + 468; - Name_Unconstrained_Array : constant Name_Id := N + 469; - Name_Universal_Literal_String : constant Name_Id := N + 470; -- GNAT - Name_Unrestricted_Access : constant Name_Id := N + 471; -- GNAT - Name_VADS_Size : constant Name_Id := N + 472; -- GNAT - Name_Val : constant Name_Id := N + 473; - Name_Valid : constant Name_Id := N + 474; - Name_Value_Size : constant Name_Id := N + 475; -- GNAT - Name_Version : constant Name_Id := N + 476; - Name_Wchar_T_Size : constant Name_Id := N + 477; -- GNAT - Name_Wide_Wide_Width : constant Name_Id := N + 478; -- Ada 05 - Name_Wide_Width : constant Name_Id := N + 479; - Name_Width : constant Name_Id := N + 480; - Name_Word_Size : constant Name_Id := N + 481; -- GNAT + First_Attribute_Name : constant Name_Id := N + 378; + Name_Abort_Signal : constant Name_Id := N + 378; -- GNAT + Name_Access : constant Name_Id := N + 379; + Name_Address : constant Name_Id := N + 380; + Name_Address_Size : constant Name_Id := N + 381; -- GNAT + Name_Aft : constant Name_Id := N + 382; + Name_Alignment : constant Name_Id := N + 383; + Name_Asm_Input : constant Name_Id := N + 384; -- GNAT + Name_Asm_Output : constant Name_Id := N + 385; -- GNAT + Name_AST_Entry : constant Name_Id := N + 386; -- VMS + Name_Bit : constant Name_Id := N + 387; -- GNAT + Name_Bit_Order : constant Name_Id := N + 388; + Name_Bit_Position : constant Name_Id := N + 389; -- GNAT + Name_Body_Version : constant Name_Id := N + 390; + Name_Callable : constant Name_Id := N + 391; + Name_Caller : constant Name_Id := N + 392; + Name_Code_Address : constant Name_Id := N + 393; -- GNAT + Name_Component_Size : constant Name_Id := N + 394; + Name_Compose : constant Name_Id := N + 395; + Name_Constrained : constant Name_Id := N + 396; + Name_Count : constant Name_Id := N + 397; + Name_Default_Bit_Order : constant Name_Id := N + 398; -- GNAT + Name_Definite : constant Name_Id := N + 399; + Name_Delta : constant Name_Id := N + 400; + Name_Denorm : constant Name_Id := N + 401; + Name_Digits : constant Name_Id := N + 402; + Name_Elaborated : constant Name_Id := N + 403; -- GNAT + Name_Emax : constant Name_Id := N + 404; -- Ada 83 + Name_Enabled : constant Name_Id := N + 405; -- GNAT + Name_Enum_Rep : constant Name_Id := N + 406; -- GNAT + Name_Enum_Val : constant Name_Id := N + 407; -- GNAT + Name_Epsilon : constant Name_Id := N + 408; -- Ada 83 + Name_Exponent : constant Name_Id := N + 409; + Name_External_Tag : constant Name_Id := N + 410; + Name_Fast_Math : constant Name_Id := N + 411; -- GNAT + Name_First : constant Name_Id := N + 412; + Name_First_Bit : constant Name_Id := N + 413; + Name_Fixed_Value : constant Name_Id := N + 414; -- GNAT + Name_Fore : constant Name_Id := N + 415; + Name_Has_Access_Values : constant Name_Id := N + 416; -- GNAT + Name_Has_Discriminants : constant Name_Id := N + 417; -- GNAT + Name_Has_Tagged_Values : constant Name_Id := N + 418; -- GNAT + Name_Identity : constant Name_Id := N + 419; + Name_Img : constant Name_Id := N + 420; -- GNAT + Name_Integer_Value : constant Name_Id := N + 421; -- GNAT + Name_Invalid_Value : constant Name_Id := N + 422; -- GNAT + Name_Large : constant Name_Id := N + 423; -- Ada 83 + Name_Last : constant Name_Id := N + 424; + Name_Last_Bit : constant Name_Id := N + 425; + Name_Leading_Part : constant Name_Id := N + 426; + Name_Length : constant Name_Id := N + 427; + Name_Machine_Emax : constant Name_Id := N + 428; + Name_Machine_Emin : constant Name_Id := N + 429; + Name_Machine_Mantissa : constant Name_Id := N + 430; + Name_Machine_Overflows : constant Name_Id := N + 431; + Name_Machine_Radix : constant Name_Id := N + 432; + Name_Machine_Rounding : constant Name_Id := N + 433; -- Ada 05 + Name_Machine_Rounds : constant Name_Id := N + 434; + Name_Machine_Size : constant Name_Id := N + 435; -- GNAT + Name_Mantissa : constant Name_Id := N + 436; -- Ada 83 + Name_Max_Size_In_Storage_Elements : constant Name_Id := N + 437; + Name_Maximum_Alignment : constant Name_Id := N + 438; -- GNAT + Name_Mechanism_Code : constant Name_Id := N + 439; -- GNAT + Name_Mod : constant Name_Id := N + 440; -- Ada 05 + Name_Model_Emin : constant Name_Id := N + 441; + Name_Model_Epsilon : constant Name_Id := N + 442; + Name_Model_Mantissa : constant Name_Id := N + 443; + Name_Model_Small : constant Name_Id := N + 444; + Name_Modulus : constant Name_Id := N + 445; + Name_Null_Parameter : constant Name_Id := N + 446; -- GNAT + Name_Object_Size : constant Name_Id := N + 447; -- GNAT + Name_Old : constant Name_Id := N + 448; -- GNAT + Name_Partition_ID : constant Name_Id := N + 449; + Name_Passed_By_Reference : constant Name_Id := N + 450; -- GNAT + Name_Pool_Address : constant Name_Id := N + 451; + Name_Pos : constant Name_Id := N + 452; + Name_Position : constant Name_Id := N + 453; + Name_Priority : constant Name_Id := N + 454; -- Ada 05 + Name_Range : constant Name_Id := N + 455; + Name_Range_Length : constant Name_Id := N + 456; -- GNAT + Name_Result : constant Name_Id := N + 457; -- GNAT + Name_Round : constant Name_Id := N + 458; + Name_Safe_Emax : constant Name_Id := N + 459; -- Ada 83 + Name_Safe_First : constant Name_Id := N + 460; + Name_Safe_Large : constant Name_Id := N + 461; -- Ada 83 + Name_Safe_Last : constant Name_Id := N + 462; + Name_Safe_Small : constant Name_Id := N + 463; -- Ada 83 + Name_Scale : constant Name_Id := N + 464; + Name_Scaling : constant Name_Id := N + 465; + Name_Signed_Zeros : constant Name_Id := N + 466; + Name_Size : constant Name_Id := N + 467; + Name_Small : constant Name_Id := N + 468; + Name_Storage_Size : constant Name_Id := N + 469; + Name_Storage_Unit : constant Name_Id := N + 470; -- GNAT + Name_Stream_Size : constant Name_Id := N + 471; -- Ada 05 + Name_Tag : constant Name_Id := N + 472; + Name_Target_Name : constant Name_Id := N + 473; -- GNAT + Name_Terminated : constant Name_Id := N + 474; + Name_To_Address : constant Name_Id := N + 475; -- GNAT + Name_Type_Class : constant Name_Id := N + 476; -- GNAT + Name_UET_Address : constant Name_Id := N + 477; -- GNAT + Name_Unbiased_Rounding : constant Name_Id := N + 478; + Name_Unchecked_Access : constant Name_Id := N + 479; + Name_Unconstrained_Array : constant Name_Id := N + 480; + Name_Universal_Literal_String : constant Name_Id := N + 481; -- GNAT + Name_Unrestricted_Access : constant Name_Id := N + 482; -- GNAT + Name_VADS_Size : constant Name_Id := N + 483; -- GNAT + Name_Val : constant Name_Id := N + 484; + Name_Valid : constant Name_Id := N + 485; + Name_Value_Size : constant Name_Id := N + 486; -- GNAT + Name_Version : constant Name_Id := N + 487; + Name_Wchar_T_Size : constant Name_Id := N + 488; -- GNAT + Name_Wide_Wide_Width : constant Name_Id := N + 489; -- Ada 05 + Name_Wide_Width : constant Name_Id := N + 490; + Name_Width : constant Name_Id := N + 491; + Name_Word_Size : constant Name_Id := N + 492; -- GNAT -- Attributes that designate attributes returning renamable functions, -- i.e. functions that return other than a universal value and that -- have non-universal arguments. - First_Renamable_Function_Attribute : constant Name_Id := N + 482; - Name_Adjacent : constant Name_Id := N + 482; - Name_Ceiling : constant Name_Id := N + 483; - Name_Copy_Sign : constant Name_Id := N + 484; - Name_Floor : constant Name_Id := N + 485; - Name_Fraction : constant Name_Id := N + 486; - Name_Image : constant Name_Id := N + 487; - Name_Input : constant Name_Id := N + 488; - Name_Machine : constant Name_Id := N + 489; - Name_Max : constant Name_Id := N + 490; - Name_Min : constant Name_Id := N + 491; - Name_Model : constant Name_Id := N + 492; - Name_Pred : constant Name_Id := N + 493; - Name_Remainder : constant Name_Id := N + 494; - Name_Rounding : constant Name_Id := N + 495; - Name_Succ : constant Name_Id := N + 496; - Name_Truncation : constant Name_Id := N + 497; - Name_Value : constant Name_Id := N + 498; - Name_Wide_Image : constant Name_Id := N + 499; - Name_Wide_Wide_Image : constant Name_Id := N + 500; - Name_Wide_Value : constant Name_Id := N + 501; - Name_Wide_Wide_Value : constant Name_Id := N + 502; - Last_Renamable_Function_Attribute : constant Name_Id := N + 502; + First_Renamable_Function_Attribute : constant Name_Id := N + 493; + Name_Adjacent : constant Name_Id := N + 493; + Name_Ceiling : constant Name_Id := N + 494; + Name_Copy_Sign : constant Name_Id := N + 495; + Name_Floor : constant Name_Id := N + 496; + Name_Fraction : constant Name_Id := N + 497; + Name_Image : constant Name_Id := N + 498; + Name_Input : constant Name_Id := N + 499; + Name_Machine : constant Name_Id := N + 500; + Name_Max : constant Name_Id := N + 501; + Name_Min : constant Name_Id := N + 502; + Name_Model : constant Name_Id := N + 503; + Name_Pred : constant Name_Id := N + 504; + Name_Remainder : constant Name_Id := N + 505; + Name_Rounding : constant Name_Id := N + 506; + Name_Succ : constant Name_Id := N + 507; + Name_Truncation : constant Name_Id := N + 508; + Name_Value : constant Name_Id := N + 509; + Name_Wide_Image : constant Name_Id := N + 510; + Name_Wide_Wide_Image : constant Name_Id := N + 511; + Name_Wide_Value : constant Name_Id := N + 512; + Name_Wide_Wide_Value : constant Name_Id := N + 513; + Last_Renamable_Function_Attribute : constant Name_Id := N + 513; -- Attributes that designate procedures - First_Procedure_Attribute : constant Name_Id := N + 503; - Name_Output : constant Name_Id := N + 503; - Name_Read : constant Name_Id := N + 504; - Name_Write : constant Name_Id := N + 505; - Last_Procedure_Attribute : constant Name_Id := N + 505; + First_Procedure_Attribute : constant Name_Id := N + 514; + Name_Output : constant Name_Id := N + 514; + Name_Read : constant Name_Id := N + 515; + Name_Write : constant Name_Id := N + 516; + Last_Procedure_Attribute : constant Name_Id := N + 516; -- Remaining attributes are ones that return entities - First_Entity_Attribute_Name : constant Name_Id := N + 506; - Name_Elab_Body : constant Name_Id := N + 506; -- GNAT - Name_Elab_Spec : constant Name_Id := N + 507; -- GNAT - Name_Storage_Pool : constant Name_Id := N + 508; + First_Entity_Attribute_Name : constant Name_Id := N + 517; + Name_Elab_Body : constant Name_Id := N + 517; -- GNAT + Name_Elab_Spec : constant Name_Id := N + 518; -- GNAT + Name_Storage_Pool : constant Name_Id := N + 519; -- These attributes are the ones that return types - First_Type_Attribute_Name : constant Name_Id := N + 509; - Name_Base : constant Name_Id := N + 509; - Name_Class : constant Name_Id := N + 510; - Name_Stub_Type : constant Name_Id := N + 511; - Last_Type_Attribute_Name : constant Name_Id := N + 511; - Last_Entity_Attribute_Name : constant Name_Id := N + 511; - Last_Attribute_Name : constant Name_Id := N + 511; + First_Type_Attribute_Name : constant Name_Id := N + 520; + Name_Base : constant Name_Id := N + 520; + Name_Class : constant Name_Id := N + 521; + Name_Stub_Type : constant Name_Id := N + 522; + Last_Type_Attribute_Name : constant Name_Id := N + 522; + Last_Entity_Attribute_Name : constant Name_Id := N + 522; + Last_Attribute_Name : constant Name_Id := N + 522; -- Names of recognized locking policy identifiers @@ -836,10 +847,10 @@ package Snames is -- name (e.g. C for Ceiling_Locking). If new policy names are added, -- the first character must be distinct. - First_Locking_Policy_Name : constant Name_Id := N + 512; - Name_Ceiling_Locking : constant Name_Id := N + 512; - Name_Inheritance_Locking : constant Name_Id := N + 513; - Last_Locking_Policy_Name : constant Name_Id := N + 513; + First_Locking_Policy_Name : constant Name_Id := N + 523; + Name_Ceiling_Locking : constant Name_Id := N + 523; + Name_Inheritance_Locking : constant Name_Id := N + 524; + Last_Locking_Policy_Name : constant Name_Id := N + 524; -- Names of recognized queuing policy identifiers @@ -847,10 +858,10 @@ package Snames is -- name (e.g. F for FIFO_Queuing). If new policy names are added, -- the first character must be distinct. - First_Queuing_Policy_Name : constant Name_Id := N + 514; - Name_FIFO_Queuing : constant Name_Id := N + 514; - Name_Priority_Queuing : constant Name_Id := N + 515; - Last_Queuing_Policy_Name : constant Name_Id := N + 515; + First_Queuing_Policy_Name : constant Name_Id := N + 525; + Name_FIFO_Queuing : constant Name_Id := N + 525; + Name_Priority_Queuing : constant Name_Id := N + 526; + Last_Queuing_Policy_Name : constant Name_Id := N + 526; -- Names of recognized task dispatching policy identifiers @@ -858,275 +869,279 @@ package Snames is -- name (e.g. F for FIFO_Within_Priorities). If new policy names -- are added, the first character must be distinct. - First_Task_Dispatching_Policy_Name : constant Name_Id := N + 516; - Name_EDF_Across_Priorities : constant Name_Id := N + 516; - Name_FIFO_Within_Priorities : constant Name_Id := N + 517; - Name_Non_Preemptive_Within_Priorities - : constant Name_Id := N + 513; - Name_Round_Robin_Within_Priorities : constant Name_Id := N + 518; - Last_Task_Dispatching_Policy_Name : constant Name_Id := N + 518; + First_Task_Dispatching_Policy_Name : constant Name_Id := N + 527; + Name_EDF_Across_Priorities : constant Name_Id := N + 527; + Name_FIFO_Within_Priorities : constant Name_Id := N + 528; + Name_Non_Preemptive_Within_Priorities : constant Name_Id := N + 529; + Name_Round_Robin_Within_Priorities : constant Name_Id := N + 530; + Last_Task_Dispatching_Policy_Name : constant Name_Id := N + 530; -- Names of recognized checks for pragma Suppress - First_Check_Name : constant Name_Id := N + 519; - Name_Access_Check : constant Name_Id := N + 519; - Name_Accessibility_Check : constant Name_Id := N + 520; - Name_Alignment_Check : constant Name_Id := N + 521; -- GNAT - Name_Discriminant_Check : constant Name_Id := N + 522; - Name_Division_Check : constant Name_Id := N + 523; - Name_Elaboration_Check : constant Name_Id := N + 524; - Name_Index_Check : constant Name_Id := N + 525; - Name_Length_Check : constant Name_Id := N + 526; - Name_Overflow_Check : constant Name_Id := N + 527; - Name_Range_Check : constant Name_Id := N + 528; - Name_Storage_Check : constant Name_Id := N + 529; - Name_Tag_Check : constant Name_Id := N + 530; - Name_Validity_Check : constant Name_Id := N + 531; -- GNAT - Name_All_Checks : constant Name_Id := N + 532; - Last_Check_Name : constant Name_Id := N + 532; + First_Check_Name : constant Name_Id := N + 531; + Name_Access_Check : constant Name_Id := N + 531; + Name_Accessibility_Check : constant Name_Id := N + 532; + Name_Alignment_Check : constant Name_Id := N + 533; -- GNAT + Name_Discriminant_Check : constant Name_Id := N + 534; + Name_Division_Check : constant Name_Id := N + 535; + Name_Elaboration_Check : constant Name_Id := N + 536; + Name_Index_Check : constant Name_Id := N + 537; + Name_Length_Check : constant Name_Id := N + 538; + Name_Overflow_Check : constant Name_Id := N + 539; + Name_Range_Check : constant Name_Id := N + 540; + Name_Storage_Check : constant Name_Id := N + 541; + Name_Tag_Check : constant Name_Id := N + 542; + Name_Validity_Check : constant Name_Id := N + 543; -- GNAT + Name_All_Checks : constant Name_Id := N + 544; + Last_Check_Name : constant Name_Id := N + 544; -- Names corresponding to reserved keywords, excluding those already -- declared in the attribute list (Access, Delta, Digits, Mod, Range). - Name_Abort : constant Name_Id := N + 533; - Name_Abs : constant Name_Id := N + 534; - Name_Accept : constant Name_Id := N + 535; - Name_And : constant Name_Id := N + 536; - Name_All : constant Name_Id := N + 537; - Name_Array : constant Name_Id := N + 538; - Name_At : constant Name_Id := N + 539; - Name_Begin : constant Name_Id := N + 540; - Name_Body : constant Name_Id := N + 541; - Name_Case : constant Name_Id := N + 542; - Name_Constant : constant Name_Id := N + 543; - Name_Declare : constant Name_Id := N + 544; - Name_Delay : constant Name_Id := N + 545; - Name_Do : constant Name_Id := N + 546; - Name_Else : constant Name_Id := N + 547; - Name_Elsif : constant Name_Id := N + 548; - Name_End : constant Name_Id := N + 549; - Name_Entry : constant Name_Id := N + 550; - Name_Exception : constant Name_Id := N + 551; - Name_Exit : constant Name_Id := N + 552; - Name_For : constant Name_Id := N + 553; - Name_Function : constant Name_Id := N + 554; - Name_Generic : constant Name_Id := N + 555; - Name_Goto : constant Name_Id := N + 556; - Name_If : constant Name_Id := N + 557; - Name_In : constant Name_Id := N + 558; - Name_Is : constant Name_Id := N + 559; - Name_Limited : constant Name_Id := N + 560; - Name_Loop : constant Name_Id := N + 561; - Name_New : constant Name_Id := N + 562; - Name_Not : constant Name_Id := N + 563; - Name_Null : constant Name_Id := N + 564; - Name_Of : constant Name_Id := N + 565; - Name_Or : constant Name_Id := N + 566; - Name_Others : constant Name_Id := N + 567; - Name_Out : constant Name_Id := N + 568; - Name_Package : constant Name_Id := N + 569; - Name_Pragma : constant Name_Id := N + 570; - Name_Private : constant Name_Id := N + 571; - Name_Procedure : constant Name_Id := N + 572; - Name_Raise : constant Name_Id := N + 573; - Name_Record : constant Name_Id := N + 574; - Name_Rem : constant Name_Id := N + 575; - Name_Renames : constant Name_Id := N + 576; - Name_Return : constant Name_Id := N + 577; - Name_Reverse : constant Name_Id := N + 578; - Name_Select : constant Name_Id := N + 579; - Name_Separate : constant Name_Id := N + 580; - Name_Subtype : constant Name_Id := N + 581; - Name_Task : constant Name_Id := N + 582; - Name_Terminate : constant Name_Id := N + 583; - Name_Then : constant Name_Id := N + 584; - Name_Type : constant Name_Id := N + 585; - Name_Use : constant Name_Id := N + 586; - Name_When : constant Name_Id := N + 587; - Name_While : constant Name_Id := N + 588; - Name_With : constant Name_Id := N + 589; - Name_Xor : constant Name_Id := N + 590; + Name_Abort : constant Name_Id := N + 545; + Name_Abs : constant Name_Id := N + 546; + Name_Accept : constant Name_Id := N + 547; + Name_And : constant Name_Id := N + 548; + Name_All : constant Name_Id := N + 549; + Name_Array : constant Name_Id := N + 550; + Name_At : constant Name_Id := N + 551; + Name_Begin : constant Name_Id := N + 552; + Name_Body : constant Name_Id := N + 553; + Name_Case : constant Name_Id := N + 554; + Name_Constant : constant Name_Id := N + 555; + Name_Declare : constant Name_Id := N + 556; + Name_Delay : constant Name_Id := N + 557; + Name_Do : constant Name_Id := N + 558; + Name_Else : constant Name_Id := N + 559; + Name_Elsif : constant Name_Id := N + 560; + Name_End : constant Name_Id := N + 561; + Name_Entry : constant Name_Id := N + 562; + Name_Exception : constant Name_Id := N + 563; + Name_Exit : constant Name_Id := N + 564; + Name_For : constant Name_Id := N + 565; + Name_Function : constant Name_Id := N + 566; + Name_Generic : constant Name_Id := N + 567; + Name_Goto : constant Name_Id := N + 568; + Name_If : constant Name_Id := N + 569; + Name_In : constant Name_Id := N + 570; + Name_Is : constant Name_Id := N + 571; + Name_Limited : constant Name_Id := N + 572; + Name_Loop : constant Name_Id := N + 573; + Name_New : constant Name_Id := N + 574; + Name_Not : constant Name_Id := N + 575; + Name_Null : constant Name_Id := N + 576; + Name_Of : constant Name_Id := N + 577; + Name_Or : constant Name_Id := N + 578; + Name_Others : constant Name_Id := N + 579; + Name_Out : constant Name_Id := N + 580; + Name_Package : constant Name_Id := N + 581; + Name_Pragma : constant Name_Id := N + 582; + Name_Private : constant Name_Id := N + 583; + Name_Procedure : constant Name_Id := N + 584; + Name_Raise : constant Name_Id := N + 585; + Name_Record : constant Name_Id := N + 586; + Name_Rem : constant Name_Id := N + 587; + Name_Renames : constant Name_Id := N + 588; + Name_Return : constant Name_Id := N + 589; + Name_Reverse : constant Name_Id := N + 590; + Name_Select : constant Name_Id := N + 591; + Name_Separate : constant Name_Id := N + 592; + Name_Subtype : constant Name_Id := N + 593; + Name_Task : constant Name_Id := N + 594; + Name_Terminate : constant Name_Id := N + 595; + Name_Then : constant Name_Id := N + 596; + Name_Type : constant Name_Id := N + 597; + Name_Use : constant Name_Id := N + 598; + Name_When : constant Name_Id := N + 599; + Name_While : constant Name_Id := N + 600; + Name_With : constant Name_Id := N + 601; + Name_Xor : constant Name_Id := N + 602; -- Names of intrinsic subprograms -- Note: Asm is missing from this list, since Asm is a legitimate - -- convention name. So is To_Adress, which is a GNAT attribute. - - First_Intrinsic_Name : constant Name_Id := N + 591; - Name_Divide : constant Name_Id := N + 591; - Name_Enclosing_Entity : constant Name_Id := N + 592; - Name_Exception_Information : constant Name_Id := N + 593; - Name_Exception_Message : constant Name_Id := N + 594; - Name_Exception_Name : constant Name_Id := N + 595; - Name_File : constant Name_Id := N + 596; - Name_Generic_Dispatching_Constructor : constant Name_Id := N + 597; - Name_Import_Address : constant Name_Id := N + 598; - Name_Import_Largest_Value : constant Name_Id := N + 599; - Name_Import_Value : constant Name_Id := N + 600; - Name_Is_Negative : constant Name_Id := N + 601; - Name_Line : constant Name_Id := N + 602; - Name_Rotate_Left : constant Name_Id := N + 603; - Name_Rotate_Right : constant Name_Id := N + 604; - Name_Shift_Left : constant Name_Id := N + 605; - Name_Shift_Right : constant Name_Id := N + 606; - Name_Shift_Right_Arithmetic : constant Name_Id := N + 607; - Name_Source_Location : constant Name_Id := N + 608; - Name_Unchecked_Conversion : constant Name_Id := N + 609; - Name_Unchecked_Deallocation : constant Name_Id := N + 610; - Name_To_Pointer : constant Name_Id := N + 611; - Last_Intrinsic_Name : constant Name_Id := N + 611; + -- convention name. So is To_Address, which is a GNAT attribute. + + First_Intrinsic_Name : constant Name_Id := N + 603; + Name_Divide : constant Name_Id := N + 603; + Name_Enclosing_Entity : constant Name_Id := N + 604; + Name_Exception_Information : constant Name_Id := N + 605; + Name_Exception_Message : constant Name_Id := N + 606; + Name_Exception_Name : constant Name_Id := N + 607; + Name_File : constant Name_Id := N + 608; + Name_Generic_Dispatching_Constructor : constant Name_Id := N + 609; + Name_Import_Address : constant Name_Id := N + 610; + Name_Import_Largest_Value : constant Name_Id := N + 611; + Name_Import_Value : constant Name_Id := N + 612; + Name_Is_Negative : constant Name_Id := N + 613; + Name_Line : constant Name_Id := N + 614; + Name_Rotate_Left : constant Name_Id := N + 615; + Name_Rotate_Right : constant Name_Id := N + 616; + Name_Shift_Left : constant Name_Id := N + 617; + Name_Shift_Right : constant Name_Id := N + 618; + Name_Shift_Right_Arithmetic : constant Name_Id := N + 619; + Name_Source_Location : constant Name_Id := N + 620; + Name_Unchecked_Conversion : constant Name_Id := N + 621; + Name_Unchecked_Deallocation : constant Name_Id := N + 622; + Name_To_Pointer : constant Name_Id := N + 623; + Last_Intrinsic_Name : constant Name_Id := N + 623; -- Names used in processing intrinsic calls - Name_Free : constant Name_Id := N + 612; + Name_Free : constant Name_Id := N + 624; -- Reserved words used only in Ada 95 - First_95_Reserved_Word : constant Name_Id := N + 613; - Name_Abstract : constant Name_Id := N + 613; - Name_Aliased : constant Name_Id := N + 614; - Name_Protected : constant Name_Id := N + 615; - Name_Until : constant Name_Id := N + 616; - Name_Requeue : constant Name_Id := N + 617; - Name_Tagged : constant Name_Id := N + 618; - Last_95_Reserved_Word : constant Name_Id := N + 618; + First_95_Reserved_Word : constant Name_Id := N + 625; + Name_Abstract : constant Name_Id := N + 625; + Name_Aliased : constant Name_Id := N + 626; + Name_Protected : constant Name_Id := N + 627; + Name_Until : constant Name_Id := N + 628; + Name_Requeue : constant Name_Id := N + 629; + Name_Tagged : constant Name_Id := N + 630; + Last_95_Reserved_Word : constant Name_Id := N + 630; subtype Ada_95_Reserved_Words is Name_Id range First_95_Reserved_Word .. Last_95_Reserved_Word; -- Miscellaneous names used in semantic checking - Name_Raise_Exception : constant Name_Id := N + 619; + Name_Raise_Exception : constant Name_Id := N + 631; -- Additional reserved words and identifiers used in GNAT Project Files -- Note that Name_External is already previously declared - Name_Ada_Roots : constant Name_Id := N + 620; - Name_Archive_Builder : constant Name_Id := N + 621; - Name_Archive_Indexer : constant Name_Id := N + 622; - Name_Archive_Suffix : constant Name_Id := N + 623; - Name_Binder : constant Name_Id := N + 624; - Name_Binder_Prefix : constant Name_Id := N + 625; - Name_Body_Suffix : constant Name_Id := N + 626; - Name_Builder : constant Name_Id := N + 627; - Name_Builder_Switches : constant Name_Id := N + 628; - Name_Compiler : constant Name_Id := N + 629; - Name_Compiler_Kind : constant Name_Id := N + 630; - Name_Config_Body_File_Name : constant Name_Id := N + 631; - Name_Config_Body_File_Name_Pattern : constant Name_Id := N + 632; - Name_Config_File_Switches : constant Name_Id := N + 633; - Name_Config_File_Unique : constant Name_Id := N + 634; - Name_Config_Spec_File_Name : constant Name_Id := N + 635; - Name_Config_Spec_File_Name_Pattern : constant Name_Id := N + 636; - Name_Cross_Reference : constant Name_Id := N + 637; - Name_Default_Language : constant Name_Id := N + 638; - Name_Default_Switches : constant Name_Id := N + 639; - Name_Dependency_Driver : constant Name_Id := N + 640; - Name_Dependency_File_Kind : constant Name_Id := N + 641; - Name_Dependency_Switches : constant Name_Id := N + 642; - Name_Driver : constant Name_Id := N + 643; - Name_Excluded_Source_Dirs : constant Name_Id := N + 644; - Name_Excluded_Source_Files : constant Name_Id := N + 645; - Name_Exec_Dir : constant Name_Id := N + 646; - Name_Executable : constant Name_Id := N + 647; - Name_Executable_Suffix : constant Name_Id := N + 648; - Name_Extends : constant Name_Id := N + 649; - Name_Externally_Built : constant Name_Id := N + 650; - Name_Finder : constant Name_Id := N + 651; - Name_Global_Configuration_Pragmas : constant Name_Id := N + 652; - Name_Global_Config_File : constant Name_Id := N + 653; - Name_Gnatls : constant Name_Id := N + 654; - Name_Gnatstub : constant Name_Id := N + 655; - Name_Implementation : constant Name_Id := N + 656; - Name_Implementation_Exceptions : constant Name_Id := N + 657; - Name_Implementation_Suffix : constant Name_Id := N + 658; - Name_Include_Switches : constant Name_Id := N + 659; - Name_Include_Path : constant Name_Id := N + 660; - Name_Include_Path_File : constant Name_Id := N + 661; - Name_Language_Kind : constant Name_Id := N + 662; - Name_Language_Processing : constant Name_Id := N + 663; - Name_Languages : constant Name_Id := N + 664; - Name_Library_Ali_Dir : constant Name_Id := N + 665; - Name_Library_Auto_Init : constant Name_Id := N + 666; - Name_Library_Auto_Init_Supported : constant Name_Id := N + 667; - Name_Library_Builder : constant Name_Id := N + 668; - Name_Library_Dir : constant Name_Id := N + 669; - Name_Library_GCC : constant Name_Id := N + 670; - Name_Library_Interface : constant Name_Id := N + 671; - Name_Library_Kind : constant Name_Id := N + 672; - Name_Library_Name : constant Name_Id := N + 673; - Name_Library_Major_Minor_Id_Supported : constant Name_Id := N + 674; - Name_Library_Options : constant Name_Id := N + 675; - Name_Library_Partial_Linker : constant Name_Id := N + 676; - Name_Library_Reference_Symbol_File : constant Name_Id := N + 677; - Name_Library_Src_Dir : constant Name_Id := N + 678; - Name_Library_Support : constant Name_Id := N + 679; - Name_Library_Symbol_File : constant Name_Id := N + 680; - Name_Library_Symbol_Policy : constant Name_Id := N + 681; - Name_Library_Version : constant Name_Id := N + 682; - Name_Library_Version_Switches : constant Name_Id := N + 683; - Name_Linker : constant Name_Id := N + 684; - Name_Linker_Executable_Option : constant Name_Id := N + 685; - Name_Linker_Lib_Dir_Option : constant Name_Id := N + 686; - Name_Linker_Lib_Name_Option : constant Name_Id := N + 687; - Name_Local_Config_File : constant Name_Id := N + 688; - Name_Local_Configuration_Pragmas : constant Name_Id := N + 689; - Name_Locally_Removed_Files : constant Name_Id := N + 690; - Name_Mapping_File_Switches : constant Name_Id := N + 691; - Name_Mapping_Spec_Suffix : constant Name_Id := N + 692; - Name_Mapping_Body_Suffix : constant Name_Id := N + 693; - Name_Metrics : constant Name_Id := N + 694; - Name_Naming : constant Name_Id := N + 695; - Name_Objects_Path : constant Name_Id := N + 696; - Name_Objects_Path_File : constant Name_Id := N + 697; - Name_Object_Dir : constant Name_Id := N + 698; - Name_Pic_Option : constant Name_Id := N + 699; - Name_Pretty_Printer : constant Name_Id := N + 700; - Name_Prefix : constant Name_Id := N + 701; - Name_Project : constant Name_Id := N + 702; - Name_Roots : constant Name_Id := N + 703; - Name_Required_Switches : constant Name_Id := N + 704; - Name_Run_Path_Option : constant Name_Id := N + 705; - Name_Runtime_Project : constant Name_Id := N + 706; - Name_Shared_Library_Minimum_Switches : constant Name_Id := N + 707; - Name_Shared_Library_Prefix : constant Name_Id := N + 708; - Name_Shared_Library_Suffix : constant Name_Id := N + 709; - Name_Separate_Suffix : constant Name_Id := N + 710; - Name_Source_Dirs : constant Name_Id := N + 711; - Name_Source_Files : constant Name_Id := N + 712; - Name_Source_List_File : constant Name_Id := N + 713; - Name_Spec : constant Name_Id := N + 714; - Name_Spec_Suffix : constant Name_Id := N + 715; - Name_Specification : constant Name_Id := N + 716; - Name_Specification_Exceptions : constant Name_Id := N + 717; - Name_Specification_Suffix : constant Name_Id := N + 718; - Name_Stack : constant Name_Id := N + 719; - Name_Switches : constant Name_Id := N + 720; - Name_Symbolic_Link_Supported : constant Name_Id := N + 721; - Name_Sync : constant Name_Id := N + 722; - Name_Synchronize : constant Name_Id := N + 723; - Name_Toolchain_Description : constant Name_Id := N + 724; - Name_Toolchain_Version : constant Name_Id := N + 725; - Name_Runtime_Library_Dir : constant Name_Id := N + 726; + Name_Ada_Roots : constant Name_Id := N + 632; + Name_Aggregate : constant Name_Id := N + 633; + Name_Archive_Builder : constant Name_Id := N + 634; + Name_Archive_Builder_Append_Option : constant Name_Id := N + 635; + Name_Archive_Indexer : constant Name_Id := N + 636; + Name_Archive_Suffix : constant Name_Id := N + 637; + Name_Binder : constant Name_Id := N + 638; + Name_Binder_Prefix : constant Name_Id := N + 639; + Name_Body_Suffix : constant Name_Id := N + 640; + Name_Builder : constant Name_Id := N + 641; + Name_Builder_Switches : constant Name_Id := N + 642; + Name_Compiler : constant Name_Id := N + 643; + Name_Compiler_Kind : constant Name_Id := N + 644; + Name_Config_Body_File_Name : constant Name_Id := N + 645; + Name_Config_Body_File_Name_Pattern : constant Name_Id := N + 646; + Name_Config_File_Switches : constant Name_Id := N + 647; + Name_Config_File_Unique : constant Name_Id := N + 648; + Name_Config_Spec_File_Name : constant Name_Id := N + 649; + Name_Config_Spec_File_Name_Pattern : constant Name_Id := N + 650; + Name_Configuration : constant Name_Id := N + 651; + Name_Cross_Reference : constant Name_Id := N + 652; + Name_Default_Language : constant Name_Id := N + 653; + Name_Default_Switches : constant Name_Id := N + 654; + Name_Dependency_Driver : constant Name_Id := N + 655; + Name_Dependency_File_Kind : constant Name_Id := N + 656; + Name_Dependency_Switches : constant Name_Id := N + 657; + Name_Driver : constant Name_Id := N + 658; + Name_Excluded_Source_Dirs : constant Name_Id := N + 659; + Name_Excluded_Source_Files : constant Name_Id := N + 660; + Name_Exec_Dir : constant Name_Id := N + 661; + Name_Executable : constant Name_Id := N + 662; + Name_Executable_Suffix : constant Name_Id := N + 663; + Name_Extends : constant Name_Id := N + 664; + Name_Externally_Built : constant Name_Id := N + 665; + Name_Finder : constant Name_Id := N + 666; + Name_Global_Configuration_Pragmas : constant Name_Id := N + 667; + Name_Global_Config_File : constant Name_Id := N + 668; + Name_Gnatls : constant Name_Id := N + 669; + Name_Gnatstub : constant Name_Id := N + 670; + Name_Implementation : constant Name_Id := N + 671; + Name_Implementation_Exceptions : constant Name_Id := N + 672; + Name_Implementation_Suffix : constant Name_Id := N + 673; + Name_Include_Switches : constant Name_Id := N + 674; + Name_Include_Path : constant Name_Id := N + 675; + Name_Include_Path_File : constant Name_Id := N + 676; + Name_Inherit_Source_Path : constant Name_Id := N + 677; + Name_Language_Kind : constant Name_Id := N + 678; + Name_Language_Processing : constant Name_Id := N + 679; + Name_Languages : constant Name_Id := N + 680; + Name_Library : constant Name_Id := N + 681; + Name_Library_Ali_Dir : constant Name_Id := N + 682; + Name_Library_Auto_Init : constant Name_Id := N + 683; + Name_Library_Auto_Init_Supported : constant Name_Id := N + 684; + Name_Library_Builder : constant Name_Id := N + 685; + Name_Library_Dir : constant Name_Id := N + 686; + Name_Library_GCC : constant Name_Id := N + 687; + Name_Library_Interface : constant Name_Id := N + 688; + Name_Library_Kind : constant Name_Id := N + 689; + Name_Library_Name : constant Name_Id := N + 690; + Name_Library_Major_Minor_Id_Supported : constant Name_Id := N + 691; + Name_Library_Options : constant Name_Id := N + 692; + Name_Library_Partial_Linker : constant Name_Id := N + 693; + Name_Library_Reference_Symbol_File : constant Name_Id := N + 694; + Name_Library_Src_Dir : constant Name_Id := N + 695; + Name_Library_Support : constant Name_Id := N + 696; + Name_Library_Symbol_File : constant Name_Id := N + 697; + Name_Library_Symbol_Policy : constant Name_Id := N + 698; + Name_Library_Version : constant Name_Id := N + 699; + Name_Library_Version_Switches : constant Name_Id := N + 700; + Name_Linker : constant Name_Id := N + 701; + Name_Linker_Executable_Option : constant Name_Id := N + 702; + Name_Linker_Lib_Dir_Option : constant Name_Id := N + 703; + Name_Linker_Lib_Name_Option : constant Name_Id := N + 704; + Name_Local_Config_File : constant Name_Id := N + 705; + Name_Local_Configuration_Pragmas : constant Name_Id := N + 706; + Name_Locally_Removed_Files : constant Name_Id := N + 707; + Name_Mapping_File_Switches : constant Name_Id := N + 708; + Name_Mapping_Spec_Suffix : constant Name_Id := N + 709; + Name_Mapping_Body_Suffix : constant Name_Id := N + 710; + Name_Metrics : constant Name_Id := N + 711; + Name_Naming : constant Name_Id := N + 712; + Name_Objects_Path : constant Name_Id := N + 713; + Name_Objects_Path_File : constant Name_Id := N + 714; + Name_Object_Dir : constant Name_Id := N + 715; + Name_Pic_Option : constant Name_Id := N + 716; + Name_Pretty_Printer : constant Name_Id := N + 717; + Name_Prefix : constant Name_Id := N + 718; + Name_Project : constant Name_Id := N + 719; + Name_Roots : constant Name_Id := N + 720; + Name_Required_Switches : constant Name_Id := N + 721; + Name_Run_Path_Option : constant Name_Id := N + 722; + Name_Runtime_Project : constant Name_Id := N + 723; + Name_Shared_Library_Minimum_Switches : constant Name_Id := N + 724; + Name_Shared_Library_Prefix : constant Name_Id := N + 725; + Name_Shared_Library_Suffix : constant Name_Id := N + 726; + Name_Separate_Suffix : constant Name_Id := N + 727; + Name_Source_Dirs : constant Name_Id := N + 728; + Name_Source_Files : constant Name_Id := N + 729; + Name_Source_List_File : constant Name_Id := N + 730; + Name_Spec : constant Name_Id := N + 731; + Name_Spec_Suffix : constant Name_Id := N + 732; + Name_Specification : constant Name_Id := N + 733; + Name_Specification_Exceptions : constant Name_Id := N + 734; + Name_Specification_Suffix : constant Name_Id := N + 735; + Name_Stack : constant Name_Id := N + 736; + Name_Switches : constant Name_Id := N + 737; + Name_Symbolic_Link_Supported : constant Name_Id := N + 738; + Name_Sync : constant Name_Id := N + 739; + Name_Synchronize : constant Name_Id := N + 740; + Name_Toolchain_Description : constant Name_Id := N + 741; + Name_Toolchain_Version : constant Name_Id := N + 742; + Name_Runtime_Library_Dir : constant Name_Id := N + 743; -- Other miscellaneous names used in front end - Name_Unaligned_Valid : constant Name_Id := N + 727; + Name_Unaligned_Valid : constant Name_Id := N + 744; -- Ada 2005 reserved words - First_2005_Reserved_Word : constant Name_Id := N + 728; - Name_Interface : constant Name_Id := N + 728; - Name_Overriding : constant Name_Id := N + 729; - Name_Synchronized : constant Name_Id := N + 730; - Last_2005_Reserved_Word : constant Name_Id := N + 730; + First_2005_Reserved_Word : constant Name_Id := N + 745; + Name_Interface : constant Name_Id := N + 745; + Name_Overriding : constant Name_Id := N + 746; + Name_Synchronized : constant Name_Id := N + 747; + Last_2005_Reserved_Word : constant Name_Id := N + 747; subtype Ada_2005_Reserved_Words is Name_Id range First_2005_Reserved_Word .. Last_2005_Reserved_Word; -- Mark last defined name for consistency check in Snames body - Last_Predefined_Name : constant Name_Id := N + 730; + Last_Predefined_Name : constant Name_Id := N + 747; --------------------------------------- -- Subtypes Defining Name Categories -- @@ -1172,6 +1187,7 @@ package Snames is Attribute_Emax, Attribute_Enabled, Attribute_Enum_Rep, + Attribute_Enum_Val, Attribute_Epsilon, Attribute_Exponent, Attribute_External_Tag, @@ -1182,9 +1198,11 @@ package Snames is Attribute_Fore, Attribute_Has_Access_Values, Attribute_Has_Discriminants, + Attribute_Has_Tagged_Values, Attribute_Identity, Attribute_Img, Attribute_Integer_Value, + Attribute_Invalid_Value, Attribute_Large, Attribute_Last, Attribute_Last_Bit, @@ -1219,6 +1237,7 @@ package Snames is Attribute_Priority, Attribute_Range, Attribute_Range_Length, + Attribute_Result, Attribute_Round, Attribute_Safe_Emax, Attribute_Safe_First, @@ -1328,7 +1347,7 @@ package Snames is -- Note: Convention C_Pass_By_Copy is allowed only for record -- types (where it is treated like C except that the appropriate - -- flag is set in the record type). Recognizion of this convention + -- flag is set in the record type). Recognizing this convention -- is specially handled in Sem_Prag. for Convention_Id'Size use 8; @@ -1353,6 +1372,10 @@ package Snames is -- Configuration pragmas + -- Note: This list is in the GNAT users guide, so be sure that if any + -- additions or deletions are made to the following list, they are + -- properly reflected in the users guide. + Pragma_Ada_83, Pragma_Ada_95, Pragma_Ada_05, @@ -1360,6 +1383,7 @@ package Snames is Pragma_Assertion_Policy, Pragma_C_Pass_By_Copy, Pragma_Check_Name, + Pragma_Check_Policy, Pragma_Compile_Time_Error, Pragma_Compile_Time_Warning, Pragma_Compiler_Unit, @@ -1385,8 +1409,8 @@ package Snames is Pragma_No_Strict_Aliasing, Pragma_Normalize_Scalars, Pragma_Optimize_Alignment, - Pragma_Polling, Pragma_Persistent_BSS, + Pragma_Polling, Pragma_Priority_Specific_Dispatching, Pragma_Profile, Pragma_Profile_Warnings, @@ -1420,6 +1444,7 @@ package Snames is Pragma_Atomic, Pragma_Atomic_Components, Pragma_Attach_Handler, + Pragma_Check, Pragma_CIL_Constructor, Pragma_Comment, Pragma_Common_Object, @@ -1480,6 +1505,8 @@ package Snames is Pragma_Pack, Pragma_Page, Pragma_Passive, + Pragma_Postcondition, + Pragma_Precondition, Pragma_Preelaborable_Initialization, Pragma_Preelaborate, Pragma_Preelaborate_05, @@ -1487,6 +1514,7 @@ package Snames is Pragma_Pure, Pragma_Pure_05, Pragma_Pure_Function, + Pragma_Relative_Deadline, Pragma_Remote_Call_Interface, Pragma_Remote_Types, Pragma_Share_Generic, @@ -1569,7 +1597,7 @@ package Snames is -- Test to see if the name N is the name of a recognized attribute -- that designates a renameable function, and can therefore appear in -- a renaming statement. Note that not all attributes designating - -- functions are renamable, in particular, thos returning a universal + -- functions are renamable, in particular, those returning a universal -- value cannot be renamed. function Is_Type_Attribute_Name (N : Name_Id) return Boolean; @@ -1627,7 +1655,7 @@ package Snames is -- or one previously given in a call to Record_Convention_Identifier. function Get_Convention_Name (C : Convention_Id) return Name_Id; - -- Returns the name of language convention correspoding to given + -- Returns the name of language convention corresponding to given -- convention id. function Get_Locking_Policy_Id (N : Name_Id) return Locking_Policy_Id; diff --git a/gcc/ada/snames.h b/gcc/ada/snames.h index 2f282edf4d1..80ed0392a30 100644 --- a/gcc/ada/snames.h +++ b/gcc/ada/snames.h @@ -6,7 +6,7 @@ * * * C Header File * * * - * Copyright (C) 1992-2007, Free Software Foundation, Inc. * + * Copyright (C) 1992-2008, Free Software Foundation, Inc. * * * * GNAT is free software; you can redistribute it and/or modify it under * * terms of the GNU General Public License as published by the Free Soft- * @@ -73,118 +73,122 @@ extern unsigned char Get_Attribute_Id (int); #define Attr_Emax 26 #define Attr_Enabled 27 #define Attr_Enum_Rep 28 -#define Attr_Epsilon 29 -#define Attr_Exponent 30 -#define Attr_External_Tag 31 -#define Attr_Fast_Math 32 -#define Attr_First 33 -#define Attr_First_Bit 34 -#define Attr_Fixed_Value 35 -#define Attr_Fore 36 -#define Attr_Has_Access_Values 37 -#define Attr_Has_Discriminants 38 -#define Attr_Identity 39 -#define Attr_Img 40 -#define Attr_Integer_Value 41 -#define Attr_Large 42 -#define Attr_Last 43 -#define Attr_Last_Bit 44 -#define Attr_Leading_Part 45 -#define Attr_Length 46 -#define Attr_Machine_Emax 47 -#define Attr_Machine_Emin 48 -#define Attr_Machine_Mantissa 49 -#define Attr_Machine_Overflows 50 -#define Attr_Machine_Radix 51 -#define Attr_Machine_Rounding 52 -#define Attr_Machine_Rounds 53 -#define Attr_Machine_Size 54 -#define Attr_Mantissa 55 -#define Attr_Max_Size_In_Storage_Elements 56 -#define Attr_Maximum_Alignment 57 -#define Attr_Mechanism_Code 58 -#define Attr_Mod 59 -#define Attr_Model_Emin 60 -#define Attr_Model_Epsilon 61 -#define Attr_Model_Mantissa 62 -#define Attr_Model_Small 63 -#define Attr_Modulus 64 -#define Attr_Null_Parameter 65 -#define Attr_Object_Size 66 -#define Attr_Old 67 -#define Attr_Partition_ID 68 -#define Attr_Passed_By_Reference 69 -#define Attr_Pool_Address 70 -#define Attr_Pos 71 -#define Attr_Position 72 -#define Attr_Priority 73 -#define Attr_Range 74 -#define Attr_Range_Length 75 -#define Attr_Round 76 -#define Attr_Safe_Emax 77 -#define Attr_Safe_First 78 -#define Attr_Safe_Large 79 -#define Attr_Safe_Last 80 -#define Attr_Safe_Small 81 -#define Attr_Scale 82 -#define Attr_Scaling 83 -#define Attr_Signed_Zeros 84 -#define Attr_Size 85 -#define Attr_Small 86 -#define Attr_Storage_Size 87 -#define Attr_Storage_Unit 88 -#define Attr_Stream_Size 89 -#define Attr_Tag 90 -#define Attr_Target_Name 91 -#define Attr_Terminated 92 -#define Attr_To_Address 93 -#define Attr_Type_Class 94 -#define Attr_UET_Address 95 -#define Attr_Unbiased_Rounding 96 -#define Attr_Unchecked_Access 97 -#define Attr_Unconstrained_Array 98 -#define Attr_Universal_Literal_String 99 -#define Attr_Unrestricted_Access 100 -#define Attr_VADS_Size 101 -#define Attr_Val 102 -#define Attr_Valid 103 -#define Attr_Value_Size 104 -#define Attr_Version 105 -#define Attr_Wchar_T_Size 106 -#define Attr_Wide_Wide_Width 107 -#define Attr_Wide_Width 108 -#define Attr_Width 109 -#define Attr_Word_Size 110 -#define Attr_Adjacent 111 -#define Attr_Ceiling 112 -#define Attr_Copy_Sign 113 -#define Attr_Floor 114 -#define Attr_Fraction 115 -#define Attr_Image 116 -#define Attr_Input 117 -#define Attr_Machine 118 -#define Attr_Max 119 -#define Attr_Min 120 -#define Attr_Model 121 -#define Attr_Pred 122 -#define Attr_Remainder 123 -#define Attr_Rounding 124 -#define Attr_Succ 125 -#define Attr_Truncation 126 -#define Attr_Value 127 -#define Attr_Wide_Image 128 -#define Attr_Wide_Wide_Image 129 -#define Attr_Wide_Value 130 -#define Attr_Wide_Wide_Value 131 -#define Attr_Output 132 -#define Attr_Read 133 -#define Attr_Write 134 -#define Attr_Elab_Body 135 -#define Attr_Elab_Spec 136 -#define Attr_Storage_Pool 137 -#define Attr_Base 138 -#define Attr_Class 139 -#define Attr_Stub_Type 140 +#define Attr_Enum_Val 29 +#define Attr_Epsilon 30 +#define Attr_Exponent 31 +#define Attr_External_Tag 32 +#define Attr_Fast_Math 33 +#define Attr_First 34 +#define Attr_First_Bit 35 +#define Attr_Fixed_Value 36 +#define Attr_Fore 37 +#define Attr_Has_Access_Values 38 +#define Attr_Has_Discriminants 39 +#define Attr_Has_Tagged_Values 40 +#define Attr_Identity 41 +#define Attr_Img 42 +#define Attr_Integer_Value 43 +#define Attr_Invalid_Value 44 +#define Attr_Large 45 +#define Attr_Last 46 +#define Attr_Last_Bit 47 +#define Attr_Leading_Part 48 +#define Attr_Length 49 +#define Attr_Machine_Emax 50 +#define Attr_Machine_Emin 51 +#define Attr_Machine_Mantissa 52 +#define Attr_Machine_Overflows 53 +#define Attr_Machine_Radix 54 +#define Attr_Machine_Rounding 55 +#define Attr_Machine_Rounds 56 +#define Attr_Machine_Size 57 +#define Attr_Mantissa 58 +#define Attr_Max_Size_In_Storage_Elements 59 +#define Attr_Maximum_Alignment 60 +#define Attr_Mechanism_Code 61 +#define Attr_Mod 62 +#define Attr_Model_Emin 63 +#define Attr_Model_Epsilon 64 +#define Attr_Model_Mantissa 65 +#define Attr_Model_Small 66 +#define Attr_Modulus 67 +#define Attr_Null_Parameter 68 +#define Attr_Object_Size 69 +#define Attr_Old 70 +#define Attr_Partition_ID 71 +#define Attr_Passed_By_Reference 72 +#define Attr_Pool_Address 73 +#define Attr_Pos 74 +#define Attr_Position 75 +#define Attr_Priority 76 +#define Attr_Range 77 +#define Attr_Range_Length 78 +#define Attr_Result 79 +#define Attr_Round 80 +#define Attr_Safe_Emax 81 +#define Attr_Safe_First 82 +#define Attr_Safe_Large 83 +#define Attr_Safe_Last 84 +#define Attr_Safe_Small 85 +#define Attr_Scale 86 +#define Attr_Scaling 87 +#define Attr_Signed_Zeros 88 +#define Attr_Size 89 +#define Attr_Small 90 +#define Attr_Storage_Size 91 +#define Attr_Storage_Unit 92 +#define Attr_Stream_Size 93 +#define Attr_Tag 94 +#define Attr_Target_Name 95 +#define Attr_Terminated 96 +#define Attr_To_Address 97 +#define Attr_Type_Class 98 +#define Attr_UET_Address 99 +#define Attr_Unbiased_Rounding 100 +#define Attr_Unchecked_Access 101 +#define Attr_Unconstrained_Array 102 +#define Attr_Universal_Literal_String 103 +#define Attr_Unrestricted_Access 104 +#define Attr_VADS_Size 105 +#define Attr_Val 106 +#define Attr_Valid 107 +#define Attr_Value_Size 108 +#define Attr_Version 109 +#define Attr_Wchar_T_Size 110 +#define Attr_Wide_Wide_Width 111 +#define Attr_Wide_Width 112 +#define Attr_Width 113 +#define Attr_Word_Size 114 +#define Attr_Adjacent 115 +#define Attr_Ceiling 116 +#define Attr_Copy_Sign 117 +#define Attr_Floor 118 +#define Attr_Fraction 119 +#define Attr_Image 120 +#define Attr_Input 121 +#define Attr_Machine 122 +#define Attr_Max 123 +#define Attr_Min 124 +#define Attr_Model 125 +#define Attr_Pred 126 +#define Attr_Remainder 127 +#define Attr_Rounding 128 +#define Attr_Succ 129 +#define Attr_Truncation 130 +#define Attr_Value 131 +#define Attr_Wide_Image 132 +#define Attr_Wide_Wide_Image 133 +#define Attr_Wide_Value 134 +#define Attr_Wide_Wide_Value 135 +#define Attr_Output 136 +#define Attr_Read 137 +#define Attr_Write 138 +#define Attr_Elab_Body 139 +#define Attr_Elab_Spec 140 +#define Attr_Storage_Pool 141 +#define Attr_Base 142 +#define Attr_Class 143 +#define Attr_Stub_Type 144 /* Define the numeric values for the conventions. */ @@ -224,163 +228,168 @@ extern unsigned char Get_Pragma_Id (int); #define Pragma_Assertion_Policy 4 #define Pragma_C_Pass_By_Copy 5 #define Pragma_Check_Name 6 -#define Pragma_Compile_Time_Error 7 -#define Pragma_Compile_Time_Warning 8 -#define Pragma_Compiler_Unit 9 -#define Pragma_Component_Alignment 10 -#define Pragma_Convention_Identifier 11 -#define Pragma_Debug_Policy 12 -#define Pragma_Detect_Blocking 13 -#define Pragma_Discard_Names 14 -#define Pragma_Elaboration_Checks 15 -#define Pragma_Eliminate 16 -#define Pragma_Extend_System 17 -#define Pragma_Extensions_Allowed 18 -#define Pragma_External_Name_Casing 19 -#define Pragma_Favor_Top_Level 20 -#define Pragma_Float_Representation 21 -#define Pragma_Implicit_Packing 22 -#define Pragma_Initialize_Scalars 23 -#define Pragma_Interrupt_State 24 -#define Pragma_License 25 -#define Pragma_Locking_Policy 26 -#define Pragma_Long_Float 27 -#define Pragma_No_Run_Time 28 -#define Pragma_No_Strict_Aliasing 29 -#define Pragma_Normalize_Scalars 30 -#define Pragma_Optimize_Alignment 31 -#define Pragma_Polling 32 -#define Pragma_Persistent_BSS 33 -#define Pragma_Priority_Specific_Dispatching 34 -#define Pragma_Profile 35 -#define Pragma_Profile_Warnings 36 -#define Pragma_Propagate_Exceptions 37 -#define Pragma_Queuing_Policy 38 -#define Pragma_Ravenscar 39 -#define Pragma_Restricted_Run_Time 40 -#define Pragma_Restrictions 41 -#define Pragma_Restriction_Warnings 42 -#define Pragma_Reviewable 43 -#define Pragma_Source_File_Name 44 -#define Pragma_Source_File_Name_Project 45 -#define Pragma_Style_Checks 46 -#define Pragma_Suppress 47 -#define Pragma_Suppress_Exception_Locations 48 -#define Pragma_Task_Dispatching_Policy 49 -#define Pragma_Universal_Data 50 -#define Pragma_Unsuppress 51 -#define Pragma_Use_VADS_Size 52 -#define Pragma_Validity_Checks 53 -#define Pragma_Warnings 54 -#define Pragma_Wide_Character_Encoding 55 -#define Pragma_Abort_Defer 56 -#define Pragma_All_Calls_Remote 57 -#define Pragma_Annotate 58 -#define Pragma_Assert 59 -#define Pragma_Asynchronous 60 -#define Pragma_Atomic 61 -#define Pragma_Atomic_Components 62 -#define Pragma_Attach_Handler 63 -#define Pragma_CIL_Constructor 64 -#define Pragma_Comment 65 -#define Pragma_Common_Object 66 -#define Pragma_Complete_Representation 67 -#define Pragma_Complex_Representation 68 -#define Pragma_Controlled 69 -#define Pragma_Convention 70 -#define Pragma_CPP_Class 71 -#define Pragma_CPP_Constructor 72 -#define Pragma_CPP_Virtual 73 -#define Pragma_CPP_Vtable 74 -#define Pragma_Debug 75 -#define Pragma_Elaborate 76 -#define Pragma_Elaborate_All 77 -#define Pragma_Elaborate_Body 78 -#define Pragma_Export 79 -#define Pragma_Export_Exception 80 -#define Pragma_Export_Function 81 -#define Pragma_Export_Object 82 -#define Pragma_Export_Procedure 83 -#define Pragma_Export_Value 84 -#define Pragma_Export_Valued_Procedure 85 -#define Pragma_External 86 -#define Pragma_Finalize_Storage_Only 87 -#define Pragma_Ident 88 -#define Pragma_Implemented_By_Entry 89 -#define Pragma_Import 90 -#define Pragma_Import_Exception 91 -#define Pragma_Import_Function 92 -#define Pragma_Import_Object 93 -#define Pragma_Import_Procedure 94 -#define Pragma_Import_Valued_Procedure 95 -#define Pragma_Inline 96 -#define Pragma_Inline_Always 97 -#define Pragma_Inline_Generic 98 -#define Pragma_Inspection_Point 99 -#define Pragma_Interface_Name 100 -#define Pragma_Interrupt_Handler 101 -#define Pragma_Interrupt_Priority 102 -#define Pragma_Java_Constructor 103 -#define Pragma_Java_Interface 104 -#define Pragma_Keep_Names 105 -#define Pragma_Link_With 106 -#define Pragma_Linker_Alias 107 -#define Pragma_Linker_Constructor 108 -#define Pragma_Linker_Destructor 109 -#define Pragma_Linker_Options 110 -#define Pragma_Linker_Section 111 -#define Pragma_List 112 -#define Pragma_Machine_Attribute 113 -#define Pragma_Main 114 -#define Pragma_Main_Storage 115 -#define Pragma_Memory_Size 116 -#define Pragma_No_Body 117 -#define Pragma_No_Return 118 -#define Pragma_Obsolescent 119 -#define Pragma_Optimize 120 -#define Pragma_Pack 121 -#define Pragma_Page 122 -#define Pragma_Passive 123 -#define Pragma_Preelaborable_Initialization 124 -#define Pragma_Preelaborate 125 -#define Pragma_Preelaborate_05 126 -#define Pragma_Psect_Object 127 -#define Pragma_Pure 128 -#define Pragma_Pure_05 129 -#define Pragma_Pure_Function 130 -#define Pragma_Remote_Call_Interface 131 -#define Pragma_Remote_Types 132 -#define Pragma_Share_Generic 133 -#define Pragma_Shared 134 -#define Pragma_Shared_Passive 135 -#define Pragma_Source_Reference 136 -#define Pragma_Static_Elaboration_Desired 137 -#define Pragma_Stream_Convert 138 -#define Pragma_Subtitle 139 -#define Pragma_Suppress_All 140 -#define Pragma_Suppress_Debug_Info 141 -#define Pragma_Suppress_Initialization 142 -#define Pragma_System_Name 143 -#define Pragma_Task_Info 144 -#define Pragma_Task_Name 145 -#define Pragma_Task_Storage 146 -#define Pragma_Time_Slice 147 -#define Pragma_Title 148 -#define Pragma_Unchecked_Union 149 -#define Pragma_Unimplemented_Unit 150 -#define Pragma_Universal_Aliasing 151 -#define Pragma_Unmodified 152 -#define Pragma_Unreferenced 153 -#define Pragma_Unreferenced_Objects 154 -#define Pragma_Unreserve_All_Interrupts 155 -#define Pragma_Volatile 156 -#define Pragma_Volatile_Components 157 -#define Pragma_Weak_External 158 -#define Pragma_AST_Entry 159 -#define Pragma_Fast_Math 160 -#define Pragma_Interface 161 -#define Pragma_Priority 162 -#define Pragma_Storage_Size 163 -#define Pragma_Storage_Unit 164 +#define Pragma_Check_Policy 7 +#define Pragma_Compile_Time_Error 8 +#define Pragma_Compile_Time_Warning 9 +#define Pragma_Compiler_Unit 10 +#define Pragma_Component_Alignment 11 +#define Pragma_Convention_Identifier 12 +#define Pragma_Debug_Policy 13 +#define Pragma_Detect_Blocking 14 +#define Pragma_Discard_Names 15 +#define Pragma_Elaboration_Checks 16 +#define Pragma_Eliminate 17 +#define Pragma_Extend_System 18 +#define Pragma_Extensions_Allowed 19 +#define Pragma_External_Name_Casing 20 +#define Pragma_Favor_Top_Level 21 +#define Pragma_Float_Representation 22 +#define Pragma_Implicit_Packing 23 +#define Pragma_Initialize_Scalars 24 +#define Pragma_Interrupt_State 25 +#define Pragma_License 26 +#define Pragma_Locking_Policy 27 +#define Pragma_Long_Float 28 +#define Pragma_No_Run_Time 29 +#define Pragma_No_Strict_Aliasing 30 +#define Pragma_Normalize_Scalars 31 +#define Pragma_Optimize_Alignment 32 +#define Pragma_Polling 33 +#define Pragma_Persistent_BSS 34 +#define Pragma_Priority_Specific_Dispatching 35 +#define Pragma_Profile 36 +#define Pragma_Profile_Warnings 37 +#define Pragma_Propagate_Exceptions 38 +#define Pragma_Queuing_Policy 39 +#define Pragma_Ravenscar 40 +#define Pragma_Restricted_Run_Time 41 +#define Pragma_Restrictions 42 +#define Pragma_Restriction_Warnings 43 +#define Pragma_Reviewable 44 +#define Pragma_Source_File_Name 45 +#define Pragma_Source_File_Name_Project 46 +#define Pragma_Style_Checks 47 +#define Pragma_Suppress 48 +#define Pragma_Suppress_Exception_Locations 49 +#define Pragma_Task_Dispatching_Policy 50 +#define Pragma_Universal_Data 51 +#define Pragma_Unsuppress 52 +#define Pragma_Use_VADS_Size 53 +#define Pragma_Validity_Checks 54 +#define Pragma_Warnings 55 +#define Pragma_Wide_Character_Encoding 56 +#define Pragma_Abort_Defer 57 +#define Pragma_All_Calls_Remote 58 +#define Pragma_Annotate 59 +#define Pragma_Assert 60 +#define Pragma_Asynchronous 61 +#define Pragma_Atomic 62 +#define Pragma_Atomic_Components 63 +#define Pragma_Attach_Handler 64 +#define Pragma_Check 65 +#define Pragma_CIL_Constructor 66 +#define Pragma_Comment 67 +#define Pragma_Common_Object 68 +#define Pragma_Complete_Representation 69 +#define Pragma_Complex_Representation 70 +#define Pragma_Controlled 71 +#define Pragma_Convention 72 +#define Pragma_CPP_Class 73 +#define Pragma_CPP_Constructor 74 +#define Pragma_CPP_Virtual 75 +#define Pragma_CPP_Vtable 76 +#define Pragma_Debug 77 +#define Pragma_Elaborate 78 +#define Pragma_Elaborate_All 79 +#define Pragma_Elaborate_Body 80 +#define Pragma_Export 81 +#define Pragma_Export_Exception 82 +#define Pragma_Export_Function 83 +#define Pragma_Export_Object 84 +#define Pragma_Export_Procedure 85 +#define Pragma_Export_Value 86 +#define Pragma_Export_Valued_Procedure 87 +#define Pragma_External 88 +#define Pragma_Finalize_Storage_Only 89 +#define Pragma_Ident 90 +#define Pragma_Implemented_By_Entry 91 +#define Pragma_Import 92 +#define Pragma_Import_Exception 93 +#define Pragma_Import_Function 94 +#define Pragma_Import_Object 95 +#define Pragma_Import_Procedure 96 +#define Pragma_Import_Valued_Procedure 97 +#define Pragma_Inline 98 +#define Pragma_Inline_Always 99 +#define Pragma_Inline_Generic 100 +#define Pragma_Inspection_Point 101 +#define Pragma_Interface_Name 102 +#define Pragma_Interrupt_Handler 103 +#define Pragma_Interrupt_Priority 104 +#define Pragma_Java_Constructor 105 +#define Pragma_Java_Interface 106 +#define Pragma_Keep_Names 107 +#define Pragma_Link_With 108 +#define Pragma_Linker_Alias 109 +#define Pragma_Linker_Constructor 110 +#define Pragma_Linker_Destructor 111 +#define Pragma_Linker_Options 112 +#define Pragma_Linker_Section 113 +#define Pragma_List 114 +#define Pragma_Machine_Attribute 115 +#define Pragma_Main 116 +#define Pragma_Main_Storage 117 +#define Pragma_Memory_Size 118 +#define Pragma_No_Body 119 +#define Pragma_No_Return 120 +#define Pragma_Obsolescent 121 +#define Pragma_Optimize 122 +#define Pragma_Pack 123 +#define Pragma_Page 124 +#define Pragma_Passive 125 +#define Pragma_Postcondition 126 +#define Pragma_Precondition 127 +#define Pragma_Preelaborable_Initialization 128 +#define Pragma_Preelaborate 129 +#define Pragma_Preelaborate_05 130 +#define Pragma_Psect_Object 131 +#define Pragma_Pure 132 +#define Pragma_Pure_05 133 +#define Pragma_Pure_Function 134 +#define Pragma_Relative_Deadline 135 +#define Pragma_Remote_Call_Interface 136 +#define Pragma_Remote_Types 137 +#define Pragma_Share_Generic 138 +#define Pragma_Shared 139 +#define Pragma_Shared_Passive 140 +#define Pragma_Source_Reference 141 +#define Pragma_Static_Elaboration_Desired 142 +#define Pragma_Stream_Convert 143 +#define Pragma_Subtitle 144 +#define Pragma_Suppress_All 145 +#define Pragma_Suppress_Debug_Info 146 +#define Pragma_Suppress_Initialization 147 +#define Pragma_System_Name 148 +#define Pragma_Task_Info 149 +#define Pragma_Task_Name 150 +#define Pragma_Task_Storage 151 +#define Pragma_Time_Slice 152 +#define Pragma_Title 153 +#define Pragma_Unchecked_Union 154 +#define Pragma_Unimplemented_Unit 155 +#define Pragma_Universal_Aliasing 156 +#define Pragma_Unmodified 157 +#define Pragma_Unreferenced 158 +#define Pragma_Unreferenced_Objects 159 +#define Pragma_Unreserve_All_Interrupts 160 +#define Pragma_Volatile 161 +#define Pragma_Volatile_Components 162 +#define Pragma_Weak_External 163 +#define Pragma_AST_Entry 164 +#define Pragma_Fast_Math 165 +#define Pragma_Interface 166 +#define Pragma_Priority 167 +#define Pragma_Storage_Size 168 +#define Pragma_Storage_Unit 169 /* End of snames.h (C version of Snames package spec) */ diff --git a/gcc/ada/socket.c b/gcc/ada/socket.c index 913d1ca40f6..f88ed8cdd07 100644 --- a/gcc/ada/socket.c +++ b/gcc/ada/socket.c @@ -6,7 +6,7 @@ * * * C Implementation File * * * - * Copyright (C) 2003-2007, Free Software Foundation, Inc. * + * Copyright (C) 2003-2008, Free Software Foundation, Inc. * * * * GNAT is free software; you can redistribute it and/or modify it under * * terms of the GNU General Public License as published by the Free Soft- * @@ -206,7 +206,7 @@ __gnat_safe_gethostbyname (const char *name, struct hostent *rh; int ri; -#ifdef __linux__ +#if defined(__linux__) || defined(__GLIBC__) (void) gethostbyname_r (name, ret, buf, buflen, &rh, h_errnop); #else rh = gethostbyname_r (name, ret, buf, buflen, h_errnop); @@ -223,7 +223,7 @@ __gnat_safe_gethostbyaddr (const char *addr, int len, int type, struct hostent *rh; int ri; -#ifdef __linux__ +#if defined(__linux__) || defined(__GLIBC__) (void) gethostbyaddr_r (addr, len, type, ret, buf, buflen, &rh, h_errnop); #else rh = gethostbyaddr_r (addr, len, type, ret, buf, buflen, h_errnop); @@ -239,7 +239,7 @@ __gnat_safe_getservbyname (const char *name, const char *proto, struct servent *rh; int ri; -#ifdef __linux__ +#if defined(__linux__) || defined(__GLIBC__) (void) getservbyname_r (name, proto, ret, buf, buflen, &rh); #else rh = getservbyname_r (name, proto, ret, buf, buflen); @@ -255,7 +255,7 @@ __gnat_safe_getservbyport (int port, const char *proto, struct servent *rh; int ri; -#ifdef __linux__ +#if defined(__linux__) || defined(__GLIBC__) (void) getservbyport_r (port, proto, ret, buf, buflen, &rh); #else rh = getservbyport_r (port, proto, ret, buf, buflen); @@ -340,7 +340,12 @@ __gnat_new_socket_set (fd_set *set) { fd_set *new; +#ifdef VMS +extern void *__gnat_malloc32 (__SIZE_TYPE__); + new = (fd_set *) __gnat_malloc32 (sizeof (fd_set)); +#else new = (fd_set *) __gnat_malloc (sizeof (fd_set)); +#endif if (set) memcpy (new, set, sizeof (fd_set)); diff --git a/gcc/ada/sprint.adb b/gcc/ada/sprint.adb index 7db69e479f4..2ead1c33019 100644 --- a/gcc/ada/sprint.adb +++ b/gcc/ada/sprint.adb @@ -35,6 +35,7 @@ with Nlists; use Nlists; with Opt; use Opt; with Output; use Output; with Rtsfind; use Rtsfind; +with Sem_Util; use Sem_Util; with Sinfo; use Sinfo; with Sinput; use Sinput; with Sinput.D; use Sinput.D; @@ -229,7 +230,7 @@ package body Sprint is -- then output all source lines up to this matching line. procedure Write_Discr_Specs (N : Node_Id); - -- Ouput discriminant specification for node, which is any of the type + -- Output discriminant specification for node, which is any of the type -- declarations that can have discriminants. procedure Write_Ekind (E : Entity_Id); @@ -268,7 +269,7 @@ package body Sprint is function Write_Indent_Identifiers_Sloc (Node : Node_Id) return Boolean; -- Like Write_Indent_Identifiers except that in Debug_Generated_Code - -- mode, the Sloc of the current debug node is set to point ot the + -- mode, the Sloc of the current debug node is set to point to the -- first output identifier. procedure Write_Indent_Str (S : String); @@ -327,7 +328,7 @@ package body Sprint is -- initial Write_Indent (to get new line) if current line is too full. procedure Write_Str_With_Col_Check_Sloc (S : String); - -- Like Write_Str_WIth_Col_Check, but sets debug Sloc of current debug + -- Like Write_Str_With_Col_Check, but sets debug Sloc of current debug -- node to first non-blank character if a current debug node is active. procedure Write_Uint_With_Col_Check (U : Uint; Format : UI_Format); @@ -1040,7 +1041,7 @@ package body Sprint is Indent_End; -- Note: let the printing of Abortable_Part handle outputting - -- the ABORT keyword, so that the Slco can be set correctly. + -- the ABORT keyword, so that the Sloc can be set correctly. Write_Indent_Str ("then "); Sprint_Node (Abortable_Part (Node)); @@ -1331,6 +1332,7 @@ package body Sprint is Sprint_Node (Subtype_Indication (Node)); if Present (Interface_List (Node)) then + Write_Str_With_Col_Check (" and "); Sprint_And_List (Interface_List (Node)); Write_Str_With_Col_Check (" with "); end if; @@ -3664,10 +3666,12 @@ package body Sprint is Write_Char (' '); end loop; - -- If we have a constructed declaration, print it - - if Present (P) and then Nkind (P) in N_Declaration then + -- If we have a constructed declaration for the itype, print it + if Present (P) + and then Nkind (P) in N_Declaration + and then Defining_Entity (P) = Typ + then -- We must set Itype_Printed true before the recursive call to -- print the node, otherwise we get an infinite recursion! diff --git a/gcc/ada/stand.ads b/gcc/ada/stand.ads index 964ff192d31..62d5ee5f925 100644 --- a/gcc/ada/stand.ads +++ b/gcc/ada/stand.ads @@ -6,7 +6,7 @@ -- -- -- S p e c -- -- -- --- Copyright (C) 1992-2007, Free Software Foundation, Inc. -- +-- Copyright (C) 1992-2008, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -364,7 +364,7 @@ package Stand is Any_Type : Entity_Id; -- Used to represent some unknown type. Plays an important role in - -- avoiding cascaded errors, since any node that remains labaled with + -- avoiding cascaded errors, since any node that remains labeled with -- this type corresponds to an already issued error message. Any_Type -- is propagated to avoid cascaded errors from a single type error. diff --git a/gcc/ada/stringt.adb b/gcc/ada/stringt.adb index 88b72e056dd..6d69d1dcf02 100644 --- a/gcc/ada/stringt.adb +++ b/gcc/ada/stringt.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 1992-2007, Free Software Foundation, Inc. -- +-- Copyright (C) 1992-2008, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -428,9 +428,8 @@ package body Stringt is for J in 1 .. String_Length (Id) loop C := Get_String_Char (Id, J); - if Character'Val (C) = '"' then + if C = Character'Pos ('"') then Write_Str (""""""); - else Write_Char_Code (C); end if; diff --git a/gcc/ada/stringt.ads b/gcc/ada/stringt.ads index fb974e4e9d2..b4e9c261839 100644 --- a/gcc/ada/stringt.ads +++ b/gcc/ada/stringt.ads @@ -6,7 +6,7 @@ -- -- -- S p e c -- -- -- --- Copyright (C) 1992-2005, Free Software Foundation, Inc. -- +-- Copyright (C) 1992-2008, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -75,7 +75,7 @@ package Stringt is -- new string is initialized to be a copy of the given string. A test is -- made to see if S is the last created string, and if so it is shared, -- rather than copied, this can be particularly helpful for the case of - -- a continued concatenaion of string constants. + -- a continued concatenation of string constants. procedure Store_String_Char (C : Char_Code); procedure Store_String_Char (C : Character); diff --git a/gcc/ada/styleg.adb b/gcc/ada/styleg.adb index 853788f3076..f22c828c673 100644 --- a/gcc/ada/styleg.adb +++ b/gcc/ada/styleg.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 1992-2007, Free Software Foundation, Inc. -- +-- Copyright (C) 1992-2008, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -238,7 +238,8 @@ package body Styleg is -- 1. Any comment that is not at the start of a line, i.e. where the -- initial minuses are not the first non-blank characters on the - -- line must have at least one blank after the second minus. + -- line must have at least one blank after the second minus or a + -- special character as defined in rule 5. -- 2. A row of all minuses of any length is permitted (see procedure -- box above in the source of this routine). @@ -274,8 +275,11 @@ package body Styleg is -- Returns True if the last two characters on the line are -- which -- characterizes a box comment (as for example follows this spec). + function Is_Special_Character (C : Character) return Boolean; + -- Determines if C is a special character (see rule 5 above) + function Same_Column_As_Next_Non_Blank_Line return Boolean; - -- Called for a full line comment. If the indentation of this commment + -- Called for a full line comment. If the indentation of this comment -- matches that of the next non-blank line in the source, then True is -- returned, otherwise False. @@ -297,6 +301,22 @@ package body Styleg is return Source (S - 1) = '-' and then Source (S - 2) = '-'; end Is_Box_Comment; + -------------------------- + -- Is_Special_Character -- + -------------------------- + + function Is_Special_Character (C : Character) return Boolean is + begin + if GNAT_Mode then + return C = '!'; + else + return + Character'Pos (C) in 16#21# .. 16#2F# + or else + Character'Pos (C) in 16#3A# .. 16#3F#; + end if; + end Is_Special_Character; + ---------------------------------------- -- Same_Column_As_Next_Non_Blank_Line -- ---------------------------------------- @@ -338,11 +358,13 @@ package body Styleg is -- For a comment that is not at the start of the line, the only -- requirement is that we cannot have a non-blank character after - -- the second minus sign. + -- the second minus sign or a special character. if Scan_Ptr /= First_Non_Blank_Location then if Style_Check_Comments then - if Source (Scan_Ptr + 2) > ' ' then + if Source (Scan_Ptr + 2) > ' ' + and then not Is_Special_Character (Source (Scan_Ptr + 2)) + then Error_Msg ("(style) space required", Scan_Ptr + 2); end if; end if; @@ -386,18 +408,8 @@ package body Styleg is -- This is not permitted in internal GNAT implementation units -- except for the case of --! as used by gnatprep output. - if GNAT_Mode then - if C = '!' then - return; - end if; - - else - if Character'Pos (C) in 16#21# .. 16#2F# - or else - Character'Pos (C) in 16#3A# .. 16#3F# - then - return; - end if; + if Is_Special_Character (C) then + return; end if; -- The only other case in which we allow a character after @@ -505,7 +517,7 @@ package body Styleg is -- In check indentation mode (-gnatyn for n a digit), a new statement or -- declaration is required to start in a column that is a multiple of the - -- indentiation amount. + -- indentation amount. procedure Check_Indentation is begin @@ -841,7 +853,7 @@ package body Styleg is -- Check_Unary_Plus_Or_Minus -- ------------------------------- - -- In check tokem mode (-gnatyt), unary plus or minus must not be + -- In check token mode (-gnatyt), unary plus or minus must not be -- followed by a space. procedure Check_Unary_Plus_Or_Minus is diff --git a/gcc/ada/styleg.ads b/gcc/ada/styleg.ads index 9ca7aa57212..ac883b6bbde 100644 --- a/gcc/ada/styleg.ads +++ b/gcc/ada/styleg.ads @@ -6,7 +6,7 @@ -- -- -- S p e c -- -- -- --- Copyright (C) 1992-2007, Free Software Foundation, Inc. -- +-- Copyright (C) 1992-2008, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -136,7 +136,7 @@ package Styleg is pragma Inline (Check_Separate_Stmt_Lines); -- Called after scanning THEN (not preceded by AND) or ELSE (not preceded -- by OR). Used to check that no tokens follow on the same line (which - -- would intefere with coverage testing). Handles case of THEN ABORT as + -- would interfere with coverage testing). Handles case of THEN ABORT as -- an exception, as well as PRAGMA after ELSE. procedure Check_Unary_Plus_Or_Minus; diff --git a/gcc/ada/stylesw.adb b/gcc/ada/stylesw.adb index a6cd38c591b..34688df9c32 100644 --- a/gcc/ada/stylesw.adb +++ b/gcc/ada/stylesw.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 1992-2007, Free Software Foundation, Inc. -- +-- Copyright (C) 1992-2008, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -168,7 +168,7 @@ package body Stylesw is procedure Set_GNAT_Style_Check_Options is begin Reset_Style_Check_Options; - Set_Style_Check_Options ("3aAbcdefhiklmnprsStux"); + Set_Style_Check_Options ("3aAbcdefhiIklmnprsStux"); end Set_GNAT_Style_Check_Options; ----------------------------- @@ -195,11 +195,18 @@ package body Stylesw is is C : Character; + On : Boolean := True; + -- Set to False if minus encountered + -- Set to True if plus encountered + + Last_Option : Character := ' '; + -- Set to last character encountered + procedure Add_Img (N : Natural); -- Concatenates image of N at end of Style_Msg_Buf procedure Bad_Style_Switch (Msg : String); - -- Called if bad style switch found. Msg is mset in Style_Msg_Buf and + -- Called if bad style switch found. Msg is set in Style_Msg_Buf and -- Style_Msg_Len. OK is set False. ------------- @@ -234,10 +241,21 @@ package body Stylesw is Err_Col := Options'First; while Err_Col <= Options'Last loop C := Options (Err_Col); + Last_Option := C; Err_Col := Err_Col + 1; - case C is - when '1' .. '9' => + -- Turning switches on + + if On then + case C is + + when '+' => + null; + + when '-' => + On := False; + + when '0' .. '9' => Style_Check_Indentation := Character'Pos (C) - Character'Pos ('0'); @@ -373,20 +391,122 @@ package body Stylesw is when 'x' => Style_Check_Xtra_Parens := True; + when 'y' => + Set_Default_Style_Check_Options; + + when ' ' => + null; + + when others => + Err_Col := Err_Col - 1; + Bad_Style_Switch ("invalid style switch: " & C); + return; + end case; + + -- Turning switches off + + else + case C is + + when '+' => + On := True; + + when '-' => + null; + + when '0' .. '9' => + Style_Check_Indentation := 0; + + when 'a' => + Style_Check_Attribute_Casing := False; + + when 'A' => + Style_Check_Array_Attribute_Index := False; + + when 'b' => + Style_Check_Blanks_At_End := False; + + when 'c' => + Style_Check_Comments := False; + + when 'd' => + Style_Check_DOS_Line_Terminator := False; + + when 'e' => + Style_Check_End_Labels := False; + + when 'f' => + Style_Check_Form_Feeds := False; + + when 'g' => + Reset_Style_Check_Options; + + when 'h' => + Style_Check_Horizontal_Tabs := False; + + when 'i' => + Style_Check_If_Then_Layout := False; + + when 'I' => + Style_Check_Mode_In := False; + + when 'k' => + Style_Check_Keyword_Casing := False; + + when 'l' => + Style_Check_Layout := False; + + when 'L' => + Style_Max_Nesting_Level := 0; + + when 'm' => + Style_Check_Max_Line_Length := False; + + when 'M' => + Style_Max_Line_Length := 0; + Style_Check_Max_Line_Length := False; + + when 'n' => + Style_Check_Standard := False; + + when 'o' => + Style_Check_Order_Subprograms := False; + + when 'p' => + Style_Check_Pragma_Casing := False; + + when 'r' => + Style_Check_References := False; + + when 's' => + Style_Check_Specs := False; + + when 'S' => + Style_Check_Separate_Stmt_Lines := False; + + when 't' => + Style_Check_Tokens := False; + + when 'u' => + Style_Check_Blank_Lines := False; + + when 'x' => + Style_Check_Xtra_Parens := False; + when ' ' => null; when others => Err_Col := Err_Col - 1; - Style_Msg_Buf (1 .. 22) := "invalid style switch: "; - Style_Msg_Len := 23; - Style_Msg_Buf (Style_Msg_Len) := C; - OK := False; + Bad_Style_Switch ("invalid style switch: " & C); return; - end case; + end case; + end if; end loop; - Style_Check := True; + -- Turn on style checking if other than N at end of string + + Style_Check := (Last_Option /= 'N'); OK := True; end Set_Style_Check_Options; end Stylesw; diff --git a/gcc/ada/stylesw.ads b/gcc/ada/stylesw.ads index 61a22fe1f4d..87552d35bc6 100644 --- a/gcc/ada/stylesw.ads +++ b/gcc/ada/stylesw.ads @@ -6,7 +6,7 @@ -- -- -- S p e c -- -- -- --- Copyright (C) 1992-2007, Free Software Foundation, Inc. -- +-- Copyright (C) 1992-2008, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -77,7 +77,7 @@ package Stylesw is -- For a comment that is not at the start of a line, the only requirement -- is that a space follow the comment characters. -- - -- For a coment that is at the start of the line, one of the following + -- For a comment that is at the start of the line, one of the following -- conditions must hold: -- -- The comment characters are the only non-blank characters on the line @@ -142,7 +142,7 @@ package Stylesw is -- indicated indentation value. A value of zero turns off checking. The -- requirement is that any new statement, line comment, declaration or -- keyword such as END, start on a column that is a multiple of the - -- indentiation value. + -- indentation value. Style_Check_Keyword_Casing : Boolean := False; -- This can be set True by using the -gnatg or -gnatyk switches. If it is @@ -269,7 +269,7 @@ package Stylesw is procedure Set_Default_Style_Check_Options; -- This procedure is called to set the default style checking options in - -- response to a -gnaty switch with no suboptions. + -- response to a -gnaty switch with no suboptions or from -gnatyy. procedure Set_GNAT_Style_Check_Options; -- This procedure is called to set the default style checking options for @@ -286,7 +286,8 @@ package Stylesw is -- This procedure is called to set the style check options that correspond -- to the characters in the given Options string. If all options are valid, -- they are set in an additive manner: any previous options are retained - -- unless overridden. + -- unless overridden, unless a minus is encountered, and then subsequent + -- style switches are subtracted from the current set. -- -- If all options given are valid, then OK is True, Err_Col is set to -- Options'Last + 1, and Style_Msg_Buf/Style_Msg_Len are unchanged. @@ -298,7 +299,7 @@ package Stylesw is procedure Set_Style_Check_Options (Options : String); -- Like the above procedure, but used when the Options string is known to - -- be valid. This is for example appopriate for calls where the string == + -- be valid. This is for example appropriate for calls where the string == -- was obtained by Save_Style_Check_Options. procedure Reset_Style_Check_Options; diff --git a/gcc/ada/switch-m.adb b/gcc/ada/switch-m.adb index 208bb38f886..20761f417cd 100644 --- a/gcc/ada/switch-m.adb +++ b/gcc/ada/switch-m.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 2001-2007, Free Software Foundation, Inc. -- +-- Copyright (C) 2001-2008, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -26,6 +26,7 @@ with Debug; use Debug; with Osint; use Osint; with Opt; use Opt; +with Prj; use Prj; with Prj.Ext; use Prj.Ext; with Table; @@ -150,20 +151,59 @@ package body Switch.M is when False => -- All switches that don't start with -gnat stay as is, - -- except -v, -E and -pg + -- except -pg, -Wall, -k8, -w - if Switch_Chars = "-pg" then + if Switch_Chars = "-pg" or else Switch_Chars = "-p" then -- The gcc driver converts -pg to -p, so that is what -- is stored in the ALI file. Add_Switch_Component ("-p"); - -- Do not take into account switches that are not transmitted - -- to gnat1 by the gcc driver. + elsif Switch_Chars = "-Wall" then - elsif C /= 'v' and then C /= 'E' then + -- The gcc driver adds -gnatwa when -Wall is used + + Add_Switch_Component ("-gnatwa"); + Add_Switch_Component ("-Wall"); + + elsif Switch_Chars = "-k8" then + + -- The gcc driver transforms -k8 into -gnatk8 + + Add_Switch_Component ("-gnatk8"); + + elsif Switch_Chars = "-w" then + + -- The gcc driver adds -gnatws when -w is used + + Add_Switch_Component ("-gnatws"); + Add_Switch_Component ("-w"); + + elsif Switch_Chars'Length > 6 + and then + Switch_Chars (Switch_Chars'First .. Switch_Chars'First + 5) + = "--RTS=" + then Add_Switch_Component (Switch_Chars); + + -- When --RTS=mtp is used, the gcc driver adds -mrtp + + if Switch_Chars = "--RTS=mtp" then + Add_Switch_Component ("-mrtp"); + end if; + + -- Take only into account switches that are transmitted to + -- gnat1 by the gcc driver and stored by gnat1 in the ALI file. + + else + case C is + when 'O' | 'W' | 'w' | 'f' | 'd' | 'g' | 'm' => + Add_Switch_Component (Switch_Chars); + + when others => + null; + end case; end if; return; @@ -332,7 +372,8 @@ package body Switch.M is Ptr := Ptr + 1; if Ptr <= Max - and then Switch_Chars (Ptr) = 's' then + and then Switch_Chars (Ptr) = 's' + then Last_Stored := Last_Stored + 1; Storing (Last_Stored) := 's'; Ptr := Ptr + 1; @@ -366,12 +407,9 @@ package body Switch.M is -- -gnatyMxxx - if C = 'M' and then - Storing (First_Stored) = 'y' - then + if C = 'M' and then Storing (First_Stored) = 'y' then Last_Stored := First_Stored + 1; Storing (Last_Stored) := 'M'; - while Ptr <= Max loop C := Switch_Chars (Ptr); exit when C not in '0' .. '9'; @@ -517,8 +555,24 @@ package body Switch.M is if Switch_Chars = "--create-missing-dirs" then Setup_Projects := True; - elsif Switch_Chars'Length > 3 and then - Switch_Chars (Ptr .. Ptr + 1) = "aP" + elsif Switch_Chars'Length > Subdirs_Option'Length + and then + Switch_Chars + (Switch_Chars'First .. + Switch_Chars'First + Subdirs_Option'Length - 1) = + Subdirs_Option + then + Subdirs := + new String' + (Switch_Chars + (Switch_Chars'First + Subdirs_Option'Length .. + Switch_Chars'Last)); + + elsif Switch_Chars (Ptr) = '-' then + Bad_Switch (Switch_Chars); + + elsif Switch_Chars'Length > 3 + and then Switch_Chars (Ptr .. Ptr + 1) = "aP" then Add_Search_Project_Directory (Switch_Chars (Ptr + 2 .. Switch_Chars'Last)); diff --git a/gcc/ada/switch.ads b/gcc/ada/switch.ads index e4ccc93f40a..029d8cf1eb3 100644 --- a/gcc/ada/switch.ads +++ b/gcc/ada/switch.ads @@ -6,7 +6,7 @@ -- -- -- S p e c -- -- -- --- Copyright (C) 1992-2007, Free Software Foundation, Inc. -- +-- Copyright (C) 1992-2008, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -24,7 +24,7 @@ ------------------------------------------------------------------------------ -- This package together with a child package appropriate to the client tool --- scans switches. Note that the body of the appropraite Usage package must be +-- scans switches. Note that the body of the appropriate Usage package must be -- coordinated with the switches that are recognized by this package. These -- Usage packages also act as the official documentation for the switches -- that are recognized. In addition, package Debug documents the otherwise diff --git a/gcc/ada/sysdep.c b/gcc/ada/sysdep.c index cf51ebea76a..a8f24cd71e5 100644 --- a/gcc/ada/sysdep.c +++ b/gcc/ada/sysdep.c @@ -6,7 +6,7 @@ * * * C Implementation File * * * - * Copyright (C) 1992-2007, Free Software Foundation, Inc. * + * Copyright (C) 1992-2008, Free Software Foundation, Inc. * * * * GNAT is free software; you can redistribute it and/or modify it under * * terms of the GNU General Public License as published by the Free Soft- * @@ -342,7 +342,8 @@ __gnat_ttyname (int filedes) || (defined (__osf__) && ! defined (__alpha_vxworks)) || defined (WINNT) \ || defined (__MACHTEN__) || defined (__hpux__) || defined (_AIX) \ || (defined (__svr4__) && defined (i386)) || defined (__Lynx__) \ - || defined (__CYGWIN__) || defined (__FreeBSD__) || defined (__OpenBSD__) + || defined (__CYGWIN__) || defined (__FreeBSD__) || defined (__OpenBSD__) \ + || defined (__GLIBC__) #ifdef __MINGW32__ #if OLD_MINGW @@ -399,7 +400,8 @@ getc_immediate_common (FILE *stream, || (defined (__osf__) && ! defined (__alpha_vxworks)) \ || defined (__CYGWIN32__) || defined (__MACHTEN__) || defined (__hpux__) \ || defined (_AIX) || (defined (__svr4__) && defined (i386)) \ - || defined (__Lynx__) || defined (__FreeBSD__) || defined (__OpenBSD__) + || defined (__Lynx__) || defined (__FreeBSD__) || defined (__OpenBSD__) \ + || defined (__GLIBC__) char c; int nread; int good_one = 0; @@ -418,7 +420,8 @@ getc_immediate_common (FILE *stream, #if defined(linux) || defined (sun) || defined (sgi) || defined (__EMX__) \ || defined (__osf__) || defined (__MACHTEN__) || defined (__hpux__) \ || defined (_AIX) || (defined (__svr4__) && defined (i386)) \ - || defined (__Lynx__) || defined (__FreeBSD__) || defined (__OpenBSD__) + || defined (__Lynx__) || defined (__FreeBSD__) || defined (__OpenBSD__) \ + || defined (__GLIBC__) eof_ch = termios_rec.c_cc[VEOF]; /* If waiting (i.e. Get_Immediate (Char)), set MIN = 1 and wait for @@ -708,7 +711,7 @@ get_gmtoff (void) long __gnat_invalid_tzoff = 259273; -/* Definition of __gnat_locatime_r used by a-calend.adb */ +/* Definition of __gnat_localtime_r used by a-calend.adb */ #if defined (__EMX__) || defined (__MINGW32__) @@ -845,7 +848,7 @@ __gnat_localtime_tzoff (const time_t *timer, struct tm *tp, long *off) /* Darwin, Free BSD, Linux, Tru64, where there exists a component tm_gmtoff in struct tm */ #elif defined (__APPLE__) || defined (__FreeBSD__) || defined (linux) ||\ - (defined (__alpha__) && defined (__osf__)) + (defined (__alpha__) && defined (__osf__)) || defined (__GLIBC__) *off = tp->tm_gmtoff; /* All other platforms: Treat all time values in GMT */ diff --git a/gcc/ada/system-linux-mips.ads b/gcc/ada/system-linux-mips.ads new file mode 100644 index 00000000000..e9a47c4bb03 --- /dev/null +++ b/gcc/ada/system-linux-mips.ads @@ -0,0 +1,154 @@ +------------------------------------------------------------------------------ +-- -- +-- GNAT RUN-TIME COMPONENTS -- +-- -- +-- S Y S T E M -- +-- -- +-- S p e c -- +-- (GNU-Linux/MIPS Version) -- +-- -- +-- Copyright (C) 1992-2005, Free Software Foundation, Inc. -- +-- -- +-- This specification is derived from the Ada Reference Manual for use with -- +-- GNAT. The copyright notice above, and the license provisions that follow -- +-- apply solely to the contents of the part following the private keyword. -- +-- -- +-- GNAT is free software; you can redistribute it and/or modify it under -- +-- terms of the GNU General Public License as published by the Free Soft- -- +-- ware Foundation; either version 2, or (at your option) any later ver- -- +-- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- +-- OUT 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 distributed with GNAT; see file COPYING. If not, write -- +-- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, -- +-- Boston, MA 02110-1301, USA. -- +-- -- +-- As a special exception, if other files instantiate generics from this -- +-- unit, or you link this unit with other files to produce an executable, -- +-- this unit does not by itself cause the resulting executable to be -- +-- covered by the GNU General Public License. This exception does not -- +-- however invalidate any other reasons why the executable file might be -- +-- covered by the GNU Public License. -- +-- -- +-- GNAT was originally developed by the GNAT team at New York University. -- +-- Extensive contributions were provided by Ada Core Technologies Inc. -- +-- -- +------------------------------------------------------------------------------ + +package System is + pragma Pure; + -- Note that we take advantage of the implementation permission to make + -- this unit Pure instead of Preelaborable; see RM 13.7.1(15). In Ada + -- 2005, this is Pure in any case (AI-362). + + type Name is (SYSTEM_NAME_GNAT); + System_Name : constant Name := SYSTEM_NAME_GNAT; + + -- System-Dependent Named Numbers + + Min_Int : constant := Long_Long_Integer'First; + Max_Int : constant := Long_Long_Integer'Last; + + Max_Binary_Modulus : constant := 2 ** Long_Long_Integer'Size; + Max_Nonbinary_Modulus : constant := Integer'Last; + + Max_Base_Digits : constant := Long_Long_Float'Digits; + Max_Digits : constant := Long_Long_Float'Digits; + + Max_Mantissa : constant := 63; + Fine_Delta : constant := 2.0 ** (-Max_Mantissa); + + Tick : constant := 0.000_001; + + -- Storage-related Declarations + + type Address is private; + Null_Address : constant Address; + + Storage_Unit : constant := 8; + Word_Size : constant := 32; + Memory_Size : constant := 2 ** 32; + + -- Address comparison + + function "<" (Left, Right : Address) return Boolean; + function "<=" (Left, Right : Address) return Boolean; + function ">" (Left, Right : Address) return Boolean; + function ">=" (Left, Right : Address) return Boolean; + function "=" (Left, Right : Address) return Boolean; + + pragma Import (Intrinsic, "<"); + pragma Import (Intrinsic, "<="); + pragma Import (Intrinsic, ">"); + pragma Import (Intrinsic, ">="); + pragma Import (Intrinsic, "="); + + -- Other System-Dependent Declarations + + type Bit_Order is (High_Order_First, Low_Order_First); + Default_Bit_Order : constant Bit_Order := High_Order_First; + pragma Warnings (Off, Default_Bit_Order); -- kill constant condition warning + + -- Priority-related Declarations (RM D.1) + + Max_Priority : constant Positive := 30; + Max_Interrupt_Priority : constant Positive := 31; + + subtype Any_Priority is Integer range 0 .. 31; + subtype Priority is Any_Priority range 0 .. 30; + subtype Interrupt_Priority is Any_Priority range 31 .. 31; + + Default_Priority : constant Priority := 15; + +private + + type Address is mod Memory_Size; + Null_Address : constant Address := 0; + + -------------------------------------- + -- System Implementation Parameters -- + -------------------------------------- + + -- These parameters provide information about the target that is used + -- by the compiler. They are in the private part of System, where they + -- can be accessed using the special circuitry in the Targparm unit + -- whose source should be consulted for more detailed descriptions + -- of the individual switch values. + + AAMP : constant Boolean := False; + Backend_Divide_Checks : constant Boolean := False; + Backend_Overflow_Checks : constant Boolean := False; + Command_Line_Args : constant Boolean := True; + Compiler_System_Version : constant Boolean := False; + Configurable_Run_Time : constant Boolean := False; + Denorm : constant Boolean := True; + Duration_32_Bits : constant Boolean := False; + Exit_Status_Supported : constant Boolean := True; + Fractional_Fixed_Ops : constant Boolean := False; + Frontend_Layout : constant Boolean := False; + Functions_Return_By_DSP : constant Boolean := False; + Machine_Overflows : constant Boolean := False; + Machine_Rounds : constant Boolean := True; + OpenVMS : constant Boolean := False; + Preallocated_Stacks : constant Boolean := False; + Signed_Zeros : constant Boolean := True; + Stack_Check_Default : constant Boolean := False; + Stack_Check_Probes : constant Boolean := False; + Support_64_Bit_Divides : constant Boolean := True; + Support_Aggregates : constant Boolean := True; + Support_Composite_Assign : constant Boolean := True; + Support_Composite_Compare : constant Boolean := True; + Support_Long_Shifts : constant Boolean := True; + Suppress_Standard_Library : constant Boolean := False; + Use_Ada_Main_Program_Name : constant Boolean := False; + ZCX_By_Default : constant Boolean := True; + GCC_ZCX_Support : constant Boolean := True; + Front_End_ZCX_Support : constant Boolean := False; + + -- Obsolete entries, to be removed eventually (bootstrap issues!) + + High_Integrity_Mode : constant Boolean := False; + Long_Shifts_Inlined : constant Boolean := True; + +end System; diff --git a/gcc/ada/system-linux-mipsel.ads b/gcc/ada/system-linux-mipsel.ads new file mode 100644 index 00000000000..80631f2f611 --- /dev/null +++ b/gcc/ada/system-linux-mipsel.ads @@ -0,0 +1,154 @@ +------------------------------------------------------------------------------ +-- -- +-- GNAT RUN-TIME COMPONENTS -- +-- -- +-- S Y S T E M -- +-- -- +-- S p e c -- +-- (GNU-Linux/MIPSEL Version) -- +-- -- +-- Copyright (C) 1992-2005, Free Software Foundation, Inc. -- +-- -- +-- This specification is derived from the Ada Reference Manual for use with -- +-- GNAT. The copyright notice above, and the license provisions that follow -- +-- apply solely to the contents of the part following the private keyword. -- +-- -- +-- GNAT is free software; you can redistribute it and/or modify it under -- +-- terms of the GNU General Public License as published by the Free Soft- -- +-- ware Foundation; either version 2, or (at your option) any later ver- -- +-- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- +-- OUT 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 distributed with GNAT; see file COPYING. If not, write -- +-- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, -- +-- Boston, MA 02110-1301, USA. -- +-- -- +-- As a special exception, if other files instantiate generics from this -- +-- unit, or you link this unit with other files to produce an executable, -- +-- this unit does not by itself cause the resulting executable to be -- +-- covered by the GNU General Public License. This exception does not -- +-- however invalidate any other reasons why the executable file might be -- +-- covered by the GNU Public License. -- +-- -- +-- GNAT was originally developed by the GNAT team at New York University. -- +-- Extensive contributions were provided by Ada Core Technologies Inc. -- +-- -- +------------------------------------------------------------------------------ + +package System is + pragma Pure; + -- Note that we take advantage of the implementation permission to make + -- this unit Pure instead of Preelaborable; see RM 13.7.1(15). In Ada + -- 2005, this is Pure in any case (AI-362). + + type Name is (SYSTEM_NAME_GNAT); + System_Name : constant Name := SYSTEM_NAME_GNAT; + + -- System-Dependent Named Numbers + + Min_Int : constant := Long_Long_Integer'First; + Max_Int : constant := Long_Long_Integer'Last; + + Max_Binary_Modulus : constant := 2 ** Long_Long_Integer'Size; + Max_Nonbinary_Modulus : constant := Integer'Last; + + Max_Base_Digits : constant := Long_Long_Float'Digits; + Max_Digits : constant := Long_Long_Float'Digits; + + Max_Mantissa : constant := 63; + Fine_Delta : constant := 2.0 ** (-Max_Mantissa); + + Tick : constant := 0.000_001; + + -- Storage-related Declarations + + type Address is private; + Null_Address : constant Address; + + Storage_Unit : constant := 8; + Word_Size : constant := 32; + Memory_Size : constant := 2 ** 32; + + -- Address comparison + + function "<" (Left, Right : Address) return Boolean; + function "<=" (Left, Right : Address) return Boolean; + function ">" (Left, Right : Address) return Boolean; + function ">=" (Left, Right : Address) return Boolean; + function "=" (Left, Right : Address) return Boolean; + + pragma Import (Intrinsic, "<"); + pragma Import (Intrinsic, "<="); + pragma Import (Intrinsic, ">"); + pragma Import (Intrinsic, ">="); + pragma Import (Intrinsic, "="); + + -- Other System-Dependent Declarations + + type Bit_Order is (High_Order_First, Low_Order_First); + Default_Bit_Order : constant Bit_Order := Low_Order_First; + pragma Warnings (Off, Default_Bit_Order); -- kill constant condition warning + + -- Priority-related Declarations (RM D.1) + + Max_Priority : constant Positive := 30; + Max_Interrupt_Priority : constant Positive := 31; + + subtype Any_Priority is Integer range 0 .. 31; + subtype Priority is Any_Priority range 0 .. 30; + subtype Interrupt_Priority is Any_Priority range 31 .. 31; + + Default_Priority : constant Priority := 15; + +private + + type Address is mod Memory_Size; + Null_Address : constant Address := 0; + + -------------------------------------- + -- System Implementation Parameters -- + -------------------------------------- + + -- These parameters provide information about the target that is used + -- by the compiler. They are in the private part of System, where they + -- can be accessed using the special circuitry in the Targparm unit + -- whose source should be consulted for more detailed descriptions + -- of the individual switch values. + + AAMP : constant Boolean := False; + Backend_Divide_Checks : constant Boolean := False; + Backend_Overflow_Checks : constant Boolean := False; + Command_Line_Args : constant Boolean := True; + Compiler_System_Version : constant Boolean := False; + Configurable_Run_Time : constant Boolean := False; + Denorm : constant Boolean := True; + Duration_32_Bits : constant Boolean := False; + Exit_Status_Supported : constant Boolean := True; + Fractional_Fixed_Ops : constant Boolean := False; + Frontend_Layout : constant Boolean := False; + Functions_Return_By_DSP : constant Boolean := False; + Machine_Overflows : constant Boolean := False; + Machine_Rounds : constant Boolean := True; + OpenVMS : constant Boolean := False; + Preallocated_Stacks : constant Boolean := False; + Signed_Zeros : constant Boolean := True; + Stack_Check_Default : constant Boolean := False; + Stack_Check_Probes : constant Boolean := False; + Support_64_Bit_Divides : constant Boolean := True; + Support_Aggregates : constant Boolean := True; + Support_Composite_Assign : constant Boolean := True; + Support_Composite_Compare : constant Boolean := True; + Support_Long_Shifts : constant Boolean := True; + Suppress_Standard_Library : constant Boolean := False; + Use_Ada_Main_Program_Name : constant Boolean := False; + ZCX_By_Default : constant Boolean := True; + GCC_ZCX_Support : constant Boolean := True; + Front_End_ZCX_Support : constant Boolean := False; + + -- Obsolete entries, to be removed eventually (bootstrap issues!) + + High_Integrity_Mode : constant Boolean := False; + Long_Shifts_Inlined : constant Boolean := True; + +end System; diff --git a/gcc/ada/system-linux-x86.ads b/gcc/ada/system-linux-x86.ads index a212fd24faa..f46da46fdaf 100644 --- a/gcc/ada/system-linux-x86.ads +++ b/gcc/ada/system-linux-x86.ads @@ -7,7 +7,7 @@ -- S p e c -- -- (GNU-Linux/x86 Version) -- -- -- --- Copyright (C) 1992-2007, Free Software Foundation, Inc. -- +-- Copyright (C) 1992-2008, Free Software Foundation, Inc. -- -- -- -- This specification is derived from the Ada Reference Manual for use with -- -- GNAT. The copyright notice above, and the license provisions that follow -- @@ -139,7 +139,7 @@ private Preallocated_Stacks : constant Boolean := False; Signed_Zeros : constant Boolean := True; Stack_Check_Default : constant Boolean := False; - Stack_Check_Probes : constant Boolean := False; + Stack_Check_Probes : constant Boolean := True; Stack_Check_Limits : constant Boolean := False; Support_64_Bit_Divides : constant Boolean := True; Support_Aggregates : constant Boolean := True; diff --git a/gcc/ada/system-linux-x86_64.ads b/gcc/ada/system-linux-x86_64.ads index e309435d0c2..7ee41803340 100644 --- a/gcc/ada/system-linux-x86_64.ads +++ b/gcc/ada/system-linux-x86_64.ads @@ -7,7 +7,7 @@ -- S p e c -- -- (GNU-Linux/x86-64 Version) -- -- -- --- Copyright (C) 1992-2007, Free Software Foundation, Inc. -- +-- Copyright (C) 1992-2008, Free Software Foundation, Inc. -- -- -- -- This specification is derived from the Ada Reference Manual for use with -- -- GNAT. The copyright notice above, and the license provisions that follow -- @@ -139,7 +139,7 @@ private Preallocated_Stacks : constant Boolean := False; Signed_Zeros : constant Boolean := True; Stack_Check_Default : constant Boolean := False; - Stack_Check_Probes : constant Boolean := False; + Stack_Check_Probes : constant Boolean := True; Stack_Check_Limits : constant Boolean := False; Support_64_Bit_Divides : constant Boolean := True; Support_Aggregates : constant Boolean := True; diff --git a/gcc/ada/table.adb b/gcc/ada/table.adb index db64c4cf956..88395c1624d 100644 --- a/gcc/ada/table.adb +++ b/gcc/ada/table.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 1992-2007, Free Software Foundation, Inc. -- +-- Copyright (C) 1992-2008, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -295,7 +295,7 @@ package body Table is -- allocation). Range checks are suppressed because this unit -- uses direct calls to System.Memory for allocation, and this can -- yield misaligned storage (and we cannot rely on the bootstrap - -- compiler supporting specifically disabling alignment cheks, so we + -- compiler supporting specifically disabling alignment checks, so we -- need to suppress all range checks). It is safe to suppress this -- check here because we know that a (possibly misaligned) object -- of that type does actually exist at that address. @@ -307,7 +307,7 @@ package body Table is -- involve moving table contents around). begin - -- If we're going to reallocate, check wheter Item references an + -- If we're going to reallocate, check whether Item references an -- element of the currently allocated table. if Need_Realloc diff --git a/gcc/ada/table.ads b/gcc/ada/table.ads index 983f7fd0e35..6b243222cd4 100644 --- a/gcc/ada/table.ads +++ b/gcc/ada/table.ads @@ -6,7 +6,7 @@ -- -- -- S p e c -- -- -- --- Copyright (C) 1992-2005, Free Software Foundation, Inc. -- +-- Copyright (C) 1992-2008, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -89,7 +89,7 @@ package Table is -- chunks controlled by the allocation parameters). -- Note: We do not make the table components aliased, since this would - -- restict the use of table for discriminated types. If it is necessary + -- restrict the use of table for discriminated types. If it is necessary -- to take the access of a table element, use Unrestricted_Access. -- WARNING: On HPPA, the virtual addressing approach used in this unit @@ -117,6 +117,7 @@ package Table is -- safety is not compromised by this approach. type Table_Ptr is access all Big_Table_Type; + for Table_Ptr'Storage_Size use 0; -- The table is actually represented as a pointer to allow reallocation Table : aliased Table_Ptr := null; diff --git a/gcc/ada/targparm.ads b/gcc/ada/targparm.ads index 4255b508d2a..c40d6d81adc 100644 --- a/gcc/ada/targparm.ads +++ b/gcc/ada/targparm.ads @@ -6,7 +6,7 @@ -- -- -- S p e c -- -- -- --- Copyright (C) 1999-2007, Free Software Foundation, Inc. -- +-- Copyright (C) 1999-2008, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -72,10 +72,10 @@ -- 3. Identification information. This is an optional string constant -- that gives the name of the run-time library configuration. This --- line may be ommitted for a version of system.ads to be used with +-- line may be omitted for a version of system.ads to be used with -- the full Ada 95 run time. --- 4. Other characterisitics of package System. At the current time the +-- 4. Other characteristics of package System. At the current time the -- only item in this category is whether type Address is private. with Rident; use Rident; @@ -219,6 +219,7 @@ package Targparm is type Virtual_Machine_Kind is (No_VM, JVM_Target, CLI_Target); VM_Target : Virtual_Machine_Kind := No_VM; -- Kind of virtual machine targetted + -- Needs comments, don't depend on names ??? ------------------------------- -- Backend Arithmetic Checks -- @@ -257,7 +258,7 @@ package Targparm is -- The generation of the setjmp and longjmp calls is handled by -- the front end of the compiler (this includes gigi in the case -- of the standard GCC back end). It does not use any back end - -- suport (such as the GCC3 exception handling mechanism). When + -- support (such as the GCC3 exception handling mechanism). When -- this approach is used, the compiler generates special exception -- handlers for handling cleanups when an exception is raised. diff --git a/gcc/ada/tb-gcc.c b/gcc/ada/tb-gcc.c index 8ea77ee279f..d0b12c79f14 100644 --- a/gcc/ada/tb-gcc.c +++ b/gcc/ada/tb-gcc.c @@ -7,6 +7,7 @@ * C Implementation File * * * * Copyright (C) 2004-2007, AdaCore * + * Copyright (C) 2008, Free Software Foundation, Inc. * * * * GNAT is free software; you can redistribute it and/or modify it under * * terms of the GNU General Public License as published by the Free Soft- * @@ -37,7 +38,7 @@ #include <unwind.h> /* The implementation boils down to a call to _Unwind_Backtrace with a - tailored callback and carried-on datastructure to keep track of the + tailored callback and carried-on data structure to keep track of the input parameters we got as well as of the basic processing state. */ /****************** diff --git a/gcc/ada/tbuild.ads b/gcc/ada/tbuild.ads index 17be6272f7a..14028630021 100644 --- a/gcc/ada/tbuild.ads +++ b/gcc/ada/tbuild.ads @@ -57,7 +57,7 @@ package Tbuild is pragma Inline (Discard_List); -- This is a dummy procedure that simply returns and does nothing. It is -- used when a function returning a Node_Id value is called for its side - -- effect (e.g. a call to the pareser to parse a list of compilation + -- effect (e.g. a call to the parser to parse a list of compilation -- units), but the List_Id value is not required. function Make_Byte_Aligned_Attribute_Reference @@ -103,7 +103,7 @@ package Tbuild is (Loc : Source_Ptr; Defining_Identifier : Node_Id; Label_Construct : Node_Id) return Node_Id; - -- Used to contruct an implicit label declaration node, including setting + -- Used to construct an implicit label declaration node, including setting -- the proper Label_Construct field (since Label_Construct is a semantic -- field, the normal call to Make_Implicit_Label_Declaration does not -- set this field). @@ -203,7 +203,7 @@ package Tbuild is -- Prefix is prepended only if Prefix is non-blank (in which case it -- must be an upper case letter other than O,Q,U,W (which are used for -- identifier encoding, see Namet), and T is reserved for use by implicit - -- types. and X is reserved for use by debug type encoding (see package + -- types, and X is reserved for use by debug type encoding (see package -- Exp_Dbug). Note: the reason that Prefix is last is that it is almost -- always omitted. The notable case of Prefix being non-null is when -- it is 'T' for an implicit type. diff --git a/gcc/ada/tracebak.c b/gcc/ada/tracebak.c index 659dad24342..65c1828badd 100644 --- a/gcc/ada/tracebak.c +++ b/gcc/ada/tracebak.c @@ -7,6 +7,7 @@ * C Implementation File * * * * Copyright (C) 2000-2007, AdaCore * + * Copyright (C) 2008, Free Software Foundation, Inc. * * * * GNAT is free software; you can redistribute it and/or modify it under * * terms of the GNU General Public License as published by the Free Soft- * @@ -147,7 +148,7 @@ extern void (*Unlock_Task) (void); of a call instruction), which is what we want in the output array, and the associated return address, which is what we retrieve from the stack. - o STOP_FRAME, to decide wether we reached the top of the call chain, and + o STOP_FRAME, to decide whether we reached the top of the call chain, and thus if the process shall stop. : diff --git a/gcc/ada/trans.c b/gcc/ada/trans.c index 8bf93d2e711..b00f5c3af05 100644 --- a/gcc/ada/trans.c +++ b/gcc/ada/trans.c @@ -553,7 +553,7 @@ Identifier_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p) required if this is a static expression because it might be used in a context where a dereference is inappropriate, such as a case statement alternative or a record discriminant. There is no possible - volatile-ness shortciruit here since Volatile constants must be imported + volatile-ness short-circuit here since Volatile constants must be imported per C.6. */ if (Ekind (gnat_temp) == E_Constant && Is_Scalar_Type (gnat_temp_type) && !Is_Imported (gnat_temp) @@ -566,7 +566,7 @@ Identifier_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p) if (use_constant_initializer) { - /* If this is a deferred constant, the initializer is attached to the + /* If this is a deferred constant, the initializer is attached to the full view. */ if (Present (Full_View (gnat_temp))) gnat_temp = Full_View (gnat_temp); @@ -691,7 +691,7 @@ Pragma_to_gnu (Node_Id gnat_node) || !Is_Pragma_Name (Chars (Pragma_Identifier (gnat_node)))) return gnu_result; - switch (Get_Pragma_Id (Pragma_Identifier (Chars (gnat_node)))) + switch (Get_Pragma_Id (Chars (Pragma_Identifier (gnat_node)))) { case Pragma_Inspection_Point: /* Do nothing at top level: all such variables are already viewable. */ @@ -852,6 +852,53 @@ Attribute_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p, int attribute) if (attribute == Attr_Address) gnu_prefix = maybe_unconstrained_array (gnu_prefix); + /* If we are building a static dispatch table, we have to honor + TARGET_VTABLE_USES_DESCRIPTORS if we want to be compatible + with the C++ ABI. We do it in the non-static case as well, + see gnat_to_gnu_entity, case E_Access_Subprogram_Type. */ + else if (TARGET_VTABLE_USES_DESCRIPTORS + && Is_Dispatch_Table_Entity (Etype (gnat_node))) + { + tree gnu_field, gnu_list = NULL_TREE, t; + /* Descriptors can only be built here for top-level functions. */ + bool build_descriptor = (global_bindings_p () != 0); + int i; + + gnu_result_type = get_unpadded_type (Etype (gnat_node)); + + /* If we're not going to build the descriptor, we have to retrieve + the one which will be built by the linker (or by the compiler + later if a static chain is requested). */ + if (!build_descriptor) + { + gnu_result = build_unary_op (ADDR_EXPR, NULL_TREE, gnu_prefix); + gnu_result = fold_convert (build_pointer_type (gnu_result_type), + gnu_result); + gnu_result = build1 (INDIRECT_REF, gnu_result_type, gnu_result); + } + + for (gnu_field = TYPE_FIELDS (gnu_result_type), i = 0; + i < TARGET_VTABLE_USES_DESCRIPTORS; + gnu_field = TREE_CHAIN (gnu_field), i++) + { + if (build_descriptor) + { + t = build2 (FDESC_EXPR, TREE_TYPE (gnu_field), gnu_prefix, + build_int_cst (NULL_TREE, i)); + TREE_CONSTANT (t) = 1; + TREE_INVARIANT (t) = 1; + } + else + t = build3 (COMPONENT_REF, ptr_void_ftype, gnu_result, + gnu_field, NULL_TREE); + + gnu_list = tree_cons (gnu_field, t, gnu_list); + } + + gnu_result = gnat_build_constructor (gnu_result_type, gnu_list); + break; + } + /* ... fall through ... */ case Attr_Access: @@ -2370,7 +2417,7 @@ call_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p, tree gnu_target) { /* Conceptually, what we need is a COMPOUND_EXPR with the call followed by the target object converted to the proper type. Doing so would - potentially be very inefficient, however, as this expresssion might + potentially be very inefficient, however, as this expression might end up wrapped into an outer SAVE_EXPR later on, which would incur a pointless temporary copy of the whole object. @@ -3052,7 +3099,7 @@ gnat_to_gnu (Node_Id gnat_node) elaboration procedure, so mark us as being in that procedure and push our context. - If we are in the elaboration procedure, check if we are violating a a + If we are in the elaboration procedure, check if we are violating a No_Elaboration_Code restriction by having a statement there. */ if ((IN (Nkind (gnat_node), N_Statement_Other_Than_Procedure_Call) && Nkind (gnat_node) != N_Null_Statement) @@ -3649,7 +3696,12 @@ gnat_to_gnu (Node_Id gnat_node) break; case N_Null: - gnu_result = null_pointer_node; + if (TARGET_VTABLE_USES_DESCRIPTORS + && Ekind (Etype (gnat_node)) == E_Access_Subprogram_Type + && Is_Dispatch_Table_Entity (Etype (gnat_node))) + gnu_result = null_fdesc_node; + else + gnu_result = null_pointer_node; gnu_result_type = get_unpadded_type (Etype (gnat_node)); break; @@ -3673,7 +3725,6 @@ gnat_to_gnu (Node_Id gnat_node) /* If the result is a pointer type, see if we are improperly converting to a stricter alignment. */ - if (STRICT_ALIGNMENT && POINTER_TYPE_P (gnu_result_type) && IN (Ekind (Etype (gnat_node)), Access_Kind)) { @@ -3688,6 +3739,13 @@ gnat_to_gnu (Node_Id gnat_node) size_int (align / BITS_PER_UNIT), oalign / BITS_PER_UNIT); } + /* If we are converting a descriptor to a function pointer, first + build the pointer. */ + if (TARGET_VTABLE_USES_DESCRIPTORS + && TREE_TYPE (gnu_result) == fdesc_type_node + && POINTER_TYPE_P (gnu_result_type)) + gnu_result = build_unary_op (ADDR_EXPR, NULL_TREE, gnu_result); + gnu_result = unchecked_convert (gnu_result_type, gnu_result, No_Truncation (gnat_node)); break; @@ -4182,26 +4240,13 @@ gnat_to_gnu (Node_Id gnat_node) else if (TYPE_RETURNS_UNCONSTRAINED_P (gnu_subprog_type)) { gnu_ret_val = maybe_unconstrained_array (gnu_ret_val); - - /* We have two cases: either the function returns with - depressed stack or not. If not, we allocate on the - secondary stack. If so, we allocate in the stack frame. - if no copy is needed, the front end will set By_Ref, - which we handle in the case above. */ - if (TYPE_RETURNS_STACK_DEPRESSED (gnu_subprog_type)) - gnu_ret_val - = build_allocator (TREE_TYPE (gnu_ret_val), - gnu_ret_val, - TREE_TYPE (gnu_subprog_type), - 0, -1, gnat_node, false); - else - gnu_ret_val - = build_allocator (TREE_TYPE (gnu_ret_val), - gnu_ret_val, - TREE_TYPE (gnu_subprog_type), - Procedure_To_Call (gnat_node), - Storage_Pool (gnat_node), - gnat_node, false); + gnu_ret_val + = build_allocator (TREE_TYPE (gnu_ret_val), + gnu_ret_val, + TREE_TYPE (gnu_subprog_type), + Procedure_To_Call (gnat_node), + Storage_Pool (gnat_node), + gnat_node, false); } } } @@ -4670,7 +4715,7 @@ gnat_to_gnu (Node_Id gnat_node) } /* If the object was allocated from the default storage pool, the - alignement was greater than what the allocator provides, and this + alignment was greater than what the allocator provides, and this is not a fat or thin pointer, what we have in gnu_ptr here is an address dynamically adjusted to match the alignment requirement (see build_allocator). What we need to pass to free is the @@ -4845,34 +4890,41 @@ gnat_to_gnu (Node_Id gnat_node) || CONTAINS_PLACEHOLDER_P (TYPE_SIZE (gnu_result_type)))) gnu_result = gnat_stabilize_reference (gnu_result, false); - /* Now convert the result to the proper type. If the type is void or if - we have no result, return error_mark_node to show we have no result. - If the type of the result is correct or if we have a label (which doesn't - have any well-defined type), return our result. Also don't do the - conversion if the "desired" type involves a PLACEHOLDER_EXPR in its size - since those are the cases where the front end may have the type wrong due - to "instantiating" the unconstrained record with discriminant values - or if this is a FIELD_DECL. If this is the Name of an assignment - statement or a parameter of a procedure call, return what we have since - the RHS has to be converted to our type there in that case, unless - GNU_RESULT_TYPE has a simpler size. Similarly, if the two types are - record types with the same name and GNU_RESULT_TYPE has BLKmode, don't - convert. This will be the case when we are converting from a packable - type to its actual type and we need those conversions to be NOPs in - order for assignments into these types to work properly. Finally, - don't convert integral types that are the operand of an unchecked - conversion since we need to ignore those conversions (for 'Valid). - Otherwise, convert the result to the proper type. */ + /* Now convert the result to the result type, unless we are in one of the + following cases: + + 1. If this is the Name of an assignment statement or a parameter of + a procedure call, return the result almost unmodified since the + RHS will have to be converted to our type in that case, unless + the result type has a simpler size. Similarly, don't convert + integral types that are the operands of an unchecked conversion + since we need to ignore those conversions (for 'Valid). + + 2. If we have a label (which doesn't have any well-defined type), a + field or an error, return the result almost unmodified. Also don't + do the conversion if the result type involves a PLACEHOLDER_EXPR in + its size since those are the cases where the front end may have the + type wrong due to "instantiating" the unconstrained record with + discriminant values. Similarly, if the two types are record types + with the same name don't convert. This will be the case when we are + converting from a packed version of a type to its original type and + we need those conversions to be NOPs in order for assignments into + these types to work properly. + + 3. If the type is void or if we have no result, return error_mark_node + to show we have no result. + + 4. Finally, if the type of the result is already correct. */ if (Present (Parent (gnat_node)) && ((Nkind (Parent (gnat_node)) == N_Assignment_Statement && Name (Parent (gnat_node)) == gnat_node) || (Nkind (Parent (gnat_node)) == N_Procedure_Call_Statement && Name (Parent (gnat_node)) != gnat_node) + || Nkind (Parent (gnat_node)) == N_Parameter_Association || (Nkind (Parent (gnat_node)) == N_Unchecked_Type_Conversion && !AGGREGATE_TYPE_P (gnu_result_type) - && !AGGREGATE_TYPE_P (TREE_TYPE (gnu_result))) - || Nkind (Parent (gnat_node)) == N_Parameter_Association) + && !AGGREGATE_TYPE_P (TREE_TYPE (gnu_result)))) && !(TYPE_SIZE (gnu_result_type) && TYPE_SIZE (TREE_TYPE (gnu_result)) && (AGGREGATE_TYPE_P (gnu_result_type) @@ -4887,16 +4939,14 @@ gnat_to_gnu (Node_Id gnat_node) && !(TREE_CODE (gnu_result_type) == RECORD_TYPE && TYPE_JUSTIFIED_MODULAR_P (gnu_result_type)))) { - /* In this case remove padding only if the inner object type is the - same as gnu_result_type or is of self-referential size (in that later - case it must be an object of unconstrained type with a default - discriminant). We want to avoid copying too much data. */ + /* Remove padding only if the inner object is of self-referential + size: in that case it must be an object of unconstrained type + with a default discriminant and we want to avoid copying too + much data. */ if (TREE_CODE (TREE_TYPE (gnu_result)) == RECORD_TYPE && TYPE_IS_PADDING_P (TREE_TYPE (gnu_result)) - && (TREE_TYPE (TYPE_FIELDS (TREE_TYPE (gnu_result))) - == gnu_result_type - || CONTAINS_PLACEHOLDER_P (TYPE_SIZE (TREE_TYPE (TYPE_FIELDS - (TREE_TYPE (gnu_result))))))) + && CONTAINS_PLACEHOLDER_P (TYPE_SIZE (TREE_TYPE (TYPE_FIELDS + (TREE_TYPE (gnu_result)))))) gnu_result = convert (TREE_TYPE (TYPE_FIELDS (TREE_TYPE (gnu_result))), gnu_result); } @@ -4911,23 +4961,22 @@ gnat_to_gnu (Node_Id gnat_node) || ((TYPE_NAME (gnu_result_type) == TYPE_NAME (TREE_TYPE (gnu_result))) && TREE_CODE (gnu_result_type) == RECORD_TYPE - && TREE_CODE (TREE_TYPE (gnu_result)) == RECORD_TYPE - && TYPE_MODE (gnu_result_type) == BLKmode)) + && TREE_CODE (TREE_TYPE (gnu_result)) == RECORD_TYPE)) { - /* Remove any padding record, but do nothing more in this case. */ + /* Remove any padding. */ if (TREE_CODE (TREE_TYPE (gnu_result)) == RECORD_TYPE && TYPE_IS_PADDING_P (TREE_TYPE (gnu_result))) gnu_result = convert (TREE_TYPE (TYPE_FIELDS (TREE_TYPE (gnu_result))), gnu_result); } - else if (gnu_result == error_mark_node - || gnu_result_type == void_type_node) - gnu_result = error_mark_node; + else if (gnu_result == error_mark_node || gnu_result_type == void_type_node) + gnu_result = error_mark_node; + else if (gnu_result_type != TREE_TYPE (gnu_result)) gnu_result = convert (gnu_result_type, gnu_result); - /* We don't need any NOP_EXPR or NON_LVALUE_EXPR on GNU_RESULT. */ + /* We don't need any NOP_EXPR or NON_LVALUE_EXPR on the result. */ while ((TREE_CODE (gnu_result) == NOP_EXPR || TREE_CODE (gnu_result) == NON_LVALUE_EXPR) && TREE_TYPE (TREE_OPERAND (gnu_result, 0)) == TREE_TYPE (gnu_result)) @@ -5793,7 +5842,7 @@ emit_range_check (tree gnu_expr, Entity_Id gnat_range_type) /* There's no good type to use here, so we might as well use integer_type_node. Note that the form of the check is (not (expr >= lo)) or (not (expr <= hi)) - the reason for this slightly convoluted form is that NaN's + the reason for this slightly convoluted form is that NaNs are not considered to be in range in the float case. */ return emit_check (build_binary_op (TRUTH_ORIF_EXPR, integer_type_node, @@ -5815,7 +5864,7 @@ emit_range_check (tree gnu_expr, Entity_Id gnat_range_type) against which GNU_EXPR has to be checked. Note that for index checking we cannot use the emit_range_check function (although very similar code needs to be generated in both cases) since for index - checking the array type against which we are checking the indeces + checking the array type against which we are checking the indices may be unconstrained and consequently we need to retrieve the actual index bounds from the array object itself (GNU_ARRAY_OBJECT). The place where we need to do that is in diff --git a/gcc/ada/tree_gen.adb b/gcc/ada/tree_gen.adb index 918ae29aa5b..901d373b300 100644 --- a/gcc/ada/tree_gen.adb +++ b/gcc/ada/tree_gen.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 1992-2007, Free Software Foundation, Inc. -- +-- Copyright (C) 1992-2008, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -32,12 +32,19 @@ with Nlists; with Opt; with Osint.C; with Repinfo; +with Sem_Aux; with Sinput; with Stand; with Stringt; with Uintp; with Urealp; +with Tree_In; +pragma Warnings (Off, Tree_In); +-- We do not use Tree_In in the compiler, but it is small, and worth including +-- so that we get the proper license check for Tree_In when the compiler is +-- built. This will avoid adding bad dependencies to Tree_In and blowing ASIS. + procedure Tree_Gen is begin if Opt.Tree_Output then @@ -49,6 +56,7 @@ begin Lib.Tree_Write; Namet.Tree_Write; Nlists.Tree_Write; + Sem_Aux.Tree_Write; Sinput.Tree_Write; Stand.Tree_Write; Stringt.Tree_Write; diff --git a/gcc/ada/tree_in.adb b/gcc/ada/tree_in.adb index d9c6e777b23..605c6b182aa 100644 --- a/gcc/ada/tree_in.adb +++ b/gcc/ada/tree_in.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 1992-1999, Free Software Foundation, Inc. -- +-- Copyright (C) 1992-2008, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -40,6 +40,7 @@ with Namet; with Nlists; with Opt; with Repinfo; +with Sem_Aux; with Sinput; with Stand; with Stringt; @@ -57,6 +58,7 @@ begin Lib.Tree_Read; Namet.Tree_Read; Nlists.Tree_Read; + Sem_Aux.Tree_Read; Sinput.Tree_Read; Stand.Tree_Read; Stringt.Tree_Read; diff --git a/gcc/ada/tree_io.adb b/gcc/ada/tree_io.adb index b62fb8e2bb2..699808d1067 100644 --- a/gcc/ada/tree_io.adb +++ b/gcc/ada/tree_io.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 1992-2007, Free Software Foundation, Inc. -- +-- Copyright (C) 1992-2008, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -107,7 +107,7 @@ package body Tree_IO is ----------------------- procedure Read_Buffer; - -- Reads data into buffer, setting Bufe appropriately + -- Reads data into buffer, setting Bufn appropriately function Read_Byte return Byte; pragma Inline (Read_Byte); diff --git a/gcc/ada/tree_io.ads b/gcc/ada/tree_io.ads index a8a49e91aaf..d243d726442 100644 --- a/gcc/ada/tree_io.ads +++ b/gcc/ada/tree_io.ads @@ -6,7 +6,7 @@ -- -- -- S p e c -- -- -- --- Copyright (C) 1992-2007, Free Software Foundation, Inc. -- +-- Copyright (C) 1992-2008, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -46,12 +46,12 @@ package Tree_IO is Tree_Format_Error : exception; -- Raised if a format error is detected in the input file - ASIS_Version_Number : constant := 21; + ASIS_Version_Number : constant := 22; -- ASIS Version. This is used to check for consistency between the compiler -- used to generate trees and an ASIS application that is reading the -- trees. It must be incremented whenever a change is made to the tree -- format that would result in the compiler being incompatible with an - -- older version of ASIS, or vice versa. + -- older version of ASIS. procedure Tree_Read_Initialize (Desc : File_Descriptor); -- Called to initialize reading of a tree file. This call must be made diff --git a/gcc/ada/treepr.adb b/gcc/ada/treepr.adb index 972e9a3da56..a25cfae44fa 100644 --- a/gcc/ada/treepr.adb +++ b/gcc/ada/treepr.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 1992-2007, Free Software Foundation, Inc. -- +-- Copyright (C) 1992-2008, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -1654,7 +1654,7 @@ package body Treepr is No_Indent : Boolean := False); -- This procedure tests the given value of one of the Fields referenced -- by the current node to determine whether to visit it recursively. - -- Normally No_Indent is false, which means tha the visited node will + -- Normally No_Indent is false, which means that the visited node will -- be indented using New_Prefix. If No_Indent is set to True, then -- this indentation is skipped, and Prefix_Str is used for the call -- to print the descendent. No_Indent is effective only if the diff --git a/gcc/ada/types.adb b/gcc/ada/types.adb index 978b4121fa0..d6ca613bcbe 100644 --- a/gcc/ada/types.adb +++ b/gcc/ada/types.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 1992-2005, Free Software Foundation, Inc. -- +-- Copyright (C) 1992-2008, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -83,8 +83,8 @@ package body Types is -- Note that we do not bother to worry about shifts in the day. -- It seems unlikely that such shifts could ever occur in practice - -- and even if they do we err on the safe side, ie we say that the time - -- stamps are different. + -- and even if they do we err on the safe side, i.e., we say that the + -- time stamps are different. Sright := V (Right, 13) + 60 * (V (Right, 11) + 60 * V (Right, 09)); Sleft := V (Left, 13) + 60 * (V (Left, 11) + 60 * V (Left, 09)); diff --git a/gcc/ada/types.ads b/gcc/ada/types.ads index 61318c8bcb8..9b4bfb825e4 100644 --- a/gcc/ada/types.ads +++ b/gcc/ada/types.ads @@ -6,7 +6,7 @@ -- -- -- S p e c -- -- -- --- Copyright (C) 1992-2007, Free Software Foundation, Inc. -- +-- Copyright (C) 1992-2008, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -47,6 +47,8 @@ -- 2s-complement. If there are any machines for which this is not a correct -- assumption, a significant number of changes will be required! +with System; +with Unchecked_Conversion; with Unchecked_Deallocation; package Types is @@ -123,6 +125,15 @@ package Types is procedure Free is new Unchecked_Deallocation (String, String_Ptr); -- Procedure for freeing dynamically allocated String values + subtype Big_String is String (Positive); + type Big_String_Ptr is access all Big_String; + for Big_String_Ptr'Storage_Size use 0; + -- Virtual type for handling imported big strings + + function To_Big_String_Ptr is + new Unchecked_Conversion (System.Address, Big_String_Ptr); + -- Used to obtain Big_String_Ptr values from external addresses + subtype Word_Hex_String is String (1 .. 8); -- Type used to represent Word value as 8 hex digits, with lower case -- letters for the alphabetic cases. @@ -191,6 +202,7 @@ package Types is -- type Source_Buffer_Ptr, see Osint.Read_Source_File for details. type Source_Buffer_Ptr is access all Big_Source_Buffer; + for Source_Buffer_Ptr'Storage_Size use 0; -- Pointer to source buffer. We use virtual origin addressing for source -- buffers, with thin pointers. The pointer points to a virtual instance -- of type Big_Source_Buffer, where the actual type is in fact of type @@ -200,7 +212,7 @@ package Types is subtype Source_Ptr is Text_Ptr; -- Type used to represent a source location, which is a subscript of a - -- character in the source buffer. As noted above, diffferent source + -- character in the source buffer. As noted above, different source -- buffers have different ranges, so it is possible to tell from a -- Source_Ptr value which source it refers to. Note that negative numbers -- are allowed to accommodate the following special values. @@ -423,7 +435,7 @@ package Types is No_List : constant List_Id := List_High_Bound; -- Used to indicate absence of a list. Note that the value is zero, which - -- is the same as Empty, which is helpful in intializing nodes where a + -- is the same as Empty, which is helpful in initializing nodes where a -- value of zero can represent either an empty node or an empty list. Error_List : constant List_Id := List_Low_Bound; @@ -448,7 +460,7 @@ package Types is -- Type used to identify an element list (Elist header table subscript) No_Elist : constant Elist_Id := Elist_Low_Bound; - -- Used to indicate absense of an element list. Note that this is not + -- Used to indicate absence of an element list. Note that this is not -- an actual Elist header, so element list operations on this value -- are not valid. @@ -497,7 +509,7 @@ package Types is -- Each character literal in the source is interpreted as being one of the -- 16#8000_0000 possible Wide_Wide_Character codes, and a unique Integer -- Value is assigned, corresponding to the UTF_32 value, which also - -- correspondds to the POS value in the Wide_Wide_Character type, and also + -- corresponds to the POS value in the Wide_Wide_Character type, and also -- corresponds to the POS value in the Wide_Character and Character types -- for values that are in appropriate range. String literals are similarly -- interpreted as a sequence of such codes. @@ -603,7 +615,7 @@ package Types is Dummy_Time_Stamp : constant Time_Stamp_Type := (others => '0'); -- This is used for dummy time stamp values used in the D lines for - -- non-existant files, and is intended to be an impossible value. + -- non-existent files, and is intended to be an impossible value. function "=" (Left, Right : Time_Stamp_Type) return Boolean; function "<=" (Left, Right : Time_Stamp_Type) return Boolean; diff --git a/gcc/ada/types.h b/gcc/ada/types.h index df01da67843..fb218c203a6 100644 --- a/gcc/ada/types.h +++ b/gcc/ada/types.h @@ -6,7 +6,7 @@ * * * C Header File * * * - * Copyright (C) 1992-2007, Free Software Foundation, Inc. * + * Copyright (C) 1992-2008, Free Software Foundation, Inc. * * * * GNAT is free software; you can redistribute it and/or modify it under * * terms of the GNU General Public License as published by the Free Soft- * @@ -341,7 +341,7 @@ typedef Int Mechanism_Type; #define CE_Index_Check_Failed 5 #define CE_Invalid_Data 6 #define CE_Length_Check_Failed 7 -#define CE_Null_Exception_Id 9 +#define CE_Null_Exception_Id 8 #define CE_Null_Not_Allowed 9 #define CE_Overflow_Check_Failed 10 #define CE_Partition_Check_Failed 11 diff --git a/gcc/ada/ug_words b/gcc/ada/ug_words index 3d8b83e0634..c167596477a 100644 --- a/gcc/ada/ug_words +++ b/gcc/ada/ug_words @@ -1,5 +1,5 @@ b_ ^ B_ -b~ ^ B$ +b~ ^ B__ cc1 ^ CC1 Cc1 ^ CC1 emacs ^ EMACS @@ -99,6 +99,8 @@ gcc -c ^ GNAT COMPILE -gnatVa ^ /VALIDITY_CHECKING=ALL -gnatVc ^ /VALIDITY_CHECKING=COPIES -gnatVd ^ /VALIDITY_CHECKING=DEFAULT +-gnatVE ^ /VALIDITY_CHECKING=NOCOMPONENTS +-gnatVe ^ /VALIDITY_CHECKING=COMPONENTS -gnatVD ^ /VALIDITY_CHECKING=NODEFAULT -gnatVf ^ /VALIDITY_CHECKING=FLOATS -gnatVi ^ /VALIDITY_CHECKING=IN_PARAMS @@ -123,6 +125,7 @@ gcc -c ^ GNAT COMPILE -gnatwd ^ /WARNINGS=IMPLICIT_DEREFERENCE -gnatwD ^ /WARNINGS=NOIMPLICIT_DEREFERENCE -gnatwe ^ /WARNINGS=ERRORS +-gnatw.e ^ /WARNINGS=EVERY -gnatwf ^ /WARNINGS=UNREFERENCED_FORMALS -gnatwF ^ /WARNINGS=NOUNREFERENCED_FORMALS -gnatwg ^ /WARNINGS=UNRECOGNIZED_PRAGMAS @@ -146,6 +149,8 @@ gcc -c ^ GNAT COMPILE -gnatw.O ^ /WARNINGS=NOOUT_PARAM_UNREF -gnatwp ^ /WARNINGS=INEFFECTIVE_INLINE -gnatwP ^ /WARNINGS=NOINEFFECTIVE_INLINE +-gnatw.p ^ /WARNINGS=PARAMETER_ORDER +-gnatw.P ^ /WARNINGS=NO_PARAMETER_ORDER -gnatwq ^ /WARNINGS=MISSING_PARENS -gnatwQ ^ /WARNINGS=NOMISSING_PARENS -gnatwr ^ /WARNINGS=REDUNDANT diff --git a/gcc/ada/uintp.adb b/gcc/ada/uintp.adb index 1f79670e44e..ffc636771d1 100644 --- a/gcc/ada/uintp.adb +++ b/gcc/ada/uintp.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 1992-2007, Free Software Foundation, Inc. -- +-- Copyright (C) 1992-2008, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -72,7 +72,7 @@ package body Uintp is Udigits_Min : Int; -- These values are used to make sure that the mark/release mechanism does -- not destroy values saved in the U_Power tables or in the hash table used - -- by UI_From_Int. Whenever an entry is made in either of these tabls, + -- by UI_From_Int. Whenever an entry is made in either of these tables, -- Uints_Min and Udigits_Min are updated to protect the entry, and Release -- never cuts back beyond these minimum values. @@ -142,7 +142,7 @@ package body Uintp is -- is less than 2**15, the value returned is the input value, in this case -- the result may be negative. It is expected that any use will mask off -- unnecessary bits. This is used for finding Arg mod B where B is a power - -- of two. Hence the actual base is irrelevent as long as it is a power of + -- of two. Hence the actual base is irrelevant as long as it is a power of -- two. procedure Most_Sig_2_Digits @@ -172,7 +172,7 @@ package body Uintp is Remainder : out Uint; Discard_Quotient : Boolean; Discard_Remainder : Boolean); - -- Compute euclidian division of Left by Right, and return Quotient and + -- Compute Euclidean division of Left by Right, and return Quotient and -- signed Remainder (Left rem Right). -- -- If Discard_Quotient is True, Quotient is left unchanged. @@ -750,7 +750,7 @@ package body Uintp is -- This is done in one pass - -- Mathematically: assume base congruent to 1 and compute an equivelent + -- Mathematically: assume base congruent to 1 and compute an equivalent -- integer to Left. -- If Sign = -1 return the alternating sum of the "digits" @@ -759,7 +759,7 @@ package body Uintp is -- (where D1 is Least Significant Digit) - -- Mathematically: assume base congruent to -1 and compute an equivelent + -- Mathematically: assume base congruent to -1 and compute an equivalent -- integer to Left. -- This is used in Rem and Base is assumed to be 2 ** 15 @@ -1944,7 +1944,7 @@ package body Uintp is function UI_Gt (Left : Uint; Right : Uint) return Boolean is begin - return UI_Lt (Right, Left); + return UI_Lt (Left => Right, Right => Left); end UI_Gt; --------------- @@ -1990,7 +1990,7 @@ package body Uintp is function UI_Le (Left : Uint; Right : Uint) return Boolean is begin - return not UI_Lt (Right, Left); + return not UI_Lt (Left => Right, Right => Left); end UI_Le; ------------ @@ -2742,7 +2742,7 @@ package body Uintp is -- The value is outside the direct representation range and must -- therefore be stored in the table. Expand the table to contain - -- the count and tigis. The index of the new table entry will be + -- the count and digits. The index of the new table entry will be -- returned as the result. Uints.Increment_Last; diff --git a/gcc/ada/uintp.ads b/gcc/ada/uintp.ads index e689cf84127..7454c70ca51 100644 --- a/gcc/ada/uintp.ads +++ b/gcc/ada/uintp.ads @@ -6,7 +6,7 @@ -- -- -- S p e c -- -- -- --- Copyright (C) 1992-2007, Free Software Foundation, Inc. -- +-- Copyright (C) 1992-2008, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -233,7 +233,7 @@ package Uintp is function UI_Modular_Inverse (N : Uint; Modulo : Uint) return Uint; -- Compute the multiplicative inverse of N in modular arithmetics with the -- given Modulo (uses Euclid's algorithm). Note: the call is considered - -- to be erroneous (and the behavior is undefined) if n is not inversible. + -- to be erroneous (and the behavior is undefined) if n is not invertible. function UI_From_Dint (Input : Dint) return Uint; -- Converts Dint value to universal integer form diff --git a/gcc/ada/usage.adb b/gcc/ada/usage.adb index f64188e9b73..0d131e1f2e5 100644 --- a/gcc/ada/usage.adb +++ b/gcc/ada/usage.adb @@ -23,6 +23,9 @@ -- -- ------------------------------------------------------------------------------ +-- Warning: the output of this usage for warnings is duplicated in the GNAT +-- reference manual. Be sure to update that if you change the warning list. + with Targparm; use Targparm; with Namet; use Namet; with Opt; use Opt; @@ -362,7 +365,8 @@ begin Write_Switch_Char ("wxx"); Write_Line ("Enable selected warning modes, xx = list of parameters:"); - Write_Line (" a turn on all optional warnings (except dhl.o.w)"); + Write_Line (" a turn on all optional warnings " & + "(except dhl.ot.w)"); Write_Line (" A turn off all optional warnings"); Write_Line (" .a* turn on warnings for failing assertions"); Write_Line (" .A turn off warnings for failing assertions"); @@ -377,6 +381,7 @@ begin Write_Line (" d turn on warnings for implicit dereference"); Write_Line (" D* turn off warnings for implicit dereference"); Write_Line (" e treat all warnings as errors"); + Write_Line (" .e turn on every optional warning (no exceptions)"); Write_Line (" f turn on warnings for unreferenced formal"); Write_Line (" F* turn off warnings for unreferenced formal"); Write_Line (" g* turn on warnings for unrecognized pragma"); @@ -407,9 +412,13 @@ begin Write_Line (" .O* turn off warnings for out parameters assigned " & "but not read"); Write_Line (" p turn on warnings for ineffective pragma " & - "Inline in frontend"); + "Inline in frontend"); Write_Line (" P* turn off warnings for ineffective pragma " & - "Inline in frontend"); + "Inline in frontend"); + Write_Line (" .p turn on warnings for suspicious parameter " & + "order"); + Write_Line (" .P* turn off warnings for suspicious parameter " & + "order"); Write_Line (" q* turn on warnings for questionable " & "missing parentheses"); Write_Line (" Q turn off warnings for questionable " & @@ -493,6 +502,7 @@ begin Write_Line (" m check line length <= 79 characters"); Write_Line (" n check casing of package Standard identifiers"); Write_Line (" Mnn check line length <= nn characters"); + Write_Line (" N turn off all checks"); Write_Line (" o check subprogram bodies in alphabetical order"); Write_Line (" p check pragma casing"); Write_Line (" r check casing for identifier references"); @@ -501,6 +511,9 @@ begin Write_Line (" t check token separation rules"); Write_Line (" u check no unnecessary blank lines"); Write_Line (" x check extra parentheses around conditionals"); + Write_Line (" y turn on default style checks"); + Write_Line (" - subtract (turn off) subsequent checks"); + Write_Line (" + add (turn on) subsequent checks"); -- Lines for -gnatyN switch diff --git a/gcc/ada/utils.c b/gcc/ada/utils.c index 2cde34e6565..96a85586433 100644 --- a/gcc/ada/utils.c +++ b/gcc/ada/utils.c @@ -447,7 +447,7 @@ gnat_pushdecl (tree decl, Node_Id gnat_node) tree t = TREE_TYPE (decl); if (!TYPE_NAME (t) || TREE_CODE (TYPE_NAME (t)) == IDENTIFIER_NODE) - TYPE_NAME (t) = decl; + ; else if (TYPE_FAT_POINTER_P (t)) { tree tt = build_variant_type_copy (t); @@ -455,9 +455,18 @@ gnat_pushdecl (tree decl, Node_Id gnat_node) TREE_USED (tt) = TREE_USED (t); TREE_TYPE (decl) = tt; DECL_ORIGINAL_TYPE (decl) = t; + t = NULL_TREE; } else if (DECL_ARTIFICIAL (TYPE_NAME (t)) && !DECL_ARTIFICIAL (decl)) - TYPE_NAME (t) = decl; + ; + else + t = NULL_TREE; + + /* Propagate the name to all the variants. This is needed for + the type qualifiers machinery to work properly. */ + if (t) + for (t = TYPE_MAIN_VARIANT (t); t; t = TYPE_NEXT_VARIANT (t)) + TYPE_NAME (t) = decl; } } @@ -539,6 +548,27 @@ init_gigi_decls (tree long_long_float_type, tree exception_type) void_ftype = build_function_type (void_type_node, NULL_TREE); ptr_void_ftype = build_pointer_type (void_ftype); + /* Build the special descriptor type and its null node if needed. */ + if (TARGET_VTABLE_USES_DESCRIPTORS) + { + tree field_list = NULL_TREE, null_list = NULL_TREE; + int j; + + fdesc_type_node = make_node (RECORD_TYPE); + + for (j = 0; j < TARGET_VTABLE_USES_DESCRIPTORS; j++) + { + tree field = create_field_decl (NULL_TREE, ptr_void_ftype, + fdesc_type_node, 0, 0, 0, 1); + TREE_CHAIN (field) = field_list; + field_list = field; + null_list = tree_cons (field, null_pointer_node, null_list); + } + + finish_record_type (fdesc_type_node, nreverse (field_list), 0, false); + null_fdesc_node = gnat_build_constructor (fdesc_type_node, null_list); + } + /* Now declare runtime functions. */ endlink = tree_cons (NULL_TREE, void_type_node, NULL_TREE); @@ -554,6 +584,18 @@ init_gigi_decls (tree long_long_float_type, tree exception_type) Empty); DECL_IS_MALLOC (malloc_decl) = 1; + /* malloc32 is a function declaration tree for a function to allocate + 32bit memory on a 64bit system. Needed only on 64bit VMS. */ + malloc32_decl = create_subprog_decl (get_identifier ("__gnat_malloc32"), + NULL_TREE, + build_function_type (ptr_void_type_node, + tree_cons (NULL_TREE, + sizetype, + endlink)), + NULL_TREE, false, true, true, NULL, + Empty); + DECL_IS_MALLOC (malloc32_decl) = 1; + /* free is a function declaration tree for a function to free memory. */ free_decl = create_subprog_decl (get_identifier ("__gnat_free"), NULL_TREE, @@ -1246,17 +1288,15 @@ split_plus (tree in, tree *pvar) otherwise we are dealing with a function. PARAM_DECL_LIST is a list of PARM_DECL nodes that are the subprogram arguments. CICO_LIST is the copy-in/copy-out list to be stored into TYPE_CICO_LIST. - RETURNS_UNCONSTRAINED is nonzero if the function returns an unconstrained - object. RETURNS_BY_REF is nonzero if the function returns by reference. - RETURNS_WITH_DSP is nonzero if the function is to return with a - depressed stack pointer. RETURNS_BY_TARGET_PTR is true if the function - is to be passed (as its first parameter) the address of the place to copy - its result. */ + RETURNS_UNCONSTRAINED is true if the function returns an unconstrained + object. RETURNS_BY_REF is true if the function returns by reference. + RETURNS_BY_TARGET_PTR is true if the function is to be passed (as its + first parameter) the address of the place to copy its result. */ tree create_subprog_type (tree return_type, tree param_decl_list, tree cico_list, bool returns_unconstrained, bool returns_by_ref, - bool returns_with_dsp, bool returns_by_target_ptr) + bool returns_by_target_ptr) { /* A chain of TREE_LIST nodes whose TREE_VALUEs are the data type nodes of the subprogram formal parameters. This list is generated by traversing the @@ -1293,7 +1333,6 @@ create_subprog_type (tree return_type, tree param_decl_list, tree cico_list, TYPE_CI_CO_LIST (type) = cico_list; TYPE_RETURNS_UNCONSTRAINED_P (type) = returns_unconstrained; - TYPE_RETURNS_STACK_DEPRESSED (type) = returns_with_dsp; TYPE_RETURNS_BY_REF_P (type) = returns_by_ref; TYPE_RETURNS_BY_TARGET_PTR_P (type) = returns_by_target_ptr; return type; @@ -1430,7 +1469,7 @@ create_var_decl_1 (tree var_name, tree asm_name, tree type, tree var_init, var_name, type); /* If this is external, throw away any initializations (they will be done - elsewhere) unless this is a a constant for which we would like to remain + elsewhere) unless this is a constant for which we would like to remain able to get the initializer. If we are defining a global here, leave a constant initialization and save any variable elaborations for the elaboration routine. If we are just annotating types, throw away the @@ -2043,7 +2082,7 @@ gnat_genericize_r (tree *stmt_p, int *walk_subtrees, void *data) return NULL; } - /* Otherwise, no need to walk the the same tree twice. */ + /* Otherwise, no need to walk the same tree twice. */ if (pointer_set_contains (p_set, stmt)) { *walk_subtrees = 0; @@ -2092,7 +2131,7 @@ gnat_genericize (tree fndecl) type, and the gimplifier ICEs on such attempts. Second, the middle-end now relies on a different attribute for such cases (DECL_BY_REFERENCE on RESULT/PARM_DECLs), and expects the user invisible by-reference-ness to - be explicitely accounted for by the front-end in the function body. + be explicitly accounted for by the front-end in the function body. We achieve the complete transformation in two steps: @@ -2110,7 +2149,7 @@ gnat_genericize (tree fndecl) strategy, which escapes the gimplifier temporary creation issues by creating it's own temporaries using TARGET_EXPR nodes. Our way relies on simple specific support code in aggregate_value_p to look at the - target function result decl explicitely. */ + target function result decl explicitly. */ struct pointer_set_t *p_set; tree decl_result = DECL_RESULT (fndecl); @@ -2118,7 +2157,7 @@ gnat_genericize (tree fndecl) if (!DECL_BY_REFERENCE (decl_result)) return; - /* Make the DECL_RESULT explicitely by-reference and adjust all the + /* Make the DECL_RESULT explicitly by-reference and adjust all the occurrences in the function body using the common tree-walking facility. We want to see every occurrence of the result decl to adjust the referencing tree, so need to use our own pointer set to control which @@ -2175,7 +2214,7 @@ end_subprog_body (tree body) if (type_annotate_only) return; - /* Perform the required pre-gimplfication transformations on the tree. */ + /* Perform the required pre-gimplification transformations on the tree. */ gnat_genericize (fndecl); /* We do different things for nested and non-nested functions. @@ -2372,6 +2411,42 @@ gnat_signed_type (tree type_node) return type; } +/* Return 1 if the types T1 and T2 are compatible, i.e. if they can be + transparently converted to each other. */ + +int +gnat_types_compatible_p (tree t1, tree t2) +{ + enum tree_code code; + + /* This is the default criterion. */ + if (TYPE_MAIN_VARIANT (t1) == TYPE_MAIN_VARIANT (t2)) + return 1; + + /* We only check structural equivalence here. */ + if ((code = TREE_CODE (t1)) != TREE_CODE (t2)) + return 0; + + /* Array types are also compatible if they are constrained and have + the same component type and the same domain. */ + if (code == ARRAY_TYPE + && TREE_TYPE (t1) == TREE_TYPE (t2) + && tree_int_cst_equal (TYPE_MIN_VALUE (TYPE_DOMAIN (t1)), + TYPE_MIN_VALUE (TYPE_DOMAIN (t2))) + && tree_int_cst_equal (TYPE_MAX_VALUE (TYPE_DOMAIN (t1)), + TYPE_MAX_VALUE (TYPE_DOMAIN (t2)))) + return 1; + + /* Padding record types are also compatible if they pad the same + type and have the same constant size. */ + if (code == RECORD_TYPE + && TYPE_IS_PADDING_P (t1) && TYPE_IS_PADDING_P (t2) + && TREE_TYPE (TYPE_FIELDS (t1)) == TREE_TYPE (TYPE_FIELDS (t2)) + && tree_int_cst_equal (TYPE_SIZE (t1), TYPE_SIZE (t2))) + return 1; + + return 0; +} /* EXP is an expression for the size of an object. If this size contains discriminant references, replace them with the maximum (if MAX_P) or @@ -3156,7 +3231,7 @@ update_pointer_to (tree old_type, tree new_type) qualifiers than the new_type ones, for instance in some cases of pointers to private record type elaboration (see the comments around the call to this routine from gnat_to_gnu_entity/E_Access_Type). We have to merge the - qualifiers in thoses cases too, to avoid accidentally discarding the + qualifiers in those cases too, to avoid accidentally discarding the initial set, and will often end up with old_type == new_type then. */ new_type = build_qualified_type (new_type, TYPE_QUALS (old_type) @@ -3362,15 +3437,15 @@ convert (tree type, tree expr) /* If both input and output have padding and are of variable size, do this as an unchecked conversion. Likewise if one is a mere variant of the other, so we avoid a pointless unpad/repad sequence. */ - else if (ecode == RECORD_TYPE && code == RECORD_TYPE + else if (code == RECORD_TYPE && ecode == RECORD_TYPE && TYPE_IS_PADDING_P (type) && TYPE_IS_PADDING_P (etype) && (!TREE_CONSTANT (TYPE_SIZE (type)) || !TREE_CONSTANT (TYPE_SIZE (etype)) - || TYPE_MAIN_VARIANT (type) == TYPE_MAIN_VARIANT (etype))) + || gnat_types_compatible_p (type, etype))) ; - /* If the output type has padding, make a constructor to build the - record. */ + /* If the output type has padding, convert to the inner type and + make a constructor to build the record. */ else if (code == RECORD_TYPE && TYPE_IS_PADDING_P (type)) { /* If we previously converted from another type and our type is @@ -3381,12 +3456,15 @@ convert (tree type, tree expr) expr = TREE_OPERAND (expr, 0); /* If we are just removing the padding from expr, convert the original - object if we have variable size. That will avoid the need - for some variable-size temporaries. */ + object if we have variable size in order to avoid the need for some + variable-size temporaries. Likewise if the padding is a mere variant + of the other, so we avoid a pointless unpad/repad sequence. */ if (TREE_CODE (expr) == COMPONENT_REF && TREE_CODE (TREE_TYPE (TREE_OPERAND (expr, 0))) == RECORD_TYPE && TYPE_IS_PADDING_P (TREE_TYPE (TREE_OPERAND (expr, 0))) - && !TREE_CONSTANT (TYPE_SIZE (type))) + && (!TREE_CONSTANT (TYPE_SIZE (type)) + || gnat_types_compatible_p (type, + TREE_TYPE (TREE_OPERAND (expr, 0))))) return convert (type, TREE_OPERAND (expr, 0)); /* If the result type is a padded type with a self-referentially-sized @@ -3500,14 +3578,9 @@ convert (tree type, tree expr) break; case CONSTRUCTOR: - /* If we are converting a CONSTRUCTOR to another constrained array type - with the same domain, just make a new one in the proper type. */ - if (code == ecode && code == ARRAY_TYPE - && TREE_TYPE (type) == TREE_TYPE (etype) - && tree_int_cst_equal (TYPE_MIN_VALUE (TYPE_DOMAIN (type)), - TYPE_MIN_VALUE (TYPE_DOMAIN (etype))) - && tree_int_cst_equal (TYPE_MAX_VALUE (TYPE_DOMAIN (type)), - TYPE_MAX_VALUE (TYPE_DOMAIN (etype)))) + /* If we are converting a CONSTRUCTOR to a mere variant type, just make + a new one in the proper type. */ + if (gnat_types_compatible_p (type, etype)) { expr = copy_node (expr); TREE_TYPE (expr) = type; @@ -3533,7 +3606,6 @@ convert (tree type, tree expr) the inner operand to the output type is fine in most cases, it might expose unexpected input/output type mismatches in special circumstances so we avoid such recursive calls when we can. */ - tree op0 = TREE_OPERAND (expr, 0); /* If we are converting back to the original type, we can just @@ -3543,13 +3615,13 @@ convert (tree type, tree expr) return op0; /* Otherwise, if we're converting between two aggregate types, we - might be allowed to substitute the VIEW_CONVERT target type in - place or to just convert the inner expression. */ + might be allowed to substitute the VIEW_CONVERT_EXPR target type + in place or to just convert the inner expression. */ if (AGGREGATE_TYPE_P (type) && AGGREGATE_TYPE_P (etype)) { - /* If we are converting between type variants, we can just - substitute the VIEW_CONVERT in place. */ - if (TYPE_MAIN_VARIANT (type) == TYPE_MAIN_VARIANT (etype)) + /* If we are converting between mere variants, we can just + substitute the VIEW_CONVERT_EXPR in place. */ + if (gnat_types_compatible_p (type, etype)) return build1 (VIEW_CONVERT_EXPR, type, op0); /* Otherwise, we may just bypass the input view conversion unless @@ -3588,10 +3660,10 @@ convert (tree type, tree expr) if (TYPE_FAT_POINTER_P (type) && !TYPE_FAT_POINTER_P (etype)) return convert_to_fat_pointer (type, expr); - /* If we're converting between two aggregate types that have the same main - variant, just make a VIEW_CONVER_EXPR. */ + /* If we're converting between two aggregate types that are mere + variants, just make a VIEW_CONVERT_EXPR. */ else if (AGGREGATE_TYPE_P (type) - && TYPE_MAIN_VARIANT (type) == TYPE_MAIN_VARIANT (etype)) + && gnat_types_compatible_p (type, etype)) return build1 (VIEW_CONVERT_EXPR, type, expr); /* In all other cases of related types, make a NOP_EXPR. */ diff --git a/gcc/ada/utils2.c b/gcc/ada/utils2.c index e9908676b44..3c6cb0074eb 100644 --- a/gcc/ada/utils2.c +++ b/gcc/ada/utils2.c @@ -143,7 +143,7 @@ known_alignment (tree exp) both type and expression information in this case. Beware that we can still get a dummy designated subtype here (e.g. Taft - Amendement types), in which the alignment information is meaningless and + Amendment types), in which the alignment information is meaningless and should be ignored. We always compute a type_alignment value and return the MAX of it @@ -243,7 +243,7 @@ find_common_type (tree t1, tree t2) would better be handled upstream (types should be made consistent before calling into build_binary_op), some others are really expected and we have to be careful. */ - + /* We must prevent writing more than what the target may hold if this is for an assignment and the case of tagged types is handled in build_binary_op so use the lhs type if it is known to be smaller, or of constant size and @@ -633,8 +633,7 @@ build_binary_op (enum tree_code op_code, tree result_type, tree right_base_type = get_base_type (right_type); tree operation_type = result_type; tree best_type = NULL_TREE; - tree modulus; - tree result; + tree modulus, result; bool has_side_effects = false; if (operation_type @@ -647,18 +646,19 @@ build_binary_op (enum tree_code op_code, tree result_type, && TYPE_EXTRA_SUBTYPE_P (operation_type)) operation_type = get_base_type (operation_type); - modulus = (operation_type && TREE_CODE (operation_type) == INTEGER_TYPE + modulus = (operation_type + && TREE_CODE (operation_type) == INTEGER_TYPE && TYPE_MODULAR_P (operation_type) - ? TYPE_MODULUS (operation_type) : 0); + ? TYPE_MODULUS (operation_type) : NULL_TREE); switch (op_code) { case MODIFY_EXPR: - /* If there were any integral or pointer conversions on LHS, remove + /* If there were integral or pointer conversions on the LHS, remove them; we'll be putting them back below if needed. Likewise for - conversions between array and record types. But don't do this if - the right operand is not BLKmode (for packed arrays) - unless we are not changing the mode. */ + conversions between array and record types, except for justified + modular types. But don't do this if the right operand is not + BLKmode (for packed arrays) unless we are not changing the mode. */ while ((TREE_CODE (left_operand) == CONVERT_EXPR || TREE_CODE (left_operand) == NOP_EXPR || TREE_CODE (left_operand) == VIEW_CONVERT_EXPR) @@ -669,8 +669,6 @@ build_binary_op (enum tree_code op_code, tree result_type, || POINTER_TYPE_P (TREE_TYPE (TREE_OPERAND (left_operand, 0))))) || (((TREE_CODE (left_type) == RECORD_TYPE - /* Don't remove conversions to justified modular - types. */ && !TYPE_JUSTIFIED_MODULAR_P (left_type)) || TREE_CODE (left_type) == ARRAY_TYPE) && ((TREE_CODE (TREE_TYPE @@ -692,8 +690,7 @@ build_binary_op (enum tree_code op_code, tree result_type, if (!operation_type) operation_type = left_type; - /* If we are copying one array or record to another, find the best type - to use. */ + /* Find the best type to use for copying between aggregate types. */ if (((TREE_CODE (left_type) == ARRAY_TYPE && TREE_CODE (right_type) == ARRAY_TYPE) || (TREE_CODE (left_type) == RECORD_TYPE @@ -709,11 +706,11 @@ build_binary_op (enum tree_code op_code, tree result_type, /* Ensure everything on the LHS is valid. If we have a field reference, strip anything that get_inner_reference can handle. Then remove any - conversions with type types having the same code and mode. Mark + conversions between types having the same code and mode. And mark VIEW_CONVERT_EXPRs with TREE_ADDRESSABLE. When done, we must have - either an INDIRECT_REF or a decl. */ + either an INDIRECT_REF, a NULL_EXPR or a DECL node. */ result = left_operand; - while (1) + while (true) { tree restype = TREE_TYPE (result); @@ -744,21 +741,21 @@ build_binary_op (enum tree_code op_code, tree result_type, } gcc_assert (TREE_CODE (result) == INDIRECT_REF - || TREE_CODE (result) == NULL_EXPR || DECL_P (result)); + || TREE_CODE (result) == NULL_EXPR + || DECL_P (result)); - /* Convert the right operand to the operation type unless - it is either already of the correct type or if the type - involves a placeholder, since the RHS may not have the same - record type. */ + /* Convert the right operand to the operation type unless it is + either already of the correct type or if the type involves a + placeholder, since the RHS may not have the same record type. */ if (operation_type != right_type - && (!CONTAINS_PLACEHOLDER_P (TYPE_SIZE (operation_type)))) + && !CONTAINS_PLACEHOLDER_P (TYPE_SIZE (operation_type))) { right_operand = convert (operation_type, right_operand); right_type = operation_type; } - /* If the left operand is not the same type as the operation type, - surround it in a VIEW_CONVERT_EXPR. */ + /* If the left operand is not of the same type as the operation + type, wrap it up in a VIEW_CONVERT_EXPR. */ if (left_type != operation_type) left_operand = unchecked_convert (operation_type, left_operand, false); @@ -1017,8 +1014,8 @@ build_binary_op (enum tree_code op_code, tree result_type, else if (TREE_CODE (right_operand) == NULL_EXPR) return build1 (NULL_EXPR, operation_type, TREE_OPERAND (right_operand, 0)); else if (op_code == ARRAY_REF || op_code == ARRAY_RANGE_REF) - result = build4 (op_code, operation_type, left_operand, - right_operand, NULL_TREE, NULL_TREE); + result = fold (build4 (op_code, operation_type, left_operand, + right_operand, NULL_TREE, NULL_TREE)); else result = fold_build2 (op_code, operation_type, left_operand, right_operand); @@ -1286,7 +1283,7 @@ build_unary_op (enum tree_code op_code, tree result_type, tree operand) tree modulus = ((operation_type && TREE_CODE (operation_type) == INTEGER_TYPE && TYPE_MODULAR_P (operation_type)) - ? TYPE_MODULUS (operation_type) : 0); + ? TYPE_MODULUS (operation_type) : NULL_TREE); int mod_pow2 = modulus && integer_pow2p (modulus); /* If this is a modular type, there are various possibilities @@ -1921,7 +1918,14 @@ build_call_alloc_dealloc (tree gnu_obj, tree gnu_size, unsigned align, { if (Nkind (gnat_node) != N_Allocator || !Comes_From_Source (gnat_node)) Check_No_Implicit_Heap_Alloc (gnat_node); - return build_call_1_expr (malloc_decl, gnu_size); + + /* If the allocator size is 32bits but the pointer size is 64bits then + allocate 32bit memory (sometimes necessary on 64bit VMS). Otherwise + default to standard malloc. */ + if (UI_To_Int (Esize (Etype (gnat_node))) == 32 && POINTER_SIZE == 64) + return build_call_1_expr (malloc32_decl, gnu_size); + else + return build_call_1_expr (malloc_decl, gnu_size); } } diff --git a/gcc/ada/validsw.ads b/gcc/ada/validsw.ads index dde1a59d231..f24bc878272 100644 --- a/gcc/ada/validsw.ads +++ b/gcc/ada/validsw.ads @@ -6,7 +6,7 @@ -- -- -- S p e c -- -- -- --- Copyright (C) 2001-2007, Free Software Foundation, Inc. -- +-- Copyright (C) 2001-2008, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -73,14 +73,14 @@ package Validsw is -- Controls the validity checking of IN OUT parameters. If this switch -- is set to True using -gnatVm or a 'm' in the argument of a pragma -- Validity_Checks, then the initial value of all IN OUT parameters - -- will be checked at the point of call of a procecure. Note that the + -- will be checked at the point of call of a procedure. Note that the -- character 'm' here stands for modified (parameters). Validity_Check_In_Params : Boolean := False; -- Controls the validity checking of IN parameters. If this switch is -- set to True using -gnatVm or an 'i' in the argument of a pragma -- Validity_Checks, then the initial value of all IN parameters - -- will be checked at the point of call of a procecure or function. + -- will be checked at the point of call of a procedure or function. Validity_Check_Operands : Boolean := False; -- Controls validity checking of operands. If this switch is set to @@ -145,7 +145,7 @@ package Validsw is procedure Set_Validity_Check_Options (Options : String); -- Like the above procedure, except that the call is simply ignored if - -- there are any error conditions, this is for example appopriate for + -- there are any error conditions, this is for example appropriate for -- calls where the string is known to be valid, e.g. because it was -- obtained by Save_Validity_Check_Options. diff --git a/gcc/ada/vms_conv.adb b/gcc/ada/vms_conv.adb index 128026134b6..4b4e61a155b 100644 --- a/gcc/ada/vms_conv.adb +++ b/gcc/ada/vms_conv.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 1996-2007, Free Software Foundation, Inc. -- +-- Copyright (C) 1996-2008, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -44,7 +44,7 @@ package body VMS_Conv is -- kept in a more conveniently accessible form described in this -- section. - -- Commands, command qualifers and options have a similar common format + -- Commands, command qualifiers and options have a similar common format -- so that searching for matching names can be done in a common manner. type Item_Id is (Id_Command, Id_Switch, Id_Option); @@ -274,7 +274,7 @@ package body VMS_Conv is procedure Place_Unix_Switches (S : VMS_Data.String_Ptr); -- Given a unix switch string, place corresponding switches in Buffer, - -- updating Ptr appropriatelly. Note that in the case of use of ! the + -- updating Ptr appropriately. Note that in the case of use of ! the -- result may be to remove a previously placed switch. procedure Preprocess_Command_Data; @@ -814,7 +814,12 @@ package body VMS_Conv is procedure Output_Version is begin - Put ("GNAT "); + if AAMP_On_Target then + Put ("GNAAMP "); + else + Put ("GNAT "); + end if; + Put_Line (Gnatvsn.Gnat_Version_String); Put_Line ("Copyright 1996-" & Current_Year & @@ -2015,7 +2020,7 @@ package body VMS_Conv is -- end of the Argv, otherwise strings like -- "foo/bar" get split at the slash. - -- The begining and ending of the string + -- The beginning and ending of the string -- are flagged with embedded nulls which -- are removed when building the Spawn -- call. Nulls are use because they won't diff --git a/gcc/ada/vms_conv.ads b/gcc/ada/vms_conv.ads index 666cd3a2fad..965bb372d48 100644 --- a/gcc/ada/vms_conv.ads +++ b/gcc/ada/vms_conv.ads @@ -6,7 +6,7 @@ -- -- -- S p e c -- -- -- --- Copyright (C) 2003-2007, Free Software Foundation, Inc. -- +-- Copyright (C) 2003-2008, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -65,7 +65,7 @@ package VMS_Conv is -- GNATCmd. The entries are represented by an array of records. type Parameter_Type is - -- A parameter is defined as a whitespace bounded string, not begining + -- A parameter is defined as a whitespace bounded string, not beginning -- with a slash. (But see note under FILES_OR_WILDCARD). (File, -- A required file or directory parameter @@ -81,7 +81,7 @@ package VMS_Conv is -- parameters including wildcard specifications. Unlimited_As_Is, - -- Un unlimited number of whitespace separated paameters that are + -- An unlimited number of whitespace separated parameters that are -- passed through as is (not canonicalized). Files_Or_Wildcard); diff --git a/gcc/ada/vms_data.ads b/gcc/ada/vms_data.ads index fa8e108e315..7dc0bf003f4 100644 --- a/gcc/ada/vms_data.ads +++ b/gcc/ada/vms_data.ads @@ -40,7 +40,7 @@ -- NOTE: the format of this package must follow the following rules, so that -- the VMS GNAT help tool works properly: --- - Each command zone (where the eventual qualifiers are declared must +-- - Each command zone (where the eventual qualifiers are declared) must -- begin with a boxed comment of the form: -- --------------------------------- @@ -56,7 +56,7 @@ -- - a contiguous sequence of comments that constitute the -- documentation of the qualifier. --- - each command zone ends with the declaration of the contant array +-- - each command zone ends with the declaration of the constant array -- for the command, of the form: -- <Command>__Switches : aliased constant Switches := @@ -67,7 +67,7 @@ package VMS_Data is -- QUALIFIERS -- ---------------- - -- The syntax of a qualifier delaration is as follows: + -- The syntax of a qualifier declaration is as follows: -- SWITCH_STRING ::= "/ command-qualifier-name TRANSLATION" @@ -109,7 +109,7 @@ package VMS_Data is -- The unix-switch-string always starts with a minus, and has no commas -- or spaces in it. Case is significant in the unix switch string. If a -- unix switch string is preceded by the not sign (!) it means that the - -- effect of the corresponding command qualifer is to remove any previous + -- effect of the corresponding command qualifier is to remove any previous -- occurrence of the given switch in the command line. -- The DIRECTORIES_TRANSLATION format is used where a list of directories @@ -149,7 +149,7 @@ package VMS_Data is -- The COMMANDS_TRANSLATION case is only used for gnatmake, to correspond -- to the use of -cargs, -bargs and -largs (the ARGS string as indicated -- is one of these three possibilities). The name given by COMMAND is the - -- corresponding command name to be used to interprete the switches to be + -- corresponding command name to be used to interpret the switches to be -- passed on. Switches of this type set modes, e.g. /COMPILER_QUALIFIERS -- sets the mode so that all subsequent switches, up to another switch -- with COMMANDS_TRANSLATION apply to the corresponding commands issued @@ -162,7 +162,7 @@ package VMS_Data is -- since all subsequent switches apply to an issued command. -- For the DIRECT_TRANSLATION case, an implicit additional qualifier - -- declaration is created by prepending NO to the name of the qualifer, + -- declaration is created by prepending NO to the name of the qualifier, -- and then inverting the sense of the UNIX_SWITCHES string. For example, -- given the qualifier definition: @@ -182,7 +182,7 @@ package VMS_Data is -- String pointer type used throughout type Switches is array (Natural range <>) of String_Ptr; - -- Type used for array of swtiches + -- Type used for array of switches type Switches_Ptr is access constant Switches; @@ -192,7 +192,7 @@ package VMS_Data is S_Bind_Add : aliased constant S := "/ADD_PROJECT_SEARCH_DIR=*" & "-aP*"; - -- /ADD_PROJECT_SEARCH_PATH==(directory[,...]) + -- /ADD_PROJECT_SEARCH_PATH=(directory[,...]) -- -- Add directories to the project search path. @@ -275,6 +275,13 @@ package VMS_Data is -- Example: -- /EXTERNAL_REFERENCE="DEBUG=TRUE" + S_Bind_Follow : aliased constant S := "/FOLLOW_LINKS_FOR_FILES " & + "-eL"; + -- /NOFOLLOW_LINKS_FOR_FILES (D) + -- /FOLLOW_LINKS_FOR_FILES + -- + -- Follow links when parsing project files + S_Bind_Force : aliased constant S := "/FORCE_ELAB_FLAGS " & "-F"; -- /NOFORCE_ELAB_FLAGS (D) @@ -506,7 +513,7 @@ package VMS_Data is -- /NORESTRICTION_LIST (D) -- /RESTRICTION_LIST -- - -- Generate list of pragma Rerstrictions that could be applied to the + -- Generate list of pragma Restrictions that could be applied to the -- current unit. This is useful for code audit purposes, and also may be -- used to improve code generation in some cases. @@ -519,7 +526,7 @@ package VMS_Data is -- /RETURN_CODES=VMS -- -- Specifies the style of default exit code returned. Must be used in - -- conjunction with and match the Link qualifer with same name. + -- conjunction with and match the Link qualifier with same name. -- -- POSIX (D) Return Posix success (0) by default. -- @@ -579,6 +586,14 @@ package VMS_Data is -- This qualifier has no impact, except when using the setjmp/longjmp -- exception mechanism, with the GNAT COMPILE qualifier /LONGJMP_SETJMP. + S_Bind_Subdirs : aliased constant S := "/SUBDIRS=<" & + "--subdirs=>"; + -- /SUBDIRS=dir + -- + -- The actual directories (object, exec, library, ...) are subdirectories + -- of the directory specified in the project file. If the subdirectory + -- does not exist, it is created automatically. + S_Bind_Time : aliased constant S := "/TIME_STAMP_CHECK " & "!-t"; -- /TIME_STAMP_CHECK (D) @@ -662,6 +677,7 @@ package VMS_Data is S_Bind_Elab 'Access, S_Bind_Error 'Access, S_Bind_Ext 'Access, + S_Bind_Follow 'Access, S_Bind_Force 'Access, S_Bind_Help 'Access, S_Bind_Init 'Access, @@ -693,6 +709,7 @@ package VMS_Data is S_Bind_Source 'Access, S_Bind_Static 'Access, S_Bind_Store 'Access, + S_Bind_Subdirs 'Access, S_Bind_Time 'Access, S_Bind_Verbose 'Access, S_Bind_Warn 'Access, @@ -706,7 +723,7 @@ package VMS_Data is S_Check_Add : aliased constant S := "/ADD_PROJECT_SEARCH_DIR=*" & "-aP*"; - -- /ADD_PROJECT_SEARCH_PATH==(directory[,...]) + -- /ADD_PROJECT_SEARCH_PATH=(directory[,...]) -- -- Add directories to the project search path. @@ -736,6 +753,13 @@ package VMS_Data is -- Take as arguments the files that are listed in the specified -- text file. + S_Check_Follow : aliased constant S := "/FOLLOW_LINKS_FOR_FILES " & + "-eL"; + -- /NOFOLLOW_LINKS_FOR_FILES (D) + -- /FOLLOW_LINKS_FOR_FILES + -- + -- Follow links when parsing project files + S_Check_Help : aliased constant S := "/HELP " & "-h"; -- /NOHELP (D) @@ -748,7 +772,7 @@ package VMS_Data is -- /NOLOCS (D) -- /LOCS -- - -- Use full source locations referebces in the report file. + -- Use full source locations references in the report file. S_Check_Mess : aliased constant S := "/MESSAGES_PROJECT_FILE=" & "DEFAULT " & @@ -797,20 +821,20 @@ package VMS_Data is -- /SECTIONS[=section-option, section-option, ...] -- -- Specify what sections should be included into the report file. - -- By default, all three section (diagnises in the format correcponding + -- By default, all three section (diagnoses in the format corresponding -- to compiler error and warning messages, diagnoses grouped by rules and -- then - by files, diagnoses grouped by files and then - by rules) are -- included in the report file. -- -- section-option may be one of the following: -- - -- COMPILER_STYLE Include diagnoses in compile-style format - -- (diagoses are grouped by files, for each file + -- COMPILER_STYLE Include diagnostics in compile-style format + -- (diagnoses are grouped by files, for each file -- they are ordered according to the references -- into the source) - -- BY_RULES Include diagnoses grouped first by rules and + -- BY_RULES Include diagnostics grouped first by rules and -- then by files - -- BY_FILES_BY_RULES Include diagnoses grouped first by files and + -- BY_FILES_BY_RULES Include diagnostics grouped first by files and -- then by rules -- -- If one of these options is specified, then the report file contains @@ -823,6 +847,14 @@ package VMS_Data is -- -- Generate a short form of the report file. + S_Check_Subdirs : aliased constant S := "/SUBDIRS=<" & + "--subdirs=>"; + -- /SUBDIRS=dir + -- + -- The actual directories (object, exec, library, ...) are subdirectories + -- of the directory specified in the project file. If the subdirectory + -- does not exist, it is created automatically. + S_Check_Verb : aliased constant S := "/VERBOSE " & "-v"; -- /NOVERBOSE (D) @@ -837,6 +869,7 @@ package VMS_Data is S_Check_All 'Access, S_Check_Ext 'Access, S_Check_Files 'Access, + S_Check_Follow 'Access, S_Check_Help 'Access, S_Check_Locs 'Access, S_Check_Mess 'Access, @@ -844,6 +877,7 @@ package VMS_Data is S_Check_Quiet 'Access, S_Check_Sections 'Access, S_Check_Short 'Access, + S_Check_Subdirs 'Access, S_Check_Verb 'Access); ---------------------------- @@ -852,7 +886,7 @@ package VMS_Data is S_Sync_Add : aliased constant S := "/ADD_PROJECT_SEARCH_DIR=*" & "-aP*"; - -- /ADD_PROJECT_SEARCH_PATH==(directory[,...]) + -- /ADD_PROJECT_SEARCH_PATH=(directory[,...]) -- -- Add directories to the project search path. @@ -882,6 +916,13 @@ package VMS_Data is -- Take as arguments the files that are listed in the specified -- text file. + S_Sync_Follow : aliased constant S := "/FOLLOW_LINKS_FOR_FILES " & + "-eL"; + -- /NOFOLLOW_LINKS_FOR_FILES (D) + -- /FOLLOW_LINKS_FOR_FILES + -- + -- Follow links when parsing project files + S_Sync_Mess : aliased constant S := "/MESSAGES_PROJECT_FILE=" & "DEFAULT " & "-vP0 " & @@ -917,6 +958,14 @@ package VMS_Data is -- -- Work quietly, only output warnings and errors. + S_Sync_Subdirs : aliased constant S := "/SUBDIRS=<" & + "--subdirs=>"; + -- /SUBDIRS=dir + -- + -- The actual directories (object, exec, library, ...) are subdirectories + -- of the directory specified in the project file. If the subdirectory + -- does not exist, it is created automatically. + S_Sync_Verb : aliased constant S := "/VERBOSE " & "-v"; -- /NOVERBOSE (D) @@ -967,10 +1016,12 @@ package VMS_Data is (S_Sync_Add 'Access, S_Sync_All 'Access, S_Sync_Ext 'Access, + S_Sync_Follow 'Access, S_Sync_Files 'Access, S_Sync_Mess 'Access, S_Sync_Project 'Access, S_Sync_Quiet 'Access, + S_Sync_Subdirs 'Access, S_Sync_Verb 'Access, S_Sync_Exec 'Access, S_Sync_Details 'Access, @@ -1021,7 +1072,7 @@ package VMS_Data is -- -- Causes the file modification time stamp of the input file to be -- preserved and used for the time stamp of the output file(s). This may - -- be useful for preserving coherency of time stamps in an enviroment + -- be useful for preserving coherency of time stamps in an environment -- where gnatchop is used as part of a standard build process. S_Chop_Quiet : aliased constant S := "/QUIET " & @@ -1075,7 +1126,7 @@ package VMS_Data is S_Clean_Add : aliased constant S := "/ADD_PROJECT_SEARCH_DIR=*" & "-aP*"; - -- /ADD_PROJECT_SEARCH_PATH==(directory[,...]) + -- /ADD_PROJECT_SEARCH_PATH=(directory[,...]) -- -- Add directories to the project search path. @@ -1129,6 +1180,13 @@ package VMS_Data is -- Example: -- /EXTERNAL_REFERENCE="DEBUG=TRUE" + S_Clean_Follow : aliased constant S := "/FOLLOW_LINKS_FOR_FILES " & + "-eL"; + -- /NOFOLLOW_LINKS_FOR_FILES (D) + -- /FOLLOW_LINKS_FOR_FILES + -- + -- Follow links when parsing project files + S_Clean_Full : aliased constant S := "/FULL_PATH_IN_BRIEF_MESSAGES " & "-F"; -- /NOFULL_PATH_IN_BRIEF_MESSAGES (D) @@ -1195,7 +1253,7 @@ package VMS_Data is -- /NOQUIET (D) -- /QUIET -- - -- Quiet output. If there are no error, do not ouuput anything, except in + -- Quiet output. If there are no error, do not output anything, except in -- verbose mode (qualifier /VERBOSE) or in informative-only mode -- (qualifier /NODELETE). @@ -1215,6 +1273,14 @@ package VMS_Data is -- -- Equivalent to /OBJECT_SEARCH=(directory,...). + S_Clean_Subdirs : aliased constant S := "/SUBDIRS=<" & + "--subdirs=>"; + -- /SUBDIRS=dir + -- + -- The actual directories (object, exec, library, ...) are subdirectories + -- of the directory specified in the project file. If the subdirectory + -- does not exist, it is created automatically. + S_Clean_Verbose : aliased constant S := "/VERBOSE " & "-v"; -- /NOVERBOSE (D) @@ -1229,6 +1295,7 @@ package VMS_Data is S_Clean_Delete 'Access, S_Clean_Dirobj 'Access, S_Clean_Ext 'Access, + S_Clean_Follow 'Access, S_Clean_Full 'Access, S_Clean_Help 'Access, S_Clean_Index 'Access, @@ -1238,6 +1305,7 @@ package VMS_Data is S_Clean_Quiet 'Access, S_Clean_Recurs 'Access, S_Clean_Search 'Access, + S_Clean_Subdirs'Access, S_Clean_Verbose'Access); ------------------------------- @@ -1283,7 +1351,7 @@ package VMS_Data is S_GCC_Add : aliased constant S := "/ADD_PROJECT_SEARCH_DIR=*" & "-aP*"; - -- /ADD_PROJECT_SEARCH_PATH==(directory[,...]) + -- /ADD_PROJECT_SEARCH_PATH=(directory[,...]) -- -- Add directories to the project search path. @@ -1351,7 +1419,8 @@ package VMS_Data is -- -- ASSERTIONS The pragmas "Assert" and "Debug" normally have no -- effect and are ignored. This keyword causes "Assert" - -- and "Debug" pragmas to be activated. + -- and "Debug" pragmas to be activated, as well as + -- "Check", "Precondition" and "Postcondition" pragmas. -- -- SUPPRESS_ALL Suppress all runtime checks as though you have "pragma -- Suppress (all_checks)" in your source. Use this switch @@ -1575,6 +1644,13 @@ package VMS_Data is -- including the ADS or ADB filetype. The default is not to enable file -- name krunching. + S_GCC_Follow : aliased constant S := "/FOLLOW_LINKS_FOR_FILES " & + "-eL"; + -- /NOFOLLOW_LINKS_FOR_FILES (D) + -- /FOLLOW_LINKS_FOR_FILES + -- + -- Follow links when parsing project files + S_GCC_Force : aliased constant S := "/FORCE_ALI " & "-gnatQ"; -- /NOFORCE_ALI (D) @@ -1585,7 +1661,7 @@ package VMS_Data is -- forces generation of the .ALI file. This file is marked as being -- in error, so it cannot be used for binding purposes, but it does -- contain reasonably complete cross-reference information, and thus may - -- be useful for use by tools (e.g. semantic browing tools or integrated + -- be useful for use by tools (e.g. semantic browsing tools or integrated -- development environments) that are driven from the .ALI file. S_GCC_Full : aliased constant S := "/FULL_PATH_IN_BRIEF_MESSAGES " & @@ -2151,7 +2227,9 @@ package VMS_Data is S_GCC_Style : aliased constant S := "/STYLE_CHECKS=" & "ALL_BUILTIN " & - "-gnaty " & + "-gnatyy " & + "0 " & + "-gnaty0 " & "1 " & "-gnaty1 " & "2 " & @@ -2172,52 +2250,96 @@ package VMS_Data is "-gnaty9 " & "ATTRIBUTE " & "-gnatya " & + "NOATTRIBUTE " & + "-gnaty-a " & "ARRAY_INDEXES " & "-gnatyA " & + "NOARRAY_INDEXES " & + "-gnaty-A " & "BLANKS " & "-gnatyb " & + "NOBLANKS " & + "-gnaty-b " & "COMMENTS " & "-gnatyc " & + "NOCOMMENTS " & + "-gnaty-c " & "DOS_LINE_ENDINGS " & "-gnatyd " & + "NODOS_LINE_ENDINGS " & + "-gnaty-d " & "END " & "-gnatye " & + "NOEND " & + "-gnaty-e " & "VTABS " & "-gnatyf " & + "NOVTABS " & + "-gnaty-f " & "GNAT " & "-gnatyg " & "HTABS " & "-gnatyh " & + "NOHTABS " & + "-gnaty-h " & "IF_THEN " & "-gnatyi " & + "NOIF_THEN " & + "-gnaty-i " & "KEYWORD " & "-gnatyk " & + "NOKEYWORD " & + "-gnaty-k " & "LAYOUT " & "-gnatyl " & + "NOLAYOUT " & + "-gnaty-l " & "LINE_LENGTH " & "-gnatym " & + "NOLINE_LENGTH " & + "-gnaty-m " & "MODE_IN " & "-gnatyI " & + "NOMODE_IN " & + "-gnaty-I " & "NONE " & "-gnatyN " & "STANDARD_CASING " & "-gnatyn " & + "NOSTANDARD_CASING " & + "-gnaty-n " & "ORDERED_SUBPROGRAMS " & "-gnatyo " & + "NOORDERED_SUBPROGRAMS " & + "-gnaty-o " & "PRAGMA " & "-gnatyp " & + "NOPRAGMA " & + "-gnaty-p " & "REFERENCES " & "-gnatyr " & + "NOREFERENCES " & + "-gnaty-r " & "SPECS " & "-gnatys " & + "NOSPECS " & + "-gnaty-s " & "STATEMENTS_AFTER_THEN_ELSE " & "-gnatyS " & + "NOSTATEMENTS_AFTER_THEN_ELSE " & + "-gnaty-S " & "TOKEN " & "-gnatyt " & + "NOTOKEN " & + "-gnaty-t " & "UNNECESSARY_BLANK_LINES " & "-gnatyu " & + "NOUNNECESSARY_BLANK_LINES " & + "-gnaty-u " & "XTRA_PARENS " & - "-gnatyx "; + "-gnaty-x " & + "NOXTRA_PARENS " & + "-gnaty-x "; -- /NOSTYLE_CHECKS (D) -- /STYLE_CHECKS[=(keyword,[...])] -- @@ -2282,7 +2404,7 @@ package VMS_Data is -- allows proper processing of the output -- generated by specialized tools including -- gnatprep (where --! is used) and the SPARK - -- annnotation language (where --# is used). + -- annotation language (where --# is used). -- For the purposes of this rule, a special -- character is defined as being in one of the -- ASCII ranges 16#21#..16#2F# or @@ -2531,6 +2653,14 @@ package VMS_Data is "!-gnatg,!-gnaty*"; -- NODOC (see /STYLE_CHECKS) + S_GCC_Subdirs : aliased constant S := "/SUBDIRS=<" & + "--subdirs=>"; + -- /SUBDIRS=dir + -- + -- The actual directories (object, exec, library, ...) are subdirectories + -- of the directory specified in the project file. If the subdirectory + -- does not exist, it is created automatically. + S_GCC_Symbol : aliased constant S := "/SYMBOL_PREPROCESSING=" & '"' & "-gnateD" & '"'; -- /SYMBOL_PREPROCESSING="symbol=value" @@ -2648,6 +2778,10 @@ package VMS_Data is "-gnatVc " & "NOCOPIES " & "-gnatVC " & + "COMPONENTS " & + "-gnatVe " & + "NOCOMPONENTS " & + "-gnatVE " & "FLOATS " & "-gnatVf " & "NOFLOATS " & @@ -2738,6 +2872,8 @@ package VMS_Data is "!-gnatws,!-gnatwe " & "ALL " & "-gnatwa " & + "EVERY " & + "-gnatw.e " & "OPTIONAL " & "-gnatwa " & "NOOPTIONAL " & @@ -2816,6 +2952,10 @@ package VMS_Data is "-gnatwP " & "MISSING_PARENS " & "-gnatwq " & + "PARAMETER_ORDER " & + "-gnatw.p " & + "NOPARAMETER_ORDER " & + "-gnatw.P " & "NOMISSING_PARENS " & "-gnatwQ " & "REDUNDANT " & @@ -2895,6 +3035,10 @@ package VMS_Data is -- ELABORATION. All other optional Ada -- warnings are turned on. -- + -- EVERY Activate every optional warning. + -- Activates all optional warnings, including + -- those listed above as exceptions for ALL. + -- -- NOALL Suppress all optional errors. -- Suppresses all optional warning messages -- that can be activated by option ALL. @@ -3067,7 +3211,7 @@ package VMS_Data is -- -- NOREDUNDANT Suppress warnings for redundant constructs. -- - -- SUPPRESS Completely suppresse the output of all warning + -- SUPPRESS Completely suppress the output of all warning -- messages. Same as /NOWARNINGS. -- -- UNCHECKED_CONVERSIONS Activates warnings on unchecked conversions. @@ -3140,6 +3284,12 @@ package VMS_Data is -- -- Inhibit all warning messages of the GCC back-end. + S_GCC_All_Back : aliased constant S := "/ALL_BACK_END_WARNINGS " & + "-Wall"; + -- /ALL_BACK_END_WARNINGS + -- + -- Activate all warning messages of the GCC back-end. + S_GCC_Wide : aliased constant S := "/WIDE_CHARACTER_ENCODING=" & "BRACKETS " & "-gnatWb " & @@ -3173,7 +3323,7 @@ package VMS_Data is -- of lower case. -- -- NONE No wide characters are allowed. Same - -- as /NOWIDE_CHARCTER_ENCODING. + -- as /NOWIDE_CHARACTER_ENCODING. -- -- HEX In this encoding, a wide character is represented by -- the following five character sequence: ESC a b c d @@ -3213,7 +3363,7 @@ package VMS_Data is -- 16#0800#-16#ffff#: 2#1110xxxx# 2#10xxxxxx# 2#10xxxxxx# -- -- where the xxx bits correspond to the left-padded bits - -- of the the 16-bit character value. Note that all lower + -- of the 16-bit character value. Note that all lower -- half ASCII characters are represented as ASCII bytes -- and all upper half characters and other wide characters -- are represented as sequences of upper-half (The full @@ -3287,6 +3437,7 @@ package VMS_Data is S_GCC_Extend 'Access, S_GCC_Ext 'Access, S_GCC_File 'Access, + S_GCC_Follow 'Access, S_GCC_Force 'Access, S_GCC_Full 'Access, S_GCC_GNAT 'Access, @@ -3323,6 +3474,7 @@ package VMS_Data is S_GCC_Search 'Access, S_GCC_Style 'Access, S_GCC_StyleX 'Access, + S_GCC_Subdirs 'Access, S_GCC_Symbol 'Access, S_GCC_Syntax 'Access, S_GCC_Table 'Access, @@ -3340,6 +3492,7 @@ package VMS_Data is S_GCC_Wide 'Access, S_GCC_WideX 'Access, S_GCC_No_Back 'Access, + S_GCC_All_Back'Access, S_GCC_Xdebug 'Access, S_GCC_Xref 'Access); @@ -3349,7 +3502,7 @@ package VMS_Data is S_Elim_Add : aliased constant S := "/ADD_PROJECT_SEARCH_DIR=*" & "-aP*"; - -- /ADD_PROJECT_SEARCH_PATH==(directory[,...]) + -- /ADD_PROJECT_SEARCH_PATH=(directory[,...]) -- -- Add directories to the project search path. @@ -3402,6 +3555,13 @@ package VMS_Data is -- Example: -- /EXTERNAL_REFERENCE="DEBUG=TRUE" + S_Elim_Follow : aliased constant S := "/FOLLOW_LINKS_FOR_FILES " & + "-eL"; + -- /NOFOLLOW_LINKS_FOR_FILES (D) + -- /FOLLOW_LINKS_FOR_FILES + -- + -- Follow links when parsing project files + S_Elim_GNATMAKE : aliased constant S := "/GNATMAKE=@" & "--GNATMAKE=@"; -- /GNATMAKE=path_name @@ -3452,6 +3612,14 @@ package VMS_Data is -- -- When looking for source files also look in the specified directories. + S_Elim_Subdirs : aliased constant S := "/SUBDIRS=<" & + "--subdirs=>"; + -- /SUBDIRS=dir + -- + -- The actual directories (object, exec, library, ...) are subdirectories + -- of the directory specified in the project file. If the subdirectory + -- does not exist, it is created automatically. + S_Elim_Verb : aliased constant S := "/VERBOSE " & "-v"; -- /NOVERBOSE (D) @@ -3470,11 +3638,13 @@ package VMS_Data is S_Elim_Config 'Access, S_Elim_Current 'Access, S_Elim_Ext 'Access, + S_Elim_Follow 'Access, S_Elim_GNATMAKE'Access, S_Elim_Mess 'Access, S_Elim_Project 'Access, S_Elim_Quiet 'Access, S_Elim_Search 'Access, + S_Elim_Subdirs 'Access, S_Elim_Verb 'Access); ---------------------------- @@ -3483,7 +3653,7 @@ package VMS_Data is S_Find_Add : aliased constant S := "/ADD_PROJECT_SEARCH_DIR=*" & "-aP*"; - -- /ADD_PROJECT_SEARCH_PATH==(directory[,...]) + -- /ADD_PROJECT_SEARCH_PATH=(directory[,...]) -- -- Add directories to the project search path. @@ -3524,6 +3694,13 @@ package VMS_Data is -- Example: -- /EXTERNAL_REFERENCE="DEBUG=TRUE" + S_Find_Follow : aliased constant S := "/FOLLOW_LINKS_FOR_FILES " & + "-eL"; + -- /NOFOLLOW_LINKS_FOR_FILES (D) + -- /FOLLOW_LINKS_FOR_FILES + -- + -- Follow links when parsing project files + S_Find_Full : aliased constant S := "/FULL_PATHNAME " & "-f"; -- /NOFULL_PATHNAME (D) @@ -3639,6 +3816,14 @@ package VMS_Data is -- The order in which source file search is undertaken is the same as for -- MAKE. + S_Find_Subdirs : aliased constant S := "/SUBDIRS=<" & + "--subdirs=>"; + -- /SUBDIRS=dir + -- + -- The actual directories (object, exec, library, ...) are subdirectories + -- of the directory specified in the project file. If the subdirectory + -- does not exist, it is created automatically. + S_Find_Types : aliased constant S := "/TYPE_HIERARCHY " & "-t"; -- /NOTYPE_HIERARCHY (D) @@ -3655,6 +3840,7 @@ package VMS_Data is S_Find_Deriv 'Access, S_Find_Expr 'Access, S_Find_Ext 'Access, + S_Find_Follow 'Access, S_Find_Full 'Access, S_Find_Ignore 'Access, S_Find_Mess 'Access, @@ -3667,6 +3853,7 @@ package VMS_Data is S_Find_Ref 'Access, S_Find_Search 'Access, S_Find_Source 'Access, + S_Find_Subdirs 'Access, S_Find_Types 'Access); ------------------------------ @@ -3693,7 +3880,7 @@ package VMS_Data is S_Link_Add : aliased constant S := "/ADD_PROJECT_SEARCH_DIR=*" & "-aP*"; - -- /ADD_PROJECT_SEARCH_PATH==(directory[,...]) + -- /ADD_PROJECT_SEARCH_PATH=(directory[,...]) -- -- Add directories to the project search path. @@ -3756,6 +3943,13 @@ package VMS_Data is -- Example: -- /EXTERNAL_REFERENCE="DEBUG=TRUE" + S_Link_Follow : aliased constant S := "/FOLLOW_LINKS_FOR_FILES " & + "-eL"; + -- /NOFOLLOW_LINKS_FOR_FILES (D) + -- /FOLLOW_LINKS_FOR_FILES + -- + -- Follow links when parsing project files + S_Link_Forlink : aliased constant S := "/FOR_LINKER=" & '"' & "--for-linker=" & '"'; -- /FOR_LINKER=<string> @@ -3788,7 +3982,7 @@ package VMS_Data is S_Link_Library : aliased constant S := "/LIBRARY=|" & "-l|"; - -- /LYBRARY=xyz + -- /LIBRARY=xyz -- -- Link with library named "xyz". @@ -3852,7 +4046,7 @@ package VMS_Data is -- -- Specifies the style of codes returned by -- Ada.Command_Line.Set_Exit_Status. Must be used in conjunction with - -- and match the Bind qualifer with the same name. + -- and match the Bind qualifier with the same name. -- -- POSIX (D) Return Posix compatible exit codes. -- @@ -3866,6 +4060,14 @@ package VMS_Data is -- -- Indicate to the linker that the link is static. + S_Link_Subdirs : aliased constant S := "/SUBDIRS=<" & + "--subdirs=>"; + -- /SUBDIRS=dir + -- + -- The actual directories (object, exec, library, ...) are subdirectories + -- of the directory specified in the project file. If the subdirectory + -- does not exist, it is created automatically. + S_Link_Verb : aliased constant S := "/VERBOSE " & "-v"; -- /NOVERBOSE (D) @@ -3879,7 +4081,7 @@ package VMS_Data is "--for-linker="; -- /<other> -- - -- Any other switch that will be transmited to the underlying linker. + -- Any other switch that will be transmitted to the underlying linker. Link_Switches : aliased constant Switches := (S_Link_Add 'Access, @@ -3888,6 +4090,7 @@ package VMS_Data is S_Link_Nodebug 'Access, S_Link_Execut 'Access, S_Link_Ext 'Access, + S_Link_Follow 'Access, S_Link_Forlink 'Access, S_Link_Force 'Access, S_Link_Ident 'Access, @@ -3900,6 +4103,7 @@ package VMS_Data is S_Link_Project 'Access, S_Link_Return 'Access, S_Link_Static 'Access, + S_Link_Subdirs 'Access, S_Link_Verb 'Access, S_Link_ZZZZZ 'Access); @@ -3909,7 +4113,7 @@ package VMS_Data is S_List_Add : aliased constant S := "/ADD_PROJECT_SEARCH_DIR=*" & "-aP*"; - -- /ADD_PROJECT_SEARCH_PATH==(directory[,...]) + -- /ADD_PROJECT_SEARCH_PATH=(directory[,...]) -- -- Add directories to the project search path. @@ -3959,6 +4163,13 @@ package VMS_Data is -- Take as arguments the files that are listed in the specified -- text file. + S_List_Follow : aliased constant S := "/FOLLOW_LINKS_FOR_FILES " & + "-eL"; + -- /NOFOLLOW_LINKS_FOR_FILES (D) + -- /FOLLOW_LINKS_FOR_FILES + -- + -- Follow links when parsing project files + S_List_Mess : aliased constant S := "/MESSAGES_PROJECT_FILE=" & "DEFAULT " & "-vP0 " & @@ -4044,6 +4255,14 @@ package VMS_Data is -- -- When looking for source files also look in the specified directories. + S_List_Subdirs : aliased constant S := "/SUBDIRS=<" & + "--subdirs=>"; + -- /SUBDIRS=dir + -- + -- The actual directories (object, exec, library, ...) are subdirectories + -- of the directory specified in the project file. If the subdirectory + -- does not exist, it is created automatically. + List_Switches : aliased constant Switches := (S_List_Add 'Access, S_List_All 'Access, @@ -4052,13 +4271,15 @@ package VMS_Data is S_List_Depend 'Access, S_List_Ext 'Access, S_List_Files 'Access, + S_List_Follow 'Access, S_List_Mess 'Access, S_List_Nostinc 'Access, S_List_Object 'Access, S_List_Output 'Access, S_List_Project 'Access, S_List_Search 'Access, - S_List_Source 'Access); + S_List_Source 'Access, + S_List_Subdirs 'Access); ---------------------------- -- Switches for GNAT MAKE -- @@ -4110,7 +4331,7 @@ package VMS_Data is S_Make_Add : aliased constant S := "/ADD_PROJECT_SEARCH_DIR=*" & "-aP*"; - -- /ADD_PROJECT_SEARCH_PATH==(directory[,...]) + -- /ADD_PROJECT_SEARCH_PATH=(directory[,...]) -- -- Add directories to the project search path. @@ -4203,7 +4424,7 @@ package VMS_Data is -- a Unix-style Makefile. By default, each source file is prefixed with -- its (relative or absolute) directory name. This name is whatever you -- specified in the various /SOURCE_SEARCH and /SEARCH qualifiers. If - -- you also speficy the /QUIET qualifier, only the source file names, + -- you also specify the /QUIET qualifier, only the source file names, -- without relative paths, are output. If you just specify the -- /DEPENDENCY_LIST qualifier, dependencies of the GNAT internal system -- files are omitted. This is typically what you want. If you also @@ -4251,6 +4472,13 @@ package VMS_Data is -- Example: -- /EXTERNAL_REFERENCE="DEBUG=TRUE" + S_Make_Follow : aliased constant S := "/FOLLOW_LINKS_FOR_FILES " & + "-eL"; + -- /NOFOLLOW_LINKS_FOR_FILES (D) + -- /FOLLOW_LINKS_FOR_FILES + -- + -- Follow links when parsing project files + S_Make_Force : aliased constant S := "/FORCE_COMPILE " & "-f"; -- /NOFORCE_COMPILE (D) @@ -4258,7 +4486,7 @@ package VMS_Data is -- -- Force recompilations. Recompile all sources, even though some object -- files may be up to date, but don't recompile predefined or GNAT - -- internal files unless the /ALL_FILES qualfier is also specified. + -- internal files unless the /ALL_FILES qualifier is also specified. S_Make_Full : aliased constant S := "/FULL_PATH_IN_BRIEF_MESSAGES " & "-F"; @@ -4446,7 +4674,7 @@ package VMS_Data is -- /NOPROCESSES (D) -- /PROCESSES=NNN -- - -- Use NNN processes to carry out the (re)complations. If you have a + -- Use NNN processes to carry out the (re)compilations. If you have a -- multiprocessor machine, compilations will occur in parallel. In the -- event of compilation errors, messages from various compilations might -- get interspersed (but GNAT MAKE will give you the full ordered list of @@ -4513,6 +4741,14 @@ package VMS_Data is -- Output the commands for the compiler, the binder and the linker -- on SYS$OUTPUT, instead of SYS$ERROR. + S_Make_Subdirs : aliased constant S := "/SUBDIRS=<" & + "--subdirs=>"; + -- /SUBDIRS=dir + -- + -- The actual directories (object, exec, library, ...) are subdirectories + -- of the directory specified in the project file. If the subdirectory + -- does not exist, it is created automatically. + S_Make_Switch : aliased constant S := "/SWITCH_CHECK " & "-s"; -- /NOSWITCH_CHECK (D) @@ -4568,6 +4804,7 @@ package VMS_Data is S_Make_Doobj 'Access, S_Make_Execut 'Access, S_Make_Ext 'Access, + S_Make_Follow 'Access, S_Make_Force 'Access, S_Make_Full 'Access, S_Make_Hi_Verb 'Access, @@ -4598,6 +4835,7 @@ package VMS_Data is S_Make_Skip 'Access, S_Make_Source 'Access, S_Make_Stand 'Access, + S_Make_Subdirs 'Access, S_Make_Switch 'Access, S_Make_Unique 'Access, S_Make_Use_Map 'Access, @@ -4609,7 +4847,7 @@ package VMS_Data is S_Metric_Add : aliased constant S := "/ADD_PROJECT_SEARCH_DIR=*" & "-aP*"; - -- /ADD_PROJECT_SEARCH_PATH==(directory[,...]) + -- /ADD_PROJECT_SEARCH_PATH=(directory[,...]) -- -- Add directories to the project search path. @@ -4699,9 +4937,9 @@ package VMS_Data is -- /SYNTAX_METRICS(option, option ...) -- -- Specifies the syntax element metrics to be computed (if at least one - -- positive syntax element metric, line metric or complexity metric is - -- specified then only explicitly specified specified syntax element - -- metrics are computed and reported) + -- positive syntax element metric, line metric, complexity or coupling + -- metric is specified then only explicitly specified specified syntax + -- element metrics are computed and reported) -- -- option may be one of the following: -- @@ -4833,9 +5071,9 @@ package VMS_Data is -- /LINE_COUNT_METRICS=(option, option ...) -- Specifies the line metrics to be computed (if at least one positive - -- syntax element metric, line metric or complexity metric is specified - -- then only explicitly specified specified line metrics are computed and - -- reported) + -- syntax element metric, line metric, complexity or coupling metric is + -- specified then only explicitly specified specified line metrics are + -- computed and reported) -- -- option may be one of the following: -- @@ -4888,9 +5126,9 @@ package VMS_Data is -- /COMPLEXITY_METRICS=(option, option ...) -- Specifies the complexity metrics to be computed (if at least one - -- positive syntax element metric, line metric or complexity metric is - -- specified then only explicitly specified specified line metrics are - -- computed and reported) + -- positive syntax element metric, line metric, complexity or coupling + -- metric is specified then only explicitly specified specified complexity + -- metrics are computed and reported) -- -- option may be one of the following: -- @@ -4900,7 +5138,7 @@ package VMS_Data is -- CYCLOMATIC_OFF Do not compute the McCabe Cyclomatic -- Complexity -- ESSENTIAL_ON Compute the Essential Complexity - -- ESSENTIAL_OFF Do not ompute the Essential Complexity + -- ESSENTIAL_OFF Do not compute the Essential Complexity -- LOOP_NESTIMG_ON Compute the maximal loop nesting -- LOOP_NESTIMG_OFF Do not compute the maximal loop nesting -- AVERAGE_COMPLEXITY_ON Compute the average complexity for @@ -4910,6 +5148,54 @@ package VMS_Data is -- -- All combinations of line metrics options are allowed. + S_Metric_Coupling : aliased constant S := "/COUPLING_METRICS=" & + "ALL_ON " & + "--coupling-all " & + "ALL_OFF " & + "--no-counling-all " & + "PACKAGE_EFFERENT_ON " & + "--package-efferent-coupling " & + "PACKAGE_EFFERENT_OFF " & + "--no-package-efferent-coupling " & + "PACKAGE_AFFERENT_ON " & + "--package-afferent-coupling " & + "PACKAGE_AFFERENT_OFF " & + "--no-package-afferent-coupling " & + "CATEGORY_EFFERENT_ON " & + "--category-efferent-coupling " & + "CATEGORY_EFFERENT_OFF " & + "--no-category-efferent-coupling " & + "CATEGORY_AFFERENT_ON " & + "--category-afferent-coupling " & + "CATEGORY_AFFERENT_OFF " & + "--no-category-afferent-coupling"; + + -- /COUPLING_METRICS=(option, option ...) + + -- Specifies the coupling metrics to be computed. + -- + -- option may be one of the following: + -- + -- ALL_ON All the coupling metrics are computed + -- ALL_OFF (D) None of coupling metrics is computed + -- PACKAGE_EFFERENT_ON Compute package efferent coupling + -- PACKAGE_EFFERENT_OFF Do not compute package efferent coupling + -- PACKAGE_AFFERENT_ON Compute package afferent coupling + -- PACKAGE_AFFERENT_OFF Do not compute package afferent coupling + -- CATEGORY_EFFERENT_ON Compute category efferent coupling + -- CATEGORY_EFFERENT_OFF Do not compute category efferent coupling + -- CATEGORY_AFFERENT_ON Compute category afferent coupling + -- CATEGORY_AFFERENT_OFF Do not compute category afferent coupling + -- + -- All combinations of coupling metrics options are allowed. + + S_Metric_Follow : aliased constant S := "/FOLLOW_LINKS_FOR_FILES " & + "-eL"; + -- /NOFOLLOW_LINKS_FOR_FILES (D) + -- /FOLLOW_LINKS_FOR_FILES + -- + -- Follow links when parsing project files + S_Metric_No_Local : aliased constant S := "/NO_LOCAL_DETAILS " & "-nolocal"; -- /LOCAL_DETAILS (D) @@ -4961,6 +5247,14 @@ package VMS_Data is -- the number of program units left to be processed. This option turns -- this trace off. + S_Metric_Subdirs : aliased constant S := "/SUBDIRS=<" & + "--subdirs=>"; + -- /SUBDIRS=dir + -- + -- The actual directories (object, exec, library, ...) are subdirectories + -- of the directory specified in the project file. If the subdirectory + -- does not exist, it is created automatically. + S_Metric_Suffix : aliased constant S := "/SUFFIX_DETAILS=" & '"' & "-o" & '"'; -- /SUFFIX_DETAILS=suffix @@ -5001,11 +5295,13 @@ package VMS_Data is (S_Metric_Add 'Access, S_Metric_All_Prjs 'Access, S_Metric_Complexity 'Access, + S_Metric_Coupling 'Access, S_Metric_Debug 'Access, S_Metric_Direct 'Access, S_Metric_Element 'Access, S_Metric_Ext 'Access, S_Metric_Files 'Access, + S_Metric_Follow 'Access, S_Metric_Format 'Access, S_Metric_Globout 'Access, S_Metric_Line 'Access, @@ -5016,6 +5312,7 @@ package VMS_Data is S_Metric_Project 'Access, S_Metric_Quiet 'Access, S_Metric_Suffix 'Access, + S_Metric_Subdirs 'Access, S_Metric_Syntax 'Access, S_Metric_Suppress 'Access, S_Metric_Verbose 'Access, @@ -5061,6 +5358,13 @@ package VMS_Data is -- qualifiers /SOURCE_DIRS as there are non empty lines in the specified -- text file. + S_Name_Follow : aliased constant S := "/FOLLOW_LINKS_FOR_FILES " & + "-eL"; + -- /NOFOLLOW_LINKS_FOR_FILES (D) + -- /FOLLOW_LINKS_FOR_FILES + -- + -- Follow links when parsing project files + S_Name_Frng : aliased constant S := "/FOREIGN_PATTERN=" & '"' & "-f" & '"'; -- /FOREIGN_PATTERN=<string> @@ -5089,9 +5393,17 @@ package VMS_Data is -- -- Create or update a project file. 'file_name' may include directory -- information. The specified file must be writable. There may be only - -- one qualifier /PROJECT_FILE. When a qualifier /PROJECT_DILE is + -- one qualifier /PROJECT_FILE. When a qualifier /PROJECT_FILE is -- specified, no qualifier /CONFIG_FILE may be specified. + S_Name_Subdirs : aliased constant S := "/SUBDIRS=<" & + "--subdirs=>"; + -- /SUBDIRS=dir + -- + -- The actual directories (object, exec, library, ...) are subdirectories + -- of the directory specified in the project file. If the subdirectory + -- does not exist, it is created automatically. + S_Name_Verbose : aliased constant S := "/VERBOSE " & "-v"; -- /NOVERBOSE (D) @@ -5117,14 +5429,16 @@ package VMS_Data is -- those whose names end with '_NT.ADA'. Name_Switches : aliased constant Switches := - (S_Name_Conf 'Access, - S_Name_Dirs 'Access, - S_Name_Dfile 'Access, - S_Name_Frng 'Access, - S_Name_Help 'Access, - S_Name_Proj 'Access, - S_Name_Verbose 'Access, - S_Name_Excl 'Access); + (S_Name_Conf 'Access, + S_Name_Dirs 'Access, + S_Name_Dfile 'Access, + S_Name_Follow 'Access, + S_Name_Frng 'Access, + S_Name_Help 'Access, + S_Name_Proj 'Access, + S_Name_Subdirs 'Access, + S_Name_Verbose 'Access, + S_Name_Excl 'Access); ---------------------------------- -- Switches for GNAT PREPROCESS -- @@ -5216,7 +5530,7 @@ package VMS_Data is S_Pretty_Add : aliased constant S := "/ADD_PROJECT_SEARCH_DIR=*" & "-aP*"; - -- /ADD_PROJECT_SEARCH_PATH==(directory[,...]) + -- /ADD_PROJECT_SEARCH_PATH=(directory[,...]) -- -- Add directories to the project search path. @@ -5300,7 +5614,7 @@ package VMS_Data is -- -- layout-option may be one of the following: -- - -- UNTOUCHED���������� All the comments remain unchanged + -- UNTOUCHED All the comments remain unchanged -- DEFAULT (D) GNAT style comment line indentation -- STANDARD_INDENT Standard comment line indentation -- GNAT_BEGINNING GNAT style comment beginning @@ -5456,7 +5770,7 @@ package VMS_Data is -- -- Specifies the form of the line terminators in the produced source. -- By default, the form of the line terminator depends on the platforms. - -- On Unix and VMS, it is a Line Feed (LF) chararcter. On Windows (DOS), + -- On Unix and VMS, it is a Line Feed (LF) character. On Windows (DOS), -- It is a Carriage Return (CR) followed by a Line Feed. -- The Options DOS and CRLF are equivalent. The options UNIX and LF are -- also equivalent. @@ -5511,7 +5825,7 @@ package VMS_Data is "-W8"; -- /RESULT_ENCODING[=encoding-type] -- - -- Specify the wide character encoding method used when writtimg the + -- Specify the wide character encoding method used when writing the -- reformatted code in the result file. 'encoding-type' is one of the -- following: -- @@ -5537,6 +5851,13 @@ package VMS_Data is -- Take as arguments the files that are listed in the specified -- text file. + S_Pretty_Follow : aliased constant S := "/FOLLOW_LINKS_FOR_FILES " & + "-eL"; + -- /NOFOLLOW_LINKS_FOR_FILES (D) + -- /FOLLOW_LINKS_FOR_FILES + -- + -- Follow links when parsing project files + S_Pretty_Forced : aliased constant S := "/FORCED_OUTPUT=@" & "-of@"; -- /FORCED_OUTPUT=file @@ -5630,7 +5951,7 @@ package VMS_Data is -- -- MIXED_CASE Names are in mixed case. - S_Pretty_No_Backup : aliased constant S := "/NO_BACKUP " & + S_Pretty_Replace_No_Backup : aliased constant S := "/REPLACE_NO_BACKUP " & "-rnb"; -- /REPLACE_NO_BACKUP -- @@ -5732,6 +6053,14 @@ package VMS_Data is -- -- Redirect the output to the standard output. + S_Pretty_Subdirs : aliased constant S := "/SUBDIRS=<" & + "--subdirs=>"; + -- /SUBDIRS=dir + -- + -- The actual directories (object, exec, library, ...) are subdirectories + -- of the directory specified in the project file. If the subdirectory + -- does not exist, it is created automatically. + S_Pretty_Verbose : aliased constant S := "/VERBOSE " & "-v"; -- /NOVERBOSE (D) @@ -5750,47 +6079,49 @@ package VMS_Data is -- By default such warnings are not activated. Pretty_Switches : aliased constant Switches := - (S_Pretty_Add 'Access, - S_Pretty_Align 'Access, - S_Pretty_All_Prjs 'Access, - S_Pretty_Attrib 'Access, - S_Pretty_Comments 'Access, - S_Pretty_Compact_Is 'Access, - S_Pretty_Config 'Access, - S_Pretty_Constr 'Access, - S_Pretty_Comind 'Access, - S_Pretty_Current 'Access, - S_Pretty_Dico 'Access, - S_Pretty_Eol 'Access, - S_Pretty_Ext 'Access, - S_Pretty_Encoding 'Access, - S_Pretty_Files 'Access, - S_Pretty_Forced 'Access, - S_Pretty_Formfeed 'Access, - S_Pretty_Indent 'Access, - S_Pretty_Keyword 'Access, - S_Pretty_Maxlen 'Access, - S_Pretty_Maxind 'Access, - S_Pretty_Mess 'Access, - S_Pretty_Names 'Access, - S_Pretty_No_Backup 'Access, - S_Pretty_No_Labels 'Access, - S_Pretty_Notabs 'Access, - S_Pretty_Output 'Access, - S_Pretty_Override 'Access, - S_Pretty_Pragma 'Access, - S_Pretty_Replace 'Access, - S_Pretty_Project 'Access, - S_Pretty_RTS 'Access, - S_Pretty_Search 'Access, - S_Pretty_Sep_Loop_Then 'Access, - S_Pretty_N_Sep_Loop_Then'Access, - S_Pretty_Use_On_New_Line'Access, - S_Pretty_Stnm_On_Nw_Line'Access, - S_Pretty_Specific 'Access, - S_Pretty_Standard 'Access, - S_Pretty_Verbose 'Access, - S_Pretty_Warnings 'Access); + (S_Pretty_Add 'Access, + S_Pretty_Align 'Access, + S_Pretty_All_Prjs 'Access, + S_Pretty_Attrib 'Access, + S_Pretty_Comments 'Access, + S_Pretty_Compact_Is 'Access, + S_Pretty_Config 'Access, + S_Pretty_Constr 'Access, + S_Pretty_Comind 'Access, + S_Pretty_Current 'Access, + S_Pretty_Dico 'Access, + S_Pretty_Eol 'Access, + S_Pretty_Ext 'Access, + S_Pretty_Encoding 'Access, + S_Pretty_Files 'Access, + S_Pretty_Follow 'Access, + S_Pretty_Forced 'Access, + S_Pretty_Formfeed 'Access, + S_Pretty_Indent 'Access, + S_Pretty_Keyword 'Access, + S_Pretty_Maxlen 'Access, + S_Pretty_Maxind 'Access, + S_Pretty_Mess 'Access, + S_Pretty_Names 'Access, + S_Pretty_No_Labels 'Access, + S_Pretty_Notabs 'Access, + S_Pretty_Output 'Access, + S_Pretty_Override 'Access, + S_Pretty_Pragma 'Access, + S_Pretty_Replace 'Access, + S_Pretty_Replace_No_Backup'Access, + S_Pretty_Project 'Access, + S_Pretty_RTS 'Access, + S_Pretty_Search 'Access, + S_Pretty_Sep_Loop_Then 'Access, + S_Pretty_N_Sep_Loop_Then 'Access, + S_Pretty_Subdirs 'Access, + S_Pretty_Use_On_New_Line 'Access, + S_Pretty_Stnm_On_Nw_Line 'Access, + S_Pretty_Specific 'Access, + S_Pretty_Standard 'Access, + S_Pretty_Verbose 'Access, + S_Pretty_Warnings 'Access); ------------------------------ -- Switches for GNAT SHARED -- @@ -5876,7 +6207,7 @@ package VMS_Data is S_Stack_Add : aliased constant S := "/ADD_PROJECT_SEARCH_DIR=*" & "-aP*"; - -- /ADD_PROJECT_SEARCH_PATH==(directory[,...]) + -- /ADD_PROJECT_SEARCH_PATH=(directory[,...]) -- -- Add directories to the project search path. @@ -5930,6 +6261,13 @@ package VMS_Data is -- Take as arguments the files that are listed in the specified -- text file. + S_Stack_Follow : aliased constant S := "/FOLLOW_LINKS_FOR_FILES " & + "-eL"; + -- /NOFOLLOW_LINKS_FOR_FILES (D) + -- /FOLLOW_LINKS_FOR_FILES + -- + -- Follow links when parsing project files + S_Stack_Help : aliased constant S := "/HELP " & "-h"; -- /NOHELP (D) @@ -5988,6 +6326,14 @@ package VMS_Data is -- Any symbol matching the regular expression will be considered as a -- potential entry point for the analysis. + S_Stack_Subdirs : aliased constant S := "/SUBDIRS=<" & + "--subdirs=>"; + -- /SUBDIRS=dir + -- + -- The actual directories (object, exec, library, ...) are subdirectories + -- of the directory specified in the project file. If the subdirectory + -- does not exist, it is created automatically. + S_Stack_Unbounded : aliased constant S := "/UNBOUNDED=#" & "-d#"; -- /UNBOUNDED=nnn @@ -6044,6 +6390,7 @@ package VMS_Data is S_Stack_Directory 'Access, S_Stack_Entries 'Access, S_Stack_Files 'Access, + S_Stack_Follow 'Access, S_Stack_Help 'Access, S_Stack_List 'Access, S_Stack_Order 'Access, @@ -6051,6 +6398,7 @@ package VMS_Data is S_Stack_Project 'Access, S_Stack_Output 'Access, S_Stack_Regexp 'Access, + S_Stack_Subdirs 'Access, S_Stack_Unbounded 'Access, S_Stack_Unknown 'Access, S_Stack_Verbose 'Access, @@ -6062,7 +6410,7 @@ package VMS_Data is S_Stub_Add : aliased constant S := "/ADD_PROJECT_SEARCH_DIR=*" & "-aP*"; - -- /ADD_PROJECT_SEARCH_PATH==(directory[,...]) + -- /ADD_PROJECT_SEARCH_PATH=(directory[,...]) -- -- Add directories to the project search path. @@ -6090,6 +6438,13 @@ package VMS_Data is -- Example: -- /EXTERNAL_REFERENCE="DEBUG=TRUE" + S_Stub_Follow : aliased constant S := "/FOLLOW_LINKS_FOR_FILES " & + "-eL"; + -- /NOFOLLOW_LINKS_FOR_FILES (D) + -- /FOLLOW_LINKS_FOR_FILES + -- + -- Follow links when parsing project files + S_Stub_Full : aliased constant S := "/FULL " & "-f"; -- /NOFULL (D) @@ -6132,7 +6487,7 @@ package VMS_Data is -- -- (nnn is a non-negative integer). Set the indentation level in the -- generated body stub to nnn. nnn=0 means "no indentation". - -- Default insdentation is 3. + -- Default indentation is 3. S_Stub_Keep : aliased constant S := "/KEEP " & "-k"; @@ -6202,6 +6557,14 @@ package VMS_Data is -- -- When looking for source files also look in directories specified. + S_Stub_Subdirs : aliased constant S := "/SUBDIRS=<" & + "--subdirs=>"; + -- /SUBDIRS=dir + -- + -- The actual directories (object, exec, library, ...) are subdirectories + -- of the directory specified in the project file. If the subdirectory + -- does not exist, it is created automatically. + S_Stub_Tree : aliased constant S := "/TREE_FILE=" & "OVERWRITE " & "-t " & @@ -6246,6 +6609,7 @@ package VMS_Data is S_Stub_Config 'Access, S_Stub_Current 'Access, S_Stub_Ext 'Access, + S_Stub_Follow 'Access, S_Stub_Full 'Access, S_Stub_Header 'Access, S_Stub_Header_File'Access, @@ -6257,6 +6621,7 @@ package VMS_Data is S_Stub_Project 'Access, S_Stub_Quiet 'Access, S_Stub_Search 'Access, + S_Stub_Subdirs 'Access, S_Stub_Tree 'Access, S_Stub_Verbose 'Access); @@ -6266,7 +6631,7 @@ package VMS_Data is S_Xref_Add : aliased constant S := "/ADD_PROJECT_SEARCH_DIR=*" & "-aP*"; - -- /ADD_PROJECT_SEARCH_PATH==(directory[,...]) + -- /ADD_PROJECT_SEARCH_PATH=(directory[,...]) -- -- Add directories to the project search path. @@ -6298,6 +6663,13 @@ package VMS_Data is -- Example: -- /EXTERNAL_REFERENCE="DEBUG=TRUE" + S_Xref_Follow : aliased constant S := "/FOLLOW_LINKS_FOR_FILES " & + "-eL"; + -- /NOFOLLOW_LINKS_FOR_FILES (D) + -- /FOLLOW_LINKS_FOR_FILES + -- + -- Follow links when parsing project files + S_Xref_Full : aliased constant S := "/FULL_PATHNAME " & "-f"; -- /NOFULL_PATHNAME (D) @@ -6392,6 +6764,14 @@ package VMS_Data is -- The order in which source file search is undertaken is the same as for -- MAKE. + S_Xref_Subdirs : aliased constant S := "/SUBDIRS=<" & + "--subdirs=>"; + -- /SUBDIRS=dir + -- + -- The actual directories (object, exec, library, ...) are subdirectories + -- of the directory specified in the project file. If the subdirectory + -- does not exist, it is created automatically. + S_Xref_Output : aliased constant S := "/UNUSED " & "-u"; -- /SOURCE_SEARCH=(directory,...) @@ -6412,6 +6792,7 @@ package VMS_Data is S_Xref_All 'Access, S_Xref_Deriv 'Access, S_Xref_Ext 'Access, + S_Xref_Follow 'Access, S_Xref_Full 'Access, S_Xref_Global 'Access, S_Xref_Mess 'Access, @@ -6422,6 +6803,7 @@ package VMS_Data is S_Xref_Prj 'Access, S_Xref_Search 'Access, S_Xref_Source 'Access, + S_Xref_Subdirs 'Access, S_Xref_Output 'Access, S_Xref_Tags 'Access); diff --git a/gcc/ada/vxaddr2line.adb b/gcc/ada/vxaddr2line.adb index b64e364ff01..1fd85ec506f 100644 --- a/gcc/ada/vxaddr2line.adb +++ b/gcc/ada/vxaddr2line.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 2002-2007, AdaCore -- +-- Copyright (C) 2002-2008, AdaCore -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -62,18 +62,21 @@ -- (in a format <host>_<target>), and then an appropriate value to Config_List -- array -with Text_IO; use Text_IO; -with Ada.Integer_Text_IO; use Ada.Integer_Text_IO; -with Ada.Command_Line; use Ada.Command_Line; -with Ada.Strings.Fixed; use Ada.Strings.Fixed; +with Ada.Text_IO; use Ada.Text_IO; +with Ada.Command_Line; use Ada.Command_Line; +with Ada.Strings.Fixed; use Ada.Strings.Fixed; +with Interfaces; use Interfaces; -with GNAT.OS_Lib; use GNAT.OS_Lib; +with GNAT.OS_Lib; use GNAT.OS_Lib; with GNAT.Directory_Operations; use GNAT.Directory_Operations; -with GNAT.Expect; use GNAT.Expect; -with GNAT.Regpat; use GNAT.Regpat; +with GNAT.Expect; use GNAT.Expect; +with GNAT.Regpat; use GNAT.Regpat; procedure VxAddr2Line is + package Unsigned_32_IO is new Modular_IO (Unsigned_32); + -- Instantiate Modular_IO to have Put. + Ref_Symbol : constant String := "adainit"; -- This is the name of the reference symbol which runtime address shall -- be provided as the <ref_address> argument. @@ -102,7 +105,7 @@ procedure VxAddr2Line is -- which will avoid computational overflows. Typically only useful when -- 64bit addresses are provided. - Bt_Offset_From_Call : Integer; + Bt_Offset_From_Call : Unsigned_32; -- Offset from a backtrace address to the address of the corresponding -- call instruction. This should always be 0, except on platforms where -- the backtrace addresses actually correspond to return and not call @@ -160,14 +163,14 @@ procedure VxAddr2Line is procedure Usage; -- Displays the short help message and then terminates the program - function Get_Reference_Offset return Integer; + function Get_Reference_Offset return Unsigned_32; -- Computes the static offset of the reference symbol by calling nm - function Get_Value_From_Hex_Arg (Arg : Natural) return Integer; + function Get_Value_From_Hex_Arg (Arg : Natural) return Unsigned_32; -- Threats the argument number Arg as a C-style hexadecimal literal -- and returns its integer value - function Hex_Image (Value : Integer) return String_Access; + function Hex_Image (Value : Unsigned_32) return String_Access; -- Returns access to a string that contains hexadecimal image of Value -- Separate functions that provide build-time customization: @@ -238,7 +241,7 @@ procedure VxAddr2Line is -- Get_Reference_Offset -- -------------------------- - function Get_Reference_Offset return Integer is + function Get_Reference_Offset return Unsigned_32 is Nm_Cmd : constant String_Access := Locate_Exec_On_Path (Arch_List (Cur_Arch).Nm_Binary.all); @@ -273,11 +276,11 @@ procedure VxAddr2Line is declare Match_String : constant String := Expect_Out_Match (Pd); Matches : Match_Array (0 .. 1); - Value : Integer; + Value : Unsigned_32; begin Match (Reference, Match_String, Matches); - Value := Integer'Value + Value := Unsigned_32'Value ("16#" & Match_String (Matches (1).First .. Matches (1).Last) & "#"); @@ -313,7 +316,7 @@ procedure VxAddr2Line is -- Get_Value_From_Hex_Arg -- ---------------------------- - function Get_Value_From_Hex_Arg (Arg : Natural) return Integer is + function Get_Value_From_Hex_Arg (Arg : Natural) return Unsigned_32 is Cur_Arg : constant String := Argument (Arg); Offset : Natural; @@ -332,19 +335,26 @@ procedure VxAddr2Line is -- Convert to value - return Integer'Value ("16#" & Cur_Arg (Offset .. Cur_Arg'Last) & "#"); + return Unsigned_32'Value + ("16#" & Cur_Arg (Offset .. Cur_Arg'Last) & "#"); + + exception + when Constraint_Error => + + Error ("Can't parse backtrace address '" & Cur_Arg & "'"); + raise; end Get_Value_From_Hex_Arg; --------------- -- Hex_Image -- --------------- - function Hex_Image (Value : Integer) return String_Access is + function Hex_Image (Value : Unsigned_32) return String_Access is Result : String (1 .. 20); Start_Pos : Natural; begin - Put (Result, Value, 16); + Unsigned_32_IO.Put (Result, Value, 16); Start_Pos := Index (Result, "16#") + 3; return new String'(Result (Start_Pos .. Result'Last - 1)); end Hex_Image; @@ -362,7 +372,7 @@ procedure VxAddr2Line is OS_Exit (1); end Usage; - Ref_Static_Offset, Ref_Runtime_Address, Bt_Address : Integer; + Ref_Static_Offset, Ref_Runtime_Address, Bt_Address : Unsigned_32; Addr2line_Cmd : String_Access; diff --git a/gcc/ada/widechar.adb b/gcc/ada/widechar.adb index 49976958caf..861df119739 100644 --- a/gcc/ada/widechar.adb +++ b/gcc/ada/widechar.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 1992-2006, Free Software Foundation, Inc. -- +-- Copyright (C) 1992-2008, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -121,12 +121,12 @@ package body Widechar is function WC_In is new Char_Sequence_To_UTF_32 (In_Char); - -- Start of processingf for Scan_Wide + -- Start of processing for Scan_Wide begin Chr := In_Char; - -- Scan out the wide character. if the first character is a bracket, + -- Scan out the wide character. If the first character is a bracket, -- we allow brackets encoding regardless of the standard encoding -- method being used, but otherwise we use this standard method. diff --git a/gcc/ada/widechar.ads b/gcc/ada/widechar.ads index 8686f81890b..e9a756e3f0c 100644 --- a/gcc/ada/widechar.ads +++ b/gcc/ada/widechar.ads @@ -6,7 +6,7 @@ -- -- -- S p e c -- -- -- --- Copyright (C) 1992-2005, Free Software Foundation, Inc. -- +-- Copyright (C) 1992-2008, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -43,7 +43,7 @@ package Widechar is Wide_Char_Byte_Count : Nat := 0; -- This value is incremented whenever Scan_Wide or Skip_Wide is called. -- The amount added is the length of the wide character sequence minus - -- one. This means that the count that accululates here represents the + -- one. This means that the count that accumulates here represents the -- difference between the length in characters and the length in bytes. -- This is used for checking the line length in characters. diff --git a/gcc/ada/xeinfo.adb b/gcc/ada/xeinfo.adb index b451d0b94b5..feb542988c4 100644 --- a/gcc/ada/xeinfo.adb +++ b/gcc/ada/xeinfo.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 1992-2007, Free Software Foundation, Inc. -- +-- Copyright (C) 1992-2008, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -380,7 +380,7 @@ begin while Match (Line, Get_FN) loop - -- Non-inlined funcion + -- Non-inlined function if not Present (Inlined, FN) then Put_Line (Ofile, ""); @@ -439,7 +439,7 @@ begin Line := Getlin; exit when not Match (Line, Get_Asrt); - -- Pragma asser found, get its continuation lines + -- Pragma assert found, get its continuation lines loop exit when Match (Line, Semicoln); @@ -452,7 +452,7 @@ begin Match (Line, Get_Cmnt, M); Replace (M, A); - -- Get continuations of return statemnt + -- Get continuations of return statement while not Match (Line, Semicoln) loop Nextlin := Getlin; diff --git a/gcc/ada/xgnatugn.adb b/gcc/ada/xgnatugn.adb index f3f37e2de3c..ee3b07df820 100644 --- a/gcc/ada/xgnatugn.adb +++ b/gcc/ada/xgnatugn.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 2003-2007, Free Software Foundation, Inc. -- +-- Copyright (C) 2003-2008, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -64,7 +64,7 @@ -- appropriate vms equivalents. Note that replacements do not occur -- within ^alpha^beta^ sequences. --- Any occurence of [filename].extension, where extension one of the +-- Any occurrence of [filename].extension, where extension one of the -- following: -- "o", "ads", "adb", "ali", "ada", "atb", "ats", "adc", "c" @@ -97,6 +97,7 @@ with Ada.Strings.Fixed; use Ada.Strings.Fixed; with Ada.Strings.Unbounded; use Ada.Strings.Unbounded; with Ada.Strings.Maps; use Ada.Strings.Maps; with Ada.Strings.Maps.Constants; use Ada.Strings.Maps.Constants; +with Ada.Streams.Stream_IO; use Ada.Streams.Stream_IO; with Ada.Text_IO; use Ada.Text_IO; with GNAT.Spitbol; use GNAT.Spitbol; @@ -108,12 +109,14 @@ procedure Xgnatugn is -- Print usage information. Invoked if an invalid command line is -- encountered. - Output_File : File_Type; + subtype Sfile is Ada.Streams.Stream_IO.File_Type; + + Output_File : Sfile; -- The preprocessed output is written to this file type Input_File is record Name : VString; - Data : File_Type; + Data : Ada.Text_IO.File_Type; Line : Natural := 0; end record; -- Records information on an input file. Name and Line are used @@ -123,6 +126,10 @@ procedure Xgnatugn is -- Returns a line from Input and performs the necessary -- line-oriented checks (length, character set, trailing spaces). + procedure Put_Line (F : Sfile; S : String); + procedure Put_Line (F : Sfile; S : VString); + -- Local version of Put_Line ensures Unix style line endings + Number_Of_Warnings : Natural := 0; Number_Of_Errors : Natural := 0; Warnings_Enabled : Boolean; @@ -352,6 +359,21 @@ procedure Xgnatugn is end; end Get_Line; + -------------- + -- Put_Line -- + -------------- + + procedure Put_Line (F : Sfile; S : String) is + begin + String'Write (Stream (F), S); + Character'Write (Stream (F), ASCII.LF); + end Put_Line; + + procedure Put_Line (F : Sfile; S : VString) is + begin + Put_Line (F, To_String (S)); + end Put_Line; + ----------- -- Error -- ----------- @@ -1311,7 +1333,7 @@ begin Open (Source_File.Data, In_File, Argument (2)); exception - when Name_Error => + when Ada.Text_IO.Name_Error => Valid_Command_Line := False; end; end if; @@ -1324,7 +1346,7 @@ begin Open (Dictionary_File.Data, In_File, Argument (3)); exception - when Name_Error => + when Ada.Text_IO.Name_Error => Valid_Command_Line := False; end; end if; @@ -1349,7 +1371,7 @@ begin Create (Output_File, Out_File, S (Output_File_Name)); exception - when Name_Error | Use_Error => + when Ada.Text_IO.Name_Error | Ada.Text_IO.Use_Error => Valid_Command_Line := False; end; end if; diff --git a/gcc/ada/xr_tabls.adb b/gcc/ada/xr_tabls.adb index 3456bac9c2b..82b2e7d0382 100644 --- a/gcc/ada/xr_tabls.adb +++ b/gcc/ada/xr_tabls.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 1998-2007, Free Software Foundation, Inc. -- +-- Copyright (C) 1998-2008, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -49,7 +49,7 @@ package body Xr_Tabls is function Get_Key (E : File_Reference) return Cst_String_Access; function Hash (F : Cst_String_Access) return HTable_Headers; function Equal (F1, F2 : Cst_String_Access) return Boolean; - -- The five subprograms above are used to instanciate the static + -- The five subprograms above are used to instantiate the static -- htable to store the files that should be processed. package File_HTable is new GNAT.HTable.Static_HTable @@ -81,7 +81,7 @@ package body Xr_Tabls is function Next (E : Declaration_Reference) return Declaration_Reference; procedure Set_Next (E, Next : Declaration_Reference); function Get_Key (E : Declaration_Reference) return Cst_String_Access; - -- The subprograms above are used to instanciate the static + -- The subprograms above are used to instantiate the static -- htable to store the entities that have been found in the application package Entities_HTable is new GNAT.HTable.Static_HTable @@ -1389,7 +1389,7 @@ package body Xr_Tabls is File_Ref.Visited := False; -- ??? Do not add a source file to the list. This is true at - -- least for gnatxref, and probably for gnatfind as wel + -- least for gnatxref, and probably for gnatfind as well if F'Length > 4 and then F (F'Last - 3 .. F'Last) = ".ali" diff --git a/gcc/ada/xr_tabls.ads b/gcc/ada/xr_tabls.ads index 55fb8241fa5..d5e9c5ee67c 100644 --- a/gcc/ada/xr_tabls.ads +++ b/gcc/ada/xr_tabls.ads @@ -6,7 +6,7 @@ -- -- -- S p e c -- -- -- --- Copyright (C) 1998-2007, Free Software Foundation, Inc. -- +-- Copyright (C) 1998-2008, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -140,7 +140,7 @@ package Xr_Tabls is (Sorted : Boolean := True) return Declaration_Array_Access; -- Return a sorted list of all the declarations in the application. - -- Freeing this array is the responsability of the caller, however it + -- Freeing this array is the responsibility of the caller, however it -- shouldn't free the actual contents of the array, which are pointers -- to internal data @@ -274,7 +274,7 @@ package Xr_Tabls is procedure Reset_Directory (File : File_Reference); -- Reset the cached directory for file. Next time Get_File is called, the - -- directory willl be recomputed. + -- directory will be recomputed. procedure Set_Unvisited (File_Ref : File_Reference); -- Set File_Ref as unvisited. So Next_Unvisited_File will return it @@ -282,7 +282,7 @@ package Xr_Tabls is procedure Read_File (File_Name : String; Contents : out GNAT.OS_Lib.String_Access); - -- Reads File_Name into the newly allocated strig Contents. Types.EOF + -- Reads File_Name into the newly allocated string Contents. Types.EOF -- character will be added to the returned Contents to simplify parsing. -- Name_Error is raised if the file was not found. End_Error is raised if -- the file could not be read correctly. For most systems correct reading diff --git a/gcc/ada/xref_lib.adb b/gcc/ada/xref_lib.adb index 7f22dce6f89..b09cc70e773 100644 --- a/gcc/ada/xref_lib.adb +++ b/gcc/ada/xref_lib.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 1998-2007, Free Software Foundation, Inc. -- +-- Copyright (C) 1998-2008, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -109,7 +109,7 @@ package body Xref_Lib is (Source : not null access String; Ptr : in out Positive; Number : out Natural); - -- Skips any separators and parses Source upto the first character that + -- Skips any separators and parses Source up to the first character that -- is not a decimal digit. Returns value of parsed digits or 0 if none. procedure Parse_X_Filename (File : in out ALI_File); @@ -808,7 +808,7 @@ package body Xref_Lib is exit when Ali (Ptr) = EOF; end loop; - -- We were not able to find the symbol, this should not happend but + -- We were not able to find the symbol, this should not happen but -- since we don't want to stop here we return a string of three -- question marks as the symbol name. @@ -896,6 +896,22 @@ package body Xref_Lib is Skip_To_Matching_Closing_Bracket; end if; + -- Skip any renaming indication + + if Ali (Ptr) = '=' then + declare + P_Line, P_Column : Natural; + pragma Warnings (Off, P_Line); + pragma Warnings (Off, P_Column); + + begin + Ptr := Ptr + 1; + Parse_Number (Ali, Ptr, P_Line); + Ptr := Ptr + 1; + Parse_Number (Ali, Ptr, P_Column); + end; + end if; + if Ali (Ptr) = '<' or else Ali (Ptr) = '(' or else Ali (Ptr) = '{' @@ -1036,19 +1052,6 @@ package body Xref_Lib is end loop; Ptr := Ptr + 1; end if; - - elsif Ali (Ptr) = '=' then - declare - P_Line, P_Column : Natural; - pragma Warnings (Off, P_Line); - pragma Warnings (Off, P_Column); - - begin - Ptr := Ptr + 1; - Parse_Number (Ali, Ptr, P_Line); - Ptr := Ptr + 1; - Parse_Number (Ali, Ptr, P_Column); - end; end if; -- To find the body, we will have to parse the file too diff --git a/gcc/ada/xref_lib.ads b/gcc/ada/xref_lib.ads index 8fd38a68782..e0db3fdb700 100644 --- a/gcc/ada/xref_lib.ads +++ b/gcc/ada/xref_lib.ads @@ -6,7 +6,7 @@ -- -- -- S p e c -- -- -- --- Copyright (C) 1998-2007, Free Software Foundation, Inc. -- +-- Copyright (C) 1998-2008, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -115,7 +115,7 @@ package Xref_Lib is -- If Der_Info is true, then the derived type information will be -- processed. -- - -- If Type_Tree is true, then the type hierarchy wil be searched + -- If Type_Tree is true, then the type hierarchy will be searched -- going from the pattern to the parent type. procedure Search_Xref diff --git a/gcc/ada/xsinfo.adb b/gcc/ada/xsinfo.adb index 786f4e39d45..691e9016b69 100644 --- a/gcc/ada/xsinfo.adb +++ b/gcc/ada/xsinfo.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 1992-2007, Free Software Foundation, Inc. -- +-- Copyright (C) 1992-2008, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -37,7 +37,7 @@ -- Note: this program assumes that sinfo.ads has passed the error checks -- which are carried out by the CSinfo utility, so it does not duplicate --- these checks and assumes the soruce is correct. +-- these checks and assumes the source is correct. -- An optional argument allows the specification of an output file name to -- override the default sinfo.h file name for the generated output file. diff --git a/gcc/attribs.c b/gcc/attribs.c index 767035b5dd1..65233de9e55 100644 --- a/gcc/attribs.c +++ b/gcc/attribs.c @@ -225,6 +225,9 @@ decl_attributes (tree *node, tree attributes, int flags) tree a; tree returned_attrs = NULL_TREE; + if (TREE_TYPE (*node) == error_mark_node) + return NULL_TREE; + if (!attributes_initialized) init_attributes (); diff --git a/gcc/builtins.c b/gcc/builtins.c index f268738bb7d..d5c4f9222c9 100644 --- a/gcc/builtins.c +++ b/gcc/builtins.c @@ -1351,7 +1351,7 @@ expand_builtin_apply_args_1 (void) as we might have pretended they were passed. Make sure it's a valid operand, as emit_move_insn isn't expected to handle a PLUS. */ tem - = force_operand (plus_constant (tem, current_function_pretend_args_size), + = force_operand (plus_constant (tem, crtl->args.pretend_args_size), NULL_RTX); #endif emit_move_insn (adjust_address (registers, Pmode, 0), tem); @@ -4600,7 +4600,7 @@ static rtx expand_builtin_args_info (tree exp) { int nwords = sizeof (CUMULATIVE_ARGS) / sizeof (int); - int *word_ptr = (int *) ¤t_function_args_info; + int *word_ptr = (int *) &crtl->args.info; gcc_assert (sizeof (CUMULATIVE_ARGS) % sizeof (int) == 0); @@ -4632,8 +4632,8 @@ expand_builtin_next_arg (void) /* Checking arguments is already done in fold_builtin_next_arg that must be called before this function. */ return expand_binop (ptr_mode, add_optab, - current_function_internal_arg_pointer, - current_function_arg_offset_rtx, + crtl->args.internal_arg_pointer, + crtl->args.arg_offset_rtx, NULL_RTX, 0, OPTAB_LIB_WIDEN); } diff --git a/gcc/calls.c b/gcc/calls.c index 2d68f7507a5..b747fd4057a 100644 --- a/gcc/calls.c +++ b/gcc/calls.c @@ -297,7 +297,7 @@ emit_call_1 (rtx funexp, tree fntree, tree fndecl ATTRIBUTE_UNUSED, even if the call has no arguments to pop. */ #if defined (HAVE_call) && defined (HAVE_call_value) if (HAVE_call && HAVE_call_value && HAVE_call_pop && HAVE_call_value_pop - && n_popped > 0 && ! (ecf_flags & ECF_SP_DEPRESSED)) + && n_popped > 0) #else if (HAVE_call_pop && HAVE_call_value_pop) #endif @@ -432,7 +432,7 @@ emit_call_1 (rtx funexp, tree fntree, tree fndecl ATTRIBUTE_UNUSED, if (rounded_stack_size != 0) { - if (ecf_flags & (ECF_SP_DEPRESSED | ECF_NORETURN)) + if (ecf_flags & ECF_NORETURN) /* Just pretend we did the pop. */ stack_pointer_delta -= rounded_stack_size; else if (flag_defer_pop && inhibit_defer_pop == 0 @@ -602,14 +602,6 @@ flags_from_decl_or_type (const_tree exp) if (TREE_THIS_VOLATILE (exp)) flags |= ECF_NORETURN; - /* Mark if the function returns with the stack pointer depressed. We - cannot consider it pure or constant in that case. */ - if (TREE_CODE (type) == FUNCTION_TYPE && TYPE_RETURNS_STACK_DEPRESSED (type)) - { - flags |= ECF_SP_DEPRESSED; - flags &= ~(ECF_PURE | ECF_CONST); - } - return flags; } @@ -1521,16 +1513,16 @@ mem_overlaps_already_clobbered_arg_p (rtx addr, unsigned HOST_WIDE_INT size) { HOST_WIDE_INT i; - if (addr == current_function_internal_arg_pointer) + if (addr == crtl->args.internal_arg_pointer) i = 0; else if (GET_CODE (addr) == PLUS - && XEXP (addr, 0) == current_function_internal_arg_pointer + && XEXP (addr, 0) == crtl->args.internal_arg_pointer && GET_CODE (XEXP (addr, 1)) == CONST_INT) i = INTVAL (XEXP (addr, 1)); /* Return true for arg pointer based indexed addressing. */ else if (GET_CODE (addr) == PLUS - && (XEXP (addr, 0) == current_function_internal_arg_pointer - || XEXP (addr, 1) == current_function_internal_arg_pointer)) + && (XEXP (addr, 0) == crtl->args.internal_arg_pointer + || XEXP (addr, 1) == crtl->args.internal_arg_pointer)) return true; else return false; @@ -2289,16 +2281,16 @@ expand_call (tree exp, rtx target, int ignore) || (fndecl && decl_function_context (fndecl) == current_function_decl) /* If this function requires more stack slots than the current function, we cannot change it into a sibling call. - current_function_pretend_args_size is not part of the + crtl->args.pretend_args_size is not part of the stack allocated by our caller. */ - || args_size.constant > (current_function_args_size - - current_function_pretend_args_size) + || args_size.constant > (crtl->args.size + - crtl->args.pretend_args_size) /* If the callee pops its own arguments, then it must pop exactly the same number of arguments as the current function. */ || (RETURN_POPS_ARGS (fndecl, funtype, args_size.constant) != RETURN_POPS_ARGS (current_function_decl, TREE_TYPE (current_function_decl), - current_function_args_size)) + crtl->args.size)) || !lang_hooks.decls.ok_for_sibcall (fndecl)) try_tail_call = 0; @@ -2354,13 +2346,12 @@ expand_call (tree exp, rtx target, int ignore) /* Don't let pending stack adjusts add up to too much. Also, do all pending adjustments now if there is any chance this might be a call to alloca or if we are expanding a sibling - call sequence or if we are calling a function that is to return - with stack pointer depressed. + call sequence. Also do the adjustments before a throwing call, otherwise exception handling can fail; PR 19225. */ if (pending_stack_adjust >= 32 || (pending_stack_adjust > 0 - && (flags & (ECF_MAY_BE_ALLOCA | ECF_SP_DEPRESSED))) + && (flags & ECF_MAY_BE_ALLOCA)) || (pending_stack_adjust > 0 && flag_exceptions && !(flags & ECF_NOTHROW)) || pass == 0) @@ -2404,9 +2395,9 @@ expand_call (tree exp, rtx target, int ignore) argblock = virtual_incoming_args_rtx; argblock #ifdef STACK_GROWS_DOWNWARD - = plus_constant (argblock, current_function_pretend_args_size); + = plus_constant (argblock, crtl->args.pretend_args_size); #else - = plus_constant (argblock, -current_function_pretend_args_size); + = plus_constant (argblock, -crtl->args.pretend_args_size); #endif stored_args_map = sbitmap_alloc (args_size.constant); sbitmap_zero (stored_args_map); @@ -2443,8 +2434,8 @@ expand_call (tree exp, rtx target, int ignore) the prologue (if ACCUMULATE_OUTGOING_ARGS, or stack overflow checking). */ - if (needed > current_function_outgoing_args_size) - current_function_outgoing_args_size = needed; + if (needed > crtl->outgoing_args_size) + crtl->outgoing_args_size = needed; if (must_preallocate) { @@ -3071,7 +3062,7 @@ expand_call (tree exp, rtx target, int ignore) /* If size of args is variable or this was a constructor call for a stack argument, restore saved stack-pointer value. */ - if (old_stack_level && ! (flags & ECF_SP_DEPRESSED)) + if (old_stack_level) { emit_stack_restore (SAVE_BLOCK, old_stack_level, NULL_RTX); stack_pointer_delta = old_stack_pointer_delta; @@ -3177,16 +3168,6 @@ expand_call (tree exp, rtx target, int ignore) currently_expanding_call--; - /* If this function returns with the stack pointer depressed, ensure - this block saves and restores the stack pointer, show it was - changed, and adjust for any outgoing arg space. */ - if (flags & ECF_SP_DEPRESSED) - { - clear_pending_stack_adjust (); - emit_insn (gen_rtx_CLOBBER (VOIDmode, stack_pointer_rtx)); - emit_move_insn (virtual_stack_dynamic_rtx, stack_pointer_rtx); - } - if (stack_usage_map_buf) free (stack_usage_map_buf); @@ -3570,8 +3551,8 @@ emit_library_call_value_1 (int retval, rtx orgfun, rtx value, if (!OUTGOING_REG_PARM_STACK_SPACE) args_size.constant -= reg_parm_stack_space; - if (args_size.constant > current_function_outgoing_args_size) - current_function_outgoing_args_size = args_size.constant; + if (args_size.constant > crtl->outgoing_args_size) + crtl->outgoing_args_size = args_size.constant; if (ACCUMULATE_OUTGOING_ARGS) { @@ -4344,13 +4325,13 @@ store_one_arg (struct arg_data *arg, rtx argblock, int flags, rtx x = arg->value; int i = 0; - if (XEXP (x, 0) == current_function_internal_arg_pointer + if (XEXP (x, 0) == crtl->args.internal_arg_pointer || (GET_CODE (XEXP (x, 0)) == PLUS && XEXP (XEXP (x, 0), 0) == - current_function_internal_arg_pointer + crtl->args.internal_arg_pointer && GET_CODE (XEXP (XEXP (x, 0), 1)) == CONST_INT)) { - if (XEXP (x, 0) != current_function_internal_arg_pointer) + if (XEXP (x, 0) != crtl->args.internal_arg_pointer) i = INTVAL (XEXP (XEXP (x, 0), 1)); /* expand_call should ensure this. */ diff --git a/gcc/collect2.c b/gcc/collect2.c index bba108d2749..af8bc799a38 100644 --- a/gcc/collect2.c +++ b/gcc/collect2.c @@ -2043,14 +2043,12 @@ write_c_file_glob (FILE *stream, const char *name ATTRIBUTE_UNUSED) static void write_c_file (FILE *stream, const char *name) { - fprintf (stream, "#ifdef __cplusplus\nextern \"C\" {\n#endif\n"); #ifndef LD_INIT_SWITCH if (! shared_obj) write_c_file_glob (stream, name); else #endif write_c_file_stat (stream, name); - fprintf (stream, "#ifdef __cplusplus\n}\n#endif\n"); } #ifdef COLLECT_EXPORT_LIST diff --git a/gcc/config.gcc b/gcc/config.gcc index bc440c9f045..7276be31019 100644 --- a/gcc/config.gcc +++ b/gcc/config.gcc @@ -373,7 +373,7 @@ s390*-*-*) need_64bit_hwint=yes ;; # Note the 'l'; we need to be able to match e.g. "shle" or "shl". -sh[123456789lbe]*-*-*) +sh[123456789lbe]*-*-* | sh-*-*) cpu_type=sh need_64bit_hwint=yes ;; diff --git a/gcc/config/alpha/alpha.c b/gcc/config/alpha/alpha.c index 9e650b9ae14..02d3b684ae8 100644 --- a/gcc/config/alpha/alpha.c +++ b/gcc/config/alpha/alpha.c @@ -189,9 +189,9 @@ static struct alpha_rtx_cost_data const alpha_rtx_cost_size = /* Get the number of args of a function in one of two ways. */ #if TARGET_ABI_OPEN_VMS || TARGET_ABI_UNICOSMK -#define NUM_ARGS current_function_args_info.num_args +#define NUM_ARGS crtl->args.info.num_args #else -#define NUM_ARGS current_function_args_info +#define NUM_ARGS crtl->args.info #endif #define REG_PV 27 @@ -643,8 +643,8 @@ direct_return (void) && reload_completed && alpha_sa_size () == 0 && get_frame_size () == 0 - && current_function_outgoing_args_size == 0 - && current_function_pretend_args_size == 0); + && crtl->outgoing_args_size == 0 + && crtl->args.pretend_args_size == 0); } /* Return the ADDR_VEC associated with a tablejump insn. */ @@ -6082,7 +6082,7 @@ alpha_va_start (tree valist, rtx nextarg ATTRIBUTE_UNUSED) if (NUM_ARGS < 6) offset = TARGET_ABI_OPEN_VMS ? UNITS_PER_WORD : 6 * UNITS_PER_WORD; else - offset = -6 * UNITS_PER_WORD + current_function_pretend_args_size; + offset = -6 * UNITS_PER_WORD + crtl->args.pretend_args_size; if (TARGET_ABI_OPEN_VMS) { @@ -7148,7 +7148,7 @@ alpha_sa_size (void) alpha_procedure_type = (sa_size || get_frame_size() != 0 - || current_function_outgoing_args_size + || crtl->outgoing_args_size || current_function_stdarg || current_function_calls_alloca || frame_pointer_needed) ? PT_STACK : PT_REGISTER; @@ -7184,7 +7184,7 @@ alpha_sa_size (void) = (frame_pointer_needed || current_function_has_nonlocal_label || alpha_procedure_type == PT_STACK - || current_function_outgoing_args_size) + || crtl->outgoing_args_size) ? REG_PV : HARD_FRAME_POINTER_REGNUM; /* If we want to copy PV into FP, we need to find some register @@ -7229,7 +7229,7 @@ alpha_initial_elimination_offset (unsigned int from, HOST_WIDE_INT ret; ret = alpha_sa_size (); - ret += ALPHA_ROUND (current_function_outgoing_args_size); + ret += ALPHA_ROUND (crtl->outgoing_args_size); switch (from) { @@ -7238,8 +7238,8 @@ alpha_initial_elimination_offset (unsigned int from, case ARG_POINTER_REGNUM: ret += (ALPHA_ROUND (get_frame_size () - + current_function_pretend_args_size) - - current_function_pretend_args_size); + + crtl->args.pretend_args_size) + - crtl->args.pretend_args_size); break; default: @@ -7447,23 +7447,23 @@ alpha_expand_prologue (void) frame_size = ALPHA_ROUND (sa_size + (alpha_procedure_type == PT_STACK ? 8 : 0) + frame_size - + current_function_pretend_args_size); + + crtl->args.pretend_args_size); else if (TARGET_ABI_UNICOSMK) /* We have to allocate space for the DSIB if we generate a frame. */ frame_size = ALPHA_ROUND (sa_size + (alpha_procedure_type == PT_STACK ? 48 : 0)) + ALPHA_ROUND (frame_size - + current_function_outgoing_args_size); + + crtl->outgoing_args_size); else - frame_size = (ALPHA_ROUND (current_function_outgoing_args_size) + frame_size = (ALPHA_ROUND (crtl->outgoing_args_size) + sa_size + ALPHA_ROUND (frame_size - + current_function_pretend_args_size)); + + crtl->args.pretend_args_size)); if (TARGET_ABI_OPEN_VMS) reg_offset = 8; else - reg_offset = ALPHA_ROUND (current_function_outgoing_args_size); + reg_offset = ALPHA_ROUND (crtl->outgoing_args_size); alpha_sa_mask (&imask, &fmask); @@ -7677,14 +7677,14 @@ alpha_expand_prologue (void) FRP (emit_move_insn (hard_frame_pointer_rtx, stack_pointer_rtx)); /* If we have to allocate space for outgoing args, do it now. */ - if (current_function_outgoing_args_size != 0) + if (crtl->outgoing_args_size != 0) { rtx seq = emit_move_insn (stack_pointer_rtx, plus_constant (hard_frame_pointer_rtx, - (ALPHA_ROUND - (current_function_outgoing_args_size)))); + (crtl->outgoing_args_size)))); /* Only set FRAME_RELATED_P on the stack adjustment we just emitted if ! frame_pointer_needed. Setting the bit will change the CFA @@ -7696,7 +7696,7 @@ alpha_expand_prologue (void) frame_pointer_needed => vms_unwind_regno == HARD_FRAME_POINTER_REGNUM and - current_function_outgoing_args_size != 0 + crtl->outgoing_args_size != 0 => alpha_procedure_type != PT_NULL, so when we are not setting the bit here, we are guaranteed to @@ -7773,22 +7773,22 @@ alpha_start_function (FILE *file, const char *fnname, frame_size = ALPHA_ROUND (sa_size + (alpha_procedure_type == PT_STACK ? 8 : 0) + frame_size - + current_function_pretend_args_size); + + crtl->args.pretend_args_size); else if (TARGET_ABI_UNICOSMK) frame_size = ALPHA_ROUND (sa_size + (alpha_procedure_type == PT_STACK ? 48 : 0)) + ALPHA_ROUND (frame_size - + current_function_outgoing_args_size); + + crtl->outgoing_args_size); else - frame_size = (ALPHA_ROUND (current_function_outgoing_args_size) + frame_size = (ALPHA_ROUND (crtl->outgoing_args_size) + sa_size + ALPHA_ROUND (frame_size - + current_function_pretend_args_size)); + + crtl->args.pretend_args_size)); if (TARGET_ABI_OPEN_VMS) reg_offset = 8; else - reg_offset = ALPHA_ROUND (current_function_outgoing_args_size); + reg_offset = ALPHA_ROUND (crtl->outgoing_args_size); alpha_sa_mask (&imask, &fmask); @@ -7858,7 +7858,7 @@ alpha_start_function (FILE *file, const char *fnname, } /* Set up offsets to alpha virtual arg/local debugging pointer. */ - alpha_auto_offset = -frame_size + current_function_pretend_args_size; + alpha_auto_offset = -frame_size + crtl->args.pretend_args_size; alpha_arg_offset = -frame_size + 48; /* Describe our frame. If the frame size is larger than an integer, @@ -7877,7 +7877,7 @@ alpha_start_function (FILE *file, const char *fnname, (frame_pointer_needed ? HARD_FRAME_POINTER_REGNUM : STACK_POINTER_REGNUM), frame_size >= max_frame_size ? 0 : frame_size, - current_function_pretend_args_size); + crtl->args.pretend_args_size); /* Describe which registers were spilled. */ if (TARGET_ABI_UNICOSMK) @@ -7972,17 +7972,17 @@ alpha_expand_epilogue (void) frame_size = ALPHA_ROUND (sa_size + (alpha_procedure_type == PT_STACK ? 8 : 0) + frame_size - + current_function_pretend_args_size); + + crtl->args.pretend_args_size); else if (TARGET_ABI_UNICOSMK) frame_size = ALPHA_ROUND (sa_size + (alpha_procedure_type == PT_STACK ? 48 : 0)) + ALPHA_ROUND (frame_size - + current_function_outgoing_args_size); + + crtl->outgoing_args_size); else - frame_size = (ALPHA_ROUND (current_function_outgoing_args_size) + frame_size = (ALPHA_ROUND (crtl->outgoing_args_size) + sa_size + ALPHA_ROUND (frame_size - + current_function_pretend_args_size)); + + crtl->args.pretend_args_size)); if (TARGET_ABI_OPEN_VMS) { @@ -7992,7 +7992,7 @@ alpha_expand_epilogue (void) reg_offset = 0; } else - reg_offset = ALPHA_ROUND (current_function_outgoing_args_size); + reg_offset = ALPHA_ROUND (crtl->outgoing_args_size); alpha_sa_mask (&imask, &fmask); @@ -9775,12 +9775,12 @@ unicosmk_initial_elimination_offset (int from, int to) else if (from == ARG_POINTER_REGNUM && to == HARD_FRAME_POINTER_REGNUM) return 0; else if (from == FRAME_POINTER_REGNUM && to == STACK_POINTER_REGNUM) - return (ALPHA_ROUND (current_function_outgoing_args_size) + return (ALPHA_ROUND (crtl->outgoing_args_size) + ALPHA_ROUND (get_frame_size())); else if (from == ARG_POINTER_REGNUM && to == STACK_POINTER_REGNUM) return (ALPHA_ROUND (fixed_size) + ALPHA_ROUND (get_frame_size() - + current_function_outgoing_args_size)); + + crtl->outgoing_args_size)); else gcc_unreachable (); } diff --git a/gcc/config/alpha/alpha.h b/gcc/config/alpha/alpha.h index b0019bf22cf..5f2431e2978 100644 --- a/gcc/config/alpha/alpha.h +++ b/gcc/config/alpha/alpha.h @@ -662,7 +662,7 @@ extern int alpha_memory_latency; /* Define this if the maximum size of all the outgoing args is to be accumulated and pushed during the prologue. The amount can be - found in the variable current_function_outgoing_args_size. */ + found in the variable crtl->outgoing_args_size. */ #define ACCUMULATE_OUTGOING_ARGS 1 /* Offset of first parameter from the argument pointer register value. */ @@ -915,7 +915,7 @@ do { \ #define EH_RETURN_STACKADJ_RTX gen_rtx_REG (Pmode, 28) #define EH_RETURN_HANDLER_RTX \ gen_rtx_MEM (Pmode, plus_constant (stack_pointer_rtx, \ - current_function_outgoing_args_size)) + crtl->outgoing_args_size)) /* Addressing modes, and classification of registers for them. */ diff --git a/gcc/config/alpha/alpha.md b/gcc/config/alpha/alpha.md index ca862bbbc67..768ff38b8bb 100644 --- a/gcc/config/alpha/alpha.md +++ b/gcc/config/alpha/alpha.md @@ -474,11 +474,11 @@ && INTVAL (operands[2]) < (0x7fff8000 - FIRST_PSEUDO_REGISTER * UNITS_PER_WORD - - ALPHA_ROUND(current_function_outgoing_args_size) + - ALPHA_ROUND(crtl->outgoing_args_size) - (ALPHA_ROUND (get_frame_size () + max_reg_num () * UNITS_PER_WORD - + current_function_pretend_args_size) - - current_function_pretend_args_size))" + + crtl->args.pretend_args_size) + - crtl->args.pretend_args_size))" "@ lda %0,%2(%1) ldah %0,%h2(%1) diff --git a/gcc/config/alpha/vms.h b/gcc/config/alpha/vms.h index 5bd16e73085..b2fb213b9d1 100644 --- a/gcc/config/alpha/vms.h +++ b/gcc/config/alpha/vms.h @@ -143,14 +143,14 @@ along with GCC; see the file COPYING3. If not see case ARG_POINTER_REGNUM: \ (OFFSET) = (ALPHA_ROUND (alpha_sa_size () + alpha_pv_save_size () \ + get_frame_size () \ - + current_function_pretend_args_size) \ - - current_function_pretend_args_size); \ + + crtl->args.pretend_args_size) \ + - crtl->args.pretend_args_size); \ break; \ default: \ gcc_unreachable (); \ } \ if ((TO) == STACK_POINTER_REGNUM) \ - (OFFSET) += ALPHA_ROUND (current_function_outgoing_args_size); \ + (OFFSET) += ALPHA_ROUND (crtl->outgoing_args_size); \ } /* Define a data type for recording info about an argument list diff --git a/gcc/config/arc/arc.c b/gcc/config/arc/arc.c index 5b2e7b804f4..7b7d580471f 100644 --- a/gcc/config/arc/arc.c +++ b/gcc/config/arc/arc.c @@ -1079,11 +1079,11 @@ arc_compute_frame_size (int size /* # of var. bytes allocated. */) int interrupt_p; var_size = size; - args_size = current_function_outgoing_args_size; - pretend_size = current_function_pretend_args_size; + args_size = crtl->outgoing_args_size; + pretend_size = crtl->args.pretend_args_size; extra_size = FIRST_PARM_OFFSET (0); total_size = extra_size + pretend_size + args_size + var_size; - reg_offset = FIRST_PARM_OFFSET(0) + current_function_outgoing_args_size; + reg_offset = FIRST_PARM_OFFSET(0) + crtl->outgoing_args_size; reg_size = 0; gmask = 0; @@ -2282,8 +2282,8 @@ static void arc_va_start (tree valist, rtx nextarg) { /* See arc_setup_incoming_varargs for reasons for this oddity. */ - if (current_function_args_info < 8 - && (current_function_args_info & 1)) + if (crtl->args.info < 8 + && (crtl->args.info & 1)) nextarg = plus_constant (nextarg, UNITS_PER_WORD); std_expand_builtin_va_start (valist, nextarg); diff --git a/gcc/config/arc/arc.h b/gcc/config/arc/arc.h index 17412fc18d8..06aa4035d1b 100644 --- a/gcc/config/arc/arc.h +++ b/gcc/config/arc/arc.h @@ -531,7 +531,7 @@ extern enum reg_class arc_regno_reg_class[FIRST_PSEUDO_REGISTER]; /* If defined, the maximum amount of space required for outgoing arguments will be computed and placed into the variable - `current_function_outgoing_args_size'. No space will be pushed + `crtl->outgoing_args_size'. No space will be pushed onto the stack for each call; instead, the function prologue should increase the stack frame size by this amount. */ #define ACCUMULATE_OUTGOING_ARGS 1 diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c index 43a3078278d..78aac134daf 100644 --- a/gcc/config/arm/arm.c +++ b/gcc/config/arm/arm.c @@ -1653,7 +1653,7 @@ use_return_insn (int iscond, rtx sibling) stack_adjust = offsets->outgoing_args - offsets->saved_regs; /* As do variadic functions. */ - if (current_function_pretend_args_size + if (crtl->args.pretend_args_size || cfun->machine->uses_anonymous_args /* Or if the function calls __builtin_eh_return () */ || current_function_calls_eh_return @@ -3544,15 +3544,15 @@ thumb_find_work_register (unsigned long pushed_regs_mask) the variable argument list and so we can be sure that it will be pushed right at the start of the function. Hence it will be available for the rest of the prologue. - (*): ie current_function_pretend_args_size is greater than 0. */ + (*): ie crtl->args.pretend_args_size is greater than 0. */ if (cfun->machine->uses_anonymous_args - && current_function_pretend_args_size > 0) + && crtl->args.pretend_args_size > 0) return LAST_ARG_REGNUM; /* The other case is when we have fixed arguments but less than 4 registers worth. In this case r3 might be used in the body of the function, but it is not being used to convey an argument into the function. In theory - we could just check current_function_args_size to see how many bytes are + we could just check crtl->args.size to see how many bytes are being passed in argument registers, but it seems that it is unreliable. Sometimes it will have the value 0 when in fact arguments are being passed. (See testcase execute/20021111-1.c for an example). So we also @@ -3562,8 +3562,8 @@ thumb_find_work_register (unsigned long pushed_regs_mask) when a function has an unused argument in r3. But it is better to be safe than to be sorry. */ if (! cfun->machine->uses_anonymous_args - && current_function_args_size >= 0 - && current_function_args_size <= (LAST_ARG_REGNUM * UNITS_PER_WORD) + && crtl->args.size >= 0 + && crtl->args.size <= (LAST_ARG_REGNUM * UNITS_PER_WORD) && cfun->args_info.nregs < 4) return LAST_ARG_REGNUM; @@ -10833,7 +10833,7 @@ arm_compute_save_reg_mask (void) if (TARGET_REALLY_IWMMXT && ((bit_count (save_reg_mask) - + ARM_NUM_INTS (current_function_pretend_args_size)) % 2) != 0) + + ARM_NUM_INTS (crtl->args.pretend_args_size)) % 2) != 0) { /* The total number of registers that are going to be pushed onto the stack is odd. We need to ensure that the stack @@ -11258,8 +11258,8 @@ arm_output_function_prologue (FILE *f, HOST_WIDE_INT frame_size) asm_fprintf (f, "\t%@ Stack Align: May be called with mis-aligned SP.\n"); asm_fprintf (f, "\t%@ args = %d, pretend = %d, frame = %wd\n", - current_function_args_size, - current_function_pretend_args_size, frame_size); + crtl->args.size, + crtl->args.pretend_args_size, frame_size); asm_fprintf (f, "\t%@ frame_needed = %d, uses_anonymous_args = %d\n", frame_pointer_needed, @@ -11626,7 +11626,7 @@ arm_output_epilogue (rtx sibling) && (TARGET_ARM || ARM_FUNC_TYPE (func_type) == ARM_FT_NORMAL) && !IS_STACKALIGN (func_type) && really_return - && current_function_pretend_args_size == 0 + && crtl->args.pretend_args_size == 0 && saved_regs_mask & (1 << LR_REGNUM) && !current_function_calls_eh_return) { @@ -11661,11 +11661,11 @@ arm_output_epilogue (rtx sibling) print_multi_reg (f, "pop\t", SP_REGNUM, saved_regs_mask, 0); } - if (current_function_pretend_args_size) + if (crtl->args.pretend_args_size) { /* Unwind the pre-pushed regs. */ operands[0] = operands[1] = stack_pointer_rtx; - operands[2] = GEN_INT (current_function_pretend_args_size); + operands[2] = GEN_INT (crtl->args.pretend_args_size); output_add_immediate (operands); } } @@ -11890,8 +11890,8 @@ arm_size_return_regs (void) { enum machine_mode mode; - if (current_function_return_rtx != 0) - mode = GET_MODE (current_function_return_rtx); + if (crtl->return_rtx != 0) + mode = GET_MODE (crtl->return_rtx); else mode = DECL_MODE (DECL_RESULT (current_function_decl)); @@ -12050,7 +12050,7 @@ arm_get_frame_offsets (void) leaf = leaf_function_p (); /* Space for variadic functions. */ - offsets->saved_args = current_function_pretend_args_size; + offsets->saved_args = crtl->args.pretend_args_size; /* In Thumb mode this is incorrect, but never used. */ offsets->frame = offsets->saved_args + (frame_pointer_needed ? 4 : 0); @@ -12119,7 +12119,7 @@ arm_get_frame_offsets (void) /* Try to align stack by pushing an extra reg. Don't bother doing this when there is a stack frame as the alignment will be rolled into the normal stack adjustment. */ - if (frame_size + current_function_outgoing_args_size == 0) + if (frame_size + crtl->outgoing_args_size == 0) { int reg = -1; @@ -12150,7 +12150,7 @@ arm_get_frame_offsets (void) offsets->locals_base = offsets->soft_frame + frame_size; offsets->outgoing_args = (offsets->locals_base - + current_function_outgoing_args_size); + + crtl->outgoing_args_size); if (ARM_DOUBLEWORD_ALIGN) { @@ -12399,7 +12399,7 @@ arm_expand_prologue (void) return; /* Make a copy of c_f_p_a_s as we may need to modify it locally. */ - args_to_push = current_function_pretend_args_size; + args_to_push = crtl->args.pretend_args_size; /* Compute which register we will have to save onto the stack. */ offsets = arm_get_frame_offsets (); @@ -12599,7 +12599,7 @@ arm_expand_prologue (void) if (!df_regs_ever_live_p (3) || saved_pretend_args) insn = gen_rtx_REG (SImode, 3); - else /* if (current_function_pretend_args_size == 0) */ + else /* if (crtl->args.pretend_args_size == 0) */ { insn = plus_constant (hard_frame_pointer_rtx, 4); insn = gen_frame_mem (SImode, insn); @@ -16288,8 +16288,8 @@ thumb_exit (FILE *f, int reg_containing_return_addr) ever used in the function, not just if the register is used to hold a return value. */ - if (current_function_return_rtx != 0) - mode = GET_MODE (current_function_return_rtx); + if (crtl->return_rtx != 0) + mode = GET_MODE (crtl->return_rtx); else mode = DECL_MODE (DECL_RESULT (current_function_decl)); @@ -16705,7 +16705,7 @@ thumb_unexpanded_epilogue (void) had_to_push_lr = (live_regs_mask & (1 << LR_REGNUM)) != 0; live_regs_mask &= 0xff; - if (current_function_pretend_args_size == 0 || TARGET_BACKTRACE) + if (crtl->args.pretend_args_size == 0 || TARGET_BACKTRACE) { /* Pop the return address into the PC. */ if (had_to_push_lr) @@ -16762,7 +16762,7 @@ thumb_unexpanded_epilogue (void) /* Remove the argument registers that were pushed onto the stack. */ asm_fprintf (asm_out_file, "\tadd\t%r, %r, #%d\n", SP_REGNUM, SP_REGNUM, - current_function_pretend_args_size); + crtl->args.pretend_args_size); thumb_exit (asm_out_file, regno); } @@ -17105,12 +17105,12 @@ thumb1_output_function_prologue (FILE *f, HOST_WIDE_INT size ATTRIBUTE_UNUSED) asm_fprintf (f, "%s%U%s:\n", STUB_NAME, name); } - if (current_function_pretend_args_size) + if (crtl->args.pretend_args_size) { /* Output unwind directive for the stack adjustment. */ if (ARM_EABI_UNWIND_TABLES) fprintf (f, "\t.pad #%d\n", - current_function_pretend_args_size); + crtl->args.pretend_args_size); if (cfun->machine->uses_anonymous_args) { @@ -17118,7 +17118,7 @@ thumb1_output_function_prologue (FILE *f, HOST_WIDE_INT size ATTRIBUTE_UNUSED) fprintf (f, "\tpush\t{"); - num_pushes = ARM_NUM_INTS (current_function_pretend_args_size); + num_pushes = ARM_NUM_INTS (crtl->args.pretend_args_size); for (regno = LAST_ARG_REGNUM + 1 - num_pushes; regno <= LAST_ARG_REGNUM; @@ -17131,7 +17131,7 @@ thumb1_output_function_prologue (FILE *f, HOST_WIDE_INT size ATTRIBUTE_UNUSED) else asm_fprintf (f, "\tsub\t%r, %r, #%d\n", SP_REGNUM, SP_REGNUM, - current_function_pretend_args_size); + crtl->args.pretend_args_size); /* We don't need to record the stores for unwinding (would it help the debugger any if we did?), but record the change in @@ -17140,7 +17140,7 @@ thumb1_output_function_prologue (FILE *f, HOST_WIDE_INT size ATTRIBUTE_UNUSED) { char *l = dwarf2out_cfi_label (); - cfa_offset = cfa_offset + current_function_pretend_args_size; + cfa_offset = cfa_offset + crtl->args.pretend_args_size; dwarf2out_def_cfa (l, SP_REGNUM, cfa_offset); } } @@ -17202,7 +17202,7 @@ thumb1_output_function_prologue (FILE *f, HOST_WIDE_INT size ATTRIBUTE_UNUSED) offset = 0; asm_fprintf (f, "\tadd\t%r, %r, #%d\n", work_register, SP_REGNUM, - offset + 16 + current_function_pretend_args_size); + offset + 16 + crtl->args.pretend_args_size); asm_fprintf (f, "\tstr\t%r, [%r, #%d]\n", work_register, SP_REGNUM, offset + 4); diff --git a/gcc/config/arm/arm.h b/gcc/config/arm/arm.h index 3901768d8d6..a340441d386 100644 --- a/gcc/config/arm/arm.h +++ b/gcc/config/arm/arm.h @@ -1409,7 +1409,7 @@ do { \ couldn't convert a direct call into an indirect one. */ #define CALLER_INTERWORKING_SLOT_SIZE \ (TARGET_CALLER_INTERWORKING \ - && current_function_outgoing_args_size != 0 \ + && crtl->outgoing_args_size != 0 \ ? UNITS_PER_WORD : 0) /* Offset within stack frame to start allocating local variables at. @@ -1426,7 +1426,7 @@ do { \ /* Define this if the maximum size of all the outgoing args is to be accumulated and pushed during the prologue. The amount can be - found in the variable current_function_outgoing_args_size. */ + found in the variable crtl->outgoing_args_size. */ #define ACCUMULATE_OUTGOING_ARGS 1 /* Offset of first parameter from the argument pointer register value. */ diff --git a/gcc/config/avr/avr.c b/gcc/config/avr/avr.c index a68a065dab9..c440729b422 100644 --- a/gcc/config/avr/avr.c +++ b/gcc/config/avr/avr.c @@ -105,9 +105,6 @@ const struct base_arch_s *avr_current_arch; section *progmem_section; -/* More than 8K of program memory: use "call" and "jmp". */ -int avr_mega_p = 0; - /* Core have 'MUL*' instructions. */ int avr_have_mul_p = 0; @@ -203,7 +200,7 @@ static const struct mcu_type_s avr_mcu_types[] = { { "at76c711", ARCH_AVR3, "__AVR_AT76C711__" }, /* Classic, == 128K. */ { "avr31", ARCH_AVR31, NULL }, - { "atmega103", ARCH_AVR3, "__AVR_ATmega103__" }, + { "atmega103", ARCH_AVR31, "__AVR_ATmega103__" }, /* Classic + MOVW + JMP/CALL. */ { "avr35", ARCH_AVR35, NULL }, { "at90usb82", ARCH_AVR35, "__AVR_AT90USB82__" }, @@ -360,13 +357,13 @@ avr_override_options (void) base = &avr_arch_types[t->arch]; avr_asm_only_p = base->asm_only; avr_have_mul_p = base->have_mul; - avr_mega_p = base->have_jmp_call; avr_have_movw_lpmx_p = base->have_movw_lpmx; avr_base_arch_macro = base->macro; avr_extra_arch_macro = t->macro; if (optimize && !TARGET_NO_TABLEJUMP) - avr_case_values_threshold = (!AVR_MEGA || TARGET_CALL_PROLOGUES) ? 8 : 17; + avr_case_values_threshold = + (!AVR_HAVE_JMP_CALL || TARGET_CALL_PROLOGUES) ? 8 : 17; tmp_reg_rtx = gen_rtx_REG (QImode, TMP_REGNO); zero_reg_rtx = gen_rtx_REG (QImode, ZERO_REGNO); @@ -1148,7 +1145,7 @@ print_operand (FILE *file, rtx x, int code) if (code == '~') { - if (!AVR_MEGA) + if (!AVR_HAVE_JMP_CALL) fputc ('r', file); } else if (code == '!') @@ -1323,7 +1320,7 @@ avr_jump_mode (rtx x, rtx insn) return 1; else if (-2046 <= jump_distance && jump_distance <= 2045) return 2; - else if (AVR_MEGA) + else if (AVR_HAVE_JMP_CALL) return 3; return 2; @@ -2739,7 +2736,7 @@ int frame_pointer_required_p (void) { return (current_function_calls_alloca - || current_function_args_info.nregs == 0 + || crtl->args.info.nregs == 0 || get_frame_size () > 0); } @@ -4773,7 +4770,7 @@ avr_output_progmem_section_asm_op (const void *arg ATTRIBUTE_UNUSED) { fprintf (asm_out_file, "\t.section .progmem.gcc_sw_table, \"%s\", @progbits\n", - AVR_MEGA ? "a" : "ax"); + AVR_HAVE_JMP_CALL ? "a" : "ax"); /* Should already be aligned, this is just to be safe if it isn't. */ fprintf (asm_out_file, "\t.p2align 1\n"); } @@ -4783,7 +4780,7 @@ avr_output_progmem_section_asm_op (const void *arg ATTRIBUTE_UNUSED) static void avr_asm_init_sections (void) { - progmem_section = get_unnamed_section (AVR_MEGA ? 0 : SECTION_CODE, + progmem_section = get_unnamed_section (AVR_HAVE_JMP_CALL ? 0 : SECTION_CODE, avr_output_progmem_section_asm_op, NULL); readonly_data_section = data_section; @@ -5068,7 +5065,7 @@ avr_rtx_costs (rtx x, int code, int outer_code ATTRIBUTE_UNUSED, int *total) if (AVR_HAVE_MUL) *total = COSTS_N_INSNS (optimize_size ? 3 : 4); else if (optimize_size) - *total = COSTS_N_INSNS (AVR_MEGA ? 2 : 1); + *total = COSTS_N_INSNS (AVR_HAVE_JMP_CALL ? 2 : 1); else return false; break; @@ -5077,7 +5074,7 @@ avr_rtx_costs (rtx x, int code, int outer_code ATTRIBUTE_UNUSED, int *total) if (AVR_HAVE_MUL) *total = COSTS_N_INSNS (optimize_size ? 7 : 10); else if (optimize_size) - *total = COSTS_N_INSNS (AVR_MEGA ? 2 : 1); + *total = COSTS_N_INSNS (AVR_HAVE_JMP_CALL ? 2 : 1); else return false; break; @@ -5094,7 +5091,7 @@ avr_rtx_costs (rtx x, int code, int outer_code ATTRIBUTE_UNUSED, int *total) case UDIV: case UMOD: if (optimize_size) - *total = COSTS_N_INSNS (AVR_MEGA ? 2 : 1); + *total = COSTS_N_INSNS (AVR_HAVE_JMP_CALL ? 2 : 1); else return false; *total += avr_operand_rtx_cost (XEXP (x, 0), mode, code); diff --git a/gcc/config/avr/avr.h b/gcc/config/avr/avr.h index 72d08812e2c..7dbc76ce9de 100644 --- a/gcc/config/avr/avr.h +++ b/gcc/config/avr/avr.h @@ -82,7 +82,7 @@ extern const struct base_arch_s *avr_current_arch; builtin_define ("__AVR_HAVE_JMP_CALL__"); \ if (avr_current_arch->have_eijmp_eicall) \ { \ - builtin_define ("__AVR_HAVE_JMP_CALL__"); \ + builtin_define ("__AVR_HAVE_EIJMP_EICALL__"); \ builtin_define ("__AVR_3_BYTE_PC__"); \ } \ else \ @@ -96,7 +96,6 @@ extern const struct base_arch_s *avr_current_arch; extern const char *avr_base_arch_macro; extern const char *avr_extra_arch_macro; -extern int avr_mega_p; extern int avr_have_mul_p; extern int avr_asm_only_p; extern int avr_have_movw_lpmx_p; @@ -104,7 +103,6 @@ extern int avr_have_movw_lpmx_p; extern GTY(()) section *progmem_section; #endif -#define AVR_MEGA (avr_mega_p && !TARGET_SHORT_CALLS) #define AVR_HAVE_JMP_CALL (avr_current_arch->have_jmp_call && !TARGET_SHORT_CALLS) #define AVR_HAVE_MUL (avr_have_mul_p) #define AVR_HAVE_MOVW (avr_have_movw_lpmx_p) diff --git a/gcc/config/avr/avr.md b/gcc/config/avr/avr.md index b8a8f0ec0eb..922c4af2136 100644 --- a/gcc/config/avr/avr.md +++ b/gcc/config/avr/avr.md @@ -31,7 +31,7 @@ ;; o Displacement for (mem (plus (reg) (const_int))) operands. ;; p POST_INC or PRE_DEC address as a pointer (X, Y, Z) ;; r POST_INC or PRE_DEC address as a register (r26, r28, r30) -;; ~ Output 'r' if not AVR_MEGA. +;; ~ Output 'r' if not AVR_HAVE_JMP_CALL. ;; ! Output 'e' if AVR_HAVE_EIJMP_EICALL. ;; UNSPEC usage: @@ -74,7 +74,7 @@ (const_string "no")))) (define_attr "mcu_mega" "yes,no" - (const (if_then_else (symbol_ref "AVR_MEGA") + (const (if_then_else (symbol_ref "AVR_HAVE_JMP_CALL") (const_string "yes") (const_string "no")))) @@ -2260,7 +2260,7 @@ (label_ref (match_operand 0 "" "")))] "" "*{ - if (AVR_MEGA && get_attr_length (insn) != 1) + if (AVR_HAVE_JMP_CALL && get_attr_length (insn) != 1) return AS1 (jmp,%0); return AS1 (rjmp,%0); }" @@ -2412,7 +2412,7 @@ UNSPEC_INDEX_JMP)) (use (label_ref (match_operand 1 "" ""))) (clobber (match_dup 0))] - "AVR_MEGA && TARGET_CALL_PROLOGUES" + "AVR_HAVE_JMP_CALL && TARGET_CALL_PROLOGUES" "jmp __tablejump2__" [(set_attr "length" "2") (set_attr "cc" "clobber")]) @@ -2422,7 +2422,7 @@ UNSPEC_INDEX_JMP)) (use (label_ref (match_operand 1 "" ""))) (clobber (match_dup 0))] - "AVR_MEGA && AVR_HAVE_LPMX" + "AVR_HAVE_JMP_CALL && AVR_HAVE_LPMX" "lsl r30 rol r31 lpm __tmp_reg__,Z+ diff --git a/gcc/config/avr/libgcc.S b/gcc/config/avr/libgcc.S index 7879b18ea57..a63b26aa506 100644 --- a/gcc/config/avr/libgcc.S +++ b/gcc/config/avr/libgcc.S @@ -784,7 +784,7 @@ __do_clear_bss: /* __do_global_ctors and __do_global_dtors are only necessary if there are any constructors/destructors. */ -#if defined (__AVR_MEGA__) +#if defined (__AVR_HAVE_JMP_CALL__) #define XCALL call #else #define XCALL rcall diff --git a/gcc/config/bfin/bfin.c b/gcc/config/bfin/bfin.c index f50c09f9a99..d1a5c80d2a8 100644 --- a/gcc/config/bfin/bfin.c +++ b/gcc/config/bfin/bfin.c @@ -49,6 +49,7 @@ #include "langhooks.h" #include "bfin-protos.h" #include "tm-preds.h" +#include "tm-constrs.h" #include "gt-bfin.h" #include "basic-block.h" #include "cfglayout.h" @@ -779,9 +780,9 @@ bfin_initial_elimination_offset (int from, int to) if (to == STACK_POINTER_REGNUM) { - if (current_function_outgoing_args_size >= FIXED_STACK_AREA) - offset += current_function_outgoing_args_size; - else if (current_function_outgoing_args_size) + if (crtl->outgoing_args_size >= FIXED_STACK_AREA) + offset += crtl->outgoing_args_size; + else if (crtl->outgoing_args_size) offset += FIXED_STACK_AREA; offset += get_frame_size (); @@ -945,10 +946,10 @@ emit_link_insn (rtx spreg, HOST_WIDE_INT frame_size) static HOST_WIDE_INT arg_area_size (void) { - if (current_function_outgoing_args_size) + if (crtl->outgoing_args_size) { - if (current_function_outgoing_args_size >= FIXED_STACK_AREA) - return current_function_outgoing_args_size; + if (crtl->outgoing_args_size >= FIXED_STACK_AREA) + return crtl->outgoing_args_size; else return FIXED_STACK_AREA; } @@ -2286,7 +2287,7 @@ bfin_secondary_reload (bool in_p, rtx x, enum reg_class class, if (fp_plus_const_operand (x, mode)) { rtx op2 = XEXP (x, 1); - int large_constant_p = ! CONST_7BIT_IMM_P (INTVAL (op2)); + int large_constant_p = ! satisfies_constraint_Ks7 (op2); if (class == PREGS || class == PREGS_CLOBBERED) return NO_REGS; @@ -2712,7 +2713,7 @@ split_load_immediate (rtx operands[]) if (D_REGNO_P (regno)) { - if (CONST_7BIT_IMM_P (tmp)) + if (tmp >= -64 && tmp <= 63) { emit_insn (gen_movsi (operands[0], GEN_INT (tmp))); emit_insn (gen_movstricthi_high (operands[0], GEN_INT (val & -65536))); @@ -2739,7 +2740,7 @@ split_load_immediate (rtx operands[]) return 0; if (optimize_size - && num_compl_zero && CONST_7BIT_IMM_P (shifted_compl)) + && num_compl_zero && shifted_compl >= -64 && shifted_compl <= 63) { /* If optimizing for size, generate a sequence that has more instructions but is shorter. */ @@ -2870,7 +2871,7 @@ bfin_rtx_costs (rtx x, int code, int outer_code, int *total) { case CONST_INT: if (outer_code == SET || outer_code == PLUS) - *total = CONST_7BIT_IMM_P (INTVAL (x)) ? 0 : cost2; + *total = satisfies_constraint_Ks7 (x) ? 0 : cost2; else if (outer_code == AND) *total = log2constp (~INTVAL (x)) ? 0 : cost2; else if (outer_code == LE || outer_code == LT || outer_code == EQ) @@ -2928,7 +2929,7 @@ bfin_rtx_costs (rtx x, int code, int outer_code, int *total) { *total = 6 * cost2; if (GET_CODE (op1) != CONST_INT - || !CONST_7BIT_IMM_P (INTVAL (op1))) + || !satisfies_constraint_Ks7 (op1)) *total += rtx_cost (op1, PLUS); if (GET_CODE (op0) != REG && (GET_CODE (op0) != SUBREG || GET_CODE (SUBREG_REG (op0)) != REG)) diff --git a/gcc/config/bfin/bfin.h b/gcc/config/bfin/bfin.h index d9b2762b48f..3850c62ee38 100644 --- a/gcc/config/bfin/bfin.h +++ b/gcc/config/bfin/bfin.h @@ -287,7 +287,7 @@ extern const char *bfin_library_id_string; /* Define this if the maximum size of all the outgoing args is to be accumulated and pushed during the prologue. The amount can be - found in the variable current_function_outgoing_args_size. */ + found in the variable crtl->outgoing_args_size. */ #define ACCUMULATE_OUTGOING_ARGS 1 /* Value should be nonzero if functions must have frame pointers. @@ -677,43 +677,6 @@ enum reg_class #define REGNO_OK_FOR_INDEX_P(X) 0 -/* Get reg_class from a letter such as appears in the machine description. */ - -#define REG_CLASS_FROM_CONSTRAINT(LETTER, STR) \ - ((LETTER) == 'a' ? PREGS : \ - (LETTER) == 'Z' ? FDPIC_REGS : \ - (LETTER) == 'Y' ? FDPIC_FPTR_REGS : \ - (LETTER) == 'd' ? DREGS : \ - (LETTER) == 'z' ? PREGS_CLOBBERED : \ - (LETTER) == 'D' ? EVEN_DREGS : \ - (LETTER) == 'W' ? ODD_DREGS : \ - (LETTER) == 'e' ? AREGS : \ - (LETTER) == 'A' ? EVEN_AREGS : \ - (LETTER) == 'B' ? ODD_AREGS : \ - (LETTER) == 'b' ? IREGS : \ - (LETTER) == 'v' ? BREGS : \ - (LETTER) == 'f' ? MREGS : \ - (LETTER) == 'c' ? CIRCREGS : \ - (LETTER) == 'C' ? CCREGS : \ - (LETTER) == 't' ? LT_REGS : \ - (LETTER) == 'k' ? LC_REGS : \ - (LETTER) == 'u' ? LB_REGS : \ - (LETTER) == 'x' ? MOST_REGS : \ - (LETTER) == 'y' ? PROLOGUE_REGS : \ - (LETTER) == 'w' ? NON_A_CC_REGS : \ - (LETTER) == 'q' \ - ? ((STR)[1] == '0' ? D0REGS \ - : (STR)[1] == '1' ? D1REGS \ - : (STR)[1] == '2' ? D2REGS \ - : (STR)[1] == '3' ? D3REGS \ - : (STR)[1] == '4' ? D4REGS \ - : (STR)[1] == '5' ? D5REGS \ - : (STR)[1] == '6' ? D6REGS \ - : (STR)[1] == '7' ? D7REGS \ - : (STR)[1] == 'A' ? P0REGS \ - : NO_REGS) : \ - NO_REGS) - /* The same information, inverted: Return the class number of the smallest class containing reg number REGNO. This could be a conditional expression @@ -1198,89 +1161,6 @@ do { \ #define WORD_REGISTER_OPERATIONS */ -#define CONST_18UBIT_IMM_P(VALUE) ((VALUE) >= 0 && (VALUE) <= 262140) -#define CONST_16BIT_IMM_P(VALUE) ((VALUE) >= -32768 && (VALUE) <= 32767) -#define CONST_16UBIT_IMM_P(VALUE) ((VALUE) >= 0 && (VALUE) <= 65535) -#define CONST_7BIT_IMM_P(VALUE) ((VALUE) >= -64 && (VALUE) <= 63) -#define CONST_7NBIT_IMM_P(VALUE) ((VALUE) >= -64 && (VALUE) <= 0) -#define CONST_5UBIT_IMM_P(VALUE) ((VALUE) >= 0 && (VALUE) <= 31) -#define CONST_4BIT_IMM_P(VALUE) ((VALUE) >= -8 && (VALUE) <= 7) -#define CONST_4UBIT_IMM_P(VALUE) ((VALUE) >= 0 && (VALUE) <= 15) -#define CONST_3BIT_IMM_P(VALUE) ((VALUE) >= -4 && (VALUE) <= 3) -#define CONST_3UBIT_IMM_P(VALUE) ((VALUE) >= 0 && (VALUE) <= 7) - -#define CONSTRAINT_LEN(C, STR) \ - ((C) == 'P' || (C) == 'M' || (C) == 'N' || (C) == 'q' ? 2 \ - : (C) == 'K' ? 3 \ - : DEFAULT_CONSTRAINT_LEN ((C), (STR))) - -#define CONST_OK_FOR_P(VALUE, STR) \ - ((STR)[1] == '0' ? (VALUE) == 0 \ - : (STR)[1] == '1' ? (VALUE) == 1 \ - : (STR)[1] == '2' ? (VALUE) == 2 \ - : (STR)[1] == '3' ? (VALUE) == 3 \ - : (STR)[1] == '4' ? (VALUE) == 4 \ - : (STR)[1] == 'A' ? (VALUE) != MACFLAG_M && (VALUE) != MACFLAG_IS_M \ - : (STR)[1] == 'B' ? (VALUE) == MACFLAG_M || (VALUE) == MACFLAG_IS_M \ - : 0) - -#define CONST_OK_FOR_K(VALUE, STR) \ - ((STR)[1] == 'u' \ - ? ((STR)[2] == '3' ? CONST_3UBIT_IMM_P (VALUE) \ - : (STR)[2] == '4' ? CONST_4UBIT_IMM_P (VALUE) \ - : (STR)[2] == '5' ? CONST_5UBIT_IMM_P (VALUE) \ - : (STR)[2] == 'h' ? CONST_16UBIT_IMM_P (VALUE) \ - : 0) \ - : (STR)[1] == 's' \ - ? ((STR)[2] == '3' ? CONST_3BIT_IMM_P (VALUE) \ - : (STR)[2] == '4' ? CONST_4BIT_IMM_P (VALUE) \ - : (STR)[2] == '7' ? CONST_7BIT_IMM_P (VALUE) \ - : (STR)[2] == 'h' ? CONST_16BIT_IMM_P (VALUE) \ - : 0) \ - : (STR)[1] == 'n' \ - ? ((STR)[2] == '7' ? CONST_7NBIT_IMM_P (VALUE) \ - : 0) \ - : (STR)[1] == 'N' \ - ? ((STR)[2] == '7' ? CONST_7BIT_IMM_P (-(VALUE)) \ - : 0) \ - : 0) - -#define CONST_OK_FOR_M(VALUE, STR) \ - ((STR)[1] == '1' ? (VALUE) == 255 \ - : (STR)[1] == '2' ? (VALUE) == 65535 \ - : 0) - -/* The letters I, J, K, L and M in a register constraint string - can be used to stand for particular ranges of immediate operands. - This macro defines what the ranges are. - C is the letter, and VALUE is a constant value. - Return 1 if VALUE is in the range specified by C. - - bfin constant operands are as follows - - J 2**N 5bit imm scaled - Ks7 -64 .. 63 signed 7bit imm - Ku5 0..31 unsigned 5bit imm - Ks4 -8 .. 7 signed 4bit imm - Ks3 -4 .. 3 signed 3bit imm - Ku3 0 .. 7 unsigned 3bit imm - Pn 0, 1, 2 constants 0, 1 or 2, corresponding to n -*/ -#define CONST_OK_FOR_CONSTRAINT_P(VALUE, C, STR) \ - ((C) == 'J' ? (log2constp (VALUE)) \ - : (C) == 'K' ? CONST_OK_FOR_K (VALUE, STR) \ - : (C) == 'L' ? log2constp (~(VALUE)) \ - : (C) == 'M' ? CONST_OK_FOR_M (VALUE, STR) \ - : (C) == 'P' ? CONST_OK_FOR_P (VALUE, STR) \ - : 0) - - /*Constant Output Formats */ -#define CONST_DOUBLE_OK_FOR_LETTER_P(VALUE, C) \ - ((C) == 'H' ? 1 : 0) - -#define EXTRA_CONSTRAINT(VALUE, D) \ - ((D) == 'Q' ? GET_CODE (VALUE) == SYMBOL_REF : 0) - /* Evaluates to true if A and B are mac flags that can be used together in a single multiply insn. That is the case if they are both the same flag not involving M, or if one is a combination of diff --git a/gcc/config/bfin/bfin.md b/gcc/config/bfin/bfin.md index 2a4631dd66d..f535799b624 100644 --- a/gcc/config/bfin/bfin.md +++ b/gcc/config/bfin/bfin.md @@ -258,7 +258,7 @@ ;; Operand and operator predicates (include "predicates.md") - +(include "constraints.md") ;;; FRIO branches have been optimized for code density ;;; this comes at a slight cost of complexity when @@ -1018,7 +1018,7 @@ xops[7] = gen_rtx_REG (BImode, REG_CC); if (!register_operand (xops[4], SImode) && (GET_CODE (xops[4]) != CONST_INT - || !CONST_OK_FOR_K (INTVAL (xops[4]), "Ks7"))) + || !satisfies_constraint_Ks7 (xops[4]))) xops[4] = force_reg (SImode, xops[4]); if (!reg_overlap_mentioned_p (operands[0], operands[1]) && !reg_overlap_mentioned_p (operands[0], operands[2])) @@ -1027,7 +1027,7 @@ emit_insn (gen_movbisi (xops[6], xops[7])); if (!register_operand (xops[5], SImode) && (GET_CODE (xops[5]) != CONST_INT - || !CONST_OK_FOR_K (INTVAL (xops[5]), "Ks7"))) + || !satisfies_constraint_Ks7 (xops[5]))) xops[5] = force_reg (SImode, xops[5]); if (xops[5] != const0_rtx) emit_insn (gen_addsi3 (xops[1], xops[3], xops[5])); diff --git a/gcc/config/bfin/predicates.md b/gcc/config/bfin/predicates.md index ec261336d43..23ca2e4c825 100644 --- a/gcc/config/bfin/predicates.md +++ b/gcc/config/bfin/predicates.md @@ -34,7 +34,7 @@ ;; if the constant would be cheap to load. (define_predicate "highbits_operand" (and (match_code "const_int") - (match_test "log2constp (-INTVAL (op)) && !CONST_7BIT_IMM_P (INTVAL (op))"))) + (match_test "log2constp (-INTVAL (op)) && !satisfies_constraint_Ks7 (op)"))) ;; Return nonzero if OP is suitable as a right-hand side operand for an ;; andsi3 operation. @@ -99,7 +99,7 @@ (define_predicate "reg_or_7bit_operand" (ior (match_operand 0 "register_operand") (and (match_code "const_int") - (match_test "CONST_7BIT_IMM_P (INTVAL (op))")))) + (match_test "satisfies_constraint_Ks7 (op)")))) ;; Return nonzero if OP is a register other than DREG and PREG. (define_predicate "nondp_register_operand" @@ -123,7 +123,7 @@ (define_predicate "reg_or_neg7bit_operand" (ior (match_operand 0 "register_operand") (and (match_code "const_int") - (match_test "CONST_7BIT_IMM_P (-INTVAL (op))")))) + (match_test "satisfies_constraint_KN7 (op)")))) ;; Used for secondary reloads, this function returns 1 if OP is of the ;; form (plus (fp) (const_int)). diff --git a/gcc/config/cris/cris.c b/gcc/config/cris/cris.c index ba572eb82db..87fef5a2f90 100644 --- a/gcc/config/cris/cris.c +++ b/gcc/config/cris/cris.c @@ -1206,7 +1206,7 @@ cris_initial_frame_pointer_offset (void) offs += get_frame_size (); /* And more; the accumulated args size. */ - offs += current_function_outgoing_args_size; + offs += crtl->outgoing_args_size; /* Then round it off, in case we use aligned stack. */ if (TARGET_STACK_ALIGN) @@ -1700,9 +1700,9 @@ cris_simple_epilogue (void) if (! reload_completed || frame_pointer_needed || get_frame_size () != 0 - || current_function_pretend_args_size - || current_function_args_size - || current_function_outgoing_args_size + || crtl->args.pretend_args_size + || crtl->args.size + || crtl->outgoing_args_size || current_function_calls_eh_return /* If we're not supposed to emit prologue and epilogue, we must @@ -1883,7 +1883,12 @@ cris_address_cost (rtx x) rtx tem1 = XEXP (x, 0); rtx tem2 = XEXP (x, 1); - /* We'll "assume" canonical RTX. */ + /* Local extended canonicalization rule: the first operand must + be REG, unless it's an operation (MULT). */ + if (!REG_P (tem1) && GET_CODE (tem1) != MULT) + tem1 = tem2, tem2 = XEXP (x, 0); + + /* We'll "assume" we have canonical RTX now. */ gcc_assert (REG_P (tem1) || GET_CODE (tem1) == MULT); /* A BIAP is 2 extra bytes for the prefix insn, nothing more. We @@ -2731,14 +2736,14 @@ cris_expand_prologue (void) int regno; int size = get_frame_size (); /* Shorten the used name for readability. */ - int cfoa_size = current_function_outgoing_args_size; + int cfoa_size = crtl->outgoing_args_size; int last_movem_reg = -1; int framesize = 0; rtx mem, insn; int return_address_on_stack = cris_return_address_on_stack (); int got_really_used = false; int n_movem_regs = 0; - int pretend = current_function_pretend_args_size; + int pretend = crtl->args.pretend_args_size; /* Don't do anything if no prologues or epilogues are wanted. */ if (!TARGET_PROLOGUE_EPILOGUE) @@ -2765,7 +2770,7 @@ cris_expand_prologue (void) { /* See also cris_setup_incoming_varargs where cfun->machine->stdarg_regs is set. There are other setters of - current_function_pretend_args_size than stdarg handling, like + crtl->args.pretend_args_size than stdarg handling, like for an argument passed with parts in R13 and stack. We must not store R13 into the pretend-area for that case, as GCC does that itself. "Our" store would be marked as redundant and GCC @@ -2799,7 +2804,7 @@ cris_expand_prologue (void) get confused. */ } - /* For other setters of current_function_pretend_args_size, we + /* For other setters of crtl->args.pretend_args_size, we just adjust the stack by leaving the remaining size in "pretend", handled below. */ } @@ -3012,8 +3017,8 @@ cris_expand_epilogue (void) int regno; int size = get_frame_size (); int last_movem_reg = -1; - int argspace_offset = current_function_outgoing_args_size; - int pretend = current_function_pretend_args_size; + int argspace_offset = crtl->outgoing_args_size; + int pretend = crtl->args.pretend_args_size; rtx mem; bool return_address_on_stack = cris_return_address_on_stack (); /* A reference may have been optimized out diff --git a/gcc/config/cris/cris.md b/gcc/config/cris/cris.md index 1200a2283cb..97353cd8df0 100644 --- a/gcc/config/cris/cris.md +++ b/gcc/config/cris/cris.md @@ -2958,7 +2958,7 @@ (define_insn "*andhi_lowpart_non_v32" [(set (strict_low_part - (match_operand:HI 0 "register_operand" "=r,r, r,r,r,r")) + (match_operand:HI 0 "register_operand" "+r,r, r,r,r,r")) (and:HI (match_operand:HI 1 "register_operand" "%0,0, 0,0,0,r") (match_operand:HI 2 "general_operand" "r,Q>,L,O,g,!To")))] "!TARGET_V32" @@ -2974,7 +2974,7 @@ (define_insn "*andhi_lowpart_v32" [(set (strict_low_part - (match_operand:HI 0 "register_operand" "=r,r,r,r,r")) + (match_operand:HI 0 "register_operand" "+r,r,r,r,r")) (and:HI (match_operand:HI 1 "register_operand" "%0,0,0,0,0") (match_operand:HI 2 "general_operand" "r,Q>,L,O,g")))] "TARGET_V32" @@ -3025,7 +3025,7 @@ (define_insn "*andqi_lowpart_non_v32" [(set (strict_low_part - (match_operand:QI 0 "register_operand" "=r,r, r,r,r")) + (match_operand:QI 0 "register_operand" "+r,r, r,r,r")) (and:QI (match_operand:QI 1 "register_operand" "%0,0, 0,0,r") (match_operand:QI 2 "general_operand" "r,Q>,O,g,!To")))] "!TARGET_V32" @@ -3040,7 +3040,7 @@ (define_insn "*andqi_lowpart_v32" [(set (strict_low_part - (match_operand:QI 0 "register_operand" "=r,r,r,r")) + (match_operand:QI 0 "register_operand" "+r,r,r,r")) (and:QI (match_operand:QI 1 "register_operand" "%0,0,0,0") (match_operand:QI 2 "general_operand" "r,Q>,O,g")))] "TARGET_V32" diff --git a/gcc/config/crx/crx.c b/gcc/config/crx/crx.c index 5be938bc06d..9e8c3a97cf1 100644 --- a/gcc/config/crx/crx.c +++ b/gcc/config/crx/crx.c @@ -318,7 +318,7 @@ crx_compute_frame (void) local_vars_size += padding_locals; size_for_adjusting_sp = local_vars_size + (ACCUMULATE_OUTGOING_ARGS ? - current_function_outgoing_args_size : 0); + crtl->outgoing_args_size : 0); } /* Implements the macro INITIAL_ELIMINATION_OFFSET, return the OFFSET. */ @@ -334,13 +334,13 @@ crx_initial_elimination_offset (int from, int to) if ((from) == FRAME_POINTER_REGNUM && (to) == STACK_POINTER_REGNUM) return (ACCUMULATE_OUTGOING_ARGS ? - current_function_outgoing_args_size : 0); + crtl->outgoing_args_size : 0); else if ((from) == ARG_POINTER_REGNUM && (to) == FRAME_POINTER_REGNUM) return (sum_regs + local_vars_size); else if ((from) == ARG_POINTER_REGNUM && (to) == STACK_POINTER_REGNUM) return (sum_regs + local_vars_size + (ACCUMULATE_OUTGOING_ARGS ? - current_function_outgoing_args_size : 0)); + crtl->outgoing_args_size : 0)); else abort (); } diff --git a/gcc/config/fr30/fr30.c b/gcc/config/fr30/fr30.c index 8c523567bb9..78f7775c658 100644 --- a/gcc/config/fr30/fr30.c +++ b/gcc/config/fr30/fr30.c @@ -181,8 +181,8 @@ fr30_compute_frame_size (int from_reg, int to_reg) unsigned int gmask; var_size = WORD_ALIGN (get_frame_size ()); - args_size = WORD_ALIGN (current_function_outgoing_args_size); - pretend_size = current_function_pretend_args_size; + args_size = WORD_ALIGN (crtl->outgoing_args_size); + pretend_size = crtl->args.pretend_args_size; reg_size = 0; gmask = 0; diff --git a/gcc/config/fr30/fr30.h b/gcc/config/fr30/fr30.h index 7a39a11d96f..0f7592d490a 100644 --- a/gcc/config/fr30/fr30.h +++ b/gcc/config/fr30/fr30.h @@ -534,7 +534,7 @@ enum reg_class register. See `FIXED_REGISTERS' for more information. */ /* #define FRAME_POINTER_REQUIRED 0 */ #define FRAME_POINTER_REQUIRED \ - (flag_omit_frame_pointer == 0 || current_function_pretend_args_size > 0) + (flag_omit_frame_pointer == 0 || crtl->args.pretend_args_size > 0) /* If defined, this macro specifies a table of register pairs used to eliminate unneeded registers that point into the stack frame. If it is not defined, @@ -586,7 +586,7 @@ enum reg_class /* If defined, the maximum amount of space required for outgoing arguments will be computed and placed into the variable - `current_function_outgoing_args_size'. No space will be pushed onto the + `crtl->outgoing_args_size'. No space will be pushed onto the stack for each call; instead, the function prologue should increase the stack frame size by this amount. diff --git a/gcc/config/frv/frv.h b/gcc/config/frv/frv.h index feb88d56946..6c86ef569f2 100644 --- a/gcc/config/frv/frv.h +++ b/gcc/config/frv/frv.h @@ -1620,7 +1620,7 @@ typedef struct frv_stack { /* If defined, the maximum amount of space required for outgoing arguments will be computed and placed into the variable - `current_function_outgoing_args_size'. No space will be pushed onto the + `crtl->outgoing_args_size'. No space will be pushed onto the stack for each call; instead, the function prologue should increase the stack frame size by this amount. diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index 14aac468918..6fcbe6637e1 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -54,6 +54,7 @@ along with GCC; see the file COPYING3. If not see #include "params.h" static int x86_builtin_vectorization_cost (bool); +static rtx legitimize_dllimport_symbol (rtx, bool); #ifndef CHECK_STACK_LIMIT #define CHECK_STACK_LIMIT (-1) @@ -3250,12 +3251,33 @@ ix86_function_regparm (const_tree type, const_tree decl) tree attr; int regparm = ix86_regparm; + static bool error_issued; + if (TARGET_64BIT) return regparm; attr = lookup_attribute ("regparm", TYPE_ATTRIBUTES (type)); if (attr) - return TREE_INT_CST_LOW (TREE_VALUE (TREE_VALUE (attr))); + { + regparm + = TREE_INT_CST_LOW (TREE_VALUE (TREE_VALUE (attr))); + + if (decl && TREE_CODE (decl) == FUNCTION_DECL) + { + /* We can't use regparm(3) for nested functions because + these pass static chain pointer in %ecx register. */ + if (!error_issued && regparm == 3 + && decl_function_context (decl) + && !DECL_NO_STATIC_CHAIN (decl)) + { + error ("nested functions are limited to 2 register parameters"); + error_issued = true; + return 0; + } + } + + return regparm; + } if (lookup_attribute ("fastcall", TYPE_ATTRIBUTES (type))) return 2; @@ -5182,9 +5204,9 @@ ix86_va_start (tree valist, rtx nextarg) sav = build3 (COMPONENT_REF, TREE_TYPE (f_sav), valist, f_sav, NULL_TREE); /* Count number of gp and fp argument registers used. */ - words = current_function_args_info.words; - n_gpr = current_function_args_info.regno; - n_fpr = current_function_args_info.sse_regno; + words = crtl->args.info.words; + n_gpr = crtl->args.info.regno; + n_fpr = crtl->args.info.sse_regno; if (cfun->va_list_gpr_size) { @@ -5728,8 +5750,8 @@ ix86_can_use_return_insn_p (void) /* Don't allow more than 32 pop, since that's all we can do with one instruction. */ - if (current_function_pops_args - && current_function_args_size >= 32768) + if (crtl->args.pops_args + && crtl->args.size >= 32768) return 0; ix86_compute_frame_layout (&frame); @@ -6160,14 +6182,14 @@ ix86_compute_frame_layout (struct ix86_frame *frame) /* Add outgoing arguments area. Can be skipped if we eliminated all the function calls as dead code. Skipping is however impossible when function calls alloca. Alloca - expander assumes that last current_function_outgoing_args_size + expander assumes that last crtl->outgoing_args_size of stack frame are unused. */ if (ACCUMULATE_OUTGOING_ARGS && (!current_function_is_leaf || current_function_calls_alloca || ix86_current_function_calls_tls_descriptor)) { - offset += current_function_outgoing_args_size; - frame->outgoing_arguments_size = current_function_outgoing_args_size; + offset += crtl->outgoing_args_size; + frame->outgoing_arguments_size = crtl->outgoing_args_size; } else frame->outgoing_arguments_size = 0; @@ -6728,15 +6750,15 @@ ix86_expand_epilogue (int style) if (style == 0) return; - if (current_function_pops_args && current_function_args_size) + if (crtl->args.pops_args && crtl->args.size) { - rtx popc = GEN_INT (current_function_pops_args); + rtx popc = GEN_INT (crtl->args.pops_args); /* i386 can only pop 64K bytes. If asked to pop more, pop return address, do explicit add, and jump indirectly to the caller. */ - if (current_function_pops_args >= 65536) + if (crtl->args.pops_args >= 65536) { rtx ecx = gen_rtx_REG (SImode, CX_REG); @@ -7639,10 +7661,18 @@ legitimize_pic_address (rtx orig, rtx reg) see gotoff_operand. */ || (TARGET_VXWORKS_RTP && GET_CODE (addr) == LABEL_REF)) { - /* Given that we've already handled dllimport variables separately - in legitimize_address, and all other variables should satisfy - legitimate_pic_address_disp_p, we should never arrive here. */ - gcc_assert (!TARGET_64BIT_MS_ABI); + if (TARGET_DLLIMPORT_DECL_ATTRIBUTES) + { + if (GET_CODE (addr) == SYMBOL_REF && SYMBOL_REF_DLLIMPORT_P (addr)) + return legitimize_dllimport_symbol (addr, true); + if (GET_CODE (addr) == CONST && GET_CODE (XEXP (addr, 0)) == PLUS + && GET_CODE (XEXP (XEXP (addr, 0), 0)) == SYMBOL_REF + && SYMBOL_REF_DLLIMPORT_P (XEXP (XEXP (addr, 0), 0))) + { + rtx t = legitimize_dllimport_symbol (XEXP (XEXP (addr, 0), 0), true); + return gen_rtx_PLUS (Pmode, t, XEXP (XEXP (addr, 0), 1)); + } + } if (TARGET_64BIT && ix86_cmodel != CM_LARGE_PIC) { diff --git a/gcc/config/i386/i386.h b/gcc/config/i386/i386.h index faf0a18937c..bb6fa18d99d 100644 --- a/gcc/config/i386/i386.h +++ b/gcc/config/i386/i386.h @@ -1603,7 +1603,7 @@ enum reg_class /* If defined, the maximum amount of space required for outgoing arguments will be computed and placed into the variable - `current_function_outgoing_args_size'. No space will be pushed onto the + `crtl->outgoing_args_size'. No space will be pushed onto the stack for each call; instead, the function prologue should increase the stack frame size by this amount. */ diff --git a/gcc/config/i386/i386.md b/gcc/config/i386/i386.md index 7b65a9e705e..d428c3b58d9 100644 --- a/gcc/config/i386/i386.md +++ b/gcc/config/i386/i386.md @@ -548,7 +548,8 @@ (define_code_iterator umaxmin [umax umin]) ;; Base name for integer and FP insn mnemonic -(define_code_attr maxminiprefix [(smax "maxs") (smin "mins") (umax "maxu") (umin "minu")]) +(define_code_attr maxminiprefix [(smax "maxs") (smin "mins") + (umax "maxu") (umin "minu")]) (define_code_attr maxminfprefix [(smax "max") (smin "min")]) ;; Mapping of parallel logic operators @@ -557,6 +558,12 @@ ;; Base name for insn mnemonic. (define_code_attr plogicprefix [(and "and") (ior "or") (xor "xor")]) +;; Mapping of abs neg operators +(define_code_iterator absneg [abs neg]) + +;; Base name for x87 insn mnemonic. +(define_code_attr absnegprefix [(abs "abs") (neg "chs")]) + ;; All single word integer modes. (define_mode_iterator SWI [QI HI SI (DI "TARGET_64BIT")]) @@ -10379,17 +10386,11 @@ ;; Changing of sign for FP values is doable using integer unit too. -(define_expand "neg<mode>2" - [(set (match_operand:X87MODEF 0 "register_operand" "") - (neg:X87MODEF (match_operand:X87MODEF 1 "register_operand" "")))] - "TARGET_80387 || (SSE_FLOAT_MODE_P (<MODE>mode) && TARGET_SSE_MATH)" - "ix86_expand_fp_absneg_operator (NEG, <MODE>mode, operands); DONE;") - -(define_expand "abs<mode>2" +(define_expand "<code><mode>2" [(set (match_operand:X87MODEF 0 "register_operand" "") - (abs:X87MODEF (match_operand:X87MODEF 1 "register_operand" "")))] + (absneg:X87MODEF (match_operand:X87MODEF 1 "register_operand" "")))] "TARGET_80387 || (SSE_FLOAT_MODE_P (<MODE>mode) && TARGET_SSE_MATH)" - "ix86_expand_fp_absneg_operator (ABS, <MODE>mode, operands); DONE;") + "ix86_expand_fp_absneg_operator (<CODE>, <MODE>mode, operands); DONE;") (define_insn "*absneg<mode>2_mixed" [(set (match_operand:MODEF 0 "register_operand" "=x,x,f,!r") @@ -10418,17 +10419,11 @@ "TARGET_80387 && !(SSE_FLOAT_MODE_P (<MODE>mode) && TARGET_SSE_MATH)" "#") -(define_expand "negtf2" - [(set (match_operand:TF 0 "register_operand" "") - (neg:TF (match_operand:TF 1 "register_operand" "")))] - "TARGET_64BIT" - "ix86_expand_fp_absneg_operator (NEG, TFmode, operands); DONE;") - -(define_expand "abstf2" +(define_expand "<code>tf2" [(set (match_operand:TF 0 "register_operand" "") - (abs:TF (match_operand:TF 1 "register_operand" "")))] + (absneg:TF (match_operand:TF 1 "register_operand" "")))] "TARGET_64BIT" - "ix86_expand_fp_absneg_operator (ABS, TFmode, operands); DONE;") + "ix86_expand_fp_absneg_operator (<CODE>, TFmode, operands); DONE;") (define_insn "*absnegtf2_sse" [(set (match_operand:TF 0 "register_operand" "=x,x") @@ -10568,75 +10563,40 @@ ;; Conditionalize these after reload. If they match before reload, we ;; lose the clobber and ability to use integer instructions. -(define_insn "*neg<mode>2_1" +(define_insn "*<code><mode>2_1" [(set (match_operand:X87MODEF 0 "register_operand" "=f") - (neg:X87MODEF (match_operand:X87MODEF 1 "register_operand" "0")))] + (absneg:X87MODEF (match_operand:X87MODEF 1 "register_operand" "0")))] "TARGET_80387 - && (reload_completed || !(SSE_FLOAT_MODE_P (<MODE>mode) && TARGET_SSE_MATH))" - "fchs" + && (reload_completed + || !(SSE_FLOAT_MODE_P (<MODE>mode) && TARGET_SSE_MATH))" + "f<absnegprefix>" [(set_attr "type" "fsgn") (set_attr "mode" "<MODE>")]) -(define_insn "*abs<mode>2_1" - [(set (match_operand:X87MODEF 0 "register_operand" "=f") - (abs:X87MODEF (match_operand:X87MODEF 1 "register_operand" "0")))] - "TARGET_80387 - && (reload_completed || !(SSE_FLOAT_MODE_P (<MODE>mode) && TARGET_SSE_MATH))" - "fabs" - [(set_attr "type" "fsgn") - (set_attr "mode" "<MODE>")]) - -(define_insn "*negextendsfdf2" +(define_insn "*<code>extendsfdf2" [(set (match_operand:DF 0 "register_operand" "=f") - (neg:DF (float_extend:DF - (match_operand:SF 1 "register_operand" "0"))))] + (absneg:DF (float_extend:DF + (match_operand:SF 1 "register_operand" "0"))))] "TARGET_80387 && (!TARGET_SSE_MATH || TARGET_MIX_SSE_I387)" - "fchs" + "f<absnegprefix>" [(set_attr "type" "fsgn") (set_attr "mode" "DF")]) -(define_insn "*negextenddfxf2" +(define_insn "*<code>extendsfxf2" [(set (match_operand:XF 0 "register_operand" "=f") - (neg:XF (float_extend:XF - (match_operand:DF 1 "register_operand" "0"))))] + (absneg:XF (float_extend:XF + (match_operand:SF 1 "register_operand" "0"))))] "TARGET_80387" - "fchs" + "f<absnegprefix>" [(set_attr "type" "fsgn") (set_attr "mode" "XF")]) -(define_insn "*negextendsfxf2" +(define_insn "*<code>extenddfxf2" [(set (match_operand:XF 0 "register_operand" "=f") - (neg:XF (float_extend:XF - (match_operand:SF 1 "register_operand" "0"))))] + (absneg:XF (float_extend:XF + (match_operand:DF 1 "register_operand" "0"))))] "TARGET_80387" - "fchs" - [(set_attr "type" "fsgn") - (set_attr "mode" "XF")]) - -(define_insn "*absextendsfdf2" - [(set (match_operand:DF 0 "register_operand" "=f") - (abs:DF (float_extend:DF - (match_operand:SF 1 "register_operand" "0"))))] - "TARGET_80387 && (!TARGET_SSE_MATH || TARGET_MIX_SSE_I387)" - "fabs" - [(set_attr "type" "fsgn") - (set_attr "mode" "DF")]) - -(define_insn "*absextenddfxf2" - [(set (match_operand:XF 0 "register_operand" "=f") - (abs:XF (float_extend:XF - (match_operand:DF 1 "register_operand" "0"))))] - "TARGET_80387" - "fabs" - [(set_attr "type" "fsgn") - (set_attr "mode" "XF")]) - -(define_insn "*absextendsfxf2" - [(set (match_operand:XF 0 "register_operand" "=f") - (abs:XF (float_extend:XF - (match_operand:SF 1 "register_operand" "0"))))] - "TARGET_80387" - "fabs" + "f<absnegprefix>" [(set_attr "type" "fsgn") (set_attr "mode" "XF")]) @@ -14806,9 +14766,9 @@ [(return)] "ix86_can_use_return_insn_p ()" { - if (current_function_pops_args) + if (crtl->args.pops_args) { - rtx popc = GEN_INT (current_function_pops_args); + rtx popc = GEN_INT (crtl->args.pops_args); emit_jump_insn (gen_return_pop_internal (popc)); DONE; } @@ -21067,26 +21027,24 @@ "TARGET_64BIT && INTVAL (operands[4]) + SSE_REGPARM_MAX * 16 - 16 < 128 && INTVAL (operands[4]) + INTVAL (operands[2]) * 16 >= -128" - "* { int i; operands[0] = gen_rtx_MEM (Pmode, gen_rtx_PLUS (Pmode, operands[0], operands[4])); - output_asm_insn (\"jmp\\t%A1\", operands); + output_asm_insn ("jmp\t%A1", operands); for (i = SSE_REGPARM_MAX - 1; i >= INTVAL (operands[2]); i--) { operands[4] = adjust_address (operands[0], DImode, i*16); operands[5] = gen_rtx_REG (TImode, SSE_REGNO (i)); PUT_MODE (operands[4], TImode); if (GET_CODE (XEXP (operands[0], 0)) != PLUS) - output_asm_insn (\"rex\", operands); - output_asm_insn (\"movaps\\t{%5, %4|%4, %5}\", operands); + output_asm_insn ("rex", operands); + output_asm_insn ("movaps\t{%5, %4|%4, %5}", operands); } - (*targetm.asm_out.internal_label) (asm_out_file, \"L\", - CODE_LABEL_NUMBER (operands[3])); - return \"\"; + (*targetm.asm_out.internal_label) (asm_out_file, "L", + CODE_LABEL_NUMBER (operands[3])); + return ""; } - " [(set_attr "type" "other") (set_attr "length_immediate" "0") (set_attr "length_address" "0") diff --git a/gcc/config/i386/mingw32.h b/gcc/config/i386/mingw32.h index 890a09674dd..200569ed090 100644 --- a/gcc/config/i386/mingw32.h +++ b/gcc/config/i386/mingw32.h @@ -164,6 +164,27 @@ do { \ #undef TARGET_USE_JCR_SECTION #define TARGET_USE_JCR_SECTION 1 +#undef MINGW_ENABLE_EXECUTE_STACK +#define MINGW_ENABLE_EXECUTE_STACK \ +extern void __enable_execute_stack (void *); \ +void \ +__enable_execute_stack (void *addr) \ +{ \ + MEMORY_BASIC_INFORMATION b; \ + if (!VirtualQuery (addr, &b, sizeof(b))) \ + abort (); \ + VirtualProtect (b.BaseAddress, b.RegionSize, PAGE_EXECUTE_READWRITE, \ + &b.Protect); \ +} + +#undef ENABLE_EXECUTE_STACK +#define ENABLE_EXECUTE_STACK MINGW_ENABLE_EXECUTE_STACK + + +#ifdef IN_LIBGCC2 +#include <windows.h> +#endif + #if !TARGET_64BIT #define MD_UNWIND_SUPPORT "config/i386/w32-unwind.h" #endif diff --git a/gcc/config/i386/sse.md b/gcc/config/i386/sse.md index e40416b3a9c..40ab29746ee 100644 --- a/gcc/config/i386/sse.md +++ b/gcc/config/i386/sse.md @@ -43,8 +43,10 @@ (define_mode_attr ssevecsize [(V16QI "b") (V8HI "w") (V4SI "d") (V2DI "q")]) ;; Mapping of the sse5 suffix -(define_mode_attr ssemodesuffixf4 [(SF "ss") (DF "sd") (V4SF "ps") (V2DF "pd")]) -(define_mode_attr ssemodesuffixf2s [(SF "ss") (DF "sd") (V4SF "ss") (V2DF "sd")]) +(define_mode_attr ssemodesuffixf4 [(SF "ss") (DF "sd") + (V4SF "ps") (V2DF "pd")]) +(define_mode_attr ssemodesuffixf2s [(SF "ss") (DF "sd") + (V4SF "ss") (V2DF "sd")]) (define_mode_attr ssemodesuffixf2c [(V4SF "s") (V2DF "d")]) ;; Mapping of the max integer size for sse5 rotate immediate constraint @@ -346,17 +348,12 @@ ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -(define_expand "neg<mode>2" - [(set (match_operand:SSEMODEF2P 0 "register_operand" "") - (neg:SSEMODEF2P (match_operand:SSEMODEF2P 1 "register_operand" "")))] - "SSE_VEC_FLOAT_MODE_P (<MODE>mode)" - "ix86_expand_fp_absneg_operator (NEG, <MODE>mode, operands); DONE;") - -(define_expand "abs<mode>2" +(define_expand "<code><mode>2" [(set (match_operand:SSEMODEF2P 0 "register_operand" "") - (abs:SSEMODEF2P (match_operand:SSEMODEF2P 1 "register_operand" "")))] + (absneg:SSEMODEF2P + (match_operand:SSEMODEF2P 1 "register_operand" "")))] "SSE_VEC_FLOAT_MODE_P (<MODE>mode)" - "ix86_expand_fp_absneg_operator (ABS, <MODE>mode, operands); DONE;") + "ix86_expand_fp_absneg_operator (<CODE>, <MODE>mode, operands); DONE;") (define_expand "<addsub><mode>3" [(set (match_operand:SSEMODEF2P 0 "register_operand" "") diff --git a/gcc/config/ia64/ia64.c b/gcc/config/ia64/ia64.c index ceda8833db3..0658b539702 100644 --- a/gcc/config/ia64/ia64.c +++ b/gcc/config/ia64/ia64.c @@ -2575,12 +2575,12 @@ ia64_compute_frame_size (HOST_WIDE_INT size) the stack, then the FR save area will be unaligned. We round the size of this area up to keep things 16 byte aligned. */ if (spilled_fr_p) - pretend_args_size = IA64_STACK_ALIGN (current_function_pretend_args_size); + pretend_args_size = IA64_STACK_ALIGN (crtl->args.pretend_args_size); else - pretend_args_size = current_function_pretend_args_size; + pretend_args_size = crtl->args.pretend_args_size; total_size = (spill_size + extra_spill_size + size + pretend_args_size - + current_function_outgoing_args_size); + + crtl->outgoing_args_size); total_size = IA64_STACK_ALIGN (total_size); /* We always use the 16-byte scratch area provided by the caller, but @@ -2616,14 +2616,14 @@ ia64_initial_elimination_offset (int from, int to) offset = -current_frame_info.total_size; else offset = -(current_frame_info.total_size - - current_function_outgoing_args_size - 16); + - crtl->outgoing_args_size - 16); break; case STACK_POINTER_REGNUM: if (current_function_is_leaf) offset = 0; else - offset = 16 + current_function_outgoing_args_size; + offset = 16 + crtl->outgoing_args_size; break; default: @@ -2637,12 +2637,12 @@ ia64_initial_elimination_offset (int from, int to) switch (to) { case HARD_FRAME_POINTER_REGNUM: - offset = 16 - current_function_pretend_args_size; + offset = 16 - crtl->args.pretend_args_size; break; case STACK_POINTER_REGNUM: offset = (current_frame_info.total_size - + 16 - current_function_pretend_args_size); + + 16 - crtl->args.pretend_args_size); break; default: @@ -2994,7 +2994,7 @@ ia64_expand_prologue (void) /* We don't need an alloc instruction if we've used no outputs or locals. */ if (current_frame_info.n_local_regs == 0 && current_frame_info.n_output_regs == 0 - && current_frame_info.n_input_regs <= current_function_args_info.int_regs + && current_frame_info.n_input_regs <= crtl->args.info.int_regs && !TEST_HARD_REG_BIT (current_frame_info.mask, AR_PFS_REGNUM)) { /* If there is no alloc, but there are input registers used, then we diff --git a/gcc/config/ia64/ia64.h b/gcc/config/ia64/ia64.h index 618ba24814b..60934f2f38b 100644 --- a/gcc/config/ia64/ia64.h +++ b/gcc/config/ia64/ia64.h @@ -982,7 +982,7 @@ enum reg_class #define INIT_EXPANDERS \ do { \ ia64_init_expanders (); \ - if (rtl.emit.regno_pointer_align) \ + if (crtl->emit.regno_pointer_align) \ REGNO_POINTER_ALIGN (ARG_POINTER_REGNUM) = 64; \ } while (0) @@ -1029,7 +1029,7 @@ enum reg_class /* If defined, the maximum amount of space required for outgoing arguments will be computed and placed into the variable - `current_function_outgoing_args_size'. */ + `crtl->outgoing_args_size'. */ #define ACCUMULATE_OUTGOING_ARGS 1 diff --git a/gcc/config/iq2000/iq2000.c b/gcc/config/iq2000/iq2000.c index 7a31b4782bb..1baf6eb73bb 100644 --- a/gcc/config/iq2000/iq2000.c +++ b/gcc/config/iq2000/iq2000.c @@ -1368,7 +1368,7 @@ iq2000_va_start (tree valist, rtx nextarg) /* Find out how many non-float named formals. */ int gpr_save_area_size; /* Note UNITS_PER_WORD is 4 bytes. */ - int_arg_words = current_function_args_info.arg_words; + int_arg_words = crtl->args.info.arg_words; if (int_arg_words < 8 ) /* Adjust for the prologue's economy measure. */ @@ -1615,7 +1615,7 @@ compute_frame_size (HOST_WIDE_INT size) mask = 0; extra_size = IQ2000_STACK_ALIGN ((0)); var_size = IQ2000_STACK_ALIGN (size); - args_size = IQ2000_STACK_ALIGN (current_function_outgoing_args_size); + args_size = IQ2000_STACK_ALIGN (crtl->outgoing_args_size); /* If a function dynamically allocates the stack and has 0 for STACK_DYNAMIC_OFFSET then allocate some stack space. */ @@ -1660,7 +1660,7 @@ compute_frame_size (HOST_WIDE_INT size) && ! profile_flag) total_size = extra_size = 0; - total_size += IQ2000_STACK_ALIGN (current_function_pretend_args_size); + total_size += IQ2000_STACK_ALIGN (crtl->args.pretend_args_size); /* Save other computed information. */ cfun->machine->total_size = total_size; diff --git a/gcc/config/iq2000/iq2000.h b/gcc/config/iq2000/iq2000.h index f7beb540bed..cdbf5a2b3f2 100644 --- a/gcc/config/iq2000/iq2000.h +++ b/gcc/config/iq2000/iq2000.h @@ -303,7 +303,7 @@ enum reg_class #define FRAME_GROWS_DOWNWARD 0 #define STARTING_FRAME_OFFSET \ - (current_function_outgoing_args_size) + (crtl->outgoing_args_size) /* Use the default value zero. */ /* #define STACK_POINTER_OFFSET 0 */ diff --git a/gcc/config/m32c/m32c.c b/gcc/config/m32c/m32c.c index 37caaf974fc..c19fd4ed2cd 100644 --- a/gcc/config/m32c/m32c.c +++ b/gcc/config/m32c/m32c.c @@ -1281,11 +1281,11 @@ m32c_pushm_popm (Push_Pop_Type ppt) int n_dwarfs = 0; int nosave_mask = 0; - if (cfun->return_rtx - && GET_CODE (cfun->return_rtx) == PARALLEL + if (crtl->return_rtx + && GET_CODE (crtl->return_rtx) == PARALLEL && !(cfun->calls_eh_return || cfun->machine->is_interrupt)) { - rtx exp = XVECEXP (cfun->return_rtx, 0, 0); + rtx exp = XVECEXP (crtl->return_rtx, 0, 0); rtx rv = XEXP (exp, 0); int rv_bytes = GET_MODE_SIZE (GET_MODE (rv)); @@ -3889,20 +3889,20 @@ m32c_leaf_function_p (void) struct sequence_stack *seq; int rv; - saved_first = rtl.emit.x_first_insn; - saved_last = rtl.emit.x_last_insn; - for (seq = rtl.emit.sequence_stack; seq && seq->next; seq = seq->next) + saved_first = crtl->emit.x_first_insn; + saved_last = crtl->emit.x_last_insn; + for (seq = crtl->emit.sequence_stack; seq && seq->next; seq = seq->next) ; if (seq) { - rtl.emit.x_first_insn = seq->first; - rtl.emit.x_last_insn = seq->last; + crtl->emit.x_first_insn = seq->first; + crtl->emit.x_last_insn = seq->last; } rv = leaf_function_p (); - rtl.emit.x_first_insn = saved_first; - rtl.emit.x_last_insn = saved_last; + crtl->emit.x_first_insn = saved_first; + crtl->emit.x_last_insn = saved_last; return rv; } @@ -3918,7 +3918,7 @@ m32c_function_needs_enter (void) rtx fb = gen_rtx_REG (Pmode, FB_REGNO); insn = get_insns (); - for (seq = rtl.emit.sequence_stack; + for (seq = crtl->emit.sequence_stack; seq; insn = seq->first, seq = seq->next); diff --git a/gcc/config/m32r/m32r.c b/gcc/config/m32r/m32r.c index 1edd6597211..ea4e7f85c5c 100644 --- a/gcc/config/m32r/m32r.c +++ b/gcc/config/m32r/m32r.c @@ -1276,8 +1276,8 @@ m32r_compute_frame_size (int size) /* # of var. bytes allocated. */ | current_function_profile); var_size = M32R_STACK_ALIGN (size); - args_size = M32R_STACK_ALIGN (current_function_outgoing_args_size); - pretend_size = current_function_pretend_args_size; + args_size = M32R_STACK_ALIGN (crtl->outgoing_args_size); + pretend_size = crtl->args.pretend_args_size; extra_size = FIRST_PARM_OFFSET (0); total_size = extra_size + pretend_size + args_size + var_size; reg_size = 0; diff --git a/gcc/config/m32r/m32r.h b/gcc/config/m32r/m32r.h index 51e84146c43..d1ac1c81d21 100644 --- a/gcc/config/m32r/m32r.h +++ b/gcc/config/m32r/m32r.h @@ -717,7 +717,7 @@ extern enum reg_class m32r_regno_reg_class[FIRST_PSEUDO_REGISTER]; /* The frame pointer points at the same place as the stack pointer, except if alloca has been called. */ #define STARTING_FRAME_OFFSET \ - M32R_STACK_ALIGN (current_function_outgoing_args_size) + M32R_STACK_ALIGN (crtl->outgoing_args_size) /* Offset from the stack pointer register to the first location at which outgoing arguments are placed. */ @@ -818,9 +818,9 @@ extern enum reg_class m32r_regno_reg_class[FIRST_PSEUDO_REGISTER]; if ((FROM) == FRAME_POINTER_REGNUM && (TO) == STACK_POINTER_REGNUM) \ (OFFSET) = 0; \ else if ((FROM) == ARG_POINTER_REGNUM && (TO) == FRAME_POINTER_REGNUM) \ - (OFFSET) = size - current_function_pretend_args_size; \ + (OFFSET) = size - crtl->args.pretend_args_size; \ else if ((FROM) == ARG_POINTER_REGNUM && (TO) == STACK_POINTER_REGNUM) \ - (OFFSET) = size - current_function_pretend_args_size; \ + (OFFSET) = size - crtl->args.pretend_args_size; \ else \ gcc_unreachable (); \ } \ @@ -830,7 +830,7 @@ extern enum reg_class m32r_regno_reg_class[FIRST_PSEUDO_REGISTER]; /* If defined, the maximum amount of space required for outgoing arguments will be computed and placed into the variable - `current_function_outgoing_args_size'. No space will be pushed + `crtl->outgoing_args_size'. No space will be pushed onto the stack for each call; instead, the function prologue should increase the stack frame size by this amount. */ #define ACCUMULATE_OUTGOING_ARGS 1 diff --git a/gcc/config/m68hc11/m68hc11.c b/gcc/config/m68hc11/m68hc11.c index 0232eda25d9..83b73b2414a 100644 --- a/gcc/config/m68hc11/m68hc11.c +++ b/gcc/config/m68hc11/m68hc11.c @@ -1597,7 +1597,7 @@ expand_prologue (void) If the first argument is a 32-bit quantity, the D+X registers are used. Use Y to compute the frame. Otherwise, X is cheaper. For 68HC12, this scratch register is not used. */ - if (current_function_args_info.nregs == 2) + if (crtl->args.info.nregs == 2) scratch = iy_reg; else scratch = ix_reg; @@ -1685,12 +1685,12 @@ expand_epilogue (void) /* If we are returning a value in two registers, we have to preserve the X register and use the Y register to restore the stack and the saved registers. Otherwise, use X because it's faster (and smaller). */ - if (current_function_return_rtx == 0) + if (crtl->return_rtx == 0) return_size = 0; - else if (GET_CODE (current_function_return_rtx) == MEM) + else if (GET_CODE (crtl->return_rtx) == MEM) return_size = HARD_REG_SIZE; else - return_size = GET_MODE_SIZE (GET_MODE (current_function_return_rtx)); + return_size = GET_MODE_SIZE (GET_MODE (crtl->return_rtx)); if (return_size > HARD_REG_SIZE && return_size <= 2 * HARD_REG_SIZE) scratch = iy_reg; diff --git a/gcc/config/m68hc11/m68hc11.md b/gcc/config/m68hc11/m68hc11.md index 996f8d790a5..8a7a5d0a0bf 100644 --- a/gcc/config/m68hc11/m68hc11.md +++ b/gcc/config/m68hc11/m68hc11.md @@ -6722,8 +6722,8 @@ { int ret_size = 0; - if (current_function_return_rtx) - ret_size = GET_MODE_SIZE (GET_MODE (current_function_return_rtx)); + if (crtl->return_rtx) + ret_size = GET_MODE_SIZE (GET_MODE (crtl->return_rtx)); /* Emit use notes only when HAVE_return is true. */ if (m68hc11_total_frame_size () != 0) @@ -6768,8 +6768,8 @@ { int ret_size = 0; - if (current_function_return_rtx) - ret_size = GET_MODE_SIZE (GET_MODE (current_function_return_rtx)); + if (crtl->return_rtx) + ret_size = GET_MODE_SIZE (GET_MODE (crtl->return_rtx)); if (ret_size == 0) return \"jmp\\t__return_void\"; diff --git a/gcc/config/m68k/m68k.md b/gcc/config/m68k/m68k.md index c3f3138bf5e..523b039acd0 100644 --- a/gcc/config/m68k/m68k.md +++ b/gcc/config/m68k/m68k.md @@ -7153,9 +7153,9 @@ return "sleep"; default: - if (current_function_pops_args) + if (crtl->args.pops_args) { - operands[0] = GEN_INT (current_function_pops_args); + operands[0] = GEN_INT (crtl->args.pops_args); return "rtd %0"; } else diff --git a/gcc/config/mcore/mcore.c b/gcc/config/mcore/mcore.c index 4bf895ccd64..d9d3398b498 100644 --- a/gcc/config/mcore/mcore.c +++ b/gcc/config/mcore/mcore.c @@ -1651,7 +1651,7 @@ layout_mcore_frame (struct mcore_frame * infp) /* Might have to spill bytes to re-assemble a big argument that was passed partially in registers and partially on the stack. */ - nbytes = current_function_pretend_args_size; + nbytes = crtl->args.pretend_args_size; /* Determine how much space for spilled anonymous args (e.g., stdarg). */ if (current_function_anonymous_args) @@ -1665,7 +1665,7 @@ layout_mcore_frame (struct mcore_frame * infp) /* And the rest of it... locals and space for overflowed outbounds. */ infp->local_size = get_frame_size (); - infp->outbound_size = current_function_outgoing_args_size; + infp->outbound_size = crtl->outgoing_args_size; /* Make sure we have a whole number of words for the locals. */ if (infp->local_size % STACK_BYTES) @@ -1962,7 +1962,7 @@ mcore_expand_prolog (void) /* If we have a parameter passed partially in regs and partially in memory, the registers will have been stored to memory already in function.c. So we only need to do something here for varargs functions. */ - if (fi.arg_size != 0 && current_function_pretend_args_size == 0) + if (fi.arg_size != 0 && crtl->args.pretend_args_size == 0) { int offset; int rn = FIRST_PARM_REG + NPARM_REGS - 1; diff --git a/gcc/config/mcore/mcore.h b/gcc/config/mcore/mcore.h index 5e14410f631..7ea9ac41fe1 100644 --- a/gcc/config/mcore/mcore.h +++ b/gcc/config/mcore/mcore.h @@ -538,7 +538,7 @@ extern const enum reg_class reg_class_from_letter[]; /* If defined, the maximum amount of space required for outgoing arguments will be computed and placed into the variable - `current_function_outgoing_args_size'. No space will be pushed + `crtl->outgoing_args_size'. No space will be pushed onto the stack for each call; instead, the function prologue should increase the stack frame size by this amount. */ #define ACCUMULATE_OUTGOING_ARGS 1 diff --git a/gcc/config/mips/mips.c b/gcc/config/mips/mips.c index 861a308ab73..d69169f13a7 100644 --- a/gcc/config/mips/mips.c +++ b/gcc/config/mips/mips.c @@ -3715,9 +3715,9 @@ mips_canonicalize_int_order_test (enum rtx_code *code, rtx *cmp1, } /* Compare CMP0 and CMP1 using ordering test CODE and store the result - in TARGET. CMP0 and TARGET are register_operands that have the same - integer mode. If INVERT_PTR is nonnull, it's OK to set TARGET to the - inverse of the result and flip *INVERT_PTR instead. */ + in TARGET. CMP0 and TARGET are register_operands. If INVERT_PTR + is nonnull, it's OK to set TARGET to the inverse of the result and + flip *INVERT_PTR instead. */ static void mips_emit_int_order_test (enum rtx_code code, bool *invert_ptr, @@ -3728,7 +3728,7 @@ mips_emit_int_order_test (enum rtx_code code, bool *invert_ptr, /* First see if there is a MIPS instruction that can do this operation. If not, try doing the same for the inverse operation. If that also fails, force CMP1 into a register and try again. */ - mode = GET_MODE (target); + mode = GET_MODE (cmp0); if (mips_canonicalize_int_order_test (&code, &cmp1, mode)) mips_emit_binary (code, target, cmp0, cmp1); else @@ -3741,7 +3741,7 @@ mips_emit_int_order_test (enum rtx_code code, bool *invert_ptr, } else if (invert_ptr == 0) { - rtx inv_target = gen_reg_rtx (mode); + rtx inv_target = gen_reg_rtx (GET_MODE (target)); mips_emit_binary (inv_code, inv_target, cmp0, cmp1); mips_emit_binary (XOR, target, inv_target, const1_rtx); } @@ -3868,7 +3868,7 @@ mips_emit_compare (enum rtx_code *code, rtx *op0, rtx *op1, bool need_eq_ne_p) /* Try comparing cmp_operands[0] and cmp_operands[1] using rtl code CODE. Store the result in TARGET and return true if successful. - On 64-bit targets, TARGET may be wider than cmp_operands[0]. */ + On 64-bit targets, TARGET may be narrower than cmp_operands[0]. */ bool mips_expand_scc (enum rtx_code code, rtx target) @@ -3876,7 +3876,6 @@ mips_expand_scc (enum rtx_code code, rtx target) if (GET_MODE_CLASS (GET_MODE (cmp_operands[0])) != MODE_INT) return false; - target = gen_lowpart (GET_MODE (cmp_operands[0]), target); if (code == EQ || code == NE) { rtx zie = mips_zero_if_equal (cmp_operands[0], cmp_operands[1]); @@ -4784,7 +4783,7 @@ mips_va_start (tree valist, rtx nextarg) int fpr_save_area_size; int fpr_offset; - cum = ¤t_function_args_info; + cum = &crtl->args.info; gpr_save_area_size = (MAX_ARGS_IN_REGISTERS - cum->num_gprs) * UNITS_PER_WORD; fpr_save_area_size @@ -5160,7 +5159,7 @@ mips16_build_function_stub (void) fprintf (asm_out_file, "\t# Stub function for %s (", current_function_name ()); separator = ""; - for (f = (unsigned int) current_function_args_info.fp_code; f != 0; f >>= 2) + for (f = (unsigned int) crtl->args.info.fp_code; f != 0; f >>= 2) { fprintf (asm_out_file, "%s%s", separator, (f & 3) == 1 ? "float" : "double"); @@ -5196,7 +5195,7 @@ mips16_build_function_stub (void) fprintf (asm_out_file, "\n"); /* Move the arguments from floating-point registers to general registers. */ - mips_output_args_xfer (current_function_args_info.fp_code, 'f'); + mips_output_args_xfer (crtl->args.info.fp_code, 'f'); /* Jump to the MIPS16 function. */ fprintf (asm_out_file, "\tjr\t%s\n", reg_names[GP_REG_FIRST + 1]); @@ -7846,7 +7845,7 @@ mips_compute_frame_info (void) } else { - frame->args_size = current_function_outgoing_args_size; + frame->args_size = crtl->outgoing_args_size; frame->cprestore_size = STARTING_FRAME_OFFSET - frame->args_size; } offset = frame->args_size + frame->cprestore_size; @@ -7912,7 +7911,7 @@ mips_compute_frame_info (void) frame->arg_pointer_offset = offset; /* Move above the callee-allocated area for pretend stack arguments. */ - offset += current_function_pretend_args_size; + offset += crtl->args.pretend_args_size; frame->total_size = offset; /* Work out the offsets of the save areas from the top of the frame. */ @@ -8059,7 +8058,7 @@ mips_restore_gp (void) base = frame_pointer_needed ? hard_frame_pointer_rtx : stack_pointer_rtx; address = mips_add_offset (pic_offset_table_rtx, base, - current_function_outgoing_args_size); + crtl->outgoing_args_size); mips_emit_move (pic_offset_table_rtx, gen_frame_mem (Pmode, address)); if (!TARGET_EXPLICIT_RELOCS) emit_insn (gen_blockage ()); @@ -8149,7 +8148,7 @@ mips_output_function_prologue (FILE *file, HOST_WIDE_INT size ATTRIBUTE_UNUSED) floating-point arguments. */ if (TARGET_MIPS16 && TARGET_HARD_FLOAT_ABI - && current_function_args_info.fp_code != 0) + && crtl->args.info.fp_code != 0) mips16_build_function_stub (); /* Select the MIPS16 mode for this function. */ @@ -8486,7 +8485,7 @@ mips_expand_prologue (void) /* Initialize the $gp save slot. */ if (frame->cprestore_size > 0) - emit_insn (gen_cprestore (GEN_INT (current_function_outgoing_args_size))); + emit_insn (gen_cprestore (GEN_INT (crtl->outgoing_args_size))); /* If we are profiling, make sure no instructions are scheduled before the call to mcount. */ diff --git a/gcc/config/mips/mips.h b/gcc/config/mips/mips.h index 3bc9dfe36ab..3a0e58c96e6 100644 --- a/gcc/config/mips/mips.h +++ b/gcc/config/mips/mips.h @@ -1883,7 +1883,7 @@ enum reg_class See mips_compute_frame_info for details about the frame layout. */ #define STARTING_FRAME_OFFSET \ - (current_function_outgoing_args_size \ + (crtl->outgoing_args_size \ + (TARGET_CALL_CLOBBERED_GP ? MIPS_STACK_ALIGN (UNITS_PER_WORD) : 0)) #define RETURN_ADDR_RTX mips_return_addr @@ -1935,7 +1935,7 @@ enum reg_class allocate the area reserved for arguments passed in registers. If `ACCUMULATE_OUTGOING_ARGS' is also defined, the only effect of this macro is to determine whether the space is included in - `current_function_outgoing_args_size'. */ + `crtl->outgoing_args_size'. */ #define OUTGOING_REG_PARM_STACK_SPACE 1 #define STACK_BOUNDARY (TARGET_NEWABI ? 128 : 64) diff --git a/gcc/config/mips/mips.md b/gcc/config/mips/mips.md index 2083cb9ff50..cbdcdc6ed13 100644 --- a/gcc/config/mips/mips.md +++ b/gcc/config/mips/mips.md @@ -476,6 +476,10 @@ ;; from the same template. (define_mode_iterator GPR [SI (DI "TARGET_64BIT")]) +;; A copy of GPR that can be used when a pattern has two independent +;; modes. +(define_mode_iterator GPR2 [SI (DI "TARGET_64BIT")]) + ;; This mode iterator allows :P to be used for patterns that operate on ;; pointer-sized quantities. Exactly one of the two alternatives will match. (define_mode_iterator P [(SI "Pmode == SImode") (DI "Pmode == DImode")]) @@ -5065,6 +5069,8 @@ ;; ;; .................... +;; Destination is always set in SI mode. + (define_expand "seq" [(set (match_operand:SI 0 "register_operand") (eq:SI (match_dup 1) @@ -5072,23 +5078,23 @@ "" { if (mips_expand_scc (EQ, operands[0])) DONE; else FAIL; }) -(define_insn "*seq_<mode>" - [(set (match_operand:GPR 0 "register_operand" "=d") - (eq:GPR (match_operand:GPR 1 "register_operand" "d") - (const_int 0)))] +(define_insn "*seq_<GPR:mode><GPR2:mode>" + [(set (match_operand:GPR2 0 "register_operand" "=d") + (eq:GPR2 (match_operand:GPR 1 "register_operand" "d") + (const_int 0)))] "!TARGET_MIPS16" "sltu\t%0,%1,1" [(set_attr "type" "slt") - (set_attr "mode" "<MODE>")]) + (set_attr "mode" "<GPR:MODE>")]) -(define_insn "*seq_<mode>_mips16" - [(set (match_operand:GPR 0 "register_operand" "=t") - (eq:GPR (match_operand:GPR 1 "register_operand" "d") - (const_int 0)))] +(define_insn "*seq_<GPR:mode><GPR2:mode>_mips16" + [(set (match_operand:GPR2 0 "register_operand" "=t") + (eq:GPR2 (match_operand:GPR 1 "register_operand" "d") + (const_int 0)))] "TARGET_MIPS16" "sltu\t%1,1" [(set_attr "type" "slt") - (set_attr "mode" "<MODE>")]) + (set_attr "mode" "<GPR:MODE>")]) ;; "sne" uses sltu instructions in which the first operand is $0. ;; This isn't possible in mips16 code. @@ -5100,14 +5106,14 @@ "!TARGET_MIPS16" { if (mips_expand_scc (NE, operands[0])) DONE; else FAIL; }) -(define_insn "*sne_<mode>" - [(set (match_operand:GPR 0 "register_operand" "=d") - (ne:GPR (match_operand:GPR 1 "register_operand" "d") - (const_int 0)))] +(define_insn "*sne_<GPR:mode><GPR2:mode>" + [(set (match_operand:GPR2 0 "register_operand" "=d") + (ne:GPR2 (match_operand:GPR 1 "register_operand" "d") + (const_int 0)))] "!TARGET_MIPS16" "sltu\t%0,%.,%1" [(set_attr "type" "slt") - (set_attr "mode" "<MODE>")]) + (set_attr "mode" "<GPR:MODE>")]) (define_expand "sgt<u>" [(set (match_operand:SI 0 "register_operand") @@ -5116,23 +5122,23 @@ "" { if (mips_expand_scc (<CODE>, operands[0])) DONE; else FAIL; }) -(define_insn "*sgt<u>_<mode>" - [(set (match_operand:GPR 0 "register_operand" "=d") - (any_gt:GPR (match_operand:GPR 1 "register_operand" "d") - (match_operand:GPR 2 "reg_or_0_operand" "dJ")))] +(define_insn "*sgt<u>_<GPR:mode><GPR2:mode>" + [(set (match_operand:GPR2 0 "register_operand" "=d") + (any_gt:GPR2 (match_operand:GPR 1 "register_operand" "d") + (match_operand:GPR 2 "reg_or_0_operand" "dJ")))] "!TARGET_MIPS16" "slt<u>\t%0,%z2,%1" [(set_attr "type" "slt") - (set_attr "mode" "<MODE>")]) + (set_attr "mode" "<GPR:MODE>")]) -(define_insn "*sgt<u>_<mode>_mips16" - [(set (match_operand:GPR 0 "register_operand" "=t") - (any_gt:GPR (match_operand:GPR 1 "register_operand" "d") - (match_operand:GPR 2 "register_operand" "d")))] +(define_insn "*sgt<u>_<GPR:mode><GPR2:mode>_mips16" + [(set (match_operand:GPR2 0 "register_operand" "=t") + (any_gt:GPR2 (match_operand:GPR 1 "register_operand" "d") + (match_operand:GPR 2 "register_operand" "d")))] "TARGET_MIPS16" "slt<u>\t%2,%1" [(set_attr "type" "slt") - (set_attr "mode" "<MODE>")]) + (set_attr "mode" "<GPR:MODE>")]) (define_expand "sge<u>" [(set (match_operand:SI 0 "register_operand") @@ -5141,14 +5147,14 @@ "" { if (mips_expand_scc (<CODE>, operands[0])) DONE; else FAIL; }) -(define_insn "*sge<u>_<mode>" - [(set (match_operand:GPR 0 "register_operand" "=d") - (any_ge:GPR (match_operand:GPR 1 "register_operand" "d") - (const_int 1)))] +(define_insn "*sge<u>_<GPR:mode><GPR2:mode>" + [(set (match_operand:GPR2 0 "register_operand" "=d") + (any_ge:GPR2 (match_operand:GPR 1 "register_operand" "d") + (const_int 1)))] "!TARGET_MIPS16" "slt<u>\t%0,%.,%1" [(set_attr "type" "slt") - (set_attr "mode" "<MODE>")]) + (set_attr "mode" "<GPR:MODE>")]) (define_expand "slt<u>" [(set (match_operand:SI 0 "register_operand") @@ -5157,23 +5163,23 @@ "" { if (mips_expand_scc (<CODE>, operands[0])) DONE; else FAIL; }) -(define_insn "*slt<u>_<mode>" - [(set (match_operand:GPR 0 "register_operand" "=d") - (any_lt:GPR (match_operand:GPR 1 "register_operand" "d") - (match_operand:GPR 2 "arith_operand" "dI")))] +(define_insn "*slt<u>_<GPR:mode><GPR2:mode>" + [(set (match_operand:GPR2 0 "register_operand" "=d") + (any_lt:GPR2 (match_operand:GPR 1 "register_operand" "d") + (match_operand:GPR 2 "arith_operand" "dI")))] "!TARGET_MIPS16" "slt<u>\t%0,%1,%2" [(set_attr "type" "slt") - (set_attr "mode" "<MODE>")]) + (set_attr "mode" "<GPR:MODE>")]) -(define_insn "*slt<u>_<mode>_mips16" - [(set (match_operand:GPR 0 "register_operand" "=t,t") - (any_lt:GPR (match_operand:GPR 1 "register_operand" "d,d") - (match_operand:GPR 2 "arith_operand" "d,I")))] +(define_insn "*slt<u>_<GPR:mode><GPR2:mode>_mips16" + [(set (match_operand:GPR2 0 "register_operand" "=t,t") + (any_lt:GPR2 (match_operand:GPR 1 "register_operand" "d,d") + (match_operand:GPR 2 "arith_operand" "d,I")))] "TARGET_MIPS16" "slt<u>\t%1,%2" [(set_attr "type" "slt") - (set_attr "mode" "<MODE>") + (set_attr "mode" "<GPR:MODE>") (set_attr_alternative "length" [(const_int 4) (if_then_else (match_operand 2 "m16_uimm8_1") @@ -5187,29 +5193,29 @@ "" { if (mips_expand_scc (<CODE>, operands[0])) DONE; else FAIL; }) -(define_insn "*sle<u>_<mode>" - [(set (match_operand:GPR 0 "register_operand" "=d") - (any_le:GPR (match_operand:GPR 1 "register_operand" "d") - (match_operand:GPR 2 "sle_operand" "")))] +(define_insn "*sle<u>_<GPR:mode><GPR2:mode>" + [(set (match_operand:GPR2 0 "register_operand" "=d") + (any_le:GPR2 (match_operand:GPR 1 "register_operand" "d") + (match_operand:GPR 2 "sle_operand" "")))] "!TARGET_MIPS16" { operands[2] = GEN_INT (INTVAL (operands[2]) + 1); return "slt<u>\t%0,%1,%2"; } [(set_attr "type" "slt") - (set_attr "mode" "<MODE>")]) + (set_attr "mode" "<GPR:MODE>")]) -(define_insn "*sle<u>_<mode>_mips16" - [(set (match_operand:GPR 0 "register_operand" "=t") - (any_le:GPR (match_operand:GPR 1 "register_operand" "d") - (match_operand:GPR 2 "sle_operand" "")))] +(define_insn "*sle<u>_<GPR:mode><GPR2:mode>_mips16" + [(set (match_operand:GPR2 0 "register_operand" "=t") + (any_le:GPR2 (match_operand:GPR 1 "register_operand" "d") + (match_operand:GPR 2 "sle_operand" "")))] "TARGET_MIPS16" { operands[2] = GEN_INT (INTVAL (operands[2]) + 1); return "slt<u>\t%1,%2"; } [(set_attr "type" "slt") - (set_attr "mode" "<MODE>") + (set_attr "mode" "<GPR:MODE>") (set (attr "length") (if_then_else (match_operand 2 "m16_uimm8_m1_1") (const_int 4) (const_int 8)))]) diff --git a/gcc/config/mmix/mmix.c b/gcc/config/mmix/mmix.c index fa6566b147d..3a408438c62 100644 --- a/gcc/config/mmix/mmix.c +++ b/gcc/config/mmix/mmix.c @@ -95,10 +95,10 @@ along with GCC; see the file COPYING3. If not see /* The %d in "POP %d,0". */ #define MMIX_POP_ARGUMENT() \ ((! TARGET_ABI_GNU \ - && current_function_return_rtx != NULL \ + && crtl->return_rtx != NULL \ && ! current_function_returns_struct) \ - ? (GET_CODE (current_function_return_rtx) == PARALLEL \ - ? GET_NUM_ELEM (XVEC (current_function_return_rtx, 0)) : 1) \ + ? (GET_CODE (crtl->return_rtx) == PARALLEL \ + ? GET_NUM_ELEM (XVEC (crtl->return_rtx, 0)) : 1) \ : 0) /* The canonical saved comparison operands for non-cc0 machines, set in @@ -531,7 +531,7 @@ mmix_initial_elimination_offset (int fromreg, int toreg) { int regno; int fp_sp_offset - = (get_frame_size () + current_function_outgoing_args_size + 7) & ~7; + = (get_frame_size () + crtl->outgoing_args_size + 7) & ~7; /* There is no actual offset between these two virtual values, but for the frame-pointer, we have the old one in the stack position below @@ -795,9 +795,9 @@ mmix_reorg (void) wasteful to optimize for unused parameter registers. As of 2002-04-30, df_regs_ever_live_p (n) seems to be set for only-reads too, but that might change. */ - if (!TARGET_ABI_GNU && regno < current_function_args_info.regs - 1) + if (!TARGET_ABI_GNU && regno < crtl->args.info.regs - 1) { - regno = current_function_args_info.regs - 1; + regno = crtl->args.info.regs - 1; /* We don't want to let this cause us to go over the limit and make incoming parameter registers be misnumbered and treating the last @@ -1838,8 +1838,8 @@ mmix_use_simple_return (void) int regno; int stack_space_to_allocate - = (current_function_outgoing_args_size - + current_function_pretend_args_size + = (crtl->outgoing_args_size + + crtl->args.pretend_args_size + get_frame_size () + 7) & ~7; if (!TARGET_USE_RETURN_INSN || !reload_completed) @@ -1875,8 +1875,8 @@ mmix_expand_prologue (void) HOST_WIDE_INT locals_size = get_frame_size (); int regno; HOST_WIDE_INT stack_space_to_allocate - = (current_function_outgoing_args_size - + current_function_pretend_args_size + = (crtl->outgoing_args_size + + crtl->args.pretend_args_size + locals_size + 7) & ~7; HOST_WIDE_INT offset = -8; @@ -1909,12 +1909,12 @@ mmix_expand_prologue (void) internal_error ("stack frame not a multiple of 8 bytes: %wd", stack_space_to_allocate); - if (current_function_pretend_args_size) + if (crtl->args.pretend_args_size) { int mmix_first_vararg_reg = (MMIX_FIRST_INCOMING_ARG_REGNUM + (MMIX_MAX_ARGS_IN_REGS - - current_function_pretend_args_size / 8)); + - crtl->args.pretend_args_size / 8)); for (regno = MMIX_FIRST_INCOMING_ARG_REGNUM + MMIX_MAX_ARGS_IN_REGS - 1; @@ -2110,12 +2110,12 @@ mmix_expand_epilogue (void) HOST_WIDE_INT locals_size = get_frame_size (); int regno; HOST_WIDE_INT stack_space_to_deallocate - = (current_function_outgoing_args_size - + current_function_pretend_args_size + = (crtl->outgoing_args_size + + crtl->args.pretend_args_size + locals_size + 7) & ~7; /* The first address to access is beyond the outgoing_args area. */ - HOST_WIDE_INT offset = current_function_outgoing_args_size; + HOST_WIDE_INT offset = crtl->outgoing_args_size; /* Add the space for global non-register-stack registers. It is assumed that the frame-pointer register can be one of these diff --git a/gcc/config/mn10300/mn10300.c b/gcc/config/mn10300/mn10300.c index 0d2ae38beca..1effca34473 100644 --- a/gcc/config/mn10300/mn10300.c +++ b/gcc/config/mn10300/mn10300.c @@ -585,10 +585,10 @@ int can_use_return_insn (void) { /* size includes the fixed stack space needed for function calls. */ - int size = get_frame_size () + current_function_outgoing_args_size; + int size = get_frame_size () + crtl->outgoing_args_size; /* And space for the return pointer. */ - size += current_function_outgoing_args_size ? 4 : 0; + size += crtl->outgoing_args_size ? 4 : 0; return (reload_completed && size == 0 @@ -697,8 +697,8 @@ expand_prologue (void) HOST_WIDE_INT size; /* SIZE includes the fixed stack space needed for function calls. */ - size = get_frame_size () + current_function_outgoing_args_size; - size += (current_function_outgoing_args_size ? 4 : 0); + size = get_frame_size () + crtl->outgoing_args_size; + size += (crtl->outgoing_args_size ? 4 : 0); /* If we use any of the callee-saved registers, save them now. */ mn10300_gen_multiple_store (mn10300_get_live_callee_saved_regs ()); @@ -956,8 +956,8 @@ expand_epilogue (void) HOST_WIDE_INT size; /* SIZE includes the fixed stack space needed for function calls. */ - size = get_frame_size () + current_function_outgoing_args_size; - size += (current_function_outgoing_args_size ? 4 : 0); + size = get_frame_size () + crtl->outgoing_args_size; + size += (crtl->outgoing_args_size ? 4 : 0); if (TARGET_AM33_2 && fp_regs_to_save ()) { @@ -1408,12 +1408,12 @@ initial_offset (int from, int to) || frame_pointer_needed) return (get_frame_size () + REG_SAVE_BYTES + 4 * fp_regs_to_save () - + (current_function_outgoing_args_size - ? current_function_outgoing_args_size + 4 : 0)); + + (crtl->outgoing_args_size + ? crtl->outgoing_args_size + 4 : 0)); else return (get_frame_size () - + (current_function_outgoing_args_size - ? current_function_outgoing_args_size + 4 : 0)); + + (crtl->outgoing_args_size + ? crtl->outgoing_args_size + 4 : 0)); } /* The difference between the frame pointer and stack pointer is the sum @@ -1421,8 +1421,8 @@ initial_offset (int from, int to) for function calls (if any). */ if (from == FRAME_POINTER_REGNUM && to == STACK_POINTER_REGNUM) return (get_frame_size () - + (current_function_outgoing_args_size - ? current_function_outgoing_args_size + 4 : 0)); + + (crtl->outgoing_args_size + ? crtl->outgoing_args_size + 4 : 0)); gcc_unreachable (); } @@ -1452,21 +1452,21 @@ mn10300_builtin_saveregs (void) alias_set_type set = get_varargs_alias_set (); if (argadj) - offset = plus_constant (current_function_arg_offset_rtx, argadj); + offset = plus_constant (crtl->args.arg_offset_rtx, argadj); else - offset = current_function_arg_offset_rtx; + offset = crtl->args.arg_offset_rtx; - mem = gen_rtx_MEM (SImode, current_function_internal_arg_pointer); + mem = gen_rtx_MEM (SImode, crtl->args.internal_arg_pointer); set_mem_alias_set (mem, set); emit_move_insn (mem, gen_rtx_REG (SImode, 0)); mem = gen_rtx_MEM (SImode, - plus_constant (current_function_internal_arg_pointer, 4)); + plus_constant (crtl->args.internal_arg_pointer, 4)); set_mem_alias_set (mem, set); emit_move_insn (mem, gen_rtx_REG (SImode, 1)); return copy_to_reg (expand_binop (Pmode, add_optab, - current_function_internal_arg_pointer, + crtl->args.internal_arg_pointer, offset, 0, 0, OPTAB_LIB_WIDEN)); } diff --git a/gcc/config/mn10300/mn10300.md b/gcc/config/mn10300/mn10300.md index c9540b8e9fe..7f34986d40d 100644 --- a/gcc/config/mn10300/mn10300.md +++ b/gcc/config/mn10300/mn10300.md @@ -2589,7 +2589,7 @@ { rtx sp_reg = gen_rtx_REG (SImode, SP_REG); int need_stack_space = (get_frame_size () == 0 - && current_function_outgoing_args_size == 0); + && crtl->outgoing_args_size == 0); if (need_stack_space) emit_move_insn (sp_reg, plus_constant (sp_reg, -4)); diff --git a/gcc/config/mt/mt.c b/gcc/config/mt/mt.c index 9e281a154e1..272e028b902 100644 --- a/gcc/config/mt/mt.c +++ b/gcc/config/mt/mt.c @@ -866,8 +866,8 @@ mt_compute_frame_size (int size) unsigned int reg_mask; var_size = size; - args_size = current_function_outgoing_args_size; - pretend_size = current_function_pretend_args_size; + args_size = crtl->outgoing_args_size; + pretend_size = crtl->args.pretend_args_size; extra_size = FIRST_PARM_OFFSET (0); total_size = extra_size + pretend_size + args_size + var_size; reg_size = 0; diff --git a/gcc/config/mt/mt.h b/gcc/config/mt/mt.h index 74f8d01681e..67a8185573d 100644 --- a/gcc/config/mt/mt.h +++ b/gcc/config/mt/mt.h @@ -436,7 +436,7 @@ enum save_direction subtracting the first slot's length from `STARTING_FRAME_OFFSET'. Otherwise, it is found by adding the length of the first slot to the value `STARTING_FRAME_OFFSET'. */ -#define STARTING_FRAME_OFFSET current_function_outgoing_args_size +#define STARTING_FRAME_OFFSET crtl->outgoing_args_size /* Offset from the argument pointer register to the first argument's address. On some machines it may depend on the data type of the function. @@ -527,7 +527,7 @@ extern struct mt_frame_info current_frame_info; /* If defined, the maximum amount of space required for outgoing arguments will be computed and placed into the variable - `current_function_outgoing_args_size'. */ + `crtl->outgoing_args_size'. */ #define ACCUMULATE_OUTGOING_ARGS 1 /* Define this if it is the responsibility of the caller to diff --git a/gcc/config/pa/pa.c b/gcc/config/pa/pa.c index 8076c4073ff..3fff521df55 100644 --- a/gcc/config/pa/pa.c +++ b/gcc/config/pa/pa.c @@ -3570,7 +3570,7 @@ compute_frame_size (HOST_WIDE_INT size, int *fregs_live) size of the current function's stack frame. We don't need to align for the outgoing arguments as their alignment is set by the final rounding for the frame as a whole. */ - size += current_function_outgoing_args_size; + size += crtl->outgoing_args_size; /* Allocate space for the fixed frame marker. This space must be allocated for any function that makes calls or allocates @@ -5935,9 +5935,9 @@ hppa_builtin_saveregs (void) ? UNITS_PER_WORD : 0); if (argadj) - offset = plus_constant (current_function_arg_offset_rtx, argadj); + offset = plus_constant (crtl->args.arg_offset_rtx, argadj); else - offset = current_function_arg_offset_rtx; + offset = crtl->args.arg_offset_rtx; if (TARGET_64BIT) { @@ -5945,9 +5945,9 @@ hppa_builtin_saveregs (void) /* Adjust for varargs/stdarg differences. */ if (argadj) - offset = plus_constant (current_function_arg_offset_rtx, -argadj); + offset = plus_constant (crtl->args.arg_offset_rtx, -argadj); else - offset = current_function_arg_offset_rtx; + offset = crtl->args.arg_offset_rtx; /* We need to save %r26 .. %r19 inclusive starting at offset -64 from the incoming arg pointer and growing to larger addresses. */ @@ -5971,7 +5971,7 @@ hppa_builtin_saveregs (void) /* Store general registers on the stack. */ dest = gen_rtx_MEM (BLKmode, - plus_constant (current_function_internal_arg_pointer, + plus_constant (crtl->args.internal_arg_pointer, -16)); set_mem_alias_set (dest, get_varargs_alias_set ()); set_mem_align (dest, BITS_PER_WORD); @@ -5989,7 +5989,7 @@ hppa_builtin_saveregs (void) emit_insn (gen_blockage ()); return copy_to_reg (expand_binop (Pmode, add_optab, - current_function_internal_arg_pointer, + crtl->args.internal_arg_pointer, offset, 0, 0, OPTAB_LIB_WIDEN)); } diff --git a/gcc/config/pa/pa.h b/gcc/config/pa/pa.h index 07f675e00ff..bcbacb4c69c 100644 --- a/gcc/config/pa/pa.h +++ b/gcc/config/pa/pa.h @@ -1,6 +1,6 @@ /* Definitions of target machine for GNU compiler, for the HP Spectrum. - Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, - 2001, 2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc. + Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, + 2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. Contributed by Michael Tiemann (tiemann@cygnus.com) of Cygnus Support and Tim Moore (moore@defmacro.cs.utah.edu) of the Center for Software Science at the University of Utah. @@ -566,12 +566,12 @@ extern struct rtx_def *hppa_pic_save_rtx (void); marker, although the runtime documentation only describes a 16 byte marker. For compatibility, we allocate 48 bytes. */ #define STACK_POINTER_OFFSET \ - (TARGET_64BIT ? -(current_function_outgoing_args_size + 48): -32) + (TARGET_64BIT ? -(crtl->outgoing_args_size + 48): -32) #define STACK_DYNAMIC_OFFSET(FNDECL) \ (TARGET_64BIT \ ? (STACK_POINTER_OFFSET) \ - : ((STACK_POINTER_OFFSET) - current_function_outgoing_args_size)) + : ((STACK_POINTER_OFFSET) - crtl->outgoing_args_size)) /* Value is 1 if returning from a function call automatically pops the arguments described by the number-of-args field in the call. @@ -791,7 +791,7 @@ extern int may_call_alloca; #define EXIT_IGNORE_STACK \ (get_frame_size () != 0 \ - || current_function_calls_alloca || current_function_outgoing_args_size) + || current_function_calls_alloca || crtl->outgoing_args_size) /* Output assembler code for a block containing the constant parts of a trampoline, leaving space for the variable parts.\ @@ -921,8 +921,8 @@ extern int may_call_alloca; emit_insn (gen_andsi3 (end_addr, tmp, \ GEN_INT (-MIN_CACHELINE_SIZE))); \ emit_move_insn (line_length, GEN_INT (MIN_CACHELINE_SIZE)); \ - emit_insn (gen_dcacheflush (start_addr, end_addr, line_length)); \ - emit_insn (gen_icacheflush (start_addr, end_addr, line_length, \ + emit_insn (gen_dcacheflushsi (start_addr, end_addr, line_length));\ + emit_insn (gen_icacheflushsi (start_addr, end_addr, line_length, \ gen_reg_rtx (Pmode), \ gen_reg_rtx (Pmode))); \ } \ @@ -953,8 +953,8 @@ extern int may_call_alloca; emit_insn (gen_anddi3 (end_addr, tmp, \ GEN_INT (-MIN_CACHELINE_SIZE))); \ emit_move_insn (line_length, GEN_INT (MIN_CACHELINE_SIZE)); \ - emit_insn (gen_dcacheflush (start_addr, end_addr, line_length)); \ - emit_insn (gen_icacheflush (start_addr, end_addr, line_length, \ + emit_insn (gen_dcacheflushdi (start_addr, end_addr, line_length));\ + emit_insn (gen_icacheflushdi (start_addr, end_addr, line_length, \ gen_reg_rtx (Pmode), \ gen_reg_rtx (Pmode))); \ } \ diff --git a/gcc/config/pa/pa.md b/gcc/config/pa/pa.md index 9487afac5d3..ee6037a75b6 100644 --- a/gcc/config/pa/pa.md +++ b/gcc/config/pa/pa.md @@ -1,6 +1,6 @@ ;;- Machine description for HP PA-RISC architecture for GCC compiler ;; Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, -;; 2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc. +;; 2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. ;; Contributed by the Center for Software Science at the University ;; of Utah. @@ -64,6 +64,16 @@ (MAX_17BIT_OFFSET 262100) ; 17-bit branch ]) +;; Mode and code iterators + +;; This mode iterator allows :P to be used for patterns that operate on +;; pointer-sized quantities. Exactly one of the two alternatives will match. +(define_mode_iterator P [(SI "Pmode == SImode") (DI "Pmode == DImode")]) + +;; This attribute defines the condition prefix for word and double word +;; add, compare, subtract and logical instructions. +(define_mode_attr dwc [(SI "") (DI "*")]) + ;; Insn type. Used to default other attribute values. ;; type "unary" insns have one input operand (1) and one output operand (0) @@ -7628,7 +7638,7 @@ add,l %2,%3,%3\;bv,n %%r0(%3)" the only method that we have for doing DImode multiplication is with a libcall. This could be trouble if we haven't allocated enough space for the outgoing arguments. */ - gcc_assert (INTVAL (nb) <= current_function_outgoing_args_size); + gcc_assert (INTVAL (nb) <= crtl->outgoing_args_size); emit_move_insn (arg_pointer_rtx, gen_rtx_PLUS (word_mode, stack_pointer_rtx, @@ -8127,7 +8137,7 @@ add,l %2,%3,%3\;bv,n %%r0(%3)" the only method that we have for doing DImode multiplication is with a libcall. This could be trouble if we haven't allocated enough space for the outgoing arguments. */ - gcc_assert (INTVAL (nb) <= current_function_outgoing_args_size); + gcc_assert (INTVAL (nb) <= crtl->outgoing_args_size); emit_move_insn (arg_pointer_rtx, gen_rtx_PLUS (word_mode, stack_pointer_rtx, @@ -8645,7 +8655,7 @@ add,l %2,%3,%3\;bv,n %%r0(%3)" the only method that we have for doing DImode multiplication is with a libcall. This could be trouble if we haven't allocated enough space for the outgoing arguments. */ - gcc_assert (INTVAL (nb) <= current_function_outgoing_args_size); + gcc_assert (INTVAL (nb) <= crtl->outgoing_args_size); emit_move_insn (arg_pointer_rtx, gen_rtx_PLUS (word_mode, stack_pointer_rtx, @@ -8726,7 +8736,7 @@ add,l %2,%3,%3\;bv,n %%r0(%3)" the only method that we have for doing DImode multiplication is with a libcall. This could be trouble if we haven't allocated enough space for the outgoing arguments. */ - gcc_assert (INTVAL (nb) <= current_function_outgoing_args_size); + gcc_assert (INTVAL (nb) <= crtl->outgoing_args_size); emit_move_insn (arg_pointer_rtx, gen_rtx_PLUS (word_mode, stack_pointer_rtx, @@ -9610,42 +9620,34 @@ add,l %2,%3,%3\;bv,n %%r0(%3)" [(set_attr "type" "fpalu") (set_attr "length" "4")]) -;; Flush the I and D cache lines from the start address (operand0) -;; to the end address (operand1). No lines are flushed if the end -;; address is less than the start address (unsigned). +;; The following two patterns are used by the trampoline code for nested +;; functions. They flush the I and D cache lines from the start address +;; (operand0) to the end address (operand1). No lines are flushed if the +;; end address is less than the start address (unsigned). ;; -;; Because the range of memory flushed is variable and the size of -;; a MEM can only be a CONST_INT, the patterns specify that they -;; perform an unspecified volatile operation on all memory. +;; Because the range of memory flushed is variable and the size of a MEM +;; can only be a CONST_INT, the patterns specify that they perform an +;; unspecified volatile operation on all memory. ;; ;; The address range for an icache flush must lie within a single ;; space on targets with non-equivalent space registers. ;; -;; This is used by the trampoline code for nested functions. -;; ;; Operand 0 contains the start address. ;; Operand 1 contains the end address. ;; Operand 2 contains the line length to use. -;; Operands 3 and 4 (icacheflush) are clobbered scratch registers. -(define_insn "dcacheflush" +(define_insn "dcacheflush<P:mode>" [(const_int 1) (unspec_volatile [(mem:BLK (scratch))] UNSPECV_DCACHE) (use (match_operand 0 "pmode_register_operand" "r")) (use (match_operand 1 "pmode_register_operand" "r")) (use (match_operand 2 "pmode_register_operand" "r")) - (clobber (match_scratch 3 "=&0"))] + (clobber (match_scratch:P 3 "=&0"))] "" - "* -{ - if (TARGET_64BIT) - return \"cmpb,*<<=,n %3,%1,.\;fdc,m %2(%3)\;sync\"; - else - return \"cmpb,<<=,n %3,%1,.\;fdc,m %2(%3)\;sync\"; -}" + "cmpb,<dwc><<=,n %3,%1,.\;fdc,m %2(%3)\;sync" [(set_attr "type" "multi") (set_attr "length" "12")]) -(define_insn "icacheflush" +(define_insn "icacheflush<P:mode>" [(const_int 2) (unspec_volatile [(mem:BLK (scratch))] UNSPECV_ICACHE) (use (match_operand 0 "pmode_register_operand" "r")) @@ -9653,15 +9655,9 @@ add,l %2,%3,%3\;bv,n %%r0(%3)" (use (match_operand 2 "pmode_register_operand" "r")) (clobber (match_operand 3 "pmode_register_operand" "=&r")) (clobber (match_operand 4 "pmode_register_operand" "=&r")) - (clobber (match_scratch 5 "=&0"))] + (clobber (match_scratch:P 5 "=&0"))] "" - "* -{ - if (TARGET_64BIT) - return \"mfsp %%sr0,%4\;ldsid (%5),%3\;mtsp %3,%%sr0\;cmpb,*<<=,n %5,%1,.\;fic,m %2(%%sr0,%5)\;sync\;mtsp %4,%%sr0\;nop\;nop\;nop\;nop\;nop\;nop\"; - else - return \"mfsp %%sr0,%4\;ldsid (%5),%3\;mtsp %3,%%sr0\;cmpb,<<=,n %5,%1,.\;fic,m %2(%%sr0,%5)\;sync\;mtsp %4,%%sr0\;nop\;nop\;nop\;nop\;nop\;nop\"; -}" + "mfsp %%sr0,%4\;ldsid (%5),%3\;mtsp %3,%%sr0\;cmpb,<dwc><<=,n %5,%1,.\;fic,m %2(%%sr0,%5)\;sync\;mtsp %4,%%sr0\;nop\;nop\;nop\;nop\;nop\;nop" [(set_attr "type" "multi") (set_attr "length" "52")]) diff --git a/gcc/config/rs6000/darwin.h b/gcc/config/rs6000/darwin.h index f6c9ee3c2e2..9479fc312ca 100644 --- a/gcc/config/rs6000/darwin.h +++ b/gcc/config/rs6000/darwin.h @@ -173,12 +173,12 @@ #define STARTING_FRAME_OFFSET \ (FRAME_GROWS_DOWNWARD \ ? 0 \ - : (RS6000_ALIGN (current_function_outgoing_args_size, 16) \ + : (RS6000_ALIGN (crtl->outgoing_args_size, 16) \ + RS6000_SAVE_AREA)) #undef STACK_DYNAMIC_OFFSET #define STACK_DYNAMIC_OFFSET(FUNDECL) \ - (RS6000_ALIGN (current_function_outgoing_args_size, 16) \ + (RS6000_ALIGN (crtl->outgoing_args_size, 16) \ + (STACK_POINTER_OFFSET)) /* These are used by -fbranch-probabilities */ diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c index 9734c4ee2fd..0d868944218 100644 --- a/gcc/config/rs6000/rs6000.c +++ b/gcc/config/rs6000/rs6000.c @@ -6656,10 +6656,10 @@ rs6000_va_start (tree valist, rtx nextarg) sav = build3 (COMPONENT_REF, TREE_TYPE (f_sav), valist, f_sav, NULL_TREE); /* Count number of gp and fp argument registers used. */ - words = current_function_args_info.words; - n_gpr = MIN (current_function_args_info.sysv_gregno - GP_ARG_MIN_REG, + words = crtl->args.info.words; + n_gpr = MIN (crtl->args.info.sysv_gregno - GP_ARG_MIN_REG, GP_ARG_NUM_REG); - n_fpr = MIN (current_function_args_info.fregno - FP_ARG_MIN_REG, + n_fpr = MIN (crtl->args.info.fregno - FP_ARG_MIN_REG, FP_ARG_NUM_REG); if (TARGET_DEBUG_ARG) @@ -11226,9 +11226,6 @@ rs6000_check_sdmode (tree *tp, int *walk_subtrees, void *data ATTRIBUTE_UNUSED) return NULL_TREE; } - gcc_assert (TREE_CODE (*tp) != ALIGN_INDIRECT_REF); - gcc_assert (TREE_CODE (*tp) != MISALIGNED_INDIRECT_REF); - switch (TREE_CODE (*tp)) { case VAR_DECL: @@ -11237,6 +11234,8 @@ rs6000_check_sdmode (tree *tp, int *walk_subtrees, void *data ATTRIBUTE_UNUSED) case RESULT_DECL: case REAL_CST: case INDIRECT_REF: + case ALIGN_INDIRECT_REF: + case MISALIGNED_INDIRECT_REF: case VIEW_CONVERT_EXPR: if (TYPE_MODE (TREE_TYPE (*tp)) == SDmode) return *tp; @@ -14207,7 +14206,7 @@ compute_vrsave_mask (void) them in again. More importantly, the mask we compute here is used to generate CLOBBERs in the set_vrsave insn, and we do not wish the argument registers to die. */ - for (i = cfun->args_info.vregno - 1; i >= ALTIVEC_ARG_MIN_REG; --i) + for (i = crtl->args.info.vregno - 1; i >= ALTIVEC_ARG_MIN_REG; --i) mask &= ~ALTIVEC_REG_BIT (i); /* Similarly, remove the return value from the set. */ @@ -14259,6 +14258,9 @@ compute_save_world_info (rs6000_stack_t *info_ptr) will attempt to save it. */ info_ptr->vrsave_size = 4; + /* If we are going to save the world, we need to save the link register too. */ + info_ptr->lr_save_p = 1; + /* "Save" the VRsave register too if we're saving the world. */ if (info_ptr->vrsave_mask == 0) info_ptr->vrsave_mask = compute_vrsave_mask (); @@ -14496,7 +14498,7 @@ rs6000_stack_info (void) info_ptr->reg_size = reg_size; info_ptr->fixed_size = RS6000_SAVE_AREA; info_ptr->vars_size = RS6000_ALIGN (get_frame_size (), 8); - info_ptr->parm_size = RS6000_ALIGN (current_function_outgoing_args_size, + info_ptr->parm_size = RS6000_ALIGN (crtl->outgoing_args_size, TARGET_ALTIVEC ? 16 : 8); if (FRAME_GROWS_DOWNWARD) info_ptr->vars_size @@ -16838,7 +16840,7 @@ rs6000_output_function_epilogue (FILE *file, if (! strcmp (language_string, "GNU C")) i = 0; else if (! strcmp (language_string, "GNU F77") - || ! strcmp (language_string, "GNU F95")) + || ! strcmp (language_string, "GNU Fortran")) i = 1; else if (! strcmp (language_string, "GNU Pascal")) i = 2; diff --git a/gcc/config/rs6000/rs6000.h b/gcc/config/rs6000/rs6000.h index 7f7dd57e1e1..62f1d38f9a7 100644 --- a/gcc/config/rs6000/rs6000.h +++ b/gcc/config/rs6000/rs6000.h @@ -1288,7 +1288,7 @@ extern enum rs6000_abi rs6000_current_abi; /* available for use by subtarget */ #define STARTING_FRAME_OFFSET \ (FRAME_GROWS_DOWNWARD \ ? 0 \ - : (RS6000_ALIGN (current_function_outgoing_args_size, \ + : (RS6000_ALIGN (crtl->outgoing_args_size, \ TARGET_ALTIVEC ? 16 : 8) \ + RS6000_SAVE_AREA)) @@ -1299,7 +1299,7 @@ extern enum rs6000_abi rs6000_current_abi; /* available for use by subtarget */ length of the outgoing arguments. The default is correct for most machines. See `function.c' for details. */ #define STACK_DYNAMIC_OFFSET(FUNDECL) \ - (RS6000_ALIGN (current_function_outgoing_args_size, \ + (RS6000_ALIGN (crtl->outgoing_args_size, \ TARGET_ALTIVEC ? 16 : 8) \ + (STACK_POINTER_OFFSET)) @@ -1334,7 +1334,7 @@ extern enum rs6000_abi rs6000_current_abi; /* available for use by subtarget */ /* Define this if the maximum size of all the outgoing args is to be accumulated and pushed during the prologue. The amount can be - found in the variable current_function_outgoing_args_size. */ + found in the variable crtl->outgoing_args_size. */ #define ACCUMULATE_OUTGOING_ARGS 1 /* Value is the number of bytes of arguments automatically diff --git a/gcc/config/s390/s390.c b/gcc/config/s390/s390.c index 280358c0c3f..f2a1947f5ae 100644 --- a/gcc/config/s390/s390.c +++ b/gcc/config/s390/s390.c @@ -6620,9 +6620,9 @@ s390_register_info (int clobbered_regs[]) { /* Varargs functions need to save gprs 2 to 6. */ if (cfun->va_list_gpr_size - && current_function_args_info.gprs < GP_ARG_NUM_REG) + && crtl->args.info.gprs < GP_ARG_NUM_REG) { - int min_gpr = current_function_args_info.gprs; + int min_gpr = crtl->args.info.gprs; int max_gpr = min_gpr + cfun->va_list_gpr_size; if (max_gpr > GP_ARG_NUM_REG) max_gpr = GP_ARG_NUM_REG; @@ -6644,9 +6644,9 @@ s390_register_info (int clobbered_regs[]) /* Mark f0, f2 for 31 bit and f0-f4 for 64 bit to be saved. */ if (TARGET_HARD_FLOAT && cfun->va_list_fpr_size - && current_function_args_info.fprs < FP_ARG_NUM_REG) + && crtl->args.info.fprs < FP_ARG_NUM_REG) { - int min_fpr = current_function_args_info.fprs; + int min_fpr = crtl->args.info.fprs; int max_fpr = min_fpr + cfun->va_list_fpr_size; if (max_fpr > FP_ARG_NUM_REG) max_fpr = FP_ARG_NUM_REG; @@ -6744,7 +6744,7 @@ s390_frame_info (void) if (!TARGET_PACKED_STACK) cfun_frame_layout.frame_size += (STACK_POINTER_OFFSET - + current_function_outgoing_args_size + + crtl->outgoing_args_size + cfun_frame_layout.high_fprs * 8); else { @@ -6772,7 +6772,7 @@ s390_frame_info (void) STACK_BOUNDARY / BITS_PER_UNIT - 1) & ~(STACK_BOUNDARY / BITS_PER_UNIT - 1)); - cfun_frame_layout.frame_size += current_function_outgoing_args_size; + cfun_frame_layout.frame_size += crtl->outgoing_args_size; } } @@ -6986,7 +6986,7 @@ s390_initial_elimination_offset (int from, int to) case FRAME_POINTER_REGNUM: offset = (get_frame_size() + STACK_POINTER_OFFSET - + current_function_outgoing_args_size); + + crtl->outgoing_args_size); break; case ARG_POINTER_REGNUM: @@ -8011,9 +8011,9 @@ s390_build_builtin_va_list (void) The following global variables are used to initialize the va_list structure: - current_function_args_info: + crtl->args.info: holds number of gprs and fprs used for named arguments. - current_function_arg_offset_rtx: + crtl->args.arg_offset_rtx: holds the offset of the first anonymous stack argument (relative to the virtual arg pointer). */ @@ -8038,8 +8038,8 @@ s390_va_start (tree valist, rtx nextarg ATTRIBUTE_UNUSED) /* Count number of gp and fp argument registers used. */ - n_gpr = current_function_args_info.gprs; - n_fpr = current_function_args_info.fprs; + n_gpr = crtl->args.info.gprs; + n_fpr = crtl->args.info.fprs; if (cfun->va_list_gpr_size) { @@ -8063,7 +8063,7 @@ s390_va_start (tree valist, rtx nextarg ATTRIBUTE_UNUSED) { t = make_tree (TREE_TYPE (ovf), virtual_incoming_args_rtx); - off = INTVAL (current_function_arg_offset_rtx); + off = INTVAL (crtl->args.arg_offset_rtx); off = off < 0 ? 0 : off; if (TARGET_DEBUG_ARG) fprintf (stderr, "va_start: n_gpr = %d, n_fpr = %d off %d\n", diff --git a/gcc/config/s390/s390.h b/gcc/config/s390/s390.h index 391ac1ce5e7..bec01200677 100644 --- a/gcc/config/s390/s390.h +++ b/gcc/config/s390/s390.h @@ -521,9 +521,8 @@ extern const enum reg_class regclass_map[FIRST_PSEUDO_REGISTER]; /* Offset from the stack pointer register to an item dynamically allocated on the stack, e.g., by `alloca'. */ -extern int current_function_outgoing_args_size; #define STACK_DYNAMIC_OFFSET(FUNDECL) \ - (STACK_POINTER_OFFSET + current_function_outgoing_args_size) + (STACK_POINTER_OFFSET + crtl->outgoing_args_size) /* Offset of first parameter from the argument pointer register value. We have a fake argument pointer register that points directly to diff --git a/gcc/config/score/score.h b/gcc/config/score/score.h index 8a1efb6f4f5..ffb5af891ee 100644 --- a/gcc/config/score/score.h +++ b/gcc/config/score/score.h @@ -508,7 +508,7 @@ extern enum reg_class score_char_to_class[256]; /* The offset of the first local variable from the beginning of the frame. See compute_frame_size for details about the frame layout. */ -#define STARTING_FRAME_OFFSET current_function_outgoing_args_size +#define STARTING_FRAME_OFFSET crtl->outgoing_args_size /* The argument pointer always points to the first argument. */ #define FIRST_PARM_OFFSET(FUNDECL) 0 @@ -578,7 +578,7 @@ extern enum reg_class score_char_to_class[256]; allocate the area reserved for arguments passed in registers. If `ACCUMULATE_OUTGOING_ARGS' is also defined, the only effect of this macro is to determine whether the space is included in - `current_function_outgoing_args_size'. */ + `crtl->outgoing_args_size'. */ #define OUTGOING_REG_PARM_STACK_SPACE 1 #define RETURN_POPS_ARGS(FUNDECL, FUNTYPE, STACK_SIZE) 0 diff --git a/gcc/config/score/score3.c b/gcc/config/score/score3.c index 592f5f5a1f7..1399bee15cb 100644 --- a/gcc/config/score/score3.c +++ b/gcc/config/score/score3.c @@ -183,7 +183,7 @@ score3_compute_frame_size (HOST_WIDE_INT size) f->gp_reg_size = 0; f->mask = 0; f->var_size = SCORE3_STACK_ALIGN (size); - f->args_size = current_function_outgoing_args_size; + f->args_size = crtl->outgoing_args_size; f->cprestore_size = flag_pic ? UNITS_PER_WORD : 0; if (f->var_size == 0 && current_function_is_leaf) diff --git a/gcc/config/score/score7.c b/gcc/config/score/score7.c index 3c16b0d6173..2796e2e0d24 100644 --- a/gcc/config/score/score7.c +++ b/gcc/config/score/score7.c @@ -183,7 +183,7 @@ score7_compute_frame_size (HOST_WIDE_INT size) f->gp_reg_size = 0; f->mask = 0; f->var_size = SCORE7_STACK_ALIGN (size); - f->args_size = current_function_outgoing_args_size; + f->args_size = crtl->outgoing_args_size; f->cprestore_size = flag_pic ? UNITS_PER_WORD : 0; if (f->var_size == 0 && current_function_is_leaf) f->args_size = f->cprestore_size = 0; diff --git a/gcc/config/sh/sh.c b/gcc/config/sh/sh.c index 6013c2a4755..d020ccda582 100644 --- a/gcc/config/sh/sh.c +++ b/gcc/config/sh/sh.c @@ -5629,10 +5629,10 @@ output_stack_adjust (int size, rtx reg, int epilogue_p, if (epilogue_p > 0) { int nreg = 0; - if (current_function_return_rtx) + if (crtl->return_rtx) { enum machine_mode mode; - mode = GET_MODE (current_function_return_rtx); + mode = GET_MODE (crtl->return_rtx); if (BASE_RETURN_VALUE_REG (mode) == FIRST_RET_REG) nreg = HARD_REGNO_NREGS (FIRST_RET_REG, mode); } @@ -5970,7 +5970,7 @@ calc_live_regs (HARD_REG_SET *live_regs_mask) /* Force PR to be live if the prologue has to call the SHmedia argument decoder or register saver. */ if (TARGET_SHCOMPACT - && ((current_function_args_info.call_cookie + && ((crtl->args.info.call_cookie & ~ CALL_COOKIE_RET_TRAMP (1)) || current_function_saves_all_registers)) pr_live = 1; @@ -5997,7 +5997,7 @@ calc_live_regs (HARD_REG_SET *live_regs_mask) : (/* Only push those regs which are used and need to be saved. */ (TARGET_SHCOMPACT && flag_pic - && current_function_args_info.call_cookie + && crtl->args.info.call_cookie && reg == PIC_OFFSET_TABLE_REGNUM) || (df_regs_ever_live_p (reg) && (!call_really_used_regs[reg] @@ -6245,16 +6245,16 @@ sh_expand_prologue (void) /* We have pretend args if we had an object sent partially in registers and partially on the stack, e.g. a large structure. */ - pretend_args = current_function_pretend_args_size; + pretend_args = crtl->args.pretend_args_size; if (TARGET_VARARGS_PRETEND_ARGS (current_function_decl) && (NPARM_REGS(SImode) - > current_function_args_info.arg_count[(int) SH_ARG_INT])) + > crtl->args.info.arg_count[(int) SH_ARG_INT])) pretend_args = 0; output_stack_adjust (-pretend_args - - current_function_args_info.stack_regs * 8, + - crtl->args.info.stack_regs * 8, stack_pointer_rtx, 0, NULL); - if (TARGET_SHCOMPACT && flag_pic && current_function_args_info.call_cookie) + if (TARGET_SHCOMPACT && flag_pic && crtl->args.info.call_cookie) /* We're going to use the PIC register to load the address of the incoming-argument decoder and/or of the return trampoline from the GOT, so make sure the PIC register is preserved and @@ -6262,7 +6262,7 @@ sh_expand_prologue (void) df_set_regs_ever_live (PIC_OFFSET_TABLE_REGNUM, true); if (TARGET_SHCOMPACT - && (current_function_args_info.call_cookie & ~ CALL_COOKIE_RET_TRAMP(1))) + && (crtl->args.info.call_cookie & ~ CALL_COOKIE_RET_TRAMP(1))) { int reg; @@ -6270,20 +6270,20 @@ sh_expand_prologue (void) be pushed onto the stack live, so that register renaming doesn't overwrite them. */ for (reg = 0; reg < NPARM_REGS (SImode); reg++) - if (CALL_COOKIE_STACKSEQ_GET (current_function_args_info.call_cookie) + if (CALL_COOKIE_STACKSEQ_GET (crtl->args.info.call_cookie) >= NPARM_REGS (SImode) - reg) for (; reg < NPARM_REGS (SImode); reg++) emit_insn (gen_shcompact_preserve_incoming_args (gen_rtx_REG (SImode, FIRST_PARM_REG + reg))); else if (CALL_COOKIE_INT_REG_GET - (current_function_args_info.call_cookie, reg) == 1) + (crtl->args.info.call_cookie, reg) == 1) emit_insn (gen_shcompact_preserve_incoming_args (gen_rtx_REG (SImode, FIRST_PARM_REG + reg))); emit_move_insn (gen_rtx_REG (Pmode, MACL_REG), stack_pointer_rtx); emit_move_insn (gen_rtx_REG (SImode, R0_REG), - GEN_INT (current_function_args_info.call_cookie)); + GEN_INT (crtl->args.info.call_cookie)); emit_move_insn (gen_rtx_REG (SImode, MACH_REG), gen_rtx_REG (SImode, R0_REG)); } @@ -6308,7 +6308,7 @@ sh_expand_prologue (void) rtx insn; if (i >= (NPARM_REGS(SImode) - - current_function_args_info.arg_count[(int) SH_ARG_INT] + - crtl->args.info.arg_count[(int) SH_ARG_INT] )) break; insn = push (rn); @@ -6568,7 +6568,7 @@ sh_expand_prologue (void) frame_insn (GEN_MOV (hard_frame_pointer_rtx, stack_pointer_rtx)); if (TARGET_SHCOMPACT - && (current_function_args_info.call_cookie & ~ CALL_COOKIE_RET_TRAMP(1))) + && (crtl->args.info.call_cookie & ~ CALL_COOKIE_RET_TRAMP(1))) { /* This must NOT go through the PLT, otherwise mach and macl may be clobbered. */ @@ -6837,9 +6837,9 @@ sh_expand_epilogue (bool sibcall_p) emit_insn (gen_toggle_sz ()); target_flags = save_flags; - output_stack_adjust (current_function_pretend_args_size + output_stack_adjust (crtl->args.pretend_args_size + save_size + d_rounding - + current_function_args_info.stack_regs * 8, + + crtl->args.info.stack_regs * 8, stack_pointer_rtx, e, NULL); if (current_function_calls_eh_return) @@ -6956,11 +6956,11 @@ static rtx sh_builtin_saveregs (void) { /* First unnamed integer register. */ - int first_intreg = current_function_args_info.arg_count[(int) SH_ARG_INT]; + int first_intreg = crtl->args.info.arg_count[(int) SH_ARG_INT]; /* Number of integer registers we need to save. */ int n_intregs = MAX (0, NPARM_REGS (SImode) - first_intreg); /* First unnamed SFmode float reg */ - int first_floatreg = current_function_args_info.arg_count[(int) SH_ARG_FLOAT]; + int first_floatreg = crtl->args.info.arg_count[(int) SH_ARG_FLOAT]; /* Number of SFmode float regs to save. */ int n_floatregs = MAX (0, NPARM_REGS (SFmode) - first_floatreg); rtx regbuf, fpregs; @@ -6975,25 +6975,25 @@ sh_builtin_saveregs (void) while (pushregs < NPARM_REGS (SImode) - 1 && (CALL_COOKIE_INT_REG_GET - (current_function_args_info.call_cookie, + (crtl->args.info.call_cookie, NPARM_REGS (SImode) - pushregs) == 1)) { - current_function_args_info.call_cookie + crtl->args.info.call_cookie &= ~ CALL_COOKIE_INT_REG (NPARM_REGS (SImode) - pushregs, 1); pushregs++; } if (pushregs == NPARM_REGS (SImode)) - current_function_args_info.call_cookie + crtl->args.info.call_cookie |= (CALL_COOKIE_INT_REG (0, 1) | CALL_COOKIE_STACKSEQ (pushregs - 1)); else - current_function_args_info.call_cookie + crtl->args.info.call_cookie |= CALL_COOKIE_STACKSEQ (pushregs); - current_function_pretend_args_size += 8 * n_intregs; + crtl->args.pretend_args_size += 8 * n_intregs; } if (TARGET_SHCOMPACT) return const0_rtx; @@ -7191,7 +7191,7 @@ sh_va_start (tree valist, rtx nextarg) TREE_SIDE_EFFECTS (t) = 1; expand_expr (t, const0_rtx, VOIDmode, EXPAND_NORMAL); - nfp = current_function_args_info.arg_count[SH_ARG_FLOAT]; + nfp = crtl->args.info.arg_count[SH_ARG_FLOAT]; if (nfp < 8) nfp = 8 - nfp; else @@ -7206,7 +7206,7 @@ sh_va_start (tree valist, rtx nextarg) TREE_SIDE_EFFECTS (t) = 1; expand_expr (t, const0_rtx, VOIDmode, EXPAND_NORMAL); - nint = current_function_args_info.arg_count[SH_ARG_INT]; + nint = crtl->args.info.arg_count[SH_ARG_INT]; if (nint < 4) nint = 4 - nint; else @@ -7920,11 +7920,11 @@ initial_elimination_offset (int from, int to) if (from == ARG_POINTER_REGNUM && to == HARD_FRAME_POINTER_REGNUM) return total_saved_regs_space + total_auto_space - + current_function_args_info.byref_regs * 8; + + crtl->args.info.byref_regs * 8; if (from == ARG_POINTER_REGNUM && to == STACK_POINTER_REGNUM) return total_saved_regs_space + total_auto_space - + current_function_args_info.byref_regs * 8; + + crtl->args.info.byref_regs * 8; /* Initial gap between fp and sp is 0. */ if (from == HARD_FRAME_POINTER_REGNUM && to == STACK_POINTER_REGNUM) @@ -9206,7 +9206,7 @@ sh_allocate_initial_value (rtx hard_reg) if (current_function_is_leaf && ! sh_pr_n_sets () && ! (TARGET_SHCOMPACT - && ((current_function_args_info.call_cookie + && ((crtl->args.info.call_cookie & ~ CALL_COOKIE_RET_TRAMP (1)) || current_function_saves_all_registers))) x = hard_reg; @@ -9805,7 +9805,7 @@ sh_function_ok_for_sibcall (tree decl, tree exp ATTRIBUTE_UNUSED) { return (1 && (! TARGET_SHCOMPACT - || current_function_args_info.stack_regs == 0) + || crtl->args.info.stack_regs == 0) && ! sh_cfun_interrupt_handler_p () && (! flag_pic || (decl && ! TREE_PUBLIC (decl)) @@ -10602,7 +10602,7 @@ sh_get_pr_initial_val (void) PR register on SHcompact, because it might be clobbered by the prologue. We check first if that is known to be the case. */ if (TARGET_SHCOMPACT - && ((current_function_args_info.call_cookie + && ((crtl->args.info.call_cookie & ~ CALL_COOKIE_RET_TRAMP (1)) || current_function_saves_all_registers)) return gen_frame_mem (SImode, return_address_pointer_rtx); diff --git a/gcc/config/sh/sh.md b/gcc/config/sh/sh.md index 773c34775c1..cfcf1b23d19 100644 --- a/gcc/config/sh/sh.md +++ b/gcc/config/sh/sh.md @@ -9383,7 +9383,7 @@ mov.l\\t1f,r0\\n\\ } if (TARGET_SHCOMPACT - && (current_function_args_info.call_cookie & CALL_COOKIE_RET_TRAMP (1))) + && (crtl->args.info.call_cookie & CALL_COOKIE_RET_TRAMP (1))) { emit_jump_insn (gen_shcompact_return_tramp ()); DONE; @@ -9393,7 +9393,7 @@ mov.l\\t1f,r0\\n\\ (define_insn "*return_i" [(return)] "TARGET_SH1 && ! (TARGET_SHCOMPACT - && (current_function_args_info.call_cookie + && (crtl->args.info.call_cookie & CALL_COOKIE_RET_TRAMP (1))) && reload_completed && lookup_attribute (\"trap_exit\", @@ -9420,7 +9420,7 @@ mov.l\\t1f,r0\\n\\ (define_expand "shcompact_return_tramp" [(return)] "TARGET_SHCOMPACT - && (current_function_args_info.call_cookie & CALL_COOKIE_RET_TRAMP (1))" + && (crtl->args.info.call_cookie & CALL_COOKIE_RET_TRAMP (1))" " { rtx reg = gen_rtx_REG (Pmode, R0_REG); @@ -9433,7 +9433,7 @@ mov.l\\t1f,r0\\n\\ (define_insn "shcompact_return_tramp_i" [(parallel [(return) (use (reg:SI R0_REG))])] "TARGET_SHCOMPACT - && (current_function_args_info.call_cookie & CALL_COOKIE_RET_TRAMP (1))" + && (crtl->args.info.call_cookie & CALL_COOKIE_RET_TRAMP (1))" "jmp @r0%#" [(set_attr "type" "jump_ind") (set_attr "needs_delay_slot" "yes")]) diff --git a/gcc/config/sparc/sparc.c b/gcc/config/sparc/sparc.c index 54c81b191f4..962ed9fe3bc 100644 --- a/gcc/config/sparc/sparc.c +++ b/gcc/config/sparc/sparc.c @@ -3769,7 +3769,7 @@ sparc_init_modes (void) HOST_WIDE_INT sparc_compute_frame_size (HOST_WIDE_INT size, int leaf_function_p) { - int outgoing_args_size = (current_function_outgoing_args_size + int outgoing_args_size = (crtl->outgoing_args_size + REG_PARM_STACK_SPACE (current_function_decl)); int n_regs = 0; /* N_REGS is the number of 4-byte regs saved thus far. */ int i; @@ -3799,7 +3799,7 @@ sparc_compute_frame_size (HOST_WIDE_INT size, int leaf_function_p) if (leaf_function_p && n_regs == 0 && size == 0 - && current_function_outgoing_args_size == 0) + && crtl->outgoing_args_size == 0) actual_fsize = apparent_fsize = 0; else { @@ -5675,7 +5675,7 @@ function_value (const_tree type, enum machine_mode mode, int incoming_p) static rtx sparc_builtin_saveregs (void) { - int first_reg = current_function_args_info.words; + int first_reg = crtl->args.info.words; rtx address; int regno; diff --git a/gcc/config/sparc/sparc.h b/gcc/config/sparc/sparc.h index fcea5762334..eed016470b1 100644 --- a/gcc/config/sparc/sparc.h +++ b/gcc/config/sparc/sparc.h @@ -953,7 +953,7 @@ extern int sparc_mode_class[]; /* Given the stack bias, the stack pointer isn't actually aligned. */ #define INIT_EXPANDERS \ do { \ - if (rtl.emit.regno_pointer_align && SPARC_STACK_BIAS) \ + if (crtl->emit.regno_pointer_align && SPARC_STACK_BIAS) \ { \ REGNO_POINTER_ALIGN (STACK_POINTER_REGNUM) = BITS_PER_UNIT; \ REGNO_POINTER_ALIGN (HARD_FRAME_POINTER_REGNUM) = BITS_PER_UNIT; \ @@ -1678,7 +1678,7 @@ do { \ #define EXIT_IGNORE_STACK \ (get_frame_size () != 0 \ - || current_function_calls_alloca || current_function_outgoing_args_size) + || current_function_calls_alloca || crtl->outgoing_args_size) /* Define registers used by the epilogue and return instruction. */ #define EPILOGUE_USES(REGNO) ((REGNO) == 31 \ diff --git a/gcc/config/spu/spu.c b/gcc/config/spu/spu.c index 4592e667f08..55868ac2bb9 100644 --- a/gcc/config/spu/spu.c +++ b/gcc/config/spu/spu.c @@ -1686,8 +1686,8 @@ direct_return (void) if (cfun->static_chain_decl == 0 && (spu_saved_regs_size () + get_frame_size () - + current_function_outgoing_args_size - + current_function_pretend_args_size == 0) + + crtl->outgoing_args_size + + crtl->args.pretend_args_size == 0) && current_function_is_leaf) return 1; } @@ -1705,7 +1705,7 @@ direct_return (void) prev SP | back chain | +-------------+ | var args | - | reg save | current_function_pretend_args_size bytes + | reg save | crtl->args.pretend_args_size bytes +-------------+ | ... | | saved regs | spu_saved_regs_size() bytes @@ -1715,7 +1715,7 @@ direct_return (void) +-------------+ | ... | | outgoing | - | args | current_function_outgoing_args_size bytes + | args | crtl->outgoing_args_size bytes +-------------+ | $lr of next | | frame | @@ -1749,8 +1749,8 @@ spu_expand_prologue (void) saved_regs_size = spu_saved_regs_size (); total_size = size + saved_regs_size - + current_function_outgoing_args_size - + current_function_pretend_args_size; + + crtl->outgoing_args_size + + crtl->args.pretend_args_size; if (!current_function_is_leaf || current_function_calls_alloca || total_size > 0) @@ -1766,7 +1766,7 @@ spu_expand_prologue (void) if (total_size > 0) { - offset = -current_function_pretend_args_size; + offset = -crtl->args.pretend_args_size; for (regno = 0; regno < FIRST_PSEUDO_REGISTER; ++regno) if (need_to_save_reg (regno, 1)) { @@ -1840,7 +1840,7 @@ spu_expand_prologue (void) { rtx fp_reg = gen_rtx_REG (Pmode, HARD_FRAME_POINTER_REGNUM); HOST_WIDE_INT fp_offset = STACK_POINTER_OFFSET - + current_function_outgoing_args_size; + + crtl->outgoing_args_size; /* Set the new frame_pointer */ insn = frame_emit_add_imm (fp_reg, sp_reg, fp_offset, scratch_reg_0); RTX_FRAME_RELATED_P (insn) = 1; @@ -1874,8 +1874,8 @@ spu_expand_epilogue (bool sibcall_p) saved_regs_size = spu_saved_regs_size (); total_size = size + saved_regs_size - + current_function_outgoing_args_size - + current_function_pretend_args_size; + + crtl->outgoing_args_size + + crtl->args.pretend_args_size; if (!current_function_is_leaf || current_function_calls_alloca || total_size > 0) @@ -1891,7 +1891,7 @@ spu_expand_epilogue (bool sibcall_p) if (saved_regs_size > 0) { - offset = -current_function_pretend_args_size; + offset = -crtl->args.pretend_args_size; for (regno = 0; regno < FIRST_PSEUDO_REGISTER; ++regno) if (need_to_save_reg (regno, 1)) { @@ -3045,15 +3045,15 @@ spu_initial_elimination_offset (int from, int to) { int saved_regs_size = spu_saved_regs_size (); int sp_offset = 0; - if (!current_function_is_leaf || current_function_outgoing_args_size + if (!current_function_is_leaf || crtl->outgoing_args_size || get_frame_size () || saved_regs_size) sp_offset = STACK_POINTER_OFFSET; if (from == FRAME_POINTER_REGNUM && to == STACK_POINTER_REGNUM) - return (sp_offset + current_function_outgoing_args_size); + return (sp_offset + crtl->outgoing_args_size); else if (from == FRAME_POINTER_REGNUM && to == HARD_FRAME_POINTER_REGNUM) return 0; else if (from == ARG_POINTER_REGNUM && to == STACK_POINTER_REGNUM) - return sp_offset + current_function_outgoing_args_size + return sp_offset + crtl->outgoing_args_size + get_frame_size () + saved_regs_size + STACK_POINTER_OFFSET; else if (from == ARG_POINTER_REGNUM && to == HARD_FRAME_POINTER_REGNUM) return get_frame_size () + saved_regs_size + sp_offset; @@ -3211,10 +3211,10 @@ spu_build_builtin_va_list (void) The following global variables are used to initialize the va_list structure: - current_function_args_info; + crtl->args.info; the CUMULATIVE_ARGS for this function - current_function_arg_offset_rtx: + crtl->args.arg_offset_rtx: holds the offset of the first anonymous stack argument (relative to the virtual arg pointer). */ @@ -3235,7 +3235,7 @@ spu_va_start (tree valist, rtx nextarg) /* Find the __args area. */ t = make_tree (TREE_TYPE (args), nextarg); - if (current_function_pretend_args_size > 0) + if (crtl->args.pretend_args_size > 0) t = build2 (POINTER_PLUS_EXPR, TREE_TYPE (args), t, size_int (-STACK_POINTER_OFFSET)); t = build2 (GIMPLE_MODIFY_STMT, TREE_TYPE (args), args, t); @@ -3245,7 +3245,7 @@ spu_va_start (tree valist, rtx nextarg) /* Find the __skip area. */ t = make_tree (TREE_TYPE (skip), virtual_incoming_args_rtx); t = build2 (POINTER_PLUS_EXPR, TREE_TYPE (skip), t, - size_int (current_function_pretend_args_size + size_int (crtl->args.pretend_args_size - STACK_POINTER_OFFSET)); t = build2 (GIMPLE_MODIFY_STMT, TREE_TYPE (skip), skip, t); TREE_SIDE_EFFECTS (t) = 1; @@ -4518,10 +4518,9 @@ spu_init_builtins (void) if (d->name == 0) continue; - /* find last parm */ + /* Find last parm. */ for (parm = 1; d->parm[parm] != SPU_BTI_END_OF_PARAMS; parm++) - { - } + ; p = void_list_node; while (parm > 1) @@ -4535,6 +4534,9 @@ spu_init_builtins (void) NULL, NULL_TREE); if (d->fcode == SPU_MASK_FOR_LOAD) TREE_READONLY (d->fndecl) = 1; + + /* These builtins don't throw. */ + TREE_NOTHROW (d->fndecl) = 1; } } diff --git a/gcc/config/stormy16/stormy16.c b/gcc/config/stormy16/stormy16.c index 078b367554f..99aea1ce660 100644 --- a/gcc/config/stormy16/stormy16.c +++ b/gcc/config/stormy16/stormy16.c @@ -1005,13 +1005,13 @@ xstormy16_compute_stack_layout (void) + layout.register_save_size + layout.stdarg_save_size); - if (current_function_args_size <= 2048 && current_function_args_size != -1) + if (crtl->args.size <= 2048 && crtl->args.size != -1) { if (layout.frame_size + INCOMING_FRAME_SP_OFFSET - + current_function_args_size <= 2048) + + crtl->args.size <= 2048) layout.fp_minus_ap = layout.frame_size + INCOMING_FRAME_SP_OFFSET; else - layout.fp_minus_ap = 2048 - current_function_args_size; + layout.fp_minus_ap = 2048 - crtl->args.size; } else layout.fp_minus_ap = (layout.stdarg_save_size @@ -1356,7 +1356,7 @@ xstormy16_expand_builtin_va_start (tree valist, rtx nextarg ATTRIBUTE_UNUSED) t = build2 (GIMPLE_MODIFY_STMT, TREE_TYPE (count), count, build_int_cst (NULL_TREE, - current_function_args_info * UNITS_PER_WORD)); + crtl->args.info * UNITS_PER_WORD)); TREE_SIDE_EFFECTS (t) = 1; expand_expr (t, const0_rtx, VOIDmode, EXPAND_NORMAL); } diff --git a/gcc/config/v850/v850.c b/gcc/config/v850/v850.c index 85991db47e3..c99841a31a4 100644 --- a/gcc/config/v850/v850.c +++ b/gcc/config/v850/v850.c @@ -1488,7 +1488,7 @@ compute_frame_size (int size, long * p_reg_saved) { return (size + compute_register_save_size (p_reg_saved) - + current_function_outgoing_args_size); + + crtl->outgoing_args_size); } @@ -1525,7 +1525,7 @@ expand_prologue (void) } /* Save arg registers to the stack if necessary. */ - else if (current_function_args_info.anonymous_args) + else if (crtl->args.info.anonymous_args) { if (TARGET_PROLOG_FUNCTION && TARGET_V850E && !TARGET_DISABLE_CALLT) emit_insn (gen_save_r6_r9_v850e ()); diff --git a/gcc/config/v850/v850.h b/gcc/config/v850/v850.h index f7bb17fc56c..50119c2a197 100644 --- a/gcc/config/v850/v850.h +++ b/gcc/config/v850/v850.h @@ -557,7 +557,7 @@ enum reg_class #define INITIAL_ELIMINATION_OFFSET(FROM, TO, OFFSET) \ { \ if ((FROM) == FRAME_POINTER_REGNUM) \ - (OFFSET) = get_frame_size () + current_function_outgoing_args_size; \ + (OFFSET) = get_frame_size () + crtl->outgoing_args_size; \ else if ((FROM) == ARG_POINTER_REGNUM) \ (OFFSET) = compute_frame_size (get_frame_size (), (long *)0); \ else \ diff --git a/gcc/config/xtensa/xtensa.c b/gcc/config/xtensa/xtensa.c index 2518aedc000..a5ca4635248 100644 --- a/gcc/config/xtensa/xtensa.c +++ b/gcc/config/xtensa/xtensa.c @@ -2292,7 +2292,7 @@ compute_frame_size (int size) xtensa_current_frame_size = XTENSA_STACK_ALIGN (size - + current_function_outgoing_args_size + + crtl->outgoing_args_size + (WINDOW_SIZE * UNITS_PER_WORD)); return xtensa_current_frame_size; } @@ -2485,7 +2485,7 @@ static rtx xtensa_builtin_saveregs (void) { rtx gp_regs; - int arg_words = current_function_args_info.arg_words; + int arg_words = crtl->args.info.arg_words; int gp_left = MAX_ARGS_IN_REGISTERS - arg_words; if (gp_left <= 0) @@ -2522,7 +2522,7 @@ xtensa_va_start (tree valist, rtx nextarg ATTRIBUTE_UNUSED) tree t, u; int arg_words; - arg_words = current_function_args_info.arg_words; + arg_words = crtl->args.info.arg_words; f_stk = TYPE_FIELDS (va_list_type_node); f_reg = TREE_CHAIN (f_stk); @@ -2868,7 +2868,7 @@ order_regs_for_local_alloc (void) /* Use the AR registers in increasing order (skipping a0 and a1) but save the incoming argument registers for a last resort. */ - num_arg_regs = current_function_args_info.arg_words; + num_arg_regs = crtl->args.info.arg_words; if (num_arg_regs > MAX_ARGS_IN_REGISTERS) num_arg_regs = MAX_ARGS_IN_REGISTERS; for (i = GP_ARG_FIRST; i < 16 - num_arg_regs; i++) diff --git a/gcc/config/xtensa/xtensa.h b/gcc/config/xtensa/xtensa.h index 60fc78515b7..b78b25f5aa8 100644 --- a/gcc/config/xtensa/xtensa.h +++ b/gcc/config/xtensa/xtensa.h @@ -525,7 +525,7 @@ extern const enum reg_class xtensa_regno_to_class[FIRST_PSEUDO_REGISTER]; /* Offset within stack frame to start allocating local variables at. */ #define STARTING_FRAME_OFFSET \ - current_function_outgoing_args_size + crtl->outgoing_args_size /* The ARG_POINTER and FRAME_POINTER are not real Xtensa registers, so they are eliminated to either the stack pointer or hard frame pointer. */ @@ -556,7 +556,7 @@ extern const enum reg_class xtensa_regno_to_class[FIRST_PSEUDO_REGISTER]; /* If defined, the maximum amount of space required for outgoing arguments will be computed and placed into the variable - 'current_function_outgoing_args_size'. No space will be pushed + 'crtl->outgoing_args_size'. No space will be pushed onto the stack for each call; instead, the function prologue should increase the stack frame size by this amount. */ #define ACCUMULATE_OUTGOING_ARGS 1 diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 6702af2a6c7..1e131656516 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,126 @@ +2008-04-09 Jason Merrill <jason@redhat.com> + + PR c++/35708 + * semantics.c (finish_compound_literal): Return a TARGET_EXPR, + not a pushed variable. + +2008-04-09 Volker Reichelt <v.reichelt@netcologne.de> + + * call.c (build_op_delete_call): Fix quotation in warning message. + * decl.c (grokdeclarator): Quote keyword in error message. + * pt.c (check_for_bare_parameter_packs): Fix quotation in error + message. + + * parser.c (cp_parser_check_type_definition): Print error string + directly rather than using "%s". + (cp_parser_postfix_expression): Fix quotation. + (cp_parser_decltype): Likewise. + (cp_parser_sizeof_operand): Fix quotation. Simplify. + + * parser.c (cp_parser_non_integral_constant_expression): Build error + message with CONCAT rather than using "%s". + (cp_parser_primary_expression): Fix quotation. + (cp_parser_postfix_expression): Likewise. + (cp_parser_postfix_dot_deref_expression): Likewise. + (cp_parser_unary_expression): Likewise. + (cp_parser_new_expression): Likewise. + (cp_parser_delete_expression): Likewise. + + * parser.c (cp_parser_asm_specification_opt): Print CPP_CLOSE_PAREN + as `)', not as `('. Fix quotation. + (cp_parser_consume_semicolon_at_end_of_statement): Fix quotation. + (cp_parser_primary_expression): Likewise. + (cp_parser_nested_name_specifier_opt): Likewise. + (cp_parser_postfix_expression): Likewise. + (cp_parser_postfix_open_square_expression): Likewise. + (cp_parser_parenthesized_expression_list): Likewise. + (cp_parser_pseudo_destructor_name): Likewise. + (cp_parser_new_expression): Likewise. + (cp_parser_direct_new_declarator): Likewise. + (cp_parser_delete_expression): Likewise. + (cp_parser_cast_expression): Likewise. + (cp_parser_question_colon_clause): Likewise. + (cp_parser_builtin_offsetof): Likewise. + (cp_parser_trait_expr): Likewise. + (cp_parser_label_for_labeled_statement): Likewise. + (cp_parser_compound_statement): Likewise. + (cp_parser_selection_statement): Likewise. + (cp_parser_condition): Likewise. + (cp_parser_iteration_statement): Likewise. + (cp_parser_already_scoped_statement): Likewise. + (cp_parser_simple_declaration): Likewise. + (cp_parser_linkage_specification): Likewise. + (cp_parser_static_assert): Likewise. + (cp_parser_decltype): Likewise. + (cp_parser_conversion_function_id): Likewise. + (cp_parser_operator_function_id): Likewise. + (cp_parser_operator): Likewise. + (cp_parser_type_parameter): Likewise. + (cp_parser_template_id): Likewise. + (cp_parser_explicit_instantiation): Likewise. + (cp_parser_explicit_specialization): Likewise. + (cp_parser_enum_specifier): Likewise. + (cp_parser_namespace_definition): Likewise. + (cp_parser_namespace_alias_definition): Likewise. + (cp_parser_using_declaration): Likewise. + (cp_parser_using_directive): Likewise. + (cp_parser_asm_definition): Likewise. + (cp_parser_direct_declarator): Likewise. + (cp_parser_ptr_operator): Likewise. + (cp_parser_parameter_declaration_clause): Likewise. + (cp_parser_initializer_clause): Likewise. + (cp_parser_class_specifier): Likewise. + (cp_parser_member_specification_opt): Likewise. + (cp_parser_member_declaration): Likewise. + (cp_parser_pure_specifier): Likewise. + (cp_parser_constant_initializer): Likewise. + (cp_parser_base_clause): Likewise. + (cp_parser_exception_specification_opt): Likewise. + (cp_parser_try_block): Likewise. + (cp_parser_function_try_block): Likewise. + (cp_parser_handler): Likewise. + (cp_parser_throw_expression): Likewise. + (cp_parser_asm_operand_list): Likewise. + (cp_parser_attributes_opt): Likewise. + (cp_parser_label_declaration): Likewise. + (cp_parser_constructor_declarator_p): Likewise. + (cp_parser_template_declaration_after_export): Likewise. + (cp_parser_single_declaration): Likewise. + (cp_parser_objc_message_expression): Likewise. + (cp_parser_objc_message_args): 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_protocol_refs_opt): Likewise. + (cp_parser_objc_typename): Likewise. + (cp_parser_objc_method_keyword_params): Likewise. + (cp_parser_objc_superclass_or_category): Likewise. + (cp_parser_objc_try_catch_finally_statement): Likewise. + (cp_parser_objc_synchronized_statement): Likewise. + (cp_parser_objc_throw_statement): Likewise. + (cp_parser_omp_var_list_no_open): Likewise. + (cp_parser_omp_clause_default): Likewise. + (cp_parser_omp_clause_if): Likewise. + (cp_parser_omp_clause_num_threads): Likewise. + (cp_parser_omp_clause_reduction): Likewise. + (cp_parser_omp_clause_schedule): Likewise. + (cp_parser_omp_critical): Likewise. + (cp_parser_omp_for_loop): Likewise. + (cp_parser_omp_sections_scope): Likewise. + + * parser.c (cp_parser_template_parameter_list): Simplify. + +2008-04-07 James E. Wilson <wilson@tuliptree.org> + + * pt.c (tsubst_copy, case SIZEOF_EXPR): Initialize len. + +2008-04-07 Jason Merrill <jason@redhat.com> + + PR c++/35734 + * class.c (type_has_user_nondefault_constructor): A template + counts as a nondefault constructor. + 2008-04-04 Paolo Bonzini <bonzini@gnu.org> * decl.c (cxx_push_function_context): Delete. diff --git a/gcc/cp/call.c b/gcc/cp/call.c index 29dda07426f..9835c86e3a2 100644 --- a/gcc/cp/call.c +++ b/gcc/cp/call.c @@ -4260,7 +4260,7 @@ build_op_delete_call (enum tree_code code, tree addr, tree size, if (alloc_fn) { if (!placement) - warning (0, "no corresponding deallocation function for `%D'", + warning (0, "no corresponding deallocation function for %qD", alloc_fn); return NULL_TREE; } diff --git a/gcc/cp/class.c b/gcc/cp/class.c index 69acf11cdfc..a6dbc13a9b3 100644 --- a/gcc/cp/class.c +++ b/gcc/cp/class.c @@ -4060,7 +4060,9 @@ type_has_user_nondefault_constructor (tree t) { tree fn = OVL_CURRENT (fns); if (!DECL_ARTIFICIAL (fn) - && skip_artificial_parms_for (fn, DECL_ARGUMENTS (fn)) != NULL_TREE) + && (TREE_CODE (fn) == TEMPLATE_DECL + || (skip_artificial_parms_for (fn, DECL_ARGUMENTS (fn)) + != NULL_TREE))) return true; } diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index 15ebf29d61d..ccdcf379544 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -7892,7 +7892,7 @@ grokdeclarator (const cp_declarator *declarator, if (virtualp && (current_class_name == NULL_TREE || decl_context != FIELD)) { - error ("virtual outside class declaration"); + error ("%<virtual%> outside class declaration"); virtualp = 0; } diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index 85295eb743c..f57ce28f937 100644 --- a/gcc/cp/parser.c +++ b/gcc/cp/parser.c @@ -2183,9 +2183,9 @@ cp_parser_check_type_definition (cp_parser* parser) /* If types are forbidden here, issue a message. */ if (parser->type_definition_forbidden_message) { - /* Use `%s' to print the string in case there are any escape - characters in the message. */ - error ("%s", parser->type_definition_forbidden_message); + /* Don't use `%s' to print the string, because quotations (`%<', `%>') + in the message need to be interpreted. */ + error (parser->type_definition_forbidden_message); return false; } return true; @@ -2264,7 +2264,13 @@ cp_parser_non_integral_constant_expression (cp_parser *parser, { if (!parser->allow_non_integral_constant_expression_p) { - error ("%s cannot appear in a constant-expression", thing); + /* Don't use `%s' to print THING, because quotations (`%<', `%>') + in the message need to be interpreted. */ + char *message = concat (thing, + " cannot appear in a constant-expression", + NULL); + error (message); + free (message); return true; } } @@ -2545,7 +2551,7 @@ static void cp_parser_consume_semicolon_at_end_of_statement (cp_parser *parser) { /* Look for the trailing `;'. */ - if (!cp_parser_require (parser, CPP_SEMICOLON, "`;'")) + if (!cp_parser_require (parser, CPP_SEMICOLON, "%<;%>")) { /* If there is additional (erroneous) input, skip to the end of the statement. */ @@ -3199,7 +3205,7 @@ cp_parser_primary_expression (cp_parser *parser, parser->greater_than_is_operator_p = saved_greater_than_is_operator_p; /* Consume the `)'. */ - if (!cp_parser_require (parser, CPP_CLOSE_PAREN, "`)'")) + if (!cp_parser_require (parser, CPP_CLOSE_PAREN, "%<)%>")) cp_parser_skip_to_end_of_statement (parser); return expr; @@ -3230,8 +3236,7 @@ cp_parser_primary_expression (cp_parser *parser, return error_mark_node; } /* Pointers cannot appear in constant-expressions. */ - if (cp_parser_non_integral_constant_expression (parser, - "`this'")) + if (cp_parser_non_integral_constant_expression (parser, "%<this%>")) return error_mark_node; return finish_this_expr (); @@ -3263,20 +3268,20 @@ cp_parser_primary_expression (cp_parser *parser, `va_arg'. Consume the `__builtin_va_arg' token. */ cp_lexer_consume_token (parser->lexer); /* Look for the opening `('. */ - cp_parser_require (parser, CPP_OPEN_PAREN, "`('"); + cp_parser_require (parser, CPP_OPEN_PAREN, "%<(%>"); /* Now, parse the assignment-expression. */ expression = cp_parser_assignment_expression (parser, /*cast_p=*/false); /* Look for the `,'. */ - cp_parser_require (parser, CPP_COMMA, "`,'"); + cp_parser_require (parser, CPP_COMMA, "%<,%>"); /* Parse the type-id. */ type = cp_parser_type_id (parser); /* Look for the closing `)'. */ - cp_parser_require (parser, CPP_CLOSE_PAREN, "`)'"); + cp_parser_require (parser, CPP_CLOSE_PAREN, "%<)%>"); /* Using `va_arg' in a constant-expression is not allowed. */ if (cp_parser_non_integral_constant_expression (parser, - "`va_arg'")) + "%<va_arg%>")) return error_mark_node; return build_x_va_arg (expression, type); } @@ -3991,7 +3996,7 @@ cp_parser_nested_name_specifier_opt (cp_parser *parser, type_p, is_declaration); /* Look for the `::' token. */ - cp_parser_require (parser, CPP_SCOPE, "`::'"); + cp_parser_require (parser, CPP_SCOPE, "%<::%>"); /* If we found what we wanted, we keep going; otherwise, we're done. */ @@ -4307,18 +4312,18 @@ cp_parser_postfix_expression (cp_parser *parser, bool address_p, bool cast_p, = "types may not be defined in casts"; /* Look for the opening `<'. */ - cp_parser_require (parser, CPP_LESS, "`<'"); + cp_parser_require (parser, CPP_LESS, "%<<%>"); /* Parse the type to which we are casting. */ type = cp_parser_type_id (parser); /* Look for the closing `>'. */ - cp_parser_require (parser, CPP_GREATER, "`>'"); + cp_parser_require (parser, CPP_GREATER, "%<>%>"); /* Restore the old message. */ parser->type_definition_forbidden_message = saved_message; /* And the expression which is being cast. */ - cp_parser_require (parser, CPP_OPEN_PAREN, "`('"); + cp_parser_require (parser, CPP_OPEN_PAREN, "%<(%>"); expression = cp_parser_expression (parser, /*cast_p=*/true); - cp_parser_require (parser, CPP_CLOSE_PAREN, "`)'"); + cp_parser_require (parser, CPP_CLOSE_PAREN, "%<)%>"); /* Only type conversions to integral or enumeration types can be used in constant-expressions. */ @@ -4363,11 +4368,11 @@ cp_parser_postfix_expression (cp_parser *parser, bool address_p, bool cast_p, /* Consume the `typeid' token. */ cp_lexer_consume_token (parser->lexer); /* Look for the `(' token. */ - cp_parser_require (parser, CPP_OPEN_PAREN, "`('"); + cp_parser_require (parser, CPP_OPEN_PAREN, "%<(%>"); /* Types cannot be defined in a `typeid' expression. */ saved_message = parser->type_definition_forbidden_message; parser->type_definition_forbidden_message - = "types may not be defined in a `typeid\' expression"; + = "types may not be defined in a %<typeid%> expression"; /* We can't be sure yet whether we're looking at a type-id or an expression. */ cp_parser_parse_tentatively (parser); @@ -4379,7 +4384,7 @@ cp_parser_postfix_expression (cp_parser *parser, bool address_p, bool cast_p, /* Look for the `)' token. Otherwise, we can't be sure that we're not looking at an expression: consider `typeid (int (3))', for example. */ - cp_parser_require (parser, CPP_CLOSE_PAREN, "`)'"); + cp_parser_require (parser, CPP_CLOSE_PAREN, "%<)%>"); /* If all went well, simply lookup the type-id. */ if (cp_parser_parse_definitely (parser)) postfix_expression = get_typeid (type); @@ -4393,13 +4398,13 @@ cp_parser_postfix_expression (cp_parser *parser, bool address_p, bool cast_p, /* Compute its typeid. */ postfix_expression = build_typeid (expression); /* Look for the `)' token. */ - cp_parser_require (parser, CPP_CLOSE_PAREN, "`)'"); + cp_parser_require (parser, CPP_CLOSE_PAREN, "%<)%>"); } /* Restore the saved message. */ parser->type_definition_forbidden_message = saved_message; /* `typeid' may not appear in an integral constant expression. */ if (cp_parser_non_integral_constant_expression(parser, - "`typeid' operator")) + "%<typeid%> operator")) return error_mark_node; } break; @@ -4454,9 +4459,9 @@ cp_parser_postfix_expression (cp_parser *parser, bool address_p, bool cast_p, type = cp_parser_type_id (parser); parser->in_type_id_in_expr_p = saved_in_type_id_in_expr_p; /* Look for the `)'. */ - cp_parser_require (parser, CPP_CLOSE_PAREN, "`)'"); + cp_parser_require (parser, CPP_CLOSE_PAREN, "%<)%>"); /* Look for the `{'. */ - cp_parser_require (parser, CPP_OPEN_BRACE, "`{'"); + cp_parser_require (parser, CPP_OPEN_BRACE, "%<{%>"); /* If things aren't going well, there's no need to keep going. */ if (!cp_parser_error_occurred (parser)) @@ -4469,7 +4474,7 @@ cp_parser_postfix_expression (cp_parser *parser, bool address_p, bool cast_p, if (cp_lexer_next_token_is (parser->lexer, CPP_COMMA)) cp_lexer_consume_token (parser->lexer); /* Look for the final `}'. */ - cp_parser_require (parser, CPP_CLOSE_BRACE, "`}'"); + cp_parser_require (parser, CPP_CLOSE_BRACE, "%<}%>"); } /* If that worked, we're definitely looking at a compound-literal expression. */ @@ -4775,7 +4780,7 @@ cp_parser_postfix_open_square_expression (cp_parser *parser, index = cp_parser_expression (parser, /*cast_p=*/false); /* Look for the closing `]'. */ - cp_parser_require (parser, CPP_CLOSE_SQUARE, "`]'"); + cp_parser_require (parser, CPP_CLOSE_SQUARE, "%<]%>"); /* Build the ARRAY_REF. */ postfix_expression = grok_array_decl (postfix_expression, index); @@ -4955,7 +4960,7 @@ cp_parser_postfix_dot_deref_expression (cp_parser *parser, constant-expressions. */ if (!for_offsetof && (cp_parser_non_integral_constant_expression - (parser, token_type == CPP_DEREF ? "'->'" : "`.'"))) + (parser, token_type == CPP_DEREF ? "%<->%>" : "%<.%>"))) postfix_expression = error_mark_node; return postfix_expression; @@ -5003,7 +5008,7 @@ cp_parser_parenthesized_expression_list (cp_parser* parser, if (non_constant_p) *non_constant_p = false; - if (!cp_parser_require (parser, CPP_OPEN_PAREN, "`('")) + if (!cp_parser_require (parser, CPP_OPEN_PAREN, "%<(%>")) return error_mark_node; /* Within a parenthesized expression, a `>' token is always @@ -5083,7 +5088,7 @@ cp_parser_parenthesized_expression_list (cp_parser* parser, cp_lexer_consume_token (parser->lexer); } - if (!cp_parser_require (parser, CPP_CLOSE_PAREN, "`)'")) + if (!cp_parser_require (parser, CPP_CLOSE_PAREN, "%<)%>")) { int ending; @@ -5160,7 +5165,7 @@ cp_parser_pseudo_destructor_name (cp_parser* parser, /*check_dependency_p=*/false, /*is_declaration=*/true); /* Look for the `::' token. */ - cp_parser_require (parser, CPP_SCOPE, "`::'"); + cp_parser_require (parser, CPP_SCOPE, "%<::%>"); } /* If the next token is not a `~', then there might be some additional qualification. */ @@ -5186,13 +5191,13 @@ cp_parser_pseudo_destructor_name (cp_parser* parser, return; /* Look for the `::' token. */ - cp_parser_require (parser, CPP_SCOPE, "`::'"); + cp_parser_require (parser, CPP_SCOPE, "%<::%>"); } else *scope = NULL_TREE; /* Look for the `~'. */ - cp_parser_require (parser, CPP_COMPL, "`~'"); + cp_parser_require (parser, CPP_COMPL, "%<~%>"); /* Look for the type-name again. We are not responsible for checking that it matches the first type-name. */ *type = cp_parser_nonclass_name (parser); @@ -5368,13 +5373,13 @@ cp_parser_unary_expression (cp_parser *parser, bool address_p, bool cast_p) switch (unary_operator) { case INDIRECT_REF: - non_constant_p = "`*'"; + non_constant_p = "%<*%>"; expression = build_x_indirect_ref (cast_expression, "unary *", tf_warning_or_error); break; case ADDR_EXPR: - non_constant_p = "`&'"; + non_constant_p = "%<&%>"; /* Fall through. */ case BIT_NOT_EXPR: expression = build_x_unary_op (unary_operator, cast_expression, @@ -5384,7 +5389,7 @@ cp_parser_unary_expression (cp_parser *parser, bool address_p, bool cast_p) case PREINCREMENT_EXPR: case PREDECREMENT_EXPR: non_constant_p = (unary_operator == PREINCREMENT_EXPR - ? "`++'" : "`--'"); + ? "%<++%>" : "%<--%>"); /* Fall through. */ case UNARY_PLUS_EXPR: case NEGATE_EXPR: @@ -5462,7 +5467,7 @@ cp_parser_new_expression (cp_parser* parser) /*current_scope_valid_p=*/false) != NULL_TREE); /* Look for the `new' operator. */ - cp_parser_require_keyword (parser, RID_NEW, "`new'"); + cp_parser_require_keyword (parser, RID_NEW, "%<new%>"); /* There's no easy way to tell a new-placement from the `( type-id )' construct. */ cp_parser_parse_tentatively (parser); @@ -5481,7 +5486,7 @@ cp_parser_new_expression (cp_parser* parser) /* Parse the type-id. */ type = cp_parser_type_id (parser); /* Look for the closing `)'. */ - cp_parser_require (parser, CPP_CLOSE_PAREN, "`)'"); + cp_parser_require (parser, CPP_CLOSE_PAREN, "%<)%>"); /* There should not be a direct-new-declarator in this production, but GCC used to allowed this, so we check and emit a sensible error message for this case. */ @@ -5505,7 +5510,7 @@ cp_parser_new_expression (cp_parser* parser) /* A new-expression may not appear in an integral constant expression. */ - if (cp_parser_non_integral_constant_expression (parser, "`new'")) + if (cp_parser_non_integral_constant_expression (parser, "%<new%>")) return error_mark_node; /* Create a representation of the new-expression. */ @@ -5660,7 +5665,7 @@ cp_parser_direct_new_declarator (cp_parser* parser) tree expression; /* Look for the opening `['. */ - cp_parser_require (parser, CPP_OPEN_SQUARE, "`['"); + cp_parser_require (parser, CPP_OPEN_SQUARE, "%<[%>"); /* The first expression is not required to be constant. */ if (!declarator) { @@ -5692,7 +5697,7 @@ cp_parser_direct_new_declarator (cp_parser* parser) /*allow_non_constant=*/false, NULL); /* Look for the closing `]'. */ - cp_parser_require (parser, CPP_CLOSE_SQUARE, "`]'"); + cp_parser_require (parser, CPP_CLOSE_SQUARE, "%<]%>"); /* Add this bound to the declarator. */ declarator = make_array_declarator (declarator, expression); @@ -5749,14 +5754,14 @@ cp_parser_delete_expression (cp_parser* parser) /*current_scope_valid_p=*/false) != NULL_TREE); /* Look for the `delete' keyword. */ - cp_parser_require_keyword (parser, RID_DELETE, "`delete'"); + cp_parser_require_keyword (parser, RID_DELETE, "%<delete%>"); /* See if the array syntax is in use. */ if (cp_lexer_next_token_is (parser->lexer, CPP_OPEN_SQUARE)) { /* Consume the `[' token. */ cp_lexer_consume_token (parser->lexer); /* Look for the `]' token. */ - cp_parser_require (parser, CPP_CLOSE_SQUARE, "`]'"); + cp_parser_require (parser, CPP_CLOSE_SQUARE, "%<]%>"); /* Remember that this is the `[]' construct. */ array_p = true; } @@ -5768,7 +5773,7 @@ cp_parser_delete_expression (cp_parser* parser) /* A delete-expression may not appear in an integral constant expression. */ - if (cp_parser_non_integral_constant_expression (parser, "`delete'")) + if (cp_parser_non_integral_constant_expression (parser, "%<delete%>")) return error_mark_node; return delete_sanity (expression, NULL_TREE, array_p, global_scope_p); @@ -5845,7 +5850,7 @@ cp_parser_cast_expression (cp_parser *parser, bool address_p, bool cast_p) /* Look for the type-id. */ type = cp_parser_type_id (parser); /* Look for the closing `)'. */ - cp_parser_require (parser, CPP_CLOSE_PAREN, "`)'"); + cp_parser_require (parser, CPP_CLOSE_PAREN, "%<)%>"); parser->in_type_id_in_expr_p = saved_in_type_id_in_expr_p; } @@ -6118,7 +6123,7 @@ cp_parser_question_colon_clause (cp_parser* parser, tree logical_or_expr) expr = cp_parser_expression (parser, /*cast_p=*/false); /* The next token should be a `:'. */ - cp_parser_require (parser, CPP_COLON, "`:'"); + cp_parser_require (parser, CPP_COLON, "%<:%>"); /* Parse the assignment-expression. */ assignment_expr = cp_parser_assignment_expression (parser, /*cast_p=*/false); @@ -6416,11 +6421,11 @@ cp_parser_builtin_offsetof (cp_parser *parser) /* Consume the "__builtin_offsetof" token. */ cp_lexer_consume_token (parser->lexer); /* Consume the opening `('. */ - cp_parser_require (parser, CPP_OPEN_PAREN, "`('"); + cp_parser_require (parser, CPP_OPEN_PAREN, "%<(%>"); /* Parse the type-id. */ type = cp_parser_type_id (parser); /* Look for the `,'. */ - cp_parser_require (parser, CPP_COMMA, "`,'"); + cp_parser_require (parser, CPP_COMMA, "%<,%>"); /* Build the (type *)null that begins the traditional offsetof macro. */ expr = build_static_cast (build_pointer_type (type), null_pointer_node, @@ -6454,7 +6459,7 @@ cp_parser_builtin_offsetof (cp_parser *parser) default: /* Error. We know the following require will fail, but that gives the proper error message. */ - cp_parser_require (parser, CPP_CLOSE_PAREN, "`)'"); + cp_parser_require (parser, CPP_CLOSE_PAREN, "%<)%>"); cp_parser_skip_to_closing_parenthesis (parser, true, false, true); expr = error_mark_node; goto failure; @@ -6548,7 +6553,7 @@ cp_parser_trait_expr (cp_parser* parser, enum rid keyword) /* Consume the token. */ cp_lexer_consume_token (parser->lexer); - cp_parser_require (parser, CPP_OPEN_PAREN, "`('"); + cp_parser_require (parser, CPP_OPEN_PAREN, "%<(%>"); type1 = cp_parser_type_id (parser); @@ -6565,7 +6570,7 @@ cp_parser_trait_expr (cp_parser* parser, enum rid keyword) if (binary) { - cp_parser_require (parser, CPP_COMMA, "`,'"); + cp_parser_require (parser, CPP_COMMA, "%<,%>"); type2 = cp_parser_type_id (parser); @@ -6581,7 +6586,7 @@ cp_parser_trait_expr (cp_parser* parser, enum rid keyword) /*initialized=*/0, /*attrlist=*/NULL); } - cp_parser_require (parser, CPP_CLOSE_PAREN, "`)'"); + cp_parser_require (parser, CPP_CLOSE_PAREN, "%<)%>"); /* Complete the trait expression, which may mean either processing the trait expr now or saving it for template instantiation. */ @@ -6826,7 +6831,7 @@ cp_parser_label_for_labeled_statement (cp_parser* parser) } /* Require the `:' token. */ - cp_parser_require (parser, CPP_COLON, "`:'"); + cp_parser_require (parser, CPP_COLON, "%<:%>"); } /* Parse an expression-statement. @@ -6888,7 +6893,7 @@ cp_parser_compound_statement (cp_parser *parser, tree in_statement_expr, tree compound_stmt; /* Consume the `{'. */ - if (!cp_parser_require (parser, CPP_OPEN_BRACE, "`{'")) + if (!cp_parser_require (parser, CPP_OPEN_BRACE, "%<{%>")) return error_mark_node; /* Begin the compound-statement. */ compound_stmt = begin_compound_stmt (in_try ? BCS_TRY_BLOCK : 0); @@ -6900,7 +6905,7 @@ cp_parser_compound_statement (cp_parser *parser, tree in_statement_expr, /* Finish the compound-statement. */ finish_compound_stmt (compound_stmt); /* Consume the `}'. */ - cp_parser_require (parser, CPP_CLOSE_BRACE, "`}'"); + cp_parser_require (parser, CPP_CLOSE_BRACE, "%<}%>"); return compound_stmt; } @@ -6980,7 +6985,7 @@ cp_parser_selection_statement (cp_parser* parser, bool *if_p) tree condition; /* Look for the `('. */ - if (!cp_parser_require (parser, CPP_OPEN_PAREN, "`('")) + if (!cp_parser_require (parser, CPP_OPEN_PAREN, "%<(%>")) { cp_parser_skip_to_end_of_statement (parser); return error_mark_node; @@ -6995,7 +7000,7 @@ cp_parser_selection_statement (cp_parser* parser, bool *if_p) /* Parse the condition. */ condition = cp_parser_condition (parser); /* Look for the `)'. */ - if (!cp_parser_require (parser, CPP_CLOSE_PAREN, "`)'")) + if (!cp_parser_require (parser, CPP_CLOSE_PAREN, "%<)%>")) cp_parser_skip_to_closing_parenthesis (parser, true, false, /*consume_paren=*/true); @@ -7138,7 +7143,7 @@ cp_parser_condition (cp_parser* parser) looks like a decl-specifier-seq and a declarator -- but then there is no `=', so this is an expression. */ - cp_parser_require (parser, CPP_EQ, "`='"); + cp_parser_require (parser, CPP_EQ, "%<=%>"); /* If we did see an `=', then we are looking at a declaration for sure. */ if (cp_parser_parse_definitely (parser)) @@ -7260,13 +7265,13 @@ cp_parser_iteration_statement (cp_parser* parser) /* Begin the while-statement. */ statement = begin_while_stmt (); /* Look for the `('. */ - cp_parser_require (parser, CPP_OPEN_PAREN, "`('"); + cp_parser_require (parser, CPP_OPEN_PAREN, "%<(%>"); /* Parse the condition. */ condition = cp_parser_condition (parser); finish_while_stmt_cond (condition, statement); check_empty_body (parser, "while"); /* Look for the `)'. */ - cp_parser_require (parser, CPP_CLOSE_PAREN, "`)'"); + cp_parser_require (parser, CPP_CLOSE_PAREN, "%<)%>"); /* Parse the dependent statement. */ parser->in_statement = IN_ITERATION_STMT; cp_parser_already_scoped_statement (parser); @@ -7288,17 +7293,17 @@ cp_parser_iteration_statement (cp_parser* parser) parser->in_statement = in_statement; finish_do_body (statement); /* Look for the `while' keyword. */ - cp_parser_require_keyword (parser, RID_WHILE, "`while'"); + cp_parser_require_keyword (parser, RID_WHILE, "%<while%>"); /* Look for the `('. */ - cp_parser_require (parser, CPP_OPEN_PAREN, "`('"); + cp_parser_require (parser, CPP_OPEN_PAREN, "%<(%>"); /* Parse the expression. */ expression = cp_parser_expression (parser, /*cast_p=*/false); /* We're done with the do-statement. */ finish_do_stmt (expression, statement); /* Look for the `)'. */ - cp_parser_require (parser, CPP_CLOSE_PAREN, "`)'"); + cp_parser_require (parser, CPP_CLOSE_PAREN, "%<)%>"); /* Look for the `;'. */ - cp_parser_require (parser, CPP_SEMICOLON, "`;'"); + cp_parser_require (parser, CPP_SEMICOLON, "%<;%>"); } break; @@ -7310,7 +7315,7 @@ cp_parser_iteration_statement (cp_parser* parser) /* Begin the for-statement. */ statement = begin_for_stmt (); /* Look for the `('. */ - cp_parser_require (parser, CPP_OPEN_PAREN, "`('"); + cp_parser_require (parser, CPP_OPEN_PAREN, "%<(%>"); /* Parse the initialization. */ cp_parser_for_init_statement (parser); finish_for_init_stmt (statement); @@ -7320,7 +7325,7 @@ cp_parser_iteration_statement (cp_parser* parser) condition = cp_parser_condition (parser); finish_for_cond (condition, statement); /* Look for the `;'. */ - cp_parser_require (parser, CPP_SEMICOLON, "`;'"); + cp_parser_require (parser, CPP_SEMICOLON, "%<;%>"); /* If there's an expression, process it. */ if (cp_lexer_next_token_is_not (parser->lexer, CPP_CLOSE_PAREN)) @@ -7328,7 +7333,7 @@ cp_parser_iteration_statement (cp_parser* parser) finish_for_expr (expression, statement); check_empty_body (parser, "for"); /* Look for the `)'. */ - cp_parser_require (parser, CPP_CLOSE_PAREN, "`)'"); + cp_parser_require (parser, CPP_CLOSE_PAREN, "%<)%>"); /* Parse the body of the for-statement. */ parser->in_statement = IN_ITERATION_STMT; @@ -7583,9 +7588,9 @@ cp_parser_already_scoped_statement (cp_parser* parser) { /* Avoid calling cp_parser_compound_statement, so that we don't create a new scope. Do everything else by hand. */ - cp_parser_require (parser, CPP_OPEN_BRACE, "`{'"); + cp_parser_require (parser, CPP_OPEN_BRACE, "%<{%>"); cp_parser_statement_seq_opt (parser, NULL_TREE); - cp_parser_require (parser, CPP_CLOSE_BRACE, "`}'"); + cp_parser_require (parser, CPP_CLOSE_BRACE, "%<}%>"); } } @@ -8023,7 +8028,7 @@ cp_parser_simple_declaration (cp_parser* parser, } /* Consume the `;'. */ - cp_parser_require (parser, CPP_SEMICOLON, "`;'"); + cp_parser_require (parser, CPP_SEMICOLON, "%<;%>"); done: pop_deferring_access_checks (); @@ -8375,7 +8380,7 @@ cp_parser_linkage_specification (cp_parser* parser) tree linkage; /* Look for the `extern' keyword. */ - cp_parser_require_keyword (parser, RID_EXTERN, "`extern'"); + cp_parser_require_keyword (parser, RID_EXTERN, "%<extern%>"); /* Look for the string-literal. */ linkage = cp_parser_string_literal (parser, false, false); @@ -8405,7 +8410,7 @@ cp_parser_linkage_specification (cp_parser* parser) /* Parse the declarations. */ cp_parser_declaration_seq_opt (parser); /* Look for the closing `}'. */ - cp_parser_require (parser, CPP_CLOSE_BRACE, "`}'"); + cp_parser_require (parser, CPP_CLOSE_BRACE, "%<}%>"); } /* Otherwise, there's just one declaration. */ else @@ -8446,7 +8451,7 @@ cp_parser_static_assert(cp_parser *parser, bool member_p) /* Look for the `static_assert' keyword. */ if (!cp_parser_require_keyword (parser, RID_STATIC_ASSERT, - "`static_assert'")) + "%<static_assert%>")) return; /* We know we are in a static assertion; commit to any tentative @@ -8455,7 +8460,7 @@ cp_parser_static_assert(cp_parser *parser, bool member_p) cp_parser_commit_to_tentative_parse (parser); /* Parse the `(' starting the static assertion condition. */ - cp_parser_require (parser, CPP_OPEN_PAREN, "`('"); + cp_parser_require (parser, CPP_OPEN_PAREN, "%<(%>"); /* Parse the constant-expression. */ condition = @@ -8464,7 +8469,7 @@ cp_parser_static_assert(cp_parser *parser, bool member_p) /*non_constant_p=*/NULL); /* Parse the separating `,'. */ - cp_parser_require (parser, CPP_COMMA, "`,'"); + cp_parser_require (parser, CPP_COMMA, "%<,%>"); /* Parse the string-literal message. */ message = cp_parser_string_literal (parser, @@ -8472,14 +8477,14 @@ cp_parser_static_assert(cp_parser *parser, bool member_p) /*wide_ok=*/true); /* A `)' completes the static assertion. */ - if (!cp_parser_require (parser, CPP_CLOSE_PAREN, "`)'")) + if (!cp_parser_require (parser, CPP_CLOSE_PAREN, "%<)%>")) cp_parser_skip_to_closing_parenthesis (parser, /*recovering=*/true, /*or_comma=*/false, /*consume_paren=*/true); /* A semicolon terminates the declaration. */ - cp_parser_require (parser, CPP_SEMICOLON, "`;'"); + cp_parser_require (parser, CPP_SEMICOLON, "%<;%>"); /* Complete the static assertion, which may mean either processing the static assert now or saving it for template instantiation. */ @@ -8501,7 +8506,7 @@ cp_parser_decltype (cp_parser *parser) bool saved_non_integral_constant_expression_p; /* Look for the `decltype' token. */ - if (!cp_parser_require_keyword (parser, RID_DECLTYPE, "`decltype'")) + if (!cp_parser_require_keyword (parser, RID_DECLTYPE, "%<decltype%>")) return error_mark_node; /* Types cannot be defined in a `decltype' expression. Save away the @@ -8510,7 +8515,7 @@ cp_parser_decltype (cp_parser *parser) /* And create the new one. */ parser->type_definition_forbidden_message - = "types may not be defined in `decltype' expressions"; + = "types may not be defined in %<decltype%> expressions"; /* The restrictions on constant-expressions do not apply inside decltype expressions. */ @@ -8524,7 +8529,7 @@ cp_parser_decltype (cp_parser *parser) ++skip_evaluation; /* Parse the opening `('. */ - if (!cp_parser_require (parser, CPP_OPEN_PAREN, "`('")) + if (!cp_parser_require (parser, CPP_OPEN_PAREN, "%<(%>")) return error_mark_node; /* First, try parsing an id-expression. */ @@ -8641,7 +8646,7 @@ cp_parser_decltype (cp_parser *parser) } /* Parse to the closing `)'. */ - if (!cp_parser_require (parser, CPP_CLOSE_PAREN, "`)'")) + if (!cp_parser_require (parser, CPP_CLOSE_PAREN, "%<)%>")) { cp_parser_skip_to_closing_parenthesis (parser, true, false, /*consume_paren=*/true); @@ -8670,7 +8675,7 @@ cp_parser_conversion_function_id (cp_parser* parser) tree pushed_scope = NULL_TREE; /* Look for the `operator' token. */ - if (!cp_parser_require_keyword (parser, RID_OPERATOR, "`operator'")) + if (!cp_parser_require_keyword (parser, RID_OPERATOR, "%<operator%>")) return error_mark_node; /* When we parse the conversion-type-id, the current scope will be reset. However, we need that information in able to look up the @@ -9005,7 +9010,7 @@ static tree cp_parser_operator_function_id (cp_parser* parser) { /* Look for the `operator' keyword. */ - if (!cp_parser_require_keyword (parser, RID_OPERATOR, "`operator'")) + if (!cp_parser_require_keyword (parser, RID_OPERATOR, "%<operator%>")) return error_mark_node; /* And then the name of the operator itself. */ return cp_parser_operator (parser); @@ -9061,7 +9066,7 @@ cp_parser_operator (cp_parser* parser) /* Consume the `[' token. */ cp_lexer_consume_token (parser->lexer); /* Look for the `]' token. */ - cp_parser_require (parser, CPP_CLOSE_SQUARE, "`]'"); + cp_parser_require (parser, CPP_CLOSE_SQUARE, "%<]%>"); id = ansi_opname (op == NEW_EXPR ? VEC_NEW_EXPR : VEC_DELETE_EXPR); } @@ -9220,14 +9225,14 @@ cp_parser_operator (cp_parser* parser) /* Consume the `('. */ cp_lexer_consume_token (parser->lexer); /* Look for the matching `)'. */ - cp_parser_require (parser, CPP_CLOSE_PAREN, "`)'"); + cp_parser_require (parser, CPP_CLOSE_PAREN, "%<)%>"); return ansi_opname (CALL_EXPR); case CPP_OPEN_SQUARE: /* Consume the `['. */ cp_lexer_consume_token (parser->lexer); /* Look for the matching `]'. */ - cp_parser_require (parser, CPP_CLOSE_SQUARE, "`]'"); + cp_parser_require (parser, CPP_CLOSE_SQUARE, "%<]%>"); return ansi_opname (ARRAY_REF); default: @@ -9303,7 +9308,6 @@ cp_parser_template_parameter_list (cp_parser* parser) while (true) { tree parameter; - cp_token *token; bool is_non_type; bool is_parameter_pack; @@ -9324,10 +9328,8 @@ cp_parser_template_parameter_list (cp_parser* parser) parameter_list = chainon (parameter_list, err_parm); } - /* Peek at the next token. */ - token = cp_lexer_peek_token (parser->lexer); - /* If it's not a `,', we're done. */ - if (token->type != CPP_COMMA) + /* If the next token is not a `,', we're done. */ + if (cp_lexer_next_token_is_not (parser->lexer, CPP_COMMA)) break; /* Otherwise, consume the `,' token. */ cp_lexer_consume_token (parser->lexer); @@ -9513,7 +9515,7 @@ cp_parser_type_parameter (cp_parser* parser, bool *is_parameter_pack) /* Look for a keyword to tell us what kind of parameter this is. */ token = cp_parser_require (parser, CPP_KEYWORD, - "`class', `typename', or `template'"); + "%<class%>, %<typename%>, or %<template%>"); if (!token) return error_mark_node; @@ -9584,13 +9586,13 @@ cp_parser_type_parameter (cp_parser* parser, bool *is_parameter_pack) tree default_argument; /* Look for the `<'. */ - cp_parser_require (parser, CPP_LESS, "`<'"); + cp_parser_require (parser, CPP_LESS, "%<<%>"); /* Parse the template-parameter-list. */ parameter_list = cp_parser_template_parameter_list (parser); /* Look for the `>'. */ - cp_parser_require (parser, CPP_GREATER, "`>'"); + cp_parser_require (parser, CPP_GREATER, "%<>%>"); /* Look for the `class' keyword. */ - cp_parser_require_keyword (parser, RID_CLASS, "`class'"); + cp_parser_require_keyword (parser, RID_CLASS, "%<class%>"); /* If the next token is an ellipsis, we have a template argument pack. */ if (cp_lexer_next_token_is (parser->lexer, CPP_ELLIPSIS)) @@ -9817,7 +9819,7 @@ cp_parser_template_id (cp_parser *parser, else { /* Look for the `<' that starts the template-argument-list. */ - if (!cp_parser_require (parser, CPP_LESS, "`<'")) + if (!cp_parser_require (parser, CPP_LESS, "%<<%>")) { pop_deferring_access_checks (); return error_mark_node; @@ -10425,7 +10427,7 @@ cp_parser_explicit_instantiation (cp_parser* parser) } /* Look for the `template' keyword. */ - cp_parser_require_keyword (parser, RID_TEMPLATE, "`template'"); + cp_parser_require_keyword (parser, RID_TEMPLATE, "%<template%>"); /* Let the front end know that we are processing an explicit instantiation. */ begin_explicit_instantiation (); @@ -10507,11 +10509,11 @@ cp_parser_explicit_specialization (cp_parser* parser) { bool need_lang_pop; /* Look for the `template' keyword. */ - cp_parser_require_keyword (parser, RID_TEMPLATE, "`template'"); + cp_parser_require_keyword (parser, RID_TEMPLATE, "%<template%>"); /* Look for the `<'. */ - cp_parser_require (parser, CPP_LESS, "`<'"); + cp_parser_require (parser, CPP_LESS, "%<<%>"); /* Look for the `>'. */ - cp_parser_require (parser, CPP_GREATER, "`>'"); + cp_parser_require (parser, CPP_GREATER, "%<>%>"); /* We have processed another parameter list. */ ++parser->num_template_parameter_lists; /* [temp] @@ -11473,7 +11475,7 @@ cp_parser_enum_specifier (cp_parser* parser) cp_parser_enumerator_list (parser, type); /* Consume the final '}'. */ - cp_parser_require (parser, CPP_CLOSE_BRACE, "`}'"); + cp_parser_require (parser, CPP_CLOSE_BRACE, "%<}%>"); /* Look for trailing attributes to apply to this enumeration, and apply them if appropriate. */ @@ -11651,7 +11653,7 @@ cp_parser_namespace_definition (cp_parser* parser) is_inline = false; /* Look for the `namespace' keyword. */ - cp_parser_require_keyword (parser, RID_NAMESPACE, "`namespace'"); + cp_parser_require_keyword (parser, RID_NAMESPACE, "%<namespace%>"); /* Get the name of the namespace. We do not attempt to distinguish between an original-namespace-definition and an @@ -11666,7 +11668,7 @@ cp_parser_namespace_definition (cp_parser* parser) attribs = cp_parser_attributes_opt (parser); /* Look for the `{' to start the namespace. */ - cp_parser_require (parser, CPP_OPEN_BRACE, "`{'"); + cp_parser_require (parser, CPP_OPEN_BRACE, "%<{%>"); /* Start the namespace. */ push_namespace (identifier); @@ -11698,7 +11700,7 @@ cp_parser_namespace_definition (cp_parser* parser) /* Finish the namespace. */ pop_namespace (); /* Look for the final `}'. */ - cp_parser_require (parser, CPP_CLOSE_BRACE, "`}'"); + cp_parser_require (parser, CPP_CLOSE_BRACE, "%<}%>"); } /* Parse a namespace-body. @@ -11724,7 +11726,7 @@ cp_parser_namespace_alias_definition (cp_parser* parser) tree namespace_specifier; /* Look for the `namespace' keyword. */ - cp_parser_require_keyword (parser, RID_NAMESPACE, "`namespace'"); + cp_parser_require_keyword (parser, RID_NAMESPACE, "%<namespace%>"); /* Look for the identifier. */ identifier = cp_parser_identifier (parser); if (identifier == error_mark_node) @@ -11740,12 +11742,12 @@ cp_parser_namespace_alias_definition (cp_parser* parser) cp_lexer_consume_token (parser->lexer); return; } - cp_parser_require (parser, CPP_EQ, "`='"); + cp_parser_require (parser, CPP_EQ, "%<=%>"); /* Look for the qualified-namespace-specifier. */ namespace_specifier = cp_parser_qualified_namespace_specifier (parser); /* Look for the `;' token. */ - cp_parser_require (parser, CPP_SEMICOLON, "`;'"); + cp_parser_require (parser, CPP_SEMICOLON, "%<;%>"); /* Register the alias in the symbol table. */ do_namespace_alias (identifier, namespace_specifier); @@ -11804,7 +11806,7 @@ cp_parser_using_declaration (cp_parser* parser, else { /* Look for the `using' keyword. */ - cp_parser_require_keyword (parser, RID_USING, "`using'"); + cp_parser_require_keyword (parser, RID_USING, "%<using%>"); /* Peek at the next token. */ token = cp_lexer_peek_token (parser->lexer); @@ -11901,7 +11903,7 @@ cp_parser_using_declaration (cp_parser* parser, } /* Look for the final `;'. */ - cp_parser_require (parser, CPP_SEMICOLON, "`;'"); + cp_parser_require (parser, CPP_SEMICOLON, "%<;%>"); return true; } @@ -11919,9 +11921,9 @@ cp_parser_using_directive (cp_parser* parser) tree attribs; /* Look for the `using' keyword. */ - cp_parser_require_keyword (parser, RID_USING, "`using'"); + cp_parser_require_keyword (parser, RID_USING, "%<using%>"); /* And the `namespace' keyword. */ - cp_parser_require_keyword (parser, RID_NAMESPACE, "`namespace'"); + cp_parser_require_keyword (parser, RID_NAMESPACE, "%<namespace%>"); /* Look for the optional `::' operator. */ cp_parser_global_scope_opt (parser, /*current_scope_valid_p=*/false); /* And the optional nested-name-specifier. */ @@ -11937,7 +11939,7 @@ cp_parser_using_directive (cp_parser* parser) /* Update the symbol table. */ parse_using_directive (namespace_decl, attribs); /* Look for the final `;'. */ - cp_parser_require (parser, CPP_SEMICOLON, "`;'"); + cp_parser_require (parser, CPP_SEMICOLON, "%<;%>"); } /* Parse an asm-definition. @@ -11970,7 +11972,7 @@ cp_parser_asm_definition (cp_parser* parser) bool invalid_outputs_p = false; /* Look for the `asm' keyword. */ - cp_parser_require_keyword (parser, RID_ASM, "`asm'"); + cp_parser_require_keyword (parser, RID_ASM, "%<asm%>"); /* See if the next token is `volatile'. */ if (cp_parser_allow_gnu_extensions_p (parser) && cp_lexer_next_token_is_keyword (parser->lexer, RID_VOLATILE)) @@ -11981,7 +11983,7 @@ cp_parser_asm_definition (cp_parser* parser) cp_lexer_consume_token (parser->lexer); } /* Look for the opening `('. */ - if (!cp_parser_require (parser, CPP_OPEN_PAREN, "`('")) + if (!cp_parser_require (parser, CPP_OPEN_PAREN, "%<(%>")) return; /* Look for the string. */ string = cp_parser_string_literal (parser, false, false); @@ -12064,10 +12066,10 @@ cp_parser_asm_definition (cp_parser* parser) } } /* Look for the closing `)'. */ - if (!cp_parser_require (parser, CPP_CLOSE_PAREN, "`)'")) + if (!cp_parser_require (parser, CPP_CLOSE_PAREN, "%<)%>")) cp_parser_skip_to_closing_parenthesis (parser, true, false, /*consume_paren=*/true); - cp_parser_require (parser, CPP_SEMICOLON, "`;'"); + cp_parser_require (parser, CPP_SEMICOLON, "%<;%>"); if (!invalid_inputs_p && !invalid_outputs_p) { @@ -12682,7 +12684,7 @@ cp_parser_direct_declarator (cp_parser* parser, *ctor_dtor_or_conv_p = *ctor_dtor_or_conv_p < 0; first = false; /* Consume the `)'. */ - cp_parser_require (parser, CPP_CLOSE_PAREN, "`)'"); + cp_parser_require (parser, CPP_CLOSE_PAREN, "%<)%>"); /* Parse the cv-qualifier-seq. */ cv_quals = cp_parser_cv_qualifier_seq_opt (parser); @@ -12726,7 +12728,7 @@ cp_parser_direct_declarator (cp_parser* parser, parser->in_type_id_in_expr_p = saved_in_type_id_in_expr_p; first = false; /* Expect a `)'. */ - if (!cp_parser_require (parser, CPP_CLOSE_PAREN, "`)'")) + if (!cp_parser_require (parser, CPP_CLOSE_PAREN, "%<)%>")) declarator = cp_error_declarator; if (declarator == cp_error_declarator) break; @@ -12777,7 +12779,7 @@ cp_parser_direct_declarator (cp_parser* parser, else bounds = NULL_TREE; /* Look for the closing `]'. */ - if (!cp_parser_require (parser, CPP_CLOSE_SQUARE, "`]'")) + if (!cp_parser_require (parser, CPP_CLOSE_SQUARE, "%<]%>")) { declarator = cp_error_declarator; break; @@ -13072,7 +13074,7 @@ cp_parser_ptr_operator (cp_parser* parser, /* If we found it, and the next token is a `*', then we are indeed looking at a pointer-to-member operator. */ if (!cp_parser_error_occurred (parser) - && cp_parser_require (parser, CPP_MULT, "`*'")) + && cp_parser_require (parser, CPP_MULT, "%<*%>")) { /* Indicate that the `*' operator was used. */ code = INDIRECT_REF; @@ -13394,7 +13396,7 @@ cp_parser_parameter_declaration_clause (cp_parser* parser) cp_lexer_consume_token (parser->lexer); /* Expect an ellipsis. */ ellipsis_p - = (cp_parser_require (parser, CPP_ELLIPSIS, "`...'") != NULL); + = (cp_parser_require (parser, CPP_ELLIPSIS, "%<...%>") != NULL); } /* It might also be `...' if the optional trailing `,' was omitted. */ @@ -13998,7 +14000,7 @@ cp_parser_initializer_clause (cp_parser* parser, bool* non_constant_p) cp_lexer_consume_token (parser->lexer); } /* Now, there should be a trailing `}'. */ - cp_parser_require (parser, CPP_CLOSE_BRACE, "`}'"); + cp_parser_require (parser, CPP_CLOSE_BRACE, "%<}%>"); } return initializer; @@ -14298,7 +14300,7 @@ cp_parser_class_specifier (cp_parser* parser) } /* Look for the `{'. */ - if (!cp_parser_require (parser, CPP_OPEN_BRACE, "`{'")) + if (!cp_parser_require (parser, CPP_OPEN_BRACE, "%<{%>")) { pop_deferring_access_checks (); return error_mark_node; @@ -14345,7 +14347,7 @@ cp_parser_class_specifier (cp_parser* parser) cp_parser_member_specification_opt (parser); /* Look for the trailing `}'. */ - cp_parser_require (parser, CPP_CLOSE_BRACE, "`}'"); + cp_parser_require (parser, CPP_CLOSE_BRACE, "%<}%>"); /* We get better error messages by noticing a common problem: a missing trailing `;'. */ token = cp_lexer_peek_token (parser->lexer); @@ -14884,7 +14886,7 @@ cp_parser_member_specification_opt (cp_parser* parser) /* Remember which access-specifier is active. */ current_access_specifier = token->u.value; /* Look for the `:'. */ - cp_parser_require (parser, CPP_COLON, "`:'"); + cp_parser_require (parser, CPP_COLON, "%<:%>"); break; default: @@ -15303,7 +15305,7 @@ cp_parser_member_declaration (cp_parser* parser) } } - cp_parser_require (parser, CPP_SEMICOLON, "`;'"); + cp_parser_require (parser, CPP_SEMICOLON, "%<;%>"); } /* Parse a pure-specifier. @@ -15320,7 +15322,7 @@ cp_parser_pure_specifier (cp_parser* parser) cp_token *token; /* Look for the `=' token. */ - if (!cp_parser_require (parser, CPP_EQ, "`='")) + if (!cp_parser_require (parser, CPP_EQ, "%<=%>")) return error_mark_node; /* Look for the `0' token. */ token = cp_lexer_consume_token (parser->lexer); @@ -15328,7 +15330,7 @@ cp_parser_pure_specifier (cp_parser* parser) if (token->type != CPP_NUMBER || !(token->flags & PURE_ZERO)) { cp_parser_error (parser, - "invalid pure specifier (only `= 0' is allowed)"); + "invalid pure specifier (only %<= 0%> is allowed)"); cp_parser_skip_to_end_of_statement (parser); return error_mark_node; } @@ -15352,7 +15354,7 @@ static tree cp_parser_constant_initializer (cp_parser* parser) { /* Look for the `=' token. */ - if (!cp_parser_require (parser, CPP_EQ, "`='")) + if (!cp_parser_require (parser, CPP_EQ, "%<=%>")) return error_mark_node; /* It is invalid to write: @@ -15369,7 +15371,7 @@ cp_parser_constant_initializer (cp_parser* parser) /* Skip the initializer. */ cp_parser_skip_to_closing_brace (parser); /* Look for the trailing `}'. */ - cp_parser_require (parser, CPP_CLOSE_BRACE, "`}'"); + cp_parser_require (parser, CPP_CLOSE_BRACE, "%<}%>"); return error_mark_node; } @@ -15403,7 +15405,7 @@ cp_parser_base_clause (cp_parser* parser) tree bases = NULL_TREE; /* Look for the `:' that begins the list. */ - cp_parser_require (parser, CPP_COLON, "`:'"); + cp_parser_require (parser, CPP_COLON, "%<:%>"); /* Scan the base-specifier-list. */ while (true) @@ -15609,7 +15611,7 @@ cp_parser_exception_specification_opt (cp_parser* parser) cp_lexer_consume_token (parser->lexer); /* Look for the `('. */ - cp_parser_require (parser, CPP_OPEN_PAREN, "`('"); + cp_parser_require (parser, CPP_OPEN_PAREN, "%<(%>"); /* Peek at the next token. */ token = cp_lexer_peek_token (parser->lexer); @@ -15631,7 +15633,7 @@ cp_parser_exception_specification_opt (cp_parser* parser) type_id_list = empty_except_spec; /* Look for the `)'. */ - cp_parser_require (parser, CPP_CLOSE_PAREN, "`)'"); + cp_parser_require (parser, CPP_CLOSE_PAREN, "%<)%>"); return type_id_list; } @@ -15690,7 +15692,7 @@ cp_parser_try_block (cp_parser* parser) { tree try_block; - cp_parser_require_keyword (parser, RID_TRY, "`try'"); + cp_parser_require_keyword (parser, RID_TRY, "%<try%>"); try_block = begin_try_block (); cp_parser_compound_statement (parser, NULL, true); finish_try_block (try_block); @@ -15713,7 +15715,7 @@ cp_parser_function_try_block (cp_parser* parser) bool ctor_initializer_p; /* Look for the `try' keyword. */ - if (!cp_parser_require_keyword (parser, RID_TRY, "`try'")) + if (!cp_parser_require_keyword (parser, RID_TRY, "%<try%>")) return false; /* Let the rest of the front end know where we are. */ try_block = begin_function_try_block (&compound_stmt); @@ -15763,12 +15765,12 @@ cp_parser_handler (cp_parser* parser) tree handler; tree declaration; - cp_parser_require_keyword (parser, RID_CATCH, "`catch'"); + cp_parser_require_keyword (parser, RID_CATCH, "%<catch%>"); handler = begin_handler (); - cp_parser_require (parser, CPP_OPEN_PAREN, "`('"); + cp_parser_require (parser, CPP_OPEN_PAREN, "%<(%>"); declaration = cp_parser_exception_declaration (parser); finish_handler_parms (declaration, handler); - cp_parser_require (parser, CPP_CLOSE_PAREN, "`)'"); + cp_parser_require (parser, CPP_CLOSE_PAREN, "%<)%>"); cp_parser_compound_statement (parser, NULL, false); finish_handler (handler); } @@ -15838,7 +15840,7 @@ cp_parser_throw_expression (cp_parser* parser) tree expression; cp_token* token; - cp_parser_require_keyword (parser, RID_THROW, "`throw'"); + cp_parser_require_keyword (parser, RID_THROW, "%<throw%>"); token = cp_lexer_peek_token (parser->lexer); /* Figure out whether or not there is an assignment-expression following the "throw" keyword. */ @@ -15883,13 +15885,13 @@ cp_parser_asm_specification_opt (cp_parser* parser) /* Consume the `asm' token. */ cp_lexer_consume_token (parser->lexer); /* Look for the `('. */ - cp_parser_require (parser, CPP_OPEN_PAREN, "`('"); + cp_parser_require (parser, CPP_OPEN_PAREN, "%<(%>"); /* Look for the string-literal. */ asm_specification = cp_parser_string_literal (parser, false, false); /* Look for the `)'. */ - cp_parser_require (parser, CPP_CLOSE_PAREN, "`('"); + cp_parser_require (parser, CPP_CLOSE_PAREN, "%<)%>"); return asm_specification; } @@ -15933,7 +15935,7 @@ cp_parser_asm_operand_list (cp_parser* parser) name = build_string (IDENTIFIER_LENGTH (name), IDENTIFIER_POINTER (name)); /* Look for the closing `]'. */ - cp_parser_require (parser, CPP_CLOSE_SQUARE, "`]'"); + cp_parser_require (parser, CPP_CLOSE_SQUARE, "%<]%>"); } else name = NULL_TREE; @@ -15941,11 +15943,11 @@ cp_parser_asm_operand_list (cp_parser* parser) string_literal = cp_parser_string_literal (parser, false, false); /* Look for the `('. */ - cp_parser_require (parser, CPP_OPEN_PAREN, "`('"); + cp_parser_require (parser, CPP_OPEN_PAREN, "%<(%>"); /* Parse the expression. */ expression = cp_parser_expression (parser, /*cast_p=*/false); /* Look for the `)'. */ - cp_parser_require (parser, CPP_CLOSE_PAREN, "`)'"); + cp_parser_require (parser, CPP_CLOSE_PAREN, "%<)%>"); if (name == error_mark_node || string_literal == error_mark_node @@ -16029,8 +16031,8 @@ cp_parser_attributes_opt (cp_parser* parser) /* Consume the `__attribute__' keyword. */ cp_lexer_consume_token (parser->lexer); /* Look for the two `(' tokens. */ - cp_parser_require (parser, CPP_OPEN_PAREN, "`('"); - cp_parser_require (parser, CPP_OPEN_PAREN, "`('"); + cp_parser_require (parser, CPP_OPEN_PAREN, "%<(%>"); + cp_parser_require (parser, CPP_OPEN_PAREN, "%<(%>"); /* Peek at the next token. */ token = cp_lexer_peek_token (parser->lexer); @@ -16043,8 +16045,8 @@ cp_parser_attributes_opt (cp_parser* parser) attribute_list = NULL; /* Look for the two `)' tokens. */ - cp_parser_require (parser, CPP_CLOSE_PAREN, "`)'"); - cp_parser_require (parser, CPP_CLOSE_PAREN, "`)'"); + cp_parser_require (parser, CPP_CLOSE_PAREN, "%<)%>"); + cp_parser_require (parser, CPP_CLOSE_PAREN, "%<)%>"); /* Add these new attributes to the list. */ attributes = chainon (attributes, attribute_list); @@ -16174,7 +16176,7 @@ static void cp_parser_label_declaration (cp_parser* parser) { /* Look for the `__label__' keyword. */ - cp_parser_require_keyword (parser, RID_LABEL, "`__label__'"); + cp_parser_require_keyword (parser, RID_LABEL, "%<__label__%>"); while (true) { @@ -16191,11 +16193,11 @@ cp_parser_label_declaration (cp_parser* parser) if (cp_lexer_next_token_is (parser->lexer, CPP_SEMICOLON)) break; /* Look for the `,' separating the label declarations. */ - cp_parser_require (parser, CPP_COMMA, "`,'"); + cp_parser_require (parser, CPP_COMMA, "%<,%>"); } /* Look for the final `;'. */ - cp_parser_require (parser, CPP_SEMICOLON, "`;'"); + cp_parser_require (parser, CPP_SEMICOLON, "%<;%>"); } /* Support Functions */ @@ -16729,7 +16731,7 @@ cp_parser_constructor_declarator_p (cp_parser *parser, bool friend_p) takes one parameter (of type `int') and returns a value of type `S::S'. */ if (constructor_p - && cp_parser_require (parser, CPP_OPEN_PAREN, "`('")) + && cp_parser_require (parser, CPP_OPEN_PAREN, "%<(%>")) { if (cp_lexer_next_token_is_not (parser->lexer, CPP_CLOSE_PAREN) && cp_lexer_next_token_is_not (parser->lexer, CPP_ELLIPSIS) @@ -16936,11 +16938,11 @@ cp_parser_template_declaration_after_export (cp_parser* parser, bool member_p) bool need_lang_pop; /* Look for the `template' keyword. */ - if (!cp_parser_require_keyword (parser, RID_TEMPLATE, "`template'")) + if (!cp_parser_require_keyword (parser, RID_TEMPLATE, "%<template%>")) return; /* And the `<'. */ - if (!cp_parser_require (parser, CPP_LESS, "`<'")) + if (!cp_parser_require (parser, CPP_LESS, "%<<%>")) return; if (at_class_scope_p () && current_function_decl) { @@ -17178,7 +17180,7 @@ cp_parser_single_declaration (cp_parser* parser, /* Look for a trailing `;' after the declaration. */ if (!function_definition_p && (decl == error_mark_node - || !cp_parser_require (parser, CPP_SEMICOLON, "`;'"))) + || !cp_parser_require (parser, CPP_SEMICOLON, "%<;%>"))) cp_parser_skip_to_end_of_block_or_statement (parser); return decl; @@ -17570,7 +17572,6 @@ cp_parser_late_parsing_default_args (cp_parser *parser, tree fn) static tree cp_parser_sizeof_operand (cp_parser* parser, enum rid keyword) { - static const char *format; tree expr = NULL_TREE; const char *saved_message; char *tmp; @@ -17578,19 +17579,14 @@ cp_parser_sizeof_operand (cp_parser* parser, enum rid keyword) bool saved_non_integral_constant_expression_p; bool pack_expansion_p = false; - /* Initialize FORMAT the first time we get here. */ - if (!format) - format = "types may not be defined in '%s' expressions"; - /* Types cannot be defined in a `sizeof' expression. Save away the old message. */ saved_message = parser->type_definition_forbidden_message; /* And create the new one. */ - parser->type_definition_forbidden_message = tmp - = XNEWVEC (char, strlen (format) - + strlen (IDENTIFIER_POINTER (ridpointers[keyword])) - + 1 /* `\0' */); - sprintf (tmp, format, IDENTIFIER_POINTER (ridpointers[keyword])); + tmp = concat ("types may not be defined in %<", + IDENTIFIER_POINTER (ridpointers[keyword]), + "%> expressions", NULL); + parser->type_definition_forbidden_message = tmp; /* The restrictions on constant-expressions do not apply inside sizeof expressions. */ @@ -18341,7 +18337,7 @@ cp_parser_objc_message_expression (cp_parser* parser) cp_lexer_consume_token (parser->lexer); /* Eat '['. */ receiver = cp_parser_objc_message_receiver (parser); messageargs = cp_parser_objc_message_args (parser); - cp_parser_require (parser, CPP_CLOSE_SQUARE, "`]'"); + cp_parser_require (parser, CPP_CLOSE_SQUARE, "%<]%>"); return objc_build_message_expr (build_tree_list (receiver, messageargs)); } @@ -18413,7 +18409,7 @@ cp_parser_objc_message_args (cp_parser* parser) return build_tree_list (selector, NULL_TREE); maybe_unary_selector_p = false; - cp_parser_require (parser, CPP_COLON, "`:'"); + cp_parser_require (parser, CPP_COLON, "%<:%>"); arg = cp_parser_assignment_expression (parser, false); sel_args @@ -18454,9 +18450,9 @@ cp_parser_objc_encode_expression (cp_parser* parser) tree type; cp_lexer_consume_token (parser->lexer); /* Eat '@encode'. */ - cp_parser_require (parser, CPP_OPEN_PAREN, "`('"); + cp_parser_require (parser, CPP_OPEN_PAREN, "%<(%>"); type = complete_type (cp_parser_type_id (parser)); - cp_parser_require (parser, CPP_CLOSE_PAREN, "`)'"); + cp_parser_require (parser, CPP_CLOSE_PAREN, "%<)%>"); if (!type) { @@ -18475,9 +18471,9 @@ cp_parser_objc_defs_expression (cp_parser *parser) tree name; cp_lexer_consume_token (parser->lexer); /* Eat '@defs'. */ - cp_parser_require (parser, CPP_OPEN_PAREN, "`('"); + cp_parser_require (parser, CPP_OPEN_PAREN, "%<(%>"); name = cp_parser_identifier (parser); - cp_parser_require (parser, CPP_CLOSE_PAREN, "`)'"); + cp_parser_require (parser, CPP_CLOSE_PAREN, "%<)%>"); return objc_get_class_ivars (name); } @@ -18495,9 +18491,9 @@ cp_parser_objc_protocol_expression (cp_parser* parser) tree proto; cp_lexer_consume_token (parser->lexer); /* Eat '@protocol'. */ - cp_parser_require (parser, CPP_OPEN_PAREN, "`('"); + cp_parser_require (parser, CPP_OPEN_PAREN, "%<(%>"); proto = cp_parser_identifier (parser); - cp_parser_require (parser, CPP_CLOSE_PAREN, "`)'"); + cp_parser_require (parser, CPP_CLOSE_PAREN, "%<)%>"); return objc_build_protocol_expr (proto); } @@ -18525,7 +18521,7 @@ cp_parser_objc_selector_expression (cp_parser* parser) cp_token *token; cp_lexer_consume_token (parser->lexer); /* Eat '@selector'. */ - cp_parser_require (parser, CPP_OPEN_PAREN, "`('"); + cp_parser_require (parser, CPP_OPEN_PAREN, "%<(%>"); token = cp_lexer_peek_token (parser->lexer); while (cp_parser_objc_selector_p (token->type) || token->type == CPP_COLON @@ -18572,7 +18568,7 @@ cp_parser_objc_selector_expression (cp_parser* parser) } finish_selector: - cp_parser_require (parser, CPP_CLOSE_PAREN, "`)'"); + cp_parser_require (parser, CPP_CLOSE_PAREN, "%<)%>"); return objc_build_selector_expr (sel_seq); } @@ -18658,7 +18654,7 @@ cp_parser_objc_protocol_refs_opt (cp_parser* parser) { cp_lexer_consume_token (parser->lexer); /* Eat '<'. */ protorefs = cp_parser_objc_identifier_list (parser); - cp_parser_require (parser, CPP_GREATER, "`>'"); + cp_parser_require (parser, CPP_GREATER, "%<>%>"); } return protorefs; @@ -18747,7 +18743,7 @@ cp_parser_objc_typename (cp_parser* parser) if (cp_lexer_next_token_is_not (parser->lexer, CPP_CLOSE_PAREN)) cp_type = cp_parser_type_id (parser); - cp_parser_require (parser, CPP_CLOSE_PAREN, "`)'"); + cp_parser_require (parser, CPP_CLOSE_PAREN, "%<)%>"); typename = build_tree_list (proto_quals, cp_type); } @@ -18819,7 +18815,7 @@ cp_parser_objc_method_keyword_params (cp_parser* parser) return selector; maybe_unary_selector_p = false; - cp_parser_require (parser, CPP_COLON, "`:'"); + cp_parser_require (parser, CPP_COLON, "%<:%>"); typename = cp_parser_objc_typename (parser); identifier = cp_parser_identifier (parser); @@ -19149,7 +19145,7 @@ cp_parser_objc_superclass_or_category (cp_parser *parser, tree *super, { cp_lexer_consume_token (parser->lexer); /* Eat '('. */ *categ = cp_parser_identifier (parser); - cp_parser_require (parser, CPP_CLOSE_PAREN, "`)'"); + cp_parser_require (parser, CPP_CLOSE_PAREN, "%<)%>"); } } @@ -19269,7 +19265,7 @@ cp_parser_objc_try_catch_finally_statement (cp_parser *parser) { location_t location; tree stmt; - cp_parser_require_keyword (parser, RID_AT_TRY, "`@try'"); + cp_parser_require_keyword (parser, RID_AT_TRY, "%<@try%>"); location = cp_lexer_peek_token (parser->lexer)->location; /* NB: The @try block needs to be wrapped in its own STATEMENT_LIST node, lest it get absorbed into the surrounding block. */ @@ -19283,13 +19279,13 @@ cp_parser_objc_try_catch_finally_statement (cp_parser *parser) { tree parm; cp_lexer_consume_token (parser->lexer); - cp_parser_require (parser, CPP_OPEN_PAREN, "`('"); + cp_parser_require (parser, CPP_OPEN_PAREN, "%<(%>"); parmdecl = cp_parser_parameter_declaration (parser, false, NULL); parm = grokdeclarator (parmdecl->declarator, &parmdecl->decl_specifiers, PARM, /*initialized=*/0, /*attrlist=*/NULL); - cp_parser_require (parser, CPP_CLOSE_PAREN, "`)'"); + cp_parser_require (parser, CPP_CLOSE_PAREN, "%<)%>"); objc_begin_catch_clause (parm); cp_parser_compound_statement (parser, NULL, false); objc_finish_catch_clause (); @@ -19321,12 +19317,12 @@ cp_parser_objc_synchronized_statement (cp_parser *parser) { location_t location; tree lock, stmt; - cp_parser_require_keyword (parser, RID_AT_SYNCHRONIZED, "`@synchronized'"); + cp_parser_require_keyword (parser, RID_AT_SYNCHRONIZED, "%<@synchronized%>"); location = cp_lexer_peek_token (parser->lexer)->location; - cp_parser_require (parser, CPP_OPEN_PAREN, "`('"); + cp_parser_require (parser, CPP_OPEN_PAREN, "%<(%>"); lock = cp_parser_expression (parser, false); - cp_parser_require (parser, CPP_CLOSE_PAREN, "`)'"); + cp_parser_require (parser, CPP_CLOSE_PAREN, "%<)%>"); /* NB: The @synchronized block needs to be wrapped in its own STATEMENT_LIST node, lest it get absorbed into the surrounding block. */ @@ -19347,7 +19343,7 @@ static tree cp_parser_objc_throw_statement (cp_parser *parser) { tree expr = NULL_TREE; - cp_parser_require_keyword (parser, RID_AT_THROW, "`@throw'"); + cp_parser_require_keyword (parser, RID_AT_THROW, "%<@throw%>"); if (cp_lexer_next_token_is_not (parser->lexer, CPP_SEMICOLON)) expr = cp_parser_assignment_expression (parser, false); @@ -19512,7 +19508,7 @@ cp_parser_omp_var_list_no_open (cp_parser *parser, enum omp_clause_code kind, cp_lexer_consume_token (parser->lexer); } - if (!cp_parser_require (parser, CPP_CLOSE_PAREN, "`)'")) + if (!cp_parser_require (parser, CPP_CLOSE_PAREN, "%<)%>")) { int ending; @@ -19536,7 +19532,7 @@ cp_parser_omp_var_list_no_open (cp_parser *parser, enum omp_clause_code kind, static tree cp_parser_omp_var_list (cp_parser *parser, enum omp_clause_code kind, tree list) { - if (cp_parser_require (parser, CPP_OPEN_PAREN, "`('")) + if (cp_parser_require (parser, CPP_OPEN_PAREN, "%<(%>")) return cp_parser_omp_var_list_no_open (parser, kind, list); return list; } @@ -19550,7 +19546,7 @@ cp_parser_omp_clause_default (cp_parser *parser, tree list) enum omp_clause_default_kind kind = OMP_CLAUSE_DEFAULT_UNSPECIFIED; tree c; - if (!cp_parser_require (parser, CPP_OPEN_PAREN, "`('")) + if (!cp_parser_require (parser, CPP_OPEN_PAREN, "%<(%>")) return list; if (cp_lexer_next_token_is (parser->lexer, CPP_NAME)) { @@ -19583,7 +19579,7 @@ cp_parser_omp_clause_default (cp_parser *parser, tree list) cp_parser_error (parser, "expected %<none%> or %<shared%>"); } - if (!cp_parser_require (parser, CPP_CLOSE_PAREN, "`)'")) + if (!cp_parser_require (parser, CPP_CLOSE_PAREN, "%<)%>")) cp_parser_skip_to_closing_parenthesis (parser, /*recovering=*/true, /*or_comma=*/false, /*consume_paren=*/true); @@ -19607,13 +19603,13 @@ cp_parser_omp_clause_if (cp_parser *parser, tree list) { tree t, c; - if (!cp_parser_require (parser, CPP_OPEN_PAREN, "`('")) + if (!cp_parser_require (parser, CPP_OPEN_PAREN, "%<(%>")) return list; t = cp_parser_condition (parser); if (t == error_mark_node - || !cp_parser_require (parser, CPP_CLOSE_PAREN, "`)'")) + || !cp_parser_require (parser, CPP_CLOSE_PAREN, "%<)%>")) cp_parser_skip_to_closing_parenthesis (parser, /*recovering=*/true, /*or_comma=*/false, /*consume_paren=*/true); @@ -19650,13 +19646,13 @@ cp_parser_omp_clause_num_threads (cp_parser *parser, tree list) { tree t, c; - if (!cp_parser_require (parser, CPP_OPEN_PAREN, "`('")) + if (!cp_parser_require (parser, CPP_OPEN_PAREN, "%<(%>")) return list; t = cp_parser_expression (parser, false); if (t == error_mark_node - || !cp_parser_require (parser, CPP_CLOSE_PAREN, "`)'")) + || !cp_parser_require (parser, CPP_CLOSE_PAREN, "%<)%>")) cp_parser_skip_to_closing_parenthesis (parser, /*recovering=*/true, /*or_comma=*/false, /*consume_paren=*/true); @@ -19697,7 +19693,7 @@ cp_parser_omp_clause_reduction (cp_parser *parser, tree list) enum tree_code code; tree nlist, c; - if (!cp_parser_require (parser, CPP_OPEN_PAREN, "`('")) + if (!cp_parser_require (parser, CPP_OPEN_PAREN, "%<(%>")) return list; switch (cp_lexer_peek_token (parser->lexer)->type) @@ -19727,7 +19723,8 @@ cp_parser_omp_clause_reduction (cp_parser *parser, tree list) code = TRUTH_ORIF_EXPR; break; default: - cp_parser_error (parser, "`+', `*', `-', `&', `^', `|', `&&', or `||'"); + cp_parser_error (parser, "%<+%>, %<*%>, %<-%>, %<&%>, %<^%>, %<|%>, " + "%<&&%>, or %<||%>"); resync_fail: cp_parser_skip_to_closing_parenthesis (parser, /*recovering=*/true, /*or_comma=*/false, @@ -19736,7 +19733,7 @@ cp_parser_omp_clause_reduction (cp_parser *parser, tree list) } cp_lexer_consume_token (parser->lexer); - if (!cp_parser_require (parser, CPP_COLON, "`:'")) + if (!cp_parser_require (parser, CPP_COLON, "%<:%>")) goto resync_fail; nlist = cp_parser_omp_var_list_no_open (parser, OMP_CLAUSE_REDUCTION, list); @@ -19812,10 +19809,10 @@ cp_parser_omp_clause_schedule (cp_parser *parser, tree list) else OMP_CLAUSE_SCHEDULE_CHUNK_EXPR (c) = t; - if (!cp_parser_require (parser, CPP_CLOSE_PAREN, "`)'")) + if (!cp_parser_require (parser, CPP_CLOSE_PAREN, "%<)%>")) goto resync_fail; } - else if (!cp_parser_require (parser, CPP_CLOSE_PAREN, "`,' or `)'")) + else if (!cp_parser_require (parser, CPP_CLOSE_PAREN, "%<,%> or %<)%>")) goto resync_fail; check_no_duplicate_clause (list, OMP_CLAUSE_SCHEDULE, "schedule"); @@ -20093,7 +20090,7 @@ cp_parser_omp_critical (cp_parser *parser, cp_token *pragma_tok) name = cp_parser_identifier (parser); if (name == error_mark_node - || !cp_parser_require (parser, CPP_CLOSE_PAREN, "`)'")) + || !cp_parser_require (parser, CPP_CLOSE_PAREN, "%<)%>")) cp_parser_skip_to_closing_parenthesis (parser, /*recovering=*/true, /*or_comma=*/false, /*consume_paren=*/true); @@ -20136,7 +20133,7 @@ cp_parser_omp_for_loop (cp_parser *parser) return NULL; } loc = cp_lexer_consume_token (parser->lexer)->location; - if (!cp_parser_require (parser, CPP_OPEN_PAREN, "`('")) + if (!cp_parser_require (parser, CPP_OPEN_PAREN, "%<(%>")) return NULL; init = decl = NULL; @@ -20164,7 +20161,7 @@ cp_parser_omp_for_loop (cp_parser *parser) attributes = cp_parser_attributes_opt (parser); asm_specification = cp_parser_asm_specification_opt (parser); - cp_parser_require (parser, CPP_EQ, "`='"); + cp_parser_require (parser, CPP_EQ, "%<=%>"); if (cp_parser_parse_definitely (parser)) { tree pushed_scope; @@ -20194,19 +20191,19 @@ cp_parser_omp_for_loop (cp_parser *parser) if (decl == NULL) init = cp_parser_expression (parser, false); } - cp_parser_require (parser, CPP_SEMICOLON, "`;'"); + cp_parser_require (parser, CPP_SEMICOLON, "%<;%>"); pre_body = pop_stmt_list (pre_body); cond = NULL; if (cp_lexer_next_token_is_not (parser->lexer, CPP_SEMICOLON)) cond = cp_parser_condition (parser); - cp_parser_require (parser, CPP_SEMICOLON, "`;'"); + cp_parser_require (parser, CPP_SEMICOLON, "%<;%>"); incr = NULL; if (cp_lexer_next_token_is_not (parser->lexer, CPP_CLOSE_PAREN)) incr = cp_parser_expression (parser, false); - if (!cp_parser_require (parser, CPP_CLOSE_PAREN, "`)'")) + if (!cp_parser_require (parser, CPP_CLOSE_PAREN, "%<)%>")) cp_parser_skip_to_closing_parenthesis (parser, /*recovering=*/true, /*or_comma=*/false, /*consume_paren=*/true); @@ -20297,7 +20294,7 @@ cp_parser_omp_sections_scope (cp_parser *parser) bool error_suppress = false; cp_token *tok; - if (!cp_parser_require (parser, CPP_OPEN_BRACE, "`{'")) + if (!cp_parser_require (parser, CPP_OPEN_BRACE, "%<{%>")) return NULL_TREE; stmt = push_stmt_list (); @@ -20352,7 +20349,7 @@ cp_parser_omp_sections_scope (cp_parser *parser) substmt = build1 (OMP_SECTION, void_type_node, substmt); add_stmt (substmt); } - cp_parser_require (parser, CPP_CLOSE_BRACE, "`}'"); + cp_parser_require (parser, CPP_CLOSE_BRACE, "%<}%>"); substmt = pop_stmt_list (stmt); diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 6954a1bee9e..40662d91668 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -2727,7 +2727,7 @@ check_for_bare_parameter_packs (tree t) if (parameter_packs) { - error ("parameter packs not expanded with `...':"); + error ("parameter packs not expanded with %<...%>:"); while (parameter_packs) { tree pack = TREE_VALUE (parameter_packs); @@ -9916,7 +9916,7 @@ tsubst_copy (tree t, tree args, tsubst_flags_t complain, tree in_decl) /* We only want to compute the number of arguments. */ tree expanded = tsubst_pack_expansion (TREE_OPERAND (t, 0), args, complain, in_decl); - int len; + int len = 0; if (TREE_CODE (expanded) == TREE_VEC) len = TREE_VEC_LENGTH (expanded); diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c index 3a36fddab18..12cf38750db 100644 --- a/gcc/cp/semantics.c +++ b/gcc/cp/semantics.c @@ -2101,7 +2101,6 @@ finish_unary_op_expr (enum tree_code code, tree expr) tree finish_compound_literal (tree type, VEC(constructor_elt,gc) *initializer_list) { - tree var; tree compound_literal; if (!TYPE_OBJ_P (type)) @@ -2120,30 +2119,12 @@ finish_compound_literal (tree type, VEC(constructor_elt,gc) *initializer_list) return compound_literal; } - /* Create a temporary variable to represent the compound literal. */ - var = create_temporary_var (type); - if (!current_function_decl) - { - /* If this compound-literal appears outside of a function, then - the corresponding variable has static storage duration, just - like the variable in whose initializer it appears. */ - TREE_STATIC (var) = 1; - /* The variable has internal linkage, since there is no need to - reference it from another translation unit. */ - TREE_PUBLIC (var) = 0; - /* It must have a name, so that the name mangler can mangle it. */ - DECL_NAME (var) = make_anon_name (); - } - /* We must call pushdecl, since the gimplifier complains if the - variable has not been declared via a BIND_EXPR. */ - pushdecl (var); - /* Initialize the variable as we would any other variable with a - brace-enclosed initializer. */ - cp_finish_decl (var, compound_literal, - /*init_const_expr_p=*/false, - /*asmspec_tree=*/NULL_TREE, - LOOKUP_ONLYCONVERTING); - return var; + type = complete_type (type); + compound_literal = reshape_init (type, compound_literal); + if (TREE_CODE (type) == ARRAY_TYPE) + cp_complete_array_type (&type, compound_literal, false); + compound_literal = digest_init (type, compound_literal); + return get_target_expr (compound_literal); } /* Return the declaration for the function-name variable indicated by diff --git a/gcc/dbxout.c b/gcc/dbxout.c index acf20b2ab90..0d30427eeae 100644 --- a/gcc/dbxout.c +++ b/gcc/dbxout.c @@ -931,11 +931,11 @@ dbxout_function_end (tree decl) if (flag_reorder_blocks_and_partition) { dbxout_begin_empty_stabs (N_FUN); - dbxout_stab_value_label_diff (cfun->hot_section_end_label, - cfun->hot_section_label); + dbxout_stab_value_label_diff (crtl->subsections.hot_section_end_label, + crtl->subsections.hot_section_label); dbxout_begin_empty_stabs (N_FUN); - dbxout_stab_value_label_diff (cfun->cold_section_end_label, - cfun->cold_section_label); + dbxout_stab_value_label_diff (crtl->subsections.cold_section_end_label, + crtl->subsections.cold_section_label); } else { @@ -963,7 +963,7 @@ get_lang_number (void) return N_SO_CC; else if (strcmp (language_string, "GNU F77") == 0) return N_SO_FORTRAN; - else if (strcmp (language_string, "GNU F95") == 0) + else if (strcmp (language_string, "GNU Fortran") == 0) return N_SO_FORTRAN90; /* CHECKME */ else if (strcmp (language_string, "GNU Pascal") == 0) return N_SO_PASCAL; diff --git a/gcc/df-scan.c b/gcc/df-scan.c index b5d88f3aa58..f50097ac26c 100644 --- a/gcc/df-scan.c +++ b/gcc/df-scan.c @@ -3230,7 +3230,7 @@ df_get_call_refs (struct df_collection_rec * collection_rec, && (!is_sibling_call || !bitmap_bit_p (df->exit_block_uses, ui) || refers_to_regno_p (ui, ui+1, - current_function_return_rtx, NULL))) + crtl->return_rtx, NULL))) df_ref_record (collection_rec, regno_reg_rtx[ui], NULL, bb, insn, DF_REF_REG_DEF, DF_REF_MAY_CLOBBER | flags, -1, -1); } diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi index 5152a153d32..d8ae286512a 100644 --- a/gcc/doc/invoke.texi +++ b/gcc/doc/invoke.texi @@ -932,21 +932,27 @@ C++ header file to be turned into a precompiled header. @item @var{file}.f @itemx @var{file}.for -@itemx @var{file}.FOR +@itemx @var{file}.ftn Fixed form Fortran source code which should not be preprocessed. @item @var{file}.F +@itemx @var{file}.FOR @itemx @var{file}.fpp @itemx @var{file}.FPP +@itemx @var{file}.FTN Fixed form Fortran source code which must be preprocessed (with the traditional preprocessor). @item @var{file}.f90 @itemx @var{file}.f95 +@itemx @var{file}.f03 +@itemx @var{file}.f08 Free form Fortran source code which should not be preprocessed. @item @var{file}.F90 @itemx @var{file}.F95 +@itemx @var{file}.F03 +@itemx @var{file}.F08 Free form Fortran source code which must be preprocessed (with the traditional preprocessor). diff --git a/gcc/doc/md.texi b/gcc/doc/md.texi index bd4150f35ca..a4117a34efb 100644 --- a/gcc/doc/md.texi +++ b/gcc/doc/md.texi @@ -2239,7 +2239,7 @@ range of 1 to 2047. @end table -@item Blackfin family---@file{config/bfin/bfin.h} +@item Blackfin family---@file{config/bfin/constraints.md} @table @code @item a P register diff --git a/gcc/doc/rtl.texi b/gcc/doc/rtl.texi index 90c56d909d4..e99b381a9ae 100644 --- a/gcc/doc/rtl.texi +++ b/gcc/doc/rtl.texi @@ -1712,82 +1712,176 @@ This virtual register is replaced by the sum of the register given by @end table @findex subreg -@item (subreg:@var{m} @var{reg} @var{bytenum}) +@item (subreg:@var{m1} @var{reg:m2} @var{bytenum}) + @code{subreg} expressions are used to refer to a register in a machine mode other than its natural one, or to refer to one register of a multi-part @code{reg} that actually refers to several registers. -Each pseudo-register has a natural mode. If it is necessary to -operate on it in a different mode---for example, to perform a fullword -move instruction on a pseudo-register that contains a single -byte---the pseudo-register must be enclosed in a @code{subreg}. In -such a case, @var{bytenum} is zero. - -Usually @var{m} is at least as narrow as the mode of @var{reg}, in which -case it is restricting consideration to only the bits of @var{reg} that -are in @var{m}. - -Sometimes @var{m} is wider than the mode of @var{reg}. These -@code{subreg} expressions are often called @dfn{paradoxical}. They are -used in cases where we want to refer to an object in a wider mode but do -not care what value the additional bits have. The reload pass ensures -that paradoxical references are only made to hard registers. - -The other use of @code{subreg} is to extract the individual registers of -a multi-register value. Machine modes such as @code{DImode} and -@code{TImode} can indicate values longer than a word, values which -usually require two or more consecutive registers. To access one of the -registers, use a @code{subreg} with mode @code{SImode} and a -@var{bytenum} offset that says which register. - -Storing in a non-paradoxical @code{subreg} has undefined results for -bits belonging to the same word as the @code{subreg}. This laxity makes -it easier to generate efficient code for such instructions. To -represent an instruction that preserves all the bits outside of those in -the @code{subreg}, use @code{strict_low_part} around the @code{subreg}. +Each pseudo register has a natural mode. If it is necessary to +operate on it in a different mode, the pseudo register must be +enclosed in a @code{subreg}. + +It is seldom necessary to wrap hard registers in @code{subreg}s; such +registers would normally reduce to a single @code{reg} rtx. This use of +@code{subregs} is discouraged and may not be supported in the future. + +@code{subreg}s come in two distinct flavors, each having its own +usage and rules: + +@table @asis +@item Paradoxical subregs +When @var{m1} is strictly wider than @var{m2}, the @code{subreg} +expression is called @dfn{paradoxical}. The canonical test for this +class of @code{subreg} is: + +@smallexample +GET_MODE_SIZE (@var{m1}) > GET_MODE_SIZE (@var{m2}) +@end smallexample + +Paradoxical @code{subreg}s can be used as both lvalues and rvalues. +When used as an rvalue, the low-order bits of the @code{subreg} are +taken from @var{reg} while the high-order bits are left undefined. +When used as an lvalue, the low-order bits of the source value are +stored in @var{reg} and the high-order bits are discarded. + +@var{bytenum} is always zero for a paradoxical @code{subreg}, even on +big-endian targets. + +For example, the paradoxical @code{subreg}: + +@smallexample +(set (subreg:SI (reg:HI @var{x}) 0) @var{y}) +@end smallexample + +stores the lower 2 bytes of @var{y} in @var{x} and discards the upper +2 bytes. A subsequent: +@smallexample +(set @var{z} (subreg:SI (reg:HI @var{x}) 0)) +@end smallexample + +would set the lower two bytes of @var{z} to @var{y} and set the upper two +bytes to an unknown value. + +@item Normal subregs +When @var{m1} is at least as narrow as @var{m2} the @code{subreg} +expression is called @dfn{normal}. + +Normal @code{subreg}s restrict consideration to certain bits of @var{reg}. +There are two cases. If @var{m1} is smaller than a word, the +@code{subreg} refers to the least-significant part (or @dfn{lowpart}) +of one word of @var{reg}. If @var{m1} is word-sized or greater, the +@code{subreg} refers to one or more complete words. + +When used as an lvalue, @code{subreg} is a word-based accessor. +Storing to a @code{subreg} modifies all the words of @var{reg} that +overlap the @code{subreg}, but it leaves the other words of @var{reg} +alone. + +When storing to a normal @code{subreg} that is smaller than a word, +the other bits of the referenced word are usually left in an undefined +state. This laxity makes it easier to generate efficient code for +such instructions. To represent an instruction that preserves all the +bits outside of those in the @code{subreg}, use @code{strict_low_part} +or @code{zero_extract} around the @code{subreg}. + +@var{bytenum} must identify the offset of the first byte of the +@code{subreg} from the start of @var{reg}, assuming that @var{reg} is +laid out in memory order. The memory order of bytes is defined by +two target macros, @code{WORDS_BIG_ENDIAN} and @code{BYTES_BIG_ENDIAN}: + +@itemize +@item @cindex @code{WORDS_BIG_ENDIAN}, effect on @code{subreg} -The compilation parameter @code{WORDS_BIG_ENDIAN}, if set to 1, says -that byte number zero is part of the most significant word; otherwise, -it is part of the least significant word. +@code{WORDS_BIG_ENDIAN}, if set to 1, says that byte number zero is +part of the most significant word; otherwise, it is part of the least +significant word. +@item @cindex @code{BYTES_BIG_ENDIAN}, effect on @code{subreg} -The compilation parameter @code{BYTES_BIG_ENDIAN}, if set to 1, says -that byte number zero is the most significant byte within a word; -otherwise, it is the least significant byte within a word. +@code{BYTES_BIG_ENDIAN}, if set to 1, says that byte number zero is +the most significant byte within a word; otherwise, it is the least +significant byte within a word. +@end itemize @cindex @code{FLOAT_WORDS_BIG_ENDIAN}, (lack of) effect on @code{subreg} On a few targets, @code{FLOAT_WORDS_BIG_ENDIAN} disagrees with -@code{WORDS_BIG_ENDIAN}. -However, most parts of the compiler treat floating point values as if -they had the same endianness as integer values. This works because -they handle them solely as a collection of integer values, with no -particular numerical value. Only real.c and the runtime libraries -care about @code{FLOAT_WORDS_BIG_ENDIAN}. - -@cindex combiner pass -@cindex reload pass -@cindex @code{subreg}, special reload handling -Between the combiner pass and the reload pass, it is possible to have a -paradoxical @code{subreg} which contains a @code{mem} instead of a -@code{reg} as its first operand. After the reload pass, it is also -possible to have a non-paradoxical @code{subreg} which contains a -@code{mem}; this usually occurs when the @code{mem} is a stack slot -which replaced a pseudo register. - -Note that it is not valid to access a @code{DFmode} value in @code{SFmode} -using a @code{subreg}. On some machines the most significant part of a -@code{DFmode} value does not have the same format as a single-precision -floating value. - -It is also not valid to access a single word of a multi-word value in a -hard register when less registers can hold the value than would be -expected from its size. For example, some 32-bit machines have -floating-point registers that can hold an entire @code{DFmode} value. -If register 10 were such a register @code{(subreg:SI (reg:DF 10) 4)} -would be invalid because there is no way to convert that reference to -a single machine register. The reload pass prevents @code{subreg} -expressions such as these from being formed. +@code{WORDS_BIG_ENDIAN}. However, most parts of the compiler treat +floating point values as if they had the same endianness as integer +values. This works because they handle them solely as a collection of +integer values, with no particular numerical value. Only real.c and +the runtime libraries care about @code{FLOAT_WORDS_BIG_ENDIAN}. + +Thus, + +@smallexample +(subreg:HI (reg:SI @var{x}) 2) +@end smallexample + +on a @code{BYTES_BIG_ENDIAN}, @samp{UNITS_PER_WORD == 4} target is the same as + +@smallexample +(subreg:HI (reg:SI @var{x}) 0) +@end smallexample + +on a little-endian, @samp{UNITS_PER_WORD == 4} target. Both +@code{subreg}s access the lower two bytes of register @var{x}. + +@end table + +A @code{MODE_PARTIAL_INT} mode behaves as if it were as wide as the +corresponding @code{MODE_INT} mode, except that it has an unknown +number of undefined bits. For example: + +@smallexample +(subreg:PSI (reg:SI 0) 0) +@end smallexample + +accesses the whole of @samp{(reg:SI 0)}, but the exact relationship +between the @code{PSImode} value and the @code{SImode} value is not +defined. If we assume @samp{UNITS_PER_WORD <= 4}, then the following +two @code{subreg}s: + +@smallexample +(subreg:PSI (reg:DI 0) 0) +(subreg:PSI (reg:DI 0) 4) +@end smallexample + +represent independent 4-byte accesses to the two halves of +@samp{(reg:DI 0)}. Both @code{subreg}s have an unknown number +of undefined bits. + +If @samp{UNITS_PER_WORD <= 2} then these two @code{subreg}s: + +@smallexample +(subreg:HI (reg:PSI 0) 0) +(subreg:HI (reg:PSI 0) 2) +@end smallexample + +represent independent 2-byte accesses that together span the whole +of @samp{(reg:PSI 0)}. Storing to the first @code{subreg} does not +affect the value of the second, and vice versa. @samp{(reg:PSI 0)} +has an unknown number of undefined bits, so the assignment: + +@smallexample +(set (subreg:HI (reg:PSI 0) 0) (reg:HI 4)) +@end smallexample + +does not guarantee that @samp{(subreg:HI (reg:PSI 0) 0)} has the +value @samp{(reg:HI 4)}. + +@cindex @code{CANNOT_CHANGE_MODE_CLASS} and subreg semantics +The rules above apply to both pseudo @var{reg}s and hard @var{reg}s. +If the semantics are not correct for particular combinations of +@var{m1}, @var{m2} and hard @var{reg}, the target-specific code +must ensure that those combinations are never used. For example: + +@smallexample +CANNOT_CHANGE_MODE_CLASS (@var{m2}, @var{m1}, @var{class}) +@end smallexample + +must be true for every class @var{class} that includes @var{reg}. @findex SUBREG_REG @findex SUBREG_BYTE @@ -1795,6 +1889,14 @@ The first operand of a @code{subreg} expression is customarily accessed with the @code{SUBREG_REG} macro and the second operand is customarily accessed with the @code{SUBREG_BYTE} macro. +@code{subreg}s of @code{subreg}s are not supported. Using +@code{simplify_gen_subreg} is the recommended way to avoid this problem. + +It has been several years since a platform in which +@code{BYTES_BIG_ENDIAN} was not equal to @code{WORDS_BIG_ENDIAN} has +been tested. Anyone wishing to support such a platform in the future +may be confronted with code rot. + @findex scratch @cindex scratch operands @item (scratch:@var{m}) diff --git a/gcc/dse.c b/gcc/dse.c index 696b2d84ff3..9dab6259c17 100644 --- a/gcc/dse.c +++ b/gcc/dse.c @@ -229,7 +229,7 @@ struct store_info /* An bitmask as wide as the number of bytes in the word that contains a 1 if the byte may be needed. The store is unused if all of the bits are 0. */ - long positions_needed; + unsigned HOST_WIDE_INT positions_needed; /* The next store info for this insn. */ struct store_info *next; @@ -240,6 +240,15 @@ struct store_info rtx rhs; }; +/* Return a bitmask with the first N low bits set. */ + +static unsigned HOST_WIDE_INT +lowpart_bitmask (int n) +{ + unsigned HOST_WIDE_INT mask = ~(unsigned HOST_WIDE_INT) 0; + return mask >> (HOST_BITS_PER_WIDE_INT - n); +} + typedef struct store_info *store_info_t; static alloc_pool cse_store_info_pool; static alloc_pool rtx_store_info_pool; @@ -522,11 +531,8 @@ struct clear_alias_mode_holder static alloc_pool clear_alias_mode_pool; -/* This is true except for two cases: - (1) current_function_stdarg -- i.e. we cannot do this - for vararg functions because they play games with the frame. - (2) In ada, it is sometimes not safe to do assume that any stores - based off the stack frame go dead at the exit to a function. */ +/* This is true except if current_function_stdarg -- i.e. we cannot do + this for vararg functions because they play games with the frame. */ static bool stores_off_frame_dead_at_return; /* Counter for stats. */ @@ -712,10 +718,7 @@ dse_step0 (void) bb_table = XCNEWVEC (bb_info_t, last_basic_block); rtx_group_next_id = 0; - stores_off_frame_dead_at_return = - (!(TREE_CODE (TREE_TYPE (current_function_decl)) == FUNCTION_TYPE - && (TYPE_RETURNS_STACK_DEPRESSED (TREE_TYPE (current_function_decl))))) - && (!current_function_stdarg); + stores_off_frame_dead_at_return = !current_function_stdarg; init_alias_analysis (); @@ -1314,7 +1317,7 @@ record_store (rtx body, bb_info_t bb_info) && (GET_MODE (mem) == entry->mode)) { delete = true; - s_info->positions_needed = 0; + s_info->positions_needed = (unsigned HOST_WIDE_INT) 0; } if (dump_file) fprintf (dump_file, " trying spill store in insn=%d alias_set=%d\n", @@ -1330,7 +1333,8 @@ record_store (rtx body, bb_info_t bb_info) (int)s_info->begin, (int)s_info->end); for (i = offset; i < offset+width; i++) if (i >= s_info->begin && i < s_info->end) - s_info->positions_needed &= ~(1L << (i - s_info->begin)); + s_info->positions_needed + &= ~(((unsigned HOST_WIDE_INT) 1) << (i - s_info->begin)); } else if (s_info->rhs) /* Need to see if it is possible for this store to overwrite @@ -1346,7 +1350,7 @@ record_store (rtx body, bb_info_t bb_info) /* An insn can be deleted if every position of every one of its s_infos is zero. */ - if (s_info->positions_needed != 0) + if (s_info->positions_needed != (unsigned HOST_WIDE_INT) 0) delete = false; if (delete) @@ -1366,7 +1370,7 @@ record_store (rtx body, bb_info_t bb_info) ptr = next; } - gcc_assert ((unsigned) width < sizeof (store_info->positions_needed) * CHAR_BIT); + gcc_assert ((unsigned) width <= HOST_BITS_PER_WIDE_INT); /* Finish filling in the store_info. */ store_info->next = insn_info->store_rec; @@ -1375,7 +1379,7 @@ record_store (rtx body, bb_info_t bb_info) store_info->alias_set = spill_alias_set; store_info->mem_addr = get_addr (XEXP (mem, 0)); store_info->cse_base = base; - store_info->positions_needed = (1L << width) - 1; + store_info->positions_needed = lowpart_bitmask (width); store_info->group_id = group_id; store_info->begin = offset; store_info->end = offset + width; @@ -1807,8 +1811,10 @@ check_mem_read_rtx (rtx *loc, void *data) && (offset >= store_info->begin) && (offset + width <= store_info->end)) { - int mask = ((1L << width) - 1) << (offset - store_info->begin); - + unsigned HOST_WIDE_INT mask + = (lowpart_bitmask (width) + << (offset - store_info->begin)); + if ((store_info->positions_needed & mask) == mask && replace_read (store_info, i_ptr, read_info, insn_info, loc)) @@ -1874,8 +1880,10 @@ check_mem_read_rtx (rtx *loc, void *data) && (offset >= store_info->begin) && (offset + width <= store_info->end)) { - int mask = ((1L << width) - 1) << (offset - store_info->begin); - + unsigned HOST_WIDE_INT mask + = (lowpart_bitmask (width) + << (offset - store_info->begin)); + if ((store_info->positions_needed & mask) == mask && replace_read (store_info, i_ptr, read_info, insn_info, loc)) diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c index 1d99699286b..2d8736de0fc 100644 --- a/gcc/dwarf2out.c +++ b/gcc/dwarf2out.c @@ -2744,10 +2744,10 @@ dwarf2out_switch_text_section (void) fde = &fde_table[fde_table_in_use - 1]; fde->dw_fde_switched_sections = true; - fde->dw_fde_hot_section_label = cfun->hot_section_label; - fde->dw_fde_hot_section_end_label = cfun->hot_section_end_label; - fde->dw_fde_unlikely_section_label = cfun->cold_section_label; - fde->dw_fde_unlikely_section_end_label = cfun->cold_section_end_label; + fde->dw_fde_hot_section_label = crtl->subsections.hot_section_label; + fde->dw_fde_hot_section_end_label = crtl->subsections.hot_section_end_label; + fde->dw_fde_unlikely_section_label = crtl->subsections.cold_section_label; + fde->dw_fde_unlikely_section_end_label = crtl->subsections.cold_section_end_label; have_multiple_function_sections = true; /* Reset the current label on switching text sections, so that we @@ -8222,7 +8222,7 @@ output_line_info (void) current_line = 1; if (cfun && in_cold_section_p) - strcpy (prev_line_label, cfun->cold_section_label); + strcpy (prev_line_label, crtl->subsections.cold_section_label); else strcpy (prev_line_label, text_section_label); for (lt_index = 1; lt_index < line_info_table_in_use; ++lt_index) @@ -10792,7 +10792,7 @@ secname_for_decl (const_tree decl) secname = TREE_STRING_POINTER (sectree); } else if (cfun && in_cold_section_p) - secname = cfun->cold_section_label; + secname = crtl->subsections.cold_section_label; else secname = text_section_label; @@ -13221,7 +13221,7 @@ gen_compile_unit_die (const char *filename) language = DW_LANG_Ada95; else if (strcmp (language_string, "GNU F77") == 0) language = DW_LANG_Fortran77; - else if (strcmp (language_string, "GNU F95") == 0) + else if (strcmp (language_string, "GNU Fortran") == 0) language = DW_LANG_Fortran95; else if (strcmp (language_string, "GNU Pascal") == 0) language = DW_LANG_Pascal83; @@ -14611,7 +14611,7 @@ dwarf2out_var_location (rtx loc_note) newloc->next = NULL; if (cfun && in_cold_section_p) - newloc->section_label = cfun->cold_section_label; + newloc->section_label = crtl->subsections.cold_section_label; else newloc->section_label = text_section_label; diff --git a/gcc/emit-rtl.c b/gcc/emit-rtl.c index fd26d015763..aa9e96584a1 100644 --- a/gcc/emit-rtl.c +++ b/gcc/emit-rtl.c @@ -68,7 +68,7 @@ enum machine_mode ptr_mode; /* Mode whose width is POINTER_SIZE. */ /* Datastructures maintained for currently processed function in RTL form. */ -struct rtl_data rtl; +struct rtl_data x_rtl; /* Indexed by pseudo register number, gives the rtx for that pseudo. Allocated in parallel with regno_pointer_align. @@ -172,11 +172,11 @@ static GTY ((if_marked ("ggc_marked_p"), param_is (struct rtx_def))) static GTY ((if_marked ("ggc_marked_p"), param_is (struct rtx_def))) htab_t const_fixed_htab; -#define first_insn (rtl.emit.x_first_insn) -#define last_insn (rtl.emit.x_last_insn) -#define cur_insn_uid (rtl.emit.x_cur_insn_uid) -#define last_location (rtl.emit.x_last_location) -#define first_label_num (rtl.emit.x_first_label_num) +#define first_insn (crtl->emit.x_first_insn) +#define last_insn (crtl->emit.x_last_insn) +#define cur_insn_uid (crtl->emit.x_cur_insn_uid) +#define last_location (crtl->emit.x_last_location) +#define first_label_num (crtl->emit.x_first_label_num) static rtx make_call_insn_raw (rtx); static rtx change_address_1 (rtx, enum machine_mode, rtx, int); @@ -887,22 +887,22 @@ gen_reg_rtx (enum machine_mode mode) /* Make sure regno_pointer_align, and regno_reg_rtx are large enough to have an element for this pseudo reg number. */ - if (reg_rtx_no == rtl.emit.regno_pointer_align_length) + if (reg_rtx_no == crtl->emit.regno_pointer_align_length) { - int old_size = rtl.emit.regno_pointer_align_length; + int old_size = crtl->emit.regno_pointer_align_length; char *new; rtx *new1; - new = xrealloc (rtl.emit.regno_pointer_align, old_size * 2); + new = xrealloc (crtl->emit.regno_pointer_align, old_size * 2); memset (new + old_size, 0, old_size); - rtl.emit.regno_pointer_align = (unsigned char *) new; + crtl->emit.regno_pointer_align = (unsigned char *) new; new1 = ggc_realloc (regno_reg_rtx, old_size * 2 * sizeof (rtx)); memset (new1 + old_size, 0, old_size * sizeof (rtx)); regno_reg_rtx = new1; - rtl.emit.regno_pointer_align_length = old_size * 2; + crtl->emit.regno_pointer_align_length = old_size * 2; } val = gen_raw_REG (mode, reg_rtx_no); @@ -964,11 +964,32 @@ set_reg_attrs_from_value (rtx reg, rtx x) int offset; offset = byte_lowpart_offset (GET_MODE (reg), GET_MODE (x)); - if (MEM_P (x) && MEM_OFFSET (x) && GET_CODE (MEM_OFFSET (x)) == CONST_INT) - REG_ATTRS (reg) - = get_reg_attrs (MEM_EXPR (x), INTVAL (MEM_OFFSET (x)) + offset); - if (REG_P (x) && REG_ATTRS (x)) - update_reg_offset (reg, x, offset); + if (MEM_P (x)) + { + if (MEM_OFFSET (x) && GET_CODE (MEM_OFFSET (x)) == CONST_INT) + REG_ATTRS (reg) + = get_reg_attrs (MEM_EXPR (x), INTVAL (MEM_OFFSET (x)) + offset); + if (MEM_POINTER (x)) + mark_reg_pointer (reg, MEM_ALIGN (x)); + } + else if (REG_P (x)) + { + if (REG_ATTRS (x)) + update_reg_offset (reg, x, offset); + if (REG_POINTER (x)) + mark_reg_pointer (reg, REGNO_POINTER_ALIGN (REGNO (x))); + } +} + +/* Generate a REG rtx for a new pseudo register, copying the mode + and attributes from X. */ + +rtx +gen_reg_rtx_and_attrs (rtx x) +{ + rtx reg = gen_reg_rtx (GET_MODE (x)); + set_reg_attrs_from_value (reg, x); + return reg; } /* Set the register attributes for registers contained in PARM_RTX. @@ -4988,14 +5009,14 @@ init_emit (void) /* Init the tables that describe all the pseudo regs. */ - rtl.emit.regno_pointer_align_length = LAST_VIRTUAL_REGISTER + 101; + crtl->emit.regno_pointer_align_length = LAST_VIRTUAL_REGISTER + 101; - rtl.emit.regno_pointer_align - = xcalloc (rtl.emit.regno_pointer_align_length + crtl->emit.regno_pointer_align + = xcalloc (crtl->emit.regno_pointer_align_length * sizeof (unsigned char), 1); regno_reg_rtx - = ggc_alloc (rtl.emit.regno_pointer_align_length * sizeof (rtx)); + = ggc_alloc (crtl->emit.regno_pointer_align_length * sizeof (rtx)); /* Put copies of all the hard registers into regno_reg_rtx. */ memcpy (regno_reg_rtx, diff --git a/gcc/explow.c b/gcc/explow.c index 612fb1bb5db..e92da9f86ff 100644 --- a/gcc/explow.c +++ b/gcc/explow.c @@ -305,7 +305,7 @@ break_out_memory_refs (rtx x) rtx op1 = break_out_memory_refs (XEXP (x, 1)); if (op0 != XEXP (x, 0) || op1 != XEXP (x, 1)) - x = gen_rtx_fmt_ee (GET_CODE (x), Pmode, op0, op1); + x = simplify_gen_binary (GET_CODE (x), Pmode, op0, op1); } return x; diff --git a/gcc/expr.c b/gcc/expr.c index b0690f51c53..98f7c1d8ecd 100644 --- a/gcc/expr.c +++ b/gcc/expr.c @@ -344,7 +344,7 @@ init_expr_target (void) void init_expr (void) { - memset (&rtl.expr, 0, sizeof (rtl.expr)); + memset (&crtl->expr, 0, sizeof (crtl->expr)); } /* Copy data from FROM to TO, where the machine modes are not the same. diff --git a/gcc/fold-const.c b/gcc/fold-const.c index ef95ae3d4a5..66e72a7d0ad 100644 --- a/gcc/fold-const.c +++ b/gcc/fold-const.c @@ -6721,7 +6721,11 @@ fold_widened_comparison (enum tree_code code, tree type, tree arg0, tree arg1) || TYPE_UNSIGNED (TREE_TYPE (arg0)) == TYPE_UNSIGNED (shorter_type)) && (TREE_TYPE (arg1_unw) == shorter_type || (TYPE_PRECISION (shorter_type) - >= TYPE_PRECISION (TREE_TYPE (arg1_unw))) + > TYPE_PRECISION (TREE_TYPE (arg1_unw))) + || ((TYPE_PRECISION (shorter_type) + == TYPE_PRECISION (TREE_TYPE (arg1_unw))) + && (TYPE_UNSIGNED (shorter_type) + == TYPE_UNSIGNED (TREE_TYPE (arg1_unw)))) || (TREE_CODE (arg1_unw) == INTEGER_CST && (TREE_CODE (shorter_type) == INTEGER_TYPE || TREE_CODE (shorter_type) == BOOLEAN_TYPE) @@ -13086,6 +13090,45 @@ fold (tree expr) switch (code) { + case ARRAY_REF: + { + tree op0 = TREE_OPERAND (t, 0); + tree op1 = TREE_OPERAND (t, 1); + + if (TREE_CODE (op1) == INTEGER_CST + && TREE_CODE (op0) == CONSTRUCTOR + && ! type_contains_placeholder_p (TREE_TYPE (op0))) + { + VEC(constructor_elt,gc) *elts = CONSTRUCTOR_ELTS (op0); + unsigned HOST_WIDE_INT end = VEC_length (constructor_elt, elts); + unsigned HOST_WIDE_INT begin = 0; + + /* Find a matching index by means of a binary search. */ + while (begin != end) + { + unsigned HOST_WIDE_INT middle = (begin + end) / 2; + tree index = VEC_index (constructor_elt, elts, middle)->index; + + if (TREE_CODE (index) == INTEGER_CST + && tree_int_cst_lt (index, op1)) + begin = middle + 1; + else if (TREE_CODE (index) == INTEGER_CST + && tree_int_cst_lt (op1, index)) + end = middle; + else if (TREE_CODE (index) == RANGE_EXPR + && tree_int_cst_lt (TREE_OPERAND (index, 1), op1)) + begin = middle + 1; + else if (TREE_CODE (index) == RANGE_EXPR + && tree_int_cst_lt (op1, TREE_OPERAND (index, 0))) + end = middle; + else + return VEC_index (constructor_elt, elts, middle)->value; + } + } + + return t; + } + case CONST_DECL: return fold (DECL_INITIAL (t)); @@ -13963,6 +14006,140 @@ tree_single_nonnegative_warnv_p (tree t, bool *strict_overflow_p) *STRICT_OVERFLOW_P. */ bool +tree_call_nonnegative_warnv_p (enum tree_code code, tree type, tree fndecl, + tree arg0, tree arg1, bool *strict_overflow_p) +{ + if (fndecl && DECL_BUILT_IN_CLASS (fndecl) == BUILT_IN_NORMAL) + switch (DECL_FUNCTION_CODE (fndecl)) + { + CASE_FLT_FN (BUILT_IN_ACOS): + CASE_FLT_FN (BUILT_IN_ACOSH): + CASE_FLT_FN (BUILT_IN_CABS): + CASE_FLT_FN (BUILT_IN_COSH): + CASE_FLT_FN (BUILT_IN_ERFC): + CASE_FLT_FN (BUILT_IN_EXP): + CASE_FLT_FN (BUILT_IN_EXP10): + CASE_FLT_FN (BUILT_IN_EXP2): + CASE_FLT_FN (BUILT_IN_FABS): + CASE_FLT_FN (BUILT_IN_FDIM): + CASE_FLT_FN (BUILT_IN_HYPOT): + CASE_FLT_FN (BUILT_IN_POW10): + CASE_INT_FN (BUILT_IN_FFS): + CASE_INT_FN (BUILT_IN_PARITY): + CASE_INT_FN (BUILT_IN_POPCOUNT): + case BUILT_IN_BSWAP32: + case BUILT_IN_BSWAP64: + /* Always true. */ + return true; + + CASE_FLT_FN (BUILT_IN_SQRT): + /* sqrt(-0.0) is -0.0. */ + if (!HONOR_SIGNED_ZEROS (TYPE_MODE (type))) + return true; + return tree_expr_nonnegative_warnv_p (arg0, + strict_overflow_p); + + CASE_FLT_FN (BUILT_IN_ASINH): + CASE_FLT_FN (BUILT_IN_ATAN): + CASE_FLT_FN (BUILT_IN_ATANH): + CASE_FLT_FN (BUILT_IN_CBRT): + CASE_FLT_FN (BUILT_IN_CEIL): + CASE_FLT_FN (BUILT_IN_ERF): + CASE_FLT_FN (BUILT_IN_EXPM1): + CASE_FLT_FN (BUILT_IN_FLOOR): + CASE_FLT_FN (BUILT_IN_FMOD): + CASE_FLT_FN (BUILT_IN_FREXP): + CASE_FLT_FN (BUILT_IN_LCEIL): + CASE_FLT_FN (BUILT_IN_LDEXP): + CASE_FLT_FN (BUILT_IN_LFLOOR): + CASE_FLT_FN (BUILT_IN_LLCEIL): + CASE_FLT_FN (BUILT_IN_LLFLOOR): + CASE_FLT_FN (BUILT_IN_LLRINT): + CASE_FLT_FN (BUILT_IN_LLROUND): + CASE_FLT_FN (BUILT_IN_LRINT): + CASE_FLT_FN (BUILT_IN_LROUND): + CASE_FLT_FN (BUILT_IN_MODF): + CASE_FLT_FN (BUILT_IN_NEARBYINT): + CASE_FLT_FN (BUILT_IN_RINT): + CASE_FLT_FN (BUILT_IN_ROUND): + CASE_FLT_FN (BUILT_IN_SCALB): + CASE_FLT_FN (BUILT_IN_SCALBLN): + CASE_FLT_FN (BUILT_IN_SCALBN): + CASE_FLT_FN (BUILT_IN_SIGNBIT): + CASE_FLT_FN (BUILT_IN_SIGNIFICAND): + CASE_FLT_FN (BUILT_IN_SINH): + CASE_FLT_FN (BUILT_IN_TANH): + CASE_FLT_FN (BUILT_IN_TRUNC): + /* True if the 1st argument is nonnegative. */ + return tree_expr_nonnegative_warnv_p (arg0, + strict_overflow_p); + + CASE_FLT_FN (BUILT_IN_FMAX): + /* True if the 1st OR 2nd arguments are nonnegative. */ + return (tree_expr_nonnegative_warnv_p (arg0, + strict_overflow_p) + || (tree_expr_nonnegative_warnv_p (arg1, + strict_overflow_p))); + + CASE_FLT_FN (BUILT_IN_FMIN): + /* True if the 1st AND 2nd arguments are nonnegative. */ + return (tree_expr_nonnegative_warnv_p (arg0, + strict_overflow_p) + && (tree_expr_nonnegative_warnv_p (arg1, + strict_overflow_p))); + + CASE_FLT_FN (BUILT_IN_COPYSIGN): + /* True if the 2nd argument is nonnegative. */ + return tree_expr_nonnegative_warnv_p (arg1, + strict_overflow_p); + + CASE_FLT_FN (BUILT_IN_POWI): + /* True if the 1st argument is nonnegative or the second + argument is an even integer. */ + if (TREE_CODE (arg1) == INTEGER_CST) + { + tree arg1 = arg1; + if ((TREE_INT_CST_LOW (arg1) & 1) == 0) + return true; + } + return tree_expr_nonnegative_warnv_p (arg0, + strict_overflow_p); + + CASE_FLT_FN (BUILT_IN_POW): + /* True if the 1st argument is nonnegative or the second + argument is an even integer valued real. */ + if (TREE_CODE (arg1) == REAL_CST) + { + REAL_VALUE_TYPE c; + HOST_WIDE_INT n; + + c = TREE_REAL_CST (arg1); + n = real_to_integer (&c); + if ((n & 1) == 0) + { + REAL_VALUE_TYPE cint; + real_from_integer (&cint, VOIDmode, n, + n < 0 ? -1 : 0, 0); + if (real_identical (&c, &cint)) + return true; + } + } + return tree_expr_nonnegative_warnv_p (arg0, + strict_overflow_p); + + default: + break; + } + return tree_simple_nonnegative_warnv_p (code, + type); +} + +/* Return true if T is known to be non-negative. If the return + value is based on the assumption that signed overflow is undefined, + set *STRICT_OVERFLOW_P to true; otherwise, don't change + *STRICT_OVERFLOW_P. */ + +bool tree_invalid_nonnegative_warnv_p (tree t, bool *strict_overflow_p) { enum tree_code code = TREE_CODE (t); @@ -14006,133 +14183,16 @@ tree_invalid_nonnegative_warnv_p (tree t, bool *strict_overflow_p) case CALL_EXPR: { - tree fndecl = get_callee_fndecl (t); - if (fndecl && DECL_BUILT_IN_CLASS (fndecl) == BUILT_IN_NORMAL) - switch (DECL_FUNCTION_CODE (fndecl)) - { - CASE_FLT_FN (BUILT_IN_ACOS): - CASE_FLT_FN (BUILT_IN_ACOSH): - CASE_FLT_FN (BUILT_IN_CABS): - CASE_FLT_FN (BUILT_IN_COSH): - CASE_FLT_FN (BUILT_IN_ERFC): - CASE_FLT_FN (BUILT_IN_EXP): - CASE_FLT_FN (BUILT_IN_EXP10): - CASE_FLT_FN (BUILT_IN_EXP2): - CASE_FLT_FN (BUILT_IN_FABS): - CASE_FLT_FN (BUILT_IN_FDIM): - CASE_FLT_FN (BUILT_IN_HYPOT): - CASE_FLT_FN (BUILT_IN_POW10): - CASE_INT_FN (BUILT_IN_FFS): - CASE_INT_FN (BUILT_IN_PARITY): - CASE_INT_FN (BUILT_IN_POPCOUNT): - case BUILT_IN_BSWAP32: - case BUILT_IN_BSWAP64: - /* Always true. */ - return true; - - CASE_FLT_FN (BUILT_IN_SQRT): - /* sqrt(-0.0) is -0.0. */ - if (!HONOR_SIGNED_ZEROS (TYPE_MODE (TREE_TYPE (t)))) - return true; - return tree_expr_nonnegative_warnv_p (CALL_EXPR_ARG (t, 0), - strict_overflow_p); - - CASE_FLT_FN (BUILT_IN_ASINH): - CASE_FLT_FN (BUILT_IN_ATAN): - CASE_FLT_FN (BUILT_IN_ATANH): - CASE_FLT_FN (BUILT_IN_CBRT): - CASE_FLT_FN (BUILT_IN_CEIL): - CASE_FLT_FN (BUILT_IN_ERF): - CASE_FLT_FN (BUILT_IN_EXPM1): - CASE_FLT_FN (BUILT_IN_FLOOR): - CASE_FLT_FN (BUILT_IN_FMOD): - CASE_FLT_FN (BUILT_IN_FREXP): - CASE_FLT_FN (BUILT_IN_LCEIL): - CASE_FLT_FN (BUILT_IN_LDEXP): - CASE_FLT_FN (BUILT_IN_LFLOOR): - CASE_FLT_FN (BUILT_IN_LLCEIL): - CASE_FLT_FN (BUILT_IN_LLFLOOR): - CASE_FLT_FN (BUILT_IN_LLRINT): - CASE_FLT_FN (BUILT_IN_LLROUND): - CASE_FLT_FN (BUILT_IN_LRINT): - CASE_FLT_FN (BUILT_IN_LROUND): - CASE_FLT_FN (BUILT_IN_MODF): - CASE_FLT_FN (BUILT_IN_NEARBYINT): - CASE_FLT_FN (BUILT_IN_RINT): - CASE_FLT_FN (BUILT_IN_ROUND): - CASE_FLT_FN (BUILT_IN_SCALB): - CASE_FLT_FN (BUILT_IN_SCALBLN): - CASE_FLT_FN (BUILT_IN_SCALBN): - CASE_FLT_FN (BUILT_IN_SIGNBIT): - CASE_FLT_FN (BUILT_IN_SIGNIFICAND): - CASE_FLT_FN (BUILT_IN_SINH): - CASE_FLT_FN (BUILT_IN_TANH): - CASE_FLT_FN (BUILT_IN_TRUNC): - /* True if the 1st argument is nonnegative. */ - return tree_expr_nonnegative_warnv_p (CALL_EXPR_ARG (t, 0), - strict_overflow_p); - - CASE_FLT_FN (BUILT_IN_FMAX): - /* True if the 1st OR 2nd arguments are nonnegative. */ - return (tree_expr_nonnegative_warnv_p (CALL_EXPR_ARG (t, 0), - strict_overflow_p) - || (tree_expr_nonnegative_warnv_p (CALL_EXPR_ARG (t, 1), - strict_overflow_p))); - - CASE_FLT_FN (BUILT_IN_FMIN): - /* True if the 1st AND 2nd arguments are nonnegative. */ - return (tree_expr_nonnegative_warnv_p (CALL_EXPR_ARG (t, 0), - strict_overflow_p) - && (tree_expr_nonnegative_warnv_p (CALL_EXPR_ARG (t, 1), - strict_overflow_p))); - - CASE_FLT_FN (BUILT_IN_COPYSIGN): - /* True if the 2nd argument is nonnegative. */ - return tree_expr_nonnegative_warnv_p (CALL_EXPR_ARG (t, 1), - strict_overflow_p); + tree arg0 = call_expr_nargs (t) > 0 ? CALL_EXPR_ARG (t, 0) : NULL_TREE; + tree arg1 = call_expr_nargs (t) > 1 ? CALL_EXPR_ARG (t, 1) : NULL_TREE; - CASE_FLT_FN (BUILT_IN_POWI): - /* True if the 1st argument is nonnegative or the second - argument is an even integer. */ - if (TREE_CODE (CALL_EXPR_ARG (t, 1)) == INTEGER_CST) - { - tree arg1 = CALL_EXPR_ARG (t, 1); - if ((TREE_INT_CST_LOW (arg1) & 1) == 0) - return true; - } - return tree_expr_nonnegative_warnv_p (CALL_EXPR_ARG (t, 0), - strict_overflow_p); - - CASE_FLT_FN (BUILT_IN_POW): - /* True if the 1st argument is nonnegative or the second - argument is an even integer valued real. */ - if (TREE_CODE (CALL_EXPR_ARG (t, 1)) == REAL_CST) - { - REAL_VALUE_TYPE c; - HOST_WIDE_INT n; - - c = TREE_REAL_CST (CALL_EXPR_ARG (t, 1)); - n = real_to_integer (&c); - if ((n & 1) == 0) - { - REAL_VALUE_TYPE cint; - real_from_integer (&cint, VOIDmode, n, - n < 0 ? -1 : 0, 0); - if (real_identical (&c, &cint)) - return true; - } - } - return tree_expr_nonnegative_warnv_p (CALL_EXPR_ARG (t, 0), - strict_overflow_p); - - default: - break; - } - return tree_simple_nonnegative_warnv_p (TREE_CODE (t), - TREE_TYPE (t)); + return tree_call_nonnegative_warnv_p (TREE_CODE (t), + TREE_TYPE (t), + get_callee_fndecl (t), + arg0, + arg1, + strict_overflow_p); } - break; - case COMPOUND_EXPR: case MODIFY_EXPR: case GIMPLE_MODIFY_STMT: diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 851008ed395..a282623da15 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,111 @@ +2008-04-13 Jerry DeLisle <jvdelisle@gcc.gnu.org> + Tobias Burnus <burnus@net-b.de> + + PR fortran/35882 + * options.c (gfc_init_options): Set the default maximum continuation + lines to 255 for both free and fixed form source for warnings. + (gfc_handle_option): Set -std=f95 fixed form max continuations to 19 and + the -std=f95 free form max continuations to 39 for warnings. + * scanner.c (gfc_next_char_literal): Adjust the current_line number only + if it is less than the current locus. + +2008-04-07 Jerry DeLisle <jvdelisle@gcc.gnu.org> + + PR fortran/25829 28655 + * io.c (io_tag): Add new tags for decimal, encoding, asynchronous, + round, sign, and id. (match_open_element): Match new tags. + (gfc_resolve_open): Resolve new tags. (gfc_match_open): Enable encoding + for DEFAULT only. Update error messages. (match_dt_element): Fix match + tag for asynchronous. Update error messages. (gfc_free_inquire): Free + new expressions. (match_inquire_element): Match new tags. + (gfc_match_inquire): Add constraint for ID and PENDING. + (gfc_resolve_inquire): Resolve new tags. + * trans-io.c (gfc_trans_inquire): Clean up whitespace and fix setting of + mask for ID parameter. + * ioparm.def: Fix order of parameters for pending, round, and sign. + NOTE: These must line up with the definitions in libgfortran/io/io.h. or + things don't work. + +2008-04-06 Paul Thomas <pault@gcc.gnu.org> + + PR fortran/35780 + * expr.c (scalarize_intrinsic_call): Identify which argument is + an array and use that as the template. + (check_init_expr): Remove tests that first argument is an array + in the call to scalarize_intrinsic_call. + +2008-04-06 Tobias Schl�ter <tobi@gcc.gnu.org> + + PR fortran/35832 + * io.c (io_tag): Add field 'value'. Split 'spec' field in + existing io_tags. + (match_etag, match_vtag, match_ltag): Split parsing in two steps + to give better error messages. + +2008-04-06 Tobias Burnus <burnus@net-b.de> + + * io.c (check_io_constraints): Add constrains. ID= requires + asynchronous= and asynchronous= must be init expression. + +2008-04-06 Francois-Xavier Coudert <fxcoudert@gcc.gnu.org> + + * f95-lang.c: Set LANG_HOOKS_NAME to "GNU Fortran". + +2008-04-06 Francois-Xavier Coudert <fxcoudert@gcc.gnu.org> + + * dump-parse-tree.c: Use fprintf, fputs and fputc instead of + gfc_status and gfc_status_char. Remove gfc_ prefix of the gfc_show_* + functions and make them static. Add new gfc_dump_parse_tree + function. + * gfortran.h (gfc_option_t): Rename verbose into dump_parse_tree. + (gfc_status, gfc_status_char): Delete prototypes. + * error.c (gfc_status, gfc_status_char): Remove functions. + * scanner.c (gfc_new_file): Use printf instead of gfc_status. + * options.c (gfc_init_options): Rename verbose into dump_parse_tree. + (gfc_handle_module_path_options): Use gfc_fatal_error instead of + gfc_status and exit. + (gfc_handle_option): Rename verbose into dump_parse_tree. + * parse.c (gfc_parse_file): Use gfc_dump_parse_tree. + +2008-04-05 Jerry DeLisle <jvdelisle@gcc.gnu.org> + Francois-Xavier Coudert <fxcoudert@gcc.gnu.org> + + PR fortran/25829 28655 + * dump-parse-tree.c (gfc_show_code_node): Show new I/O parameters. + * gfortran.h (gfc_statement): Add ST_WAIT enumerator. + (gfc_open): Add pointers for decimal, encoding, round, sign, + asynchronous. (gfc_inquire): Add pointers for asynchronous, decimal, + encoding, pending, round, sign, size, id. + (gfc_wait): New typedef struct. (gfc_dt): Add pointers for id, pos, + asynchronous, blank, decimal, delim, pad, round, sign. + (gfc_exec_op): Add EXEC_WAIT enumerator. (gfc_code): Add pointer for + wait. (gfc_free_wait), (gfc_resolve_wait): New function prototypes. + * trans-stmt.h (gfc_trans_wait): New function prototype. + * trans.c (gfc_trans_code): Add case for EXEC_WAIT. + * io.c (io_tag): Add new tags for DECIMAL, ENCODING, ROUND, SIGN, + ASYCHRONOUS, ID. (match_open_element): Add matchers for new tags. + (gfc_free_open): Free new pointers. (gfc_resolve_open): Resolve new + tags. (gfc_resolve_open): Remove comment around check for allowed + values and ASYNCHRONOUS, update it. Likewise for DECIMAL, ENCODING, + ROUND, and SIGN. (match_dt_element): Add matching for new tags. + (gfc_free_wait): New function. (gfc_resolve_wait): New function. + (match_wait_element): New function. (gfc_match_wait): New function. + * resolve.c (gfc_resolve_blocks): Add case for EXEC_WAIT. + (resolve_code): Add case for EXEC_WAIT. + * st.c (gfc_free_statement): Add case for EXEC_WAIT. + * trans-io.c (ioparam_type): Add IOPARM_ptype_wait. (gfc_st_parameter): + Add "wait" entry. (iocall): Add IOCALL_WAIT enumerator. + (gfc_build_io_library_fndecls): Add function declaration for st_wait. + (gfc_trans_open): Add mask bits for new I/O tags. + (gfc_trans_inquire): Add mask bits for new I/O tags. + (gfc_trans_wait): New translation function. + (build_dt): Add mask bits for new I/O tags. + * match.c (gfc_match_if) Add matcher for "wait". + * match.h (gfc_match_wait): Prototype for new function. + * ioparm.def: Add new I/O parameter definitions. + * parse.c (decode_statement): Add match for "wait" statement. + (next_statement): Add case for ST_WAIT. (gfc_ascii_statement): Same. + 2008-04-03 Jakub Jelinek <jakub@redhat.com> PR fortran/35786 @@ -10,7 +118,7 @@ 2008-04-03 Paolo Bonzini <bonzini@gnu.org> - * f95-lang.c (insert_block): Kill. + * f95-lang.c (insert_block): Kill. 2008-04-01 George Helffrich <george@gcc.gnu.org> diff --git a/gcc/fortran/dump-parse-tree.c b/gcc/fortran/dump-parse-tree.c index 4f4a77c0450..c195dcf977f 100644 --- a/gcc/fortran/dump-parse-tree.c +++ b/gcc/fortran/dump-parse-tree.c @@ -37,6 +37,16 @@ along with GCC; see the file COPYING3. If not see /* Keep track of indentation for symbol tree dumps. */ static int show_level = 0; +/* The file handle we're dumping to is kept in a static variable. This + is not too cool, but it avoids a lot of passing it around. */ +static FILE *dumpfile; + +/* Forward declaration of some of the functions. */ +static void show_expr (gfc_expr *p); +static void show_code_node (int, gfc_code *); +static void show_namespace (gfc_namespace *ns); + + /* Do indentation for a specific level. */ static inline void @@ -45,12 +55,12 @@ code_indent (int level, gfc_st_label *label) int i; if (label != NULL) - gfc_status ("%-5d ", label->value); + fprintf (dumpfile, "%-5d ", label->value); else - gfc_status (" "); + fputs (" ", dumpfile); for (i = 0; i < 2 * level; i++) - gfc_status_char (' '); + fputc (' ', dumpfile); } @@ -60,78 +70,78 @@ code_indent (int level, gfc_st_label *label) static inline void show_indent (void) { - gfc_status ("\n"); + fputc ('\n', dumpfile); code_indent (show_level, NULL); } /* Show type-specific information. */ -void -gfc_show_typespec (gfc_typespec *ts) +static void +show_typespec (gfc_typespec *ts) { - gfc_status ("(%s ", gfc_basic_typename (ts->type)); + fprintf (dumpfile, "(%s ", gfc_basic_typename (ts->type)); switch (ts->type) { case BT_DERIVED: - gfc_status ("%s", ts->derived->name); + fprintf (dumpfile, "%s", ts->derived->name); break; case BT_CHARACTER: - gfc_show_expr (ts->cl->length); + show_expr (ts->cl->length); break; default: - gfc_status ("%d", ts->kind); + fprintf (dumpfile, "%d", ts->kind); break; } - gfc_status (")"); + fputc (')', dumpfile); } /* Show an actual argument list. */ -void -gfc_show_actual_arglist (gfc_actual_arglist *a) +static void +show_actual_arglist (gfc_actual_arglist *a) { - gfc_status ("("); + fputc ('(', dumpfile); for (; a; a = a->next) { - gfc_status_char ('('); + fputc ('(', dumpfile); if (a->name != NULL) - gfc_status ("%s = ", a->name); + fprintf (dumpfile, "%s = ", a->name); if (a->expr != NULL) - gfc_show_expr (a->expr); + show_expr (a->expr); else - gfc_status ("(arg not-present)"); + fputs ("(arg not-present)", dumpfile); - gfc_status_char (')'); + fputc (')', dumpfile); if (a->next != NULL) - gfc_status (" "); + fputc (' ', dumpfile); } - gfc_status (")"); + fputc (')', dumpfile); } /* Show a gfc_array_spec array specification structure. */ -void -gfc_show_array_spec (gfc_array_spec *as) +static void +show_array_spec (gfc_array_spec *as) { const char *c; int i; if (as == NULL) { - gfc_status ("()"); + fputs ("()", dumpfile); return; } - gfc_status ("(%d", as->rank); + fprintf (dumpfile, "(%d", as->rank); if (as->rank != 0) { @@ -142,37 +152,37 @@ gfc_show_array_spec (gfc_array_spec *as) case AS_ASSUMED_SIZE: c = "AS_ASSUMED_SIZE"; break; case AS_ASSUMED_SHAPE: c = "AS_ASSUMED_SHAPE"; break; default: - gfc_internal_error ("gfc_show_array_spec(): Unhandled array shape " + gfc_internal_error ("show_array_spec(): Unhandled array shape " "type."); } - gfc_status (" %s ", c); + fprintf (dumpfile, " %s ", c); for (i = 0; i < as->rank; i++) { - gfc_show_expr (as->lower[i]); - gfc_status_char (' '); - gfc_show_expr (as->upper[i]); - gfc_status_char (' '); + show_expr (as->lower[i]); + fputc (' ', dumpfile); + show_expr (as->upper[i]); + fputc (' ', dumpfile); } } - gfc_status (")"); + fputc (')', dumpfile); } /* Show a gfc_array_ref array reference structure. */ -void -gfc_show_array_ref (gfc_array_ref * ar) +static void +show_array_ref (gfc_array_ref * ar) { int i; - gfc_status_char ('('); + fputc ('(', dumpfile); switch (ar->type) { case AR_FULL: - gfc_status ("FULL"); + fputs ("FULL", dumpfile); break; case AR_SECTION: @@ -186,106 +196,106 @@ gfc_show_array_ref (gfc_array_ref * ar) bound and the stride, if they're present. */ if (ar->start[i] != NULL) - gfc_show_expr (ar->start[i]); + show_expr (ar->start[i]); if (ar->dimen_type[i] == DIMEN_RANGE) { - gfc_status_char (':'); + fputc (':', dumpfile); if (ar->end[i] != NULL) - gfc_show_expr (ar->end[i]); + show_expr (ar->end[i]); if (ar->stride[i] != NULL) { - gfc_status_char (':'); - gfc_show_expr (ar->stride[i]); + fputc (':', dumpfile); + show_expr (ar->stride[i]); } } if (i != ar->dimen - 1) - gfc_status (" , "); + fputs (" , ", dumpfile); } break; case AR_ELEMENT: for (i = 0; i < ar->dimen; i++) { - gfc_show_expr (ar->start[i]); + show_expr (ar->start[i]); if (i != ar->dimen - 1) - gfc_status (" , "); + fputs (" , ", dumpfile); } break; case AR_UNKNOWN: - gfc_status ("UNKNOWN"); + fputs ("UNKNOWN", dumpfile); break; default: - gfc_internal_error ("gfc_show_array_ref(): Unknown array reference"); + gfc_internal_error ("show_array_ref(): Unknown array reference"); } - gfc_status_char (')'); + fputc (')', dumpfile); } /* Show a list of gfc_ref structures. */ -void -gfc_show_ref (gfc_ref *p) +static void +show_ref (gfc_ref *p) { for (; p; p = p->next) switch (p->type) { case REF_ARRAY: - gfc_show_array_ref (&p->u.ar); + show_array_ref (&p->u.ar); break; case REF_COMPONENT: - gfc_status (" %% %s", p->u.c.component->name); + fprintf (dumpfile, " %% %s", p->u.c.component->name); break; case REF_SUBSTRING: - gfc_status_char ('('); - gfc_show_expr (p->u.ss.start); - gfc_status_char (':'); - gfc_show_expr (p->u.ss.end); - gfc_status_char (')'); + fputc ('(', dumpfile); + show_expr (p->u.ss.start); + fputc (':', dumpfile); + show_expr (p->u.ss.end); + fputc (')', dumpfile); break; default: - gfc_internal_error ("gfc_show_ref(): Bad component code"); + gfc_internal_error ("show_ref(): Bad component code"); } } /* Display a constructor. Works recursively for array constructors. */ -void -gfc_show_constructor (gfc_constructor *c) +static void +show_constructor (gfc_constructor *c) { for (; c; c = c->next) { if (c->iterator == NULL) - gfc_show_expr (c->expr); + show_expr (c->expr); else { - gfc_status_char ('('); - gfc_show_expr (c->expr); + fputc ('(', dumpfile); + show_expr (c->expr); - gfc_status_char (' '); - gfc_show_expr (c->iterator->var); - gfc_status_char ('='); - gfc_show_expr (c->iterator->start); - gfc_status_char (','); - gfc_show_expr (c->iterator->end); - gfc_status_char (','); - gfc_show_expr (c->iterator->step); + fputc (' ', dumpfile); + show_expr (c->iterator->var); + fputc ('=', dumpfile); + show_expr (c->iterator->start); + fputc (',', dumpfile); + show_expr (c->iterator->end); + fputc (',', dumpfile); + show_expr (c->iterator->step); - gfc_status_char (')'); + fputc (')', dumpfile); } if (c->next != NULL) - gfc_status (" , "); + fputs (" , ", dumpfile); } } @@ -295,34 +305,30 @@ show_char_const (const char *c, int length) { int i; - gfc_status_char ('\''); + fputc ('\'', dumpfile); for (i = 0; i < length; i++) { if (c[i] == '\'') - gfc_status ("''"); + fputs ("''", dumpfile); else if (ISPRINT (c[i])) - gfc_status_char (c[i]); + fputc (c[i], dumpfile); else - { - gfc_status ("' // ACHAR("); - printf ("%d", c[i]); - gfc_status (") // '"); - } + fprintf (dumpfile, "' // ACHAR(%d) // '", c[i]); } - gfc_status_char ('\''); + fputc ('\'', dumpfile); } /* Show an expression. */ -void -gfc_show_expr (gfc_expr *p) +static void +show_expr (gfc_expr *p) { const char *c; int i; if (p == NULL) { - gfc_status ("()"); + fputs ("()", dumpfile); return; } @@ -330,25 +336,25 @@ gfc_show_expr (gfc_expr *p) { case EXPR_SUBSTRING: show_char_const (p->value.character.string, p->value.character.length); - gfc_show_ref (p->ref); + show_ref (p->ref); break; case EXPR_STRUCTURE: - gfc_status ("%s(", p->ts.derived->name); - gfc_show_constructor (p->value.constructor); - gfc_status_char (')'); + fprintf (dumpfile, "%s(", p->ts.derived->name); + show_constructor (p->value.constructor); + fputc (')', dumpfile); break; case EXPR_ARRAY: - gfc_status ("(/ "); - gfc_show_constructor (p->value.constructor); - gfc_status (" /)"); + fputs ("(/ ", dumpfile); + show_constructor (p->value.constructor); + fputs (" /)", dumpfile); - gfc_show_ref (p->ref); + show_ref (p->ref); break; case EXPR_NULL: - gfc_status ("NULL()"); + fputs ("NULL()", dumpfile); break; case EXPR_CONSTANT: @@ -358,20 +364,20 @@ gfc_show_expr (gfc_expr *p) mpz_out_str (stdout, 10, p->value.integer); if (p->ts.kind != gfc_default_integer_kind) - gfc_status ("_%d", p->ts.kind); + fprintf (dumpfile, "_%d", p->ts.kind); break; case BT_LOGICAL: if (p->value.logical) - gfc_status (".true."); + fputs (".true.", dumpfile); else - gfc_status (".false."); + fputs (".false.", dumpfile); break; case BT_REAL: mpfr_out_str (stdout, 10, 0, p->value.real, GFC_RND_MODE); if (p->ts.kind != gfc_default_real_kind) - gfc_status ("_%d", p->ts.kind); + fprintf (dumpfile, "_%d", p->ts.kind); break; case BT_CHARACTER: @@ -380,273 +386,264 @@ gfc_show_expr (gfc_expr *p) break; case BT_COMPLEX: - gfc_status ("(complex "); + fputs ("(complex ", dumpfile); mpfr_out_str (stdout, 10, 0, p->value.complex.r, GFC_RND_MODE); if (p->ts.kind != gfc_default_complex_kind) - gfc_status ("_%d", p->ts.kind); + fprintf (dumpfile, "_%d", p->ts.kind); - gfc_status (" "); + fputc (' ', dumpfile); mpfr_out_str (stdout, 10, 0, p->value.complex.i, GFC_RND_MODE); if (p->ts.kind != gfc_default_complex_kind) - gfc_status ("_%d", p->ts.kind); + fprintf (dumpfile, "_%d", p->ts.kind); - gfc_status (")"); + fputc (')', dumpfile); break; case BT_HOLLERITH: - gfc_status ("%dH", p->representation.length); + fprintf (dumpfile, "%dH", p->representation.length); c = p->representation.string; for (i = 0; i < p->representation.length; i++, c++) { - gfc_status_char (*c); + fputc (*c, dumpfile); } break; default: - gfc_status ("???"); + fputs ("???", dumpfile); break; } if (p->representation.string) { - gfc_status (" {"); + fputs (" {", dumpfile); c = p->representation.string; for (i = 0; i < p->representation.length; i++, c++) { - gfc_status ("%.2x", (unsigned int) *c); + fprintf (dumpfile, "%.2x", (unsigned int) *c); if (i < p->representation.length - 1) - gfc_status_char (','); + fputc (',', dumpfile); } - gfc_status_char ('}'); + fputc ('}', dumpfile); } break; case EXPR_VARIABLE: if (p->symtree->n.sym->ns && p->symtree->n.sym->ns->proc_name) - gfc_status ("%s:", p->symtree->n.sym->ns->proc_name->name); - gfc_status ("%s", p->symtree->n.sym->name); - gfc_show_ref (p->ref); + fprintf (dumpfile, "%s:", p->symtree->n.sym->ns->proc_name->name); + fprintf (dumpfile, "%s", p->symtree->n.sym->name); + show_ref (p->ref); break; case EXPR_OP: - gfc_status ("("); + fputc ('(', dumpfile); switch (p->value.op.operator) { case INTRINSIC_UPLUS: - gfc_status ("U+ "); + fputs ("U+ ", dumpfile); break; case INTRINSIC_UMINUS: - gfc_status ("U- "); + fputs ("U- ", dumpfile); break; case INTRINSIC_PLUS: - gfc_status ("+ "); + fputs ("+ ", dumpfile); break; case INTRINSIC_MINUS: - gfc_status ("- "); + fputs ("- ", dumpfile); break; case INTRINSIC_TIMES: - gfc_status ("* "); + fputs ("* ", dumpfile); break; case INTRINSIC_DIVIDE: - gfc_status ("/ "); + fputs ("/ ", dumpfile); break; case INTRINSIC_POWER: - gfc_status ("** "); + fputs ("** ", dumpfile); break; case INTRINSIC_CONCAT: - gfc_status ("// "); + fputs ("// ", dumpfile); break; case INTRINSIC_AND: - gfc_status ("AND "); + fputs ("AND ", dumpfile); break; case INTRINSIC_OR: - gfc_status ("OR "); + fputs ("OR ", dumpfile); break; case INTRINSIC_EQV: - gfc_status ("EQV "); + fputs ("EQV ", dumpfile); break; case INTRINSIC_NEQV: - gfc_status ("NEQV "); + fputs ("NEQV ", dumpfile); break; case INTRINSIC_EQ: case INTRINSIC_EQ_OS: - gfc_status ("= "); + fputs ("= ", dumpfile); break; case INTRINSIC_NE: case INTRINSIC_NE_OS: - gfc_status ("/= "); + fputs ("/= ", dumpfile); break; case INTRINSIC_GT: case INTRINSIC_GT_OS: - gfc_status ("> "); + fputs ("> ", dumpfile); break; case INTRINSIC_GE: case INTRINSIC_GE_OS: - gfc_status (">= "); + fputs (">= ", dumpfile); break; case INTRINSIC_LT: case INTRINSIC_LT_OS: - gfc_status ("< "); + fputs ("< ", dumpfile); break; case INTRINSIC_LE: case INTRINSIC_LE_OS: - gfc_status ("<= "); + fputs ("<= ", dumpfile); break; case INTRINSIC_NOT: - gfc_status ("NOT "); + fputs ("NOT ", dumpfile); break; case INTRINSIC_PARENTHESES: - gfc_status ("parens"); + fputs ("parens", dumpfile); break; default: gfc_internal_error - ("gfc_show_expr(): Bad intrinsic in expression!"); + ("show_expr(): Bad intrinsic in expression!"); } - gfc_show_expr (p->value.op.op1); + show_expr (p->value.op.op1); if (p->value.op.op2) { - gfc_status (" "); - gfc_show_expr (p->value.op.op2); + fputc (' ', dumpfile); + show_expr (p->value.op.op2); } - gfc_status (")"); + fputc (')', dumpfile); break; case EXPR_FUNCTION: if (p->value.function.name == NULL) { - gfc_status ("%s[", p->symtree->n.sym->name); - gfc_show_actual_arglist (p->value.function.actual); - gfc_status_char (']'); + fprintf (dumpfile, "%s[", p->symtree->n.sym->name); + show_actual_arglist (p->value.function.actual); + fputc (']', dumpfile); } else { - gfc_status ("%s[[", p->value.function.name); - gfc_show_actual_arglist (p->value.function.actual); - gfc_status_char (']'); - gfc_status_char (']'); + fprintf (dumpfile, "%s[[", p->value.function.name); + show_actual_arglist (p->value.function.actual); + fputc (']', dumpfile); + fputc (']', dumpfile); } break; default: - gfc_internal_error ("gfc_show_expr(): Don't know how to show expr"); + gfc_internal_error ("show_expr(): Don't know how to show expr"); } } -/* Show an expression for diagnostic purposes. */ -void -gfc_show_expr_n (const char * msg, gfc_expr *e) -{ - if (msg) - gfc_status (msg); - gfc_show_expr (e); - gfc_status_char ('\n'); -} - /* Show symbol attributes. The flavor and intent are followed by whatever single bit attributes are present. */ -void -gfc_show_attr (symbol_attribute *attr) +static void +show_attr (symbol_attribute *attr) { - gfc_status ("(%s %s %s %s %s", gfc_code2string (flavors, attr->flavor), - gfc_intent_string (attr->intent), - gfc_code2string (access_types, attr->access), - gfc_code2string (procedures, attr->proc), - gfc_code2string (save_status, attr->save)); + fprintf (dumpfile, "(%s %s %s %s %s", + gfc_code2string (flavors, attr->flavor), + gfc_intent_string (attr->intent), + gfc_code2string (access_types, attr->access), + gfc_code2string (procedures, attr->proc), + gfc_code2string (save_status, attr->save)); if (attr->allocatable) - gfc_status (" ALLOCATABLE"); + fputs (" ALLOCATABLE", dumpfile); if (attr->dimension) - gfc_status (" DIMENSION"); + fputs (" DIMENSION", dumpfile); if (attr->external) - gfc_status (" EXTERNAL"); + fputs (" EXTERNAL", dumpfile); if (attr->intrinsic) - gfc_status (" INTRINSIC"); + fputs (" INTRINSIC", dumpfile); if (attr->optional) - gfc_status (" OPTIONAL"); + fputs (" OPTIONAL", dumpfile); if (attr->pointer) - gfc_status (" POINTER"); + fputs (" POINTER", dumpfile); if (attr->protected) - gfc_status (" PROTECTED"); + fputs (" PROTECTED", dumpfile); if (attr->value) - gfc_status (" VALUE"); + fputs (" VALUE", dumpfile); if (attr->volatile_) - gfc_status (" VOLATILE"); + fputs (" VOLATILE", dumpfile); if (attr->threadprivate) - gfc_status (" THREADPRIVATE"); + fputs (" THREADPRIVATE", dumpfile); if (attr->target) - gfc_status (" TARGET"); + fputs (" TARGET", dumpfile); if (attr->dummy) - gfc_status (" DUMMY"); + fputs (" DUMMY", dumpfile); if (attr->result) - gfc_status (" RESULT"); + fputs (" RESULT", dumpfile); if (attr->entry) - gfc_status (" ENTRY"); + fputs (" ENTRY", dumpfile); if (attr->is_bind_c) - gfc_status (" BIND(C)"); + fputs (" BIND(C)", dumpfile); if (attr->data) - gfc_status (" DATA"); + fputs (" DATA", dumpfile); if (attr->use_assoc) - gfc_status (" USE-ASSOC"); + fputs (" USE-ASSOC", dumpfile); if (attr->in_namelist) - gfc_status (" IN-NAMELIST"); + fputs (" IN-NAMELIST", dumpfile); if (attr->in_common) - gfc_status (" IN-COMMON"); + fputs (" IN-COMMON", dumpfile); if (attr->abstract) - gfc_status (" ABSTRACT INTERFACE"); + fputs (" ABSTRACT INTERFACE", dumpfile); if (attr->function) - gfc_status (" FUNCTION"); + fputs (" FUNCTION", dumpfile); if (attr->subroutine) - gfc_status (" SUBROUTINE"); + fputs (" SUBROUTINE", dumpfile); if (attr->implicit_type) - gfc_status (" IMPLICIT-TYPE"); + fputs (" IMPLICIT-TYPE", dumpfile); if (attr->sequence) - gfc_status (" SEQUENCE"); + fputs (" SEQUENCE", dumpfile); if (attr->elemental) - gfc_status (" ELEMENTAL"); + fputs (" ELEMENTAL", dumpfile); if (attr->pure) - gfc_status (" PURE"); + fputs (" PURE", dumpfile); if (attr->recursive) - gfc_status (" RECURSIVE"); + fputs (" RECURSIVE", dumpfile); - gfc_status (")"); + fputc (')', dumpfile); } /* Show components of a derived type. */ -void -gfc_show_components (gfc_symbol *sym) +static void +show_components (gfc_symbol *sym) { gfc_component *c; for (c = sym->components; c; c = c->next) { - gfc_status ("(%s ", c->name); - gfc_show_typespec (&c->ts); + fprintf (dumpfile, "(%s ", c->name); + show_typespec (&c->ts); if (c->pointer) - gfc_status (" POINTER"); + fputs (" POINTER", dumpfile); if (c->dimension) - gfc_status (" DIMENSION"); - gfc_status_char (' '); - gfc_show_array_spec (c->as); + fputs (" DIMENSION", dumpfile); + fputc (' ', dumpfile); + show_array_spec (c->as); if (c->access) - gfc_status (" %s", gfc_code2string (access_types, c->access)); - gfc_status (")"); + fprintf (dumpfile, " %s", gfc_code2string (access_types, c->access)); + fputc (')', dumpfile); if (c->next != NULL) - gfc_status_char (' '); + fputc (' ', dumpfile); } } @@ -656,8 +653,8 @@ gfc_show_components (gfc_symbol *sym) specific interfaces associated with a generic symbol is done within that symbol. */ -void -gfc_show_symbol (gfc_symbol *sym) +static void +show_symbol (gfc_symbol *sym) { gfc_formal_arglist *formal; gfc_interface *intr; @@ -667,78 +664,67 @@ gfc_show_symbol (gfc_symbol *sym) show_indent (); - gfc_status ("symbol %s ", sym->name); - gfc_show_typespec (&sym->ts); - gfc_show_attr (&sym->attr); + fprintf (dumpfile, "symbol %s ", sym->name); + show_typespec (&sym->ts); + show_attr (&sym->attr); if (sym->value) { show_indent (); - gfc_status ("value: "); - gfc_show_expr (sym->value); + fputs ("value: ", dumpfile); + show_expr (sym->value); } if (sym->as) { show_indent (); - gfc_status ("Array spec:"); - gfc_show_array_spec (sym->as); + fputs ("Array spec:", dumpfile); + show_array_spec (sym->as); } if (sym->generic) { show_indent (); - gfc_status ("Generic interfaces:"); + fputs ("Generic interfaces:", dumpfile); for (intr = sym->generic; intr; intr = intr->next) - gfc_status (" %s", intr->sym->name); + fprintf (dumpfile, " %s", intr->sym->name); } if (sym->result) { show_indent (); - gfc_status ("result: %s", sym->result->name); + fprintf (dumpfile, "result: %s", sym->result->name); } if (sym->components) { show_indent (); - gfc_status ("components: "); - gfc_show_components (sym); + fputs ("components: ", dumpfile); + show_components (sym); } if (sym->formal) { show_indent (); - gfc_status ("Formal arglist:"); + fputs ("Formal arglist:", dumpfile); for (formal = sym->formal; formal; formal = formal->next) { if (formal->sym != NULL) - gfc_status (" %s", formal->sym->name); + fprintf (dumpfile, " %s", formal->sym->name); else - gfc_status (" [Alt Return]"); + fputs (" [Alt Return]", dumpfile); } } if (sym->formal_ns) { show_indent (); - gfc_status ("Formal namespace"); - gfc_show_namespace (sym->formal_ns); + fputs ("Formal namespace", dumpfile); + show_namespace (sym->formal_ns); } - gfc_status_char ('\n'); -} - - -/* Show a symbol for diagnostic purposes. */ -void -gfc_show_symbol_n (const char * msg, gfc_symbol *sym) -{ - if (msg) - gfc_status (msg); - gfc_show_symbol (sym); - gfc_status_char ('\n'); + fputc ('\n', dumpfile); } @@ -751,10 +737,10 @@ show_uop (gfc_user_op *uop) gfc_interface *intr; show_indent (); - gfc_status ("%s:", uop->name); + fprintf (dumpfile, "%s:", uop->name); for (intr = uop->operator; intr; intr = intr->next) - gfc_status (" %s", intr->sym->name); + fprintf (dumpfile, " %s", intr->sym->name); } @@ -790,17 +776,17 @@ show_common (gfc_symtree *st) gfc_symbol *s; show_indent (); - gfc_status ("common: /%s/ ", st->name); + fprintf (dumpfile, "common: /%s/ ", st->name); s = st->n.common->head; while (s) { - gfc_status ("%s", s->name); + fprintf (dumpfile, "%s", s->name); s = s->common_next; if (s) - gfc_status (", "); + fputs (", ", dumpfile); } - gfc_status_char ('\n'); + fputc ('\n', dumpfile); } @@ -810,44 +796,41 @@ static void show_symtree (gfc_symtree *st) { show_indent (); - gfc_status ("symtree: %s Ambig %d", st->name, st->ambiguous); + fprintf (dumpfile, "symtree: %s Ambig %d", st->name, st->ambiguous); if (st->n.sym->ns != gfc_current_ns) - gfc_status (" from namespace %s", st->n.sym->ns->proc_name->name); + fprintf (dumpfile, " from namespace %s", st->n.sym->ns->proc_name->name); else - gfc_show_symbol (st->n.sym); + show_symbol (st->n.sym); } /******************* Show gfc_code structures **************/ - -static void gfc_show_code_node (int, gfc_code *); - /* Show a list of code structures. Mutually recursive with - gfc_show_code_node(). */ + show_code_node(). */ -void -gfc_show_code (int level, gfc_code *c) +static void +show_code (int level, gfc_code *c) { for (; c; c = c->next) - gfc_show_code_node (level, c); + show_code_node (level, c); } -void -gfc_show_namelist (gfc_namelist *n) +static void +show_namelist (gfc_namelist *n) { for (; n->next; n = n->next) - gfc_status ("%s,", n->sym->name); - gfc_status ("%s", n->sym->name); + fprintf (dumpfile, "%s,", n->sym->name); + fprintf (dumpfile, "%s", n->sym->name); } /* Show a single OpenMP directive node and everything underneath it if necessary. */ static void -gfc_show_omp_node (int level, gfc_code *c) +show_omp_node (int level, gfc_code *c) { gfc_omp_clauses *omp_clauses = NULL; const char *name = NULL; @@ -871,7 +854,7 @@ gfc_show_omp_node (int level, gfc_code *c) default: gcc_unreachable (); } - gfc_status ("!$OMP %s", name); + fprintf (dumpfile, "!$OMP %s", name); switch (c->op) { case EXEC_OMP_DO: @@ -886,14 +869,14 @@ gfc_show_omp_node (int level, gfc_code *c) break; case EXEC_OMP_CRITICAL: if (c->ext.omp_name) - gfc_status (" (%s)", c->ext.omp_name); + fprintf (dumpfile, " (%s)", c->ext.omp_name); break; case EXEC_OMP_FLUSH: if (c->ext.omp_namelist) { - gfc_status (" ("); - gfc_show_namelist (c->ext.omp_namelist); - gfc_status_char (')'); + fputs (" (", dumpfile); + show_namelist (c->ext.omp_namelist); + fputc (')', dumpfile); } return; case EXEC_OMP_BARRIER: @@ -907,15 +890,15 @@ gfc_show_omp_node (int level, gfc_code *c) if (omp_clauses->if_expr) { - gfc_status (" IF("); - gfc_show_expr (omp_clauses->if_expr); - gfc_status_char (')'); + fputs (" IF(", dumpfile); + show_expr (omp_clauses->if_expr); + fputc (')', dumpfile); } if (omp_clauses->num_threads) { - gfc_status (" NUM_THREADS("); - gfc_show_expr (omp_clauses->num_threads); - gfc_status_char (')'); + fputs (" NUM_THREADS(", dumpfile); + show_expr (omp_clauses->num_threads); + fputc (')', dumpfile); } if (omp_clauses->sched_kind != OMP_SCHED_NONE) { @@ -929,13 +912,13 @@ gfc_show_omp_node (int level, gfc_code *c) default: gcc_unreachable (); } - gfc_status (" SCHEDULE (%s", type); + fprintf (dumpfile, " SCHEDULE (%s", type); if (omp_clauses->chunk_size) { - gfc_status_char (','); - gfc_show_expr (omp_clauses->chunk_size); + fputc (',', dumpfile); + show_expr (omp_clauses->chunk_size); } - gfc_status_char (')'); + fputc (')', dumpfile); } if (omp_clauses->default_sharing != OMP_DEFAULT_UNKNOWN) { @@ -949,10 +932,10 @@ gfc_show_omp_node (int level, gfc_code *c) default: gcc_unreachable (); } - gfc_status (" DEFAULT(%s)", type); + fprintf (dumpfile, " DEFAULT(%s)", type); } if (omp_clauses->ordered) - gfc_status (" ORDERED"); + fputs (" ORDERED", dumpfile); for (list_type = 0; list_type < OMP_LIST_NUM; list_type++) if (omp_clauses->lists[list_type] != NULL && list_type != OMP_LIST_COPYPRIVATE) @@ -977,7 +960,7 @@ gfc_show_omp_node (int level, gfc_code *c) default: gcc_unreachable (); } - gfc_status (" REDUCTION(%s:", type); + fprintf (dumpfile, " REDUCTION(%s:", type); } else { @@ -991,52 +974,52 @@ gfc_show_omp_node (int level, gfc_code *c) default: gcc_unreachable (); } - gfc_status (" %s(", type); + fprintf (dumpfile, " %s(", type); } - gfc_show_namelist (omp_clauses->lists[list_type]); - gfc_status_char (')'); + show_namelist (omp_clauses->lists[list_type]); + fputc (')', dumpfile); } } - gfc_status_char ('\n'); + fputc ('\n', dumpfile); if (c->op == EXEC_OMP_SECTIONS || c->op == EXEC_OMP_PARALLEL_SECTIONS) { gfc_code *d = c->block; while (d != NULL) { - gfc_show_code (level + 1, d->next); + show_code (level + 1, d->next); if (d->block == NULL) break; code_indent (level, 0); - gfc_status ("!$OMP SECTION\n"); + fputs ("!$OMP SECTION\n", dumpfile); d = d->block; } } else - gfc_show_code (level + 1, c->block->next); + show_code (level + 1, c->block->next); if (c->op == EXEC_OMP_ATOMIC) return; code_indent (level, 0); - gfc_status ("!$OMP END %s", name); + fprintf (dumpfile, "!$OMP END %s", name); if (omp_clauses != NULL) { if (omp_clauses->lists[OMP_LIST_COPYPRIVATE]) { - gfc_status (" COPYPRIVATE("); - gfc_show_namelist (omp_clauses->lists[OMP_LIST_COPYPRIVATE]); - gfc_status_char (')'); + fputs (" COPYPRIVATE(", dumpfile); + show_namelist (omp_clauses->lists[OMP_LIST_COPYPRIVATE]); + fputc (')', dumpfile); } else if (omp_clauses->nowait) - gfc_status (" NOWAIT"); + fputs (" NOWAIT", dumpfile); } else if (c->op == EXEC_OMP_CRITICAL && c->ext.omp_name) - gfc_status (" (%s)", c->ext.omp_name); + fprintf (dumpfile, " (%s)", c->ext.omp_name); } /* Show a single code node and everything underneath it if necessary. */ static void -gfc_show_code_node (int level, gfc_code *c) +show_code_node (int level, gfc_code *c) { gfc_forall_iterator *fa; gfc_open *open; @@ -1053,56 +1036,56 @@ gfc_show_code_node (int level, gfc_code *c) switch (c->op) { case EXEC_NOP: - gfc_status ("NOP"); + fputs ("NOP", dumpfile); break; case EXEC_CONTINUE: - gfc_status ("CONTINUE"); + fputs ("CONTINUE", dumpfile); break; case EXEC_ENTRY: - gfc_status ("ENTRY %s", c->ext.entry->sym->name); + fprintf (dumpfile, "ENTRY %s", c->ext.entry->sym->name); break; case EXEC_INIT_ASSIGN: case EXEC_ASSIGN: - gfc_status ("ASSIGN "); - gfc_show_expr (c->expr); - gfc_status_char (' '); - gfc_show_expr (c->expr2); + fputs ("ASSIGN ", dumpfile); + show_expr (c->expr); + fputc (' ', dumpfile); + show_expr (c->expr2); break; case EXEC_LABEL_ASSIGN: - gfc_status ("LABEL ASSIGN "); - gfc_show_expr (c->expr); - gfc_status (" %d", c->label->value); + fputs ("LABEL ASSIGN ", dumpfile); + show_expr (c->expr); + fprintf (dumpfile, " %d", c->label->value); break; case EXEC_POINTER_ASSIGN: - gfc_status ("POINTER ASSIGN "); - gfc_show_expr (c->expr); - gfc_status_char (' '); - gfc_show_expr (c->expr2); + fputs ("POINTER ASSIGN ", dumpfile); + show_expr (c->expr); + fputc (' ', dumpfile); + show_expr (c->expr2); break; case EXEC_GOTO: - gfc_status ("GOTO "); + fputs ("GOTO ", dumpfile); if (c->label) - gfc_status ("%d", c->label->value); + fprintf (dumpfile, "%d", c->label->value); else { - gfc_show_expr (c->expr); + show_expr (c->expr); d = c->block; if (d != NULL) { - gfc_status (", ("); + fputs (", (", dumpfile); for (; d; d = d ->block) { code_indent (level, d->label); if (d->block != NULL) - gfc_status_char (','); + fputc (',', dumpfile); else - gfc_status_char (')'); + fputc (')', dumpfile); } } } @@ -1111,54 +1094,54 @@ gfc_show_code_node (int level, gfc_code *c) case EXEC_CALL: case EXEC_ASSIGN_CALL: if (c->resolved_sym) - gfc_status ("CALL %s ", c->resolved_sym->name); + fprintf (dumpfile, "CALL %s ", c->resolved_sym->name); else if (c->symtree) - gfc_status ("CALL %s ", c->symtree->name); + fprintf (dumpfile, "CALL %s ", c->symtree->name); else - gfc_status ("CALL ?? "); + fputs ("CALL ?? ", dumpfile); - gfc_show_actual_arglist (c->ext.actual); + show_actual_arglist (c->ext.actual); break; case EXEC_RETURN: - gfc_status ("RETURN "); + fputs ("RETURN ", dumpfile); if (c->expr) - gfc_show_expr (c->expr); + show_expr (c->expr); break; case EXEC_PAUSE: - gfc_status ("PAUSE "); + fputs ("PAUSE ", dumpfile); if (c->expr != NULL) - gfc_show_expr (c->expr); + show_expr (c->expr); else - gfc_status ("%d", c->ext.stop_code); + fprintf (dumpfile, "%d", c->ext.stop_code); break; case EXEC_STOP: - gfc_status ("STOP "); + fputs ("STOP ", dumpfile); if (c->expr != NULL) - gfc_show_expr (c->expr); + show_expr (c->expr); else - gfc_status ("%d", c->ext.stop_code); + fprintf (dumpfile, "%d", c->ext.stop_code); break; case EXEC_ARITHMETIC_IF: - gfc_status ("IF "); - gfc_show_expr (c->expr); - gfc_status (" %d, %d, %d", + fputs ("IF ", dumpfile); + show_expr (c->expr); + fprintf (dumpfile, " %d, %d, %d", c->label->value, c->label2->value, c->label3->value); break; case EXEC_IF: d = c->block; - gfc_status ("IF "); - gfc_show_expr (d->expr); - gfc_status_char ('\n'); - gfc_show_code (level + 1, d->next); + fputs ("IF ", dumpfile); + show_expr (d->expr); + fputc ('\n', dumpfile); + show_code (level + 1, d->next); d = d->block; for (; d; d = d->block) @@ -1166,540 +1149,650 @@ gfc_show_code_node (int level, gfc_code *c) code_indent (level, 0); if (d->expr == NULL) - gfc_status ("ELSE\n"); + fputs ("ELSE\n", dumpfile); else { - gfc_status ("ELSE IF "); - gfc_show_expr (d->expr); - gfc_status_char ('\n'); + fputs ("ELSE IF ", dumpfile); + show_expr (d->expr); + fputc ('\n', dumpfile); } - gfc_show_code (level + 1, d->next); + show_code (level + 1, d->next); } code_indent (level, c->label); - gfc_status ("ENDIF"); + fputs ("ENDIF", dumpfile); break; case EXEC_SELECT: d = c->block; - gfc_status ("SELECT CASE "); - gfc_show_expr (c->expr); - gfc_status_char ('\n'); + fputs ("SELECT CASE ", dumpfile); + show_expr (c->expr); + fputc ('\n', dumpfile); for (; d; d = d->block) { code_indent (level, 0); - gfc_status ("CASE "); + fputs ("CASE ", dumpfile); for (cp = d->ext.case_list; cp; cp = cp->next) { - gfc_status_char ('('); - gfc_show_expr (cp->low); - gfc_status_char (' '); - gfc_show_expr (cp->high); - gfc_status_char (')'); - gfc_status_char (' '); + fputc ('(', dumpfile); + show_expr (cp->low); + fputc (' ', dumpfile); + show_expr (cp->high); + fputc (')', dumpfile); + fputc (' ', dumpfile); } - gfc_status_char ('\n'); + fputc ('\n', dumpfile); - gfc_show_code (level + 1, d->next); + show_code (level + 1, d->next); } code_indent (level, c->label); - gfc_status ("END SELECT"); + fputs ("END SELECT", dumpfile); break; case EXEC_WHERE: - gfc_status ("WHERE "); + fputs ("WHERE ", dumpfile); d = c->block; - gfc_show_expr (d->expr); - gfc_status_char ('\n'); + show_expr (d->expr); + fputc ('\n', dumpfile); - gfc_show_code (level + 1, d->next); + show_code (level + 1, d->next); for (d = d->block; d; d = d->block) { code_indent (level, 0); - gfc_status ("ELSE WHERE "); - gfc_show_expr (d->expr); - gfc_status_char ('\n'); - gfc_show_code (level + 1, d->next); + fputs ("ELSE WHERE ", dumpfile); + show_expr (d->expr); + fputc ('\n', dumpfile); + show_code (level + 1, d->next); } code_indent (level, 0); - gfc_status ("END WHERE"); + fputs ("END WHERE", dumpfile); break; case EXEC_FORALL: - gfc_status ("FORALL "); + fputs ("FORALL ", dumpfile); for (fa = c->ext.forall_iterator; fa; fa = fa->next) { - gfc_show_expr (fa->var); - gfc_status_char (' '); - gfc_show_expr (fa->start); - gfc_status_char (':'); - gfc_show_expr (fa->end); - gfc_status_char (':'); - gfc_show_expr (fa->stride); + show_expr (fa->var); + fputc (' ', dumpfile); + show_expr (fa->start); + fputc (':', dumpfile); + show_expr (fa->end); + fputc (':', dumpfile); + show_expr (fa->stride); if (fa->next != NULL) - gfc_status_char (','); + fputc (',', dumpfile); } if (c->expr != NULL) { - gfc_status_char (','); - gfc_show_expr (c->expr); + fputc (',', dumpfile); + show_expr (c->expr); } - gfc_status_char ('\n'); + fputc ('\n', dumpfile); - gfc_show_code (level + 1, c->block->next); + show_code (level + 1, c->block->next); code_indent (level, 0); - gfc_status ("END FORALL"); + fputs ("END FORALL", dumpfile); break; case EXEC_DO: - gfc_status ("DO "); + fputs ("DO ", dumpfile); - gfc_show_expr (c->ext.iterator->var); - gfc_status_char ('='); - gfc_show_expr (c->ext.iterator->start); - gfc_status_char (' '); - gfc_show_expr (c->ext.iterator->end); - gfc_status_char (' '); - gfc_show_expr (c->ext.iterator->step); - gfc_status_char ('\n'); + show_expr (c->ext.iterator->var); + fputc ('=', dumpfile); + show_expr (c->ext.iterator->start); + fputc (' ', dumpfile); + show_expr (c->ext.iterator->end); + fputc (' ', dumpfile); + show_expr (c->ext.iterator->step); + fputc ('\n', dumpfile); - gfc_show_code (level + 1, c->block->next); + show_code (level + 1, c->block->next); code_indent (level, 0); - gfc_status ("END DO"); + fputs ("END DO", dumpfile); break; case EXEC_DO_WHILE: - gfc_status ("DO WHILE "); - gfc_show_expr (c->expr); - gfc_status_char ('\n'); + fputs ("DO WHILE ", dumpfile); + show_expr (c->expr); + fputc ('\n', dumpfile); - gfc_show_code (level + 1, c->block->next); + show_code (level + 1, c->block->next); code_indent (level, c->label); - gfc_status ("END DO"); + fputs ("END DO", dumpfile); break; case EXEC_CYCLE: - gfc_status ("CYCLE"); + fputs ("CYCLE", dumpfile); if (c->symtree) - gfc_status (" %s", c->symtree->n.sym->name); + fprintf (dumpfile, " %s", c->symtree->n.sym->name); break; case EXEC_EXIT: - gfc_status ("EXIT"); + fputs ("EXIT", dumpfile); if (c->symtree) - gfc_status (" %s", c->symtree->n.sym->name); + fprintf (dumpfile, " %s", c->symtree->n.sym->name); break; case EXEC_ALLOCATE: - gfc_status ("ALLOCATE "); + fputs ("ALLOCATE ", dumpfile); if (c->expr) { - gfc_status (" STAT="); - gfc_show_expr (c->expr); + fputs (" STAT=", dumpfile); + show_expr (c->expr); } for (a = c->ext.alloc_list; a; a = a->next) { - gfc_status_char (' '); - gfc_show_expr (a->expr); + fputc (' ', dumpfile); + show_expr (a->expr); } break; case EXEC_DEALLOCATE: - gfc_status ("DEALLOCATE "); + fputs ("DEALLOCATE ", dumpfile); if (c->expr) { - gfc_status (" STAT="); - gfc_show_expr (c->expr); + fputs (" STAT=", dumpfile); + show_expr (c->expr); } for (a = c->ext.alloc_list; a; a = a->next) { - gfc_status_char (' '); - gfc_show_expr (a->expr); + fputc (' ', dumpfile); + show_expr (a->expr); } break; case EXEC_OPEN: - gfc_status ("OPEN"); + fputs ("OPEN", dumpfile); open = c->ext.open; if (open->unit) { - gfc_status (" UNIT="); - gfc_show_expr (open->unit); + fputs (" UNIT=", dumpfile); + show_expr (open->unit); } if (open->iomsg) { - gfc_status (" IOMSG="); - gfc_show_expr (open->iomsg); + fputs (" IOMSG=", dumpfile); + show_expr (open->iomsg); } if (open->iostat) { - gfc_status (" IOSTAT="); - gfc_show_expr (open->iostat); + fputs (" IOSTAT=", dumpfile); + show_expr (open->iostat); } if (open->file) { - gfc_status (" FILE="); - gfc_show_expr (open->file); + fputs (" FILE=", dumpfile); + show_expr (open->file); } if (open->status) { - gfc_status (" STATUS="); - gfc_show_expr (open->status); + fputs (" STATUS=", dumpfile); + show_expr (open->status); } if (open->access) { - gfc_status (" ACCESS="); - gfc_show_expr (open->access); + fputs (" ACCESS=", dumpfile); + show_expr (open->access); } if (open->form) { - gfc_status (" FORM="); - gfc_show_expr (open->form); + fputs (" FORM=", dumpfile); + show_expr (open->form); } if (open->recl) { - gfc_status (" RECL="); - gfc_show_expr (open->recl); + fputs (" RECL=", dumpfile); + show_expr (open->recl); } if (open->blank) { - gfc_status (" BLANK="); - gfc_show_expr (open->blank); + fputs (" BLANK=", dumpfile); + show_expr (open->blank); } if (open->position) { - gfc_status (" POSITION="); - gfc_show_expr (open->position); + fputs (" POSITION=", dumpfile); + show_expr (open->position); } if (open->action) { - gfc_status (" ACTION="); - gfc_show_expr (open->action); + fputs (" ACTION=", dumpfile); + show_expr (open->action); } if (open->delim) { - gfc_status (" DELIM="); - gfc_show_expr (open->delim); + fputs (" DELIM=", dumpfile); + show_expr (open->delim); } if (open->pad) { - gfc_status (" PAD="); - gfc_show_expr (open->pad); + fputs (" PAD=", dumpfile); + show_expr (open->pad); + } + if (open->decimal) + { + fputs (" DECIMAL=", dumpfile); + show_expr (open->decimal); + } + if (open->encoding) + { + fputs (" ENCODING=", dumpfile); + show_expr (open->encoding); + } + if (open->round) + { + fputs (" ROUND=", dumpfile); + show_expr (open->round); + } + if (open->sign) + { + fputs (" SIGN=", dumpfile); + show_expr (open->sign); } if (open->convert) { - gfc_status (" CONVERT="); - gfc_show_expr (open->convert); + fputs (" CONVERT=", dumpfile); + show_expr (open->convert); + } + if (open->asynchronous) + { + fputs (" ASYNCHRONOUS=", dumpfile); + show_expr (open->asynchronous); } if (open->err != NULL) - gfc_status (" ERR=%d", open->err->value); + fprintf (dumpfile, " ERR=%d", open->err->value); break; case EXEC_CLOSE: - gfc_status ("CLOSE"); + fputs ("CLOSE", dumpfile); close = c->ext.close; if (close->unit) { - gfc_status (" UNIT="); - gfc_show_expr (close->unit); + fputs (" UNIT=", dumpfile); + show_expr (close->unit); } if (close->iomsg) { - gfc_status (" IOMSG="); - gfc_show_expr (close->iomsg); + fputs (" IOMSG=", dumpfile); + show_expr (close->iomsg); } if (close->iostat) { - gfc_status (" IOSTAT="); - gfc_show_expr (close->iostat); + fputs (" IOSTAT=", dumpfile); + show_expr (close->iostat); } if (close->status) { - gfc_status (" STATUS="); - gfc_show_expr (close->status); + fputs (" STATUS=", dumpfile); + show_expr (close->status); } if (close->err != NULL) - gfc_status (" ERR=%d", close->err->value); + fprintf (dumpfile, " ERR=%d", close->err->value); break; case EXEC_BACKSPACE: - gfc_status ("BACKSPACE"); + fputs ("BACKSPACE", dumpfile); goto show_filepos; case EXEC_ENDFILE: - gfc_status ("ENDFILE"); + fputs ("ENDFILE", dumpfile); goto show_filepos; case EXEC_REWIND: - gfc_status ("REWIND"); + fputs ("REWIND", dumpfile); goto show_filepos; case EXEC_FLUSH: - gfc_status ("FLUSH"); + fputs ("FLUSH", dumpfile); show_filepos: fp = c->ext.filepos; if (fp->unit) { - gfc_status (" UNIT="); - gfc_show_expr (fp->unit); + fputs (" UNIT=", dumpfile); + show_expr (fp->unit); } if (fp->iomsg) { - gfc_status (" IOMSG="); - gfc_show_expr (fp->iomsg); + fputs (" IOMSG=", dumpfile); + show_expr (fp->iomsg); } if (fp->iostat) { - gfc_status (" IOSTAT="); - gfc_show_expr (fp->iostat); + fputs (" IOSTAT=", dumpfile); + show_expr (fp->iostat); } if (fp->err != NULL) - gfc_status (" ERR=%d", fp->err->value); + fprintf (dumpfile, " ERR=%d", fp->err->value); break; case EXEC_INQUIRE: - gfc_status ("INQUIRE"); + fputs ("INQUIRE", dumpfile); i = c->ext.inquire; if (i->unit) { - gfc_status (" UNIT="); - gfc_show_expr (i->unit); + fputs (" UNIT=", dumpfile); + show_expr (i->unit); } if (i->file) { - gfc_status (" FILE="); - gfc_show_expr (i->file); + fputs (" FILE=", dumpfile); + show_expr (i->file); } if (i->iomsg) { - gfc_status (" IOMSG="); - gfc_show_expr (i->iomsg); + fputs (" IOMSG=", dumpfile); + show_expr (i->iomsg); } if (i->iostat) { - gfc_status (" IOSTAT="); - gfc_show_expr (i->iostat); + fputs (" IOSTAT=", dumpfile); + show_expr (i->iostat); } if (i->exist) { - gfc_status (" EXIST="); - gfc_show_expr (i->exist); + fputs (" EXIST=", dumpfile); + show_expr (i->exist); } if (i->opened) { - gfc_status (" OPENED="); - gfc_show_expr (i->opened); + fputs (" OPENED=", dumpfile); + show_expr (i->opened); } if (i->number) { - gfc_status (" NUMBER="); - gfc_show_expr (i->number); + fputs (" NUMBER=", dumpfile); + show_expr (i->number); } if (i->named) { - gfc_status (" NAMED="); - gfc_show_expr (i->named); + fputs (" NAMED=", dumpfile); + show_expr (i->named); } if (i->name) { - gfc_status (" NAME="); - gfc_show_expr (i->name); + fputs (" NAME=", dumpfile); + show_expr (i->name); } if (i->access) { - gfc_status (" ACCESS="); - gfc_show_expr (i->access); + fputs (" ACCESS=", dumpfile); + show_expr (i->access); } if (i->sequential) { - gfc_status (" SEQUENTIAL="); - gfc_show_expr (i->sequential); + fputs (" SEQUENTIAL=", dumpfile); + show_expr (i->sequential); } if (i->direct) { - gfc_status (" DIRECT="); - gfc_show_expr (i->direct); + fputs (" DIRECT=", dumpfile); + show_expr (i->direct); } if (i->form) { - gfc_status (" FORM="); - gfc_show_expr (i->form); + fputs (" FORM=", dumpfile); + show_expr (i->form); } if (i->formatted) { - gfc_status (" FORMATTED"); - gfc_show_expr (i->formatted); + fputs (" FORMATTED", dumpfile); + show_expr (i->formatted); } if (i->unformatted) { - gfc_status (" UNFORMATTED="); - gfc_show_expr (i->unformatted); + fputs (" UNFORMATTED=", dumpfile); + show_expr (i->unformatted); } if (i->recl) { - gfc_status (" RECL="); - gfc_show_expr (i->recl); + fputs (" RECL=", dumpfile); + show_expr (i->recl); } if (i->nextrec) { - gfc_status (" NEXTREC="); - gfc_show_expr (i->nextrec); + fputs (" NEXTREC=", dumpfile); + show_expr (i->nextrec); } if (i->blank) { - gfc_status (" BLANK="); - gfc_show_expr (i->blank); + fputs (" BLANK=", dumpfile); + show_expr (i->blank); } if (i->position) { - gfc_status (" POSITION="); - gfc_show_expr (i->position); + fputs (" POSITION=", dumpfile); + show_expr (i->position); } if (i->action) { - gfc_status (" ACTION="); - gfc_show_expr (i->action); + fputs (" ACTION=", dumpfile); + show_expr (i->action); } if (i->read) { - gfc_status (" READ="); - gfc_show_expr (i->read); + fputs (" READ=", dumpfile); + show_expr (i->read); } if (i->write) { - gfc_status (" WRITE="); - gfc_show_expr (i->write); + fputs (" WRITE=", dumpfile); + show_expr (i->write); } if (i->readwrite) { - gfc_status (" READWRITE="); - gfc_show_expr (i->readwrite); + fputs (" READWRITE=", dumpfile); + show_expr (i->readwrite); } if (i->delim) { - gfc_status (" DELIM="); - gfc_show_expr (i->delim); + fputs (" DELIM=", dumpfile); + show_expr (i->delim); } if (i->pad) { - gfc_status (" PAD="); - gfc_show_expr (i->pad); + fputs (" PAD=", dumpfile); + show_expr (i->pad); } if (i->convert) { - gfc_status (" CONVERT="); - gfc_show_expr (i->convert); + fputs (" CONVERT=", dumpfile); + show_expr (i->convert); + } + if (i->asynchronous) + { + fputs (" ASYNCHRONOUS=", dumpfile); + show_expr (i->asynchronous); + } + if (i->decimal) + { + fputs (" DECIMAL=", dumpfile); + show_expr (i->decimal); + } + if (i->encoding) + { + fputs (" ENCODING=", dumpfile); + show_expr (i->encoding); + } + if (i->pending) + { + fputs (" PENDING=", dumpfile); + show_expr (i->pending); + } + if (i->round) + { + fputs (" ROUND=", dumpfile); + show_expr (i->round); + } + if (i->sign) + { + fputs (" SIGN=", dumpfile); + show_expr (i->sign); + } + if (i->size) + { + fputs (" SIZE=", dumpfile); + show_expr (i->size); + } + if (i->id) + { + fputs (" ID=", dumpfile); + show_expr (i->id); } if (i->err != NULL) - gfc_status (" ERR=%d", i->err->value); + fprintf (dumpfile, " ERR=%d", i->err->value); break; case EXEC_IOLENGTH: - gfc_status ("IOLENGTH "); - gfc_show_expr (c->expr); + fputs ("IOLENGTH ", dumpfile); + show_expr (c->expr); goto show_dt_code; break; case EXEC_READ: - gfc_status ("READ"); + fputs ("READ", dumpfile); goto show_dt; case EXEC_WRITE: - gfc_status ("WRITE"); + fputs ("WRITE", dumpfile); show_dt: dt = c->ext.dt; if (dt->io_unit) { - gfc_status (" UNIT="); - gfc_show_expr (dt->io_unit); + fputs (" UNIT=", dumpfile); + show_expr (dt->io_unit); } if (dt->format_expr) { - gfc_status (" FMT="); - gfc_show_expr (dt->format_expr); + fputs (" FMT=", dumpfile); + show_expr (dt->format_expr); } if (dt->format_label != NULL) - gfc_status (" FMT=%d", dt->format_label->value); + fprintf (dumpfile, " FMT=%d", dt->format_label->value); if (dt->namelist) - gfc_status (" NML=%s", dt->namelist->name); + fprintf (dumpfile, " NML=%s", dt->namelist->name); if (dt->iomsg) { - gfc_status (" IOMSG="); - gfc_show_expr (dt->iomsg); + fputs (" IOMSG=", dumpfile); + show_expr (dt->iomsg); } if (dt->iostat) { - gfc_status (" IOSTAT="); - gfc_show_expr (dt->iostat); + fputs (" IOSTAT=", dumpfile); + show_expr (dt->iostat); } if (dt->size) { - gfc_status (" SIZE="); - gfc_show_expr (dt->size); + fputs (" SIZE=", dumpfile); + show_expr (dt->size); } if (dt->rec) { - gfc_status (" REC="); - gfc_show_expr (dt->rec); + fputs (" REC=", dumpfile); + show_expr (dt->rec); } if (dt->advance) { - gfc_status (" ADVANCE="); - gfc_show_expr (dt->advance); + fputs (" ADVANCE=", dumpfile); + show_expr (dt->advance); + } + if (dt->id) + { + fputs (" ID=", dumpfile); + show_expr (dt->id); + } + if (dt->pos) + { + fputs (" POS=", dumpfile); + show_expr (dt->pos); + } + if (dt->asynchronous) + { + fputs (" ASYNCHRONOUS=", dumpfile); + show_expr (dt->asynchronous); + } + if (dt->blank) + { + fputs (" BLANK=", dumpfile); + show_expr (dt->blank); + } + if (dt->decimal) + { + fputs (" DECIMAL=", dumpfile); + show_expr (dt->decimal); + } + if (dt->delim) + { + fputs (" DELIM=", dumpfile); + show_expr (dt->delim); + } + if (dt->pad) + { + fputs (" PAD=", dumpfile); + show_expr (dt->pad); + } + if (dt->round) + { + fputs (" ROUND=", dumpfile); + show_expr (dt->round); + } + if (dt->sign) + { + fputs (" SIGN=", dumpfile); + show_expr (dt->sign); } show_dt_code: - gfc_status_char ('\n'); + fputc ('\n', dumpfile); for (c = c->block->next; c; c = c->next) - gfc_show_code_node (level + (c->next != NULL), c); + show_code_node (level + (c->next != NULL), c); return; case EXEC_TRANSFER: - gfc_status ("TRANSFER "); - gfc_show_expr (c->expr); + fputs ("TRANSFER ", dumpfile); + show_expr (c->expr); break; case EXEC_DT_END: - gfc_status ("DT_END"); + fputs ("DT_END", dumpfile); dt = c->ext.dt; if (dt->err != NULL) - gfc_status (" ERR=%d", dt->err->value); + fprintf (dumpfile, " ERR=%d", dt->err->value); if (dt->end != NULL) - gfc_status (" END=%d", dt->end->value); + fprintf (dumpfile, " END=%d", dt->end->value); if (dt->eor != NULL) - gfc_status (" EOR=%d", dt->eor->value); + fprintf (dumpfile, " EOR=%d", dt->eor->value); break; case EXEC_OMP_ATOMIC: @@ -1716,38 +1809,38 @@ gfc_show_code_node (int level, gfc_code *c) case EXEC_OMP_SECTIONS: case EXEC_OMP_SINGLE: case EXEC_OMP_WORKSHARE: - gfc_show_omp_node (level, c); + show_omp_node (level, c); break; default: - gfc_internal_error ("gfc_show_code_node(): Bad statement code"); + gfc_internal_error ("show_code_node(): Bad statement code"); } - gfc_status_char ('\n'); + fputc ('\n', dumpfile); } /* Show an equivalence chain. */ -void -gfc_show_equiv (gfc_equiv *eq) +static void +show_equiv (gfc_equiv *eq) { show_indent (); - gfc_status ("Equivalence: "); + fputs ("Equivalence: ", dumpfile); while (eq) { - gfc_show_expr (eq->expr); + show_expr (eq->expr); eq = eq->eq; if (eq) - gfc_status (", "); + fputs (", ", dumpfile); } } - + /* Show a freakin' whole namespace. */ -void -gfc_show_namespace (gfc_namespace *ns) +static void +show_namespace (gfc_namespace *ns) { gfc_interface *intr; gfc_namespace *save; @@ -1759,7 +1852,7 @@ gfc_show_namespace (gfc_namespace *ns) show_level++; show_indent (); - gfc_status ("Namespace:"); + fputs ("Namespace:", dumpfile); if (ns != NULL) { @@ -1773,18 +1866,18 @@ gfc_show_namespace (gfc_namespace *ns) i++; if (i > l) - gfc_status(" %c-%c: ", l+'A', i+'A'); + fprintf (dumpfile, " %c-%c: ", l+'A', i+'A'); else - gfc_status(" %c: ", l+'A'); + fprintf (dumpfile, " %c: ", l+'A'); - gfc_show_typespec(&ns->default_type[l]); + show_typespec(&ns->default_type[l]); i++; } while (i < GFC_LETTERS); if (ns->proc_name != NULL) { show_indent (); - gfc_status ("procedure name = %s", ns->proc_name->name); + fprintf (dumpfile, "procedure name = %s", ns->proc_name->name); } gfc_current_ns = ns; @@ -1800,36 +1893,47 @@ gfc_show_namespace (gfc_namespace *ns) continue; show_indent (); - gfc_status ("Operator interfaces for %s:", gfc_op2string (op)); + fprintf (dumpfile, "Operator interfaces for %s:", + gfc_op2string (op)); for (; intr; intr = intr->next) - gfc_status (" %s", intr->sym->name); + fprintf (dumpfile, " %s", intr->sym->name); } if (ns->uop_root != NULL) { show_indent (); - gfc_status ("User operators:\n"); + fputs ("User operators:\n", dumpfile); gfc_traverse_user_op (ns, show_uop); } } for (eq = ns->equiv; eq; eq = eq->next) - gfc_show_equiv (eq); + show_equiv (eq); - gfc_status_char ('\n'); - gfc_status_char ('\n'); + fputc ('\n', dumpfile); + fputc ('\n', dumpfile); - gfc_show_code (0, ns->code); + show_code (0, ns->code); for (ns = ns->contained; ns; ns = ns->sibling) { show_indent (); - gfc_status ("CONTAINS\n"); - gfc_show_namespace (ns); + fputs ("CONTAINS\n", dumpfile); + show_namespace (ns); } show_level--; - gfc_status_char ('\n'); + fputc ('\n', dumpfile); gfc_current_ns = save; } + + +/* Main function for dumping a parse tree. */ + +void +gfc_dump_parse_tree (gfc_namespace *ns, FILE *file) +{ + dumpfile = file; + show_namespace (ns); +} diff --git a/gcc/fortran/error.c b/gcc/fortran/error.c index 669c2d47a6b..40eccde5adf 100644 --- a/gcc/fortran/error.c +++ b/gcc/fortran/error.c @@ -963,31 +963,6 @@ gfc_free_error (gfc_error_buf *err) } -/* Debug wrapper for printf. */ - -void -gfc_status (const char *cmsgid, ...) -{ - va_list argp; - - va_start (argp, cmsgid); - - vprintf (_(cmsgid), argp); - - va_end (argp); -} - - -/* Subroutine for outputting a single char so that we don't have to go - around creating a lot of 1-character strings. */ - -void -gfc_status_char (char c) -{ - putchar (c); -} - - /* Report the number of warnings and errors that occurred to the caller. */ void diff --git a/gcc/fortran/expr.c b/gcc/fortran/expr.c index 329bc722dba..12e88a07420 100644 --- a/gcc/fortran/expr.c +++ b/gcc/fortran/expr.c @@ -1702,17 +1702,34 @@ scalarize_intrinsic_call (gfc_expr *e) gfc_actual_arglist *a, *b; gfc_constructor *args[5], *ctor, *new_ctor; gfc_expr *expr, *old; - int n, i, rank[5]; + int n, i, rank[5], array_arg; old = gfc_copy_expr (e); -/* Assume that the old expression carries the type information and - that the first arg carries all the shape information. */ - expr = gfc_copy_expr (old->value.function.actual->expr); + + /* Find which, if any, arguments are arrays. Assume that the old + expression carries the type information and that the first arg + that is an array expression carries all the shape information.*/ + n = array_arg = 0; + a = old->value.function.actual; + for (; a; a = a->next) + { + n++; + if (a->expr->expr_type != EXPR_ARRAY) + continue; + array_arg = n; + expr = gfc_copy_expr (a->expr); + break; + } + + if (!array_arg) + goto cleanup; + gfc_free_constructor (expr->value.constructor); expr->value.constructor = NULL; expr->ts = old->ts; + expr->where = old->where; expr->expr_type = EXPR_ARRAY; /* Copy the array argument constructors into an array, with nulls @@ -1745,14 +1762,11 @@ scalarize_intrinsic_call (gfc_expr *e) n++; } - for (i = 1; i < n; i++) - if (rank[i] && rank[i] != rank[0]) - goto compliance; /* Using the first argument as the master, step through the array calling the function for each element and advancing the array constructors together. */ - ctor = args[0]; + ctor = args[array_arg - 1]; new_ctor = NULL; for (; ctor; ctor = ctor->next) { @@ -1786,17 +1800,18 @@ scalarize_intrinsic_call (gfc_expr *e) b = b->next; } - /* Simplify the function calls. */ - if (gfc_simplify_expr (new_ctor->expr, 0) == FAILURE) - goto cleanup; + /* Simplify the function calls. If the simplification fails, the + error will be flagged up down-stream or the library will deal + with it. */ + gfc_simplify_expr (new_ctor->expr, 0); for (i = 0; i < n; i++) if (args[i]) args[i] = args[i]->next; for (i = 1; i < n; i++) - if (rank[i] && ((args[i] != NULL && args[0] == NULL) - || (args[i] == NULL && args[0] != NULL))) + if (rank[i] && ((args[i] != NULL && args[array_arg - 1] == NULL) + || (args[i] == NULL && args[array_arg - 1] != NULL))) goto compliance; } @@ -2187,11 +2202,8 @@ check_init_expr (gfc_expr *e) array argument. */ isym = gfc_find_function (e->symtree->n.sym->name); if (isym && isym->elemental - && e->value.function.actual->expr->expr_type == EXPR_ARRAY) - { - if ((t = scalarize_intrinsic_call (e)) == SUCCESS) - break; - } + && (t = scalarize_intrinsic_call (e)) == SUCCESS) + break; } if (m == MATCH_YES) diff --git a/gcc/fortran/f95-lang.c b/gcc/fortran/f95-lang.c index 4639d6c27b6..eacaff82ab0 100644 --- a/gcc/fortran/f95-lang.c +++ b/gcc/fortran/f95-lang.c @@ -121,7 +121,7 @@ static alias_set_type gfc_get_alias_set (tree); #undef LANG_HOOKS_GET_ARRAY_DESCR_INFO /* Define lang hooks. */ -#define LANG_HOOKS_NAME "GNU F95" +#define LANG_HOOKS_NAME "GNU Fortran" #define LANG_HOOKS_INIT gfc_init #define LANG_HOOKS_FINISH gfc_finish #define LANG_HOOKS_INIT_OPTIONS gfc_init_options diff --git a/gcc/fortran/gfortran.h b/gcc/fortran/gfortran.h index 07518ee8d13..6035f629f56 100644 --- a/gcc/fortran/gfortran.h +++ b/gcc/fortran/gfortran.h @@ -211,8 +211,8 @@ typedef enum ST_IF_BLOCK, ST_IMPLICIT, ST_IMPLICIT_NONE, ST_IMPORT, ST_INQUIRE, ST_INTERFACE, ST_PARAMETER, ST_MODULE, ST_MODULE_PROC, ST_NAMELIST, ST_NULLIFY, ST_OPEN, ST_PAUSE, ST_PRIVATE, ST_PROGRAM, ST_PUBLIC, ST_READ, ST_RETURN, ST_REWIND, - ST_STOP, ST_SUBROUTINE, ST_TYPE, ST_USE, ST_WHERE_BLOCK, ST_WHERE, ST_WRITE, - ST_ASSIGNMENT, ST_POINTER_ASSIGNMENT, ST_SELECT_CASE, ST_SEQUENCE, + ST_STOP, ST_SUBROUTINE, ST_TYPE, ST_USE, ST_WHERE_BLOCK, ST_WHERE, ST_WAIT, + ST_WRITE, ST_ASSIGNMENT, ST_POINTER_ASSIGNMENT, ST_SELECT_CASE, ST_SEQUENCE, ST_SIMPLE_IF, ST_STATEMENT_FUNCTION, ST_DERIVED_DECL, ST_LABEL_ASSIGNMENT, ST_ENUM, ST_ENUMERATOR, ST_END_ENUM, ST_OMP_ATOMIC, ST_OMP_BARRIER, ST_OMP_CRITICAL, ST_OMP_END_CRITICAL, @@ -1635,7 +1635,8 @@ gfc_alloc; typedef struct { gfc_expr *unit, *file, *status, *access, *form, *recl, - *blank, *position, *action, *delim, *pad, *iostat, *iomsg, *convert; + *blank, *position, *action, *delim, *pad, *iostat, *iomsg, *convert, + *decimal, *encoding, *round, *sign, *asynchronous, *id; gfc_st_label *err; } gfc_open; @@ -1662,7 +1663,8 @@ typedef struct gfc_expr *unit, *file, *iostat, *exist, *opened, *number, *named, *name, *access, *sequential, *direct, *form, *formatted, *unformatted, *recl, *nextrec, *blank, *position, *action, *read, - *write, *readwrite, *delim, *pad, *iolength, *iomsg, *convert, *strm_pos; + *write, *readwrite, *delim, *pad, *iolength, *iomsg, *convert, *strm_pos, + *asynchronous, *decimal, *encoding, *pending, *round, *sign, *size, *id; gfc_st_label *err; @@ -1672,7 +1674,17 @@ gfc_inquire; typedef struct { - gfc_expr *io_unit, *format_expr, *rec, *advance, *iostat, *size, *iomsg; + gfc_expr *unit, *iostat, *iomsg, *id; + gfc_st_label *err, *end, *eor; +} +gfc_wait; + + +typedef struct +{ + gfc_expr *io_unit, *format_expr, *rec, *advance, *iostat, *size, *iomsg, + *id, *pos, *asynchronous, *blank, *decimal, *delim, *pad, *round, + *sign; gfc_symbol *namelist; /* A format_label of `format_asterisk' indicates the "*" format */ @@ -1701,7 +1713,7 @@ typedef enum EXEC_IF, EXEC_ARITHMETIC_IF, EXEC_DO, EXEC_DO_WHILE, EXEC_SELECT, EXEC_FORALL, EXEC_WHERE, EXEC_CYCLE, EXEC_EXIT, EXEC_ALLOCATE, EXEC_DEALLOCATE, - EXEC_OPEN, EXEC_CLOSE, + EXEC_OPEN, EXEC_CLOSE, EXEC_WAIT, EXEC_READ, EXEC_WRITE, EXEC_IOLENGTH, EXEC_TRANSFER, EXEC_DT_END, EXEC_BACKSPACE, EXEC_ENDFILE, EXEC_INQUIRE, EXEC_REWIND, EXEC_FLUSH, EXEC_OMP_CRITICAL, EXEC_OMP_DO, EXEC_OMP_FLUSH, EXEC_OMP_MASTER, @@ -1738,6 +1750,7 @@ typedef struct gfc_code gfc_close *close; gfc_filepos *filepos; gfc_inquire *inquire; + gfc_wait *wait; gfc_dt *dt; gfc_forall_iterator *forall_iterator; struct gfc_code *whichloop; @@ -1805,7 +1818,7 @@ typedef struct int max_continue_fixed; int max_continue_free; int max_identifier_length; - int verbose; + int dump_parse_tree; int warn_aliasing; int warn_ampersand; @@ -1999,9 +2012,6 @@ void gfc_push_error (gfc_error_buf *); void gfc_pop_error (gfc_error_buf *); void gfc_free_error (gfc_error_buf *); -void gfc_status (const char *, ...) ATTRIBUTE_PRINTF_1; -void gfc_status_char (char); - void gfc_get_errors (int *, int *); /* arith.c */ @@ -2323,6 +2333,8 @@ void gfc_free_inquire (gfc_inquire *); try gfc_resolve_inquire (gfc_inquire *); void gfc_free_dt (gfc_dt *); try gfc_resolve_dt (gfc_dt *); +void gfc_free_wait (gfc_wait *); +try gfc_resolve_wait (gfc_wait *); /* module.c */ void gfc_module_init_2 (void); @@ -2345,22 +2357,7 @@ void gfc_insert_bbt (void *, void *, compare_fn); void gfc_delete_bbt (void *, void *, compare_fn); /* dump-parse-tree.c */ -void gfc_show_actual_arglist (gfc_actual_arglist *); -void gfc_show_array_ref (gfc_array_ref *); -void gfc_show_array_spec (gfc_array_spec *); -void gfc_show_attr (symbol_attribute *); -void gfc_show_code (int, gfc_code *); -void gfc_show_components (gfc_symbol *); -void gfc_show_constructor (gfc_constructor *); -void gfc_show_equiv (gfc_equiv *); -void gfc_show_expr (gfc_expr *); -void gfc_show_expr_n (const char *, gfc_expr *); -void gfc_show_namelist (gfc_namelist *); -void gfc_show_namespace (gfc_namespace *); -void gfc_show_ref (gfc_ref *); -void gfc_show_symbol (gfc_symbol *); -void gfc_show_symbol_n (const char *, gfc_symbol *); -void gfc_show_typespec (gfc_typespec *); +void gfc_dump_parse_tree (gfc_namespace *, FILE *); /* parse.c */ try gfc_parse_file (void); diff --git a/gcc/fortran/io.c b/gcc/fortran/io.c index decd8193070..11907a72a89 100644 --- a/gcc/fortran/io.c +++ b/gcc/fortran/io.c @@ -32,57 +32,69 @@ format_asterisk = {0, NULL, NULL, -1, ST_LABEL_FORMAT, ST_LABEL_FORMAT, NULL, typedef struct { - const char *name, *spec; + const char *name, *spec, *value; bt type; } io_tag; static const io_tag - tag_file = { "FILE", " file = %e", BT_CHARACTER }, - tag_status = { "STATUS", " status = %e", BT_CHARACTER}, - tag_e_access = {"ACCESS", " access = %e", BT_CHARACTER}, - tag_e_form = {"FORM", " form = %e", BT_CHARACTER}, - tag_e_recl = {"RECL", " recl = %e", BT_INTEGER}, - tag_e_blank = {"BLANK", " blank = %e", BT_CHARACTER}, - tag_e_position = {"POSITION", " position = %e", BT_CHARACTER}, - tag_e_action = {"ACTION", " action = %e", BT_CHARACTER}, - tag_e_delim = {"DELIM", " delim = %e", BT_CHARACTER}, - tag_e_pad = {"PAD", " pad = %e", BT_CHARACTER}, - tag_unit = {"UNIT", " unit = %e", BT_INTEGER}, - tag_advance = {"ADVANCE", " advance = %e", BT_CHARACTER}, - tag_rec = {"REC", " rec = %e", BT_INTEGER}, - tag_spos = {"POSITION", " pos = %e", BT_INTEGER}, - tag_format = {"FORMAT", NULL, BT_CHARACTER}, - tag_iomsg = {"IOMSG", " iomsg = %e", BT_CHARACTER}, - tag_iostat = {"IOSTAT", " iostat = %v", BT_INTEGER}, - tag_size = {"SIZE", " size = %v", BT_INTEGER}, - tag_exist = {"EXIST", " exist = %v", BT_LOGICAL}, - tag_opened = {"OPENED", " opened = %v", BT_LOGICAL}, - tag_named = {"NAMED", " named = %v", BT_LOGICAL}, - tag_name = {"NAME", " name = %v", BT_CHARACTER}, - tag_number = {"NUMBER", " number = %v", BT_INTEGER}, - tag_s_access = {"ACCESS", " access = %v", BT_CHARACTER}, - tag_sequential = {"SEQUENTIAL", " sequential = %v", BT_CHARACTER}, - tag_direct = {"DIRECT", " direct = %v", BT_CHARACTER}, - tag_s_form = {"FORM", " form = %v", BT_CHARACTER}, - tag_formatted = {"FORMATTED", " formatted = %v", BT_CHARACTER}, - tag_unformatted = {"UNFORMATTED", " unformatted = %v", BT_CHARACTER}, - tag_s_recl = {"RECL", " recl = %v", BT_INTEGER}, - tag_nextrec = {"NEXTREC", " nextrec = %v", BT_INTEGER}, - tag_s_blank = {"BLANK", " blank = %v", BT_CHARACTER}, - tag_s_position = {"POSITION", " position = %v", BT_CHARACTER}, - tag_s_action = {"ACTION", " action = %v", BT_CHARACTER}, - tag_read = {"READ", " read = %v", BT_CHARACTER}, - tag_write = {"WRITE", " write = %v", BT_CHARACTER}, - tag_readwrite = {"READWRITE", " readwrite = %v", BT_CHARACTER}, - tag_s_delim = {"DELIM", " delim = %v", BT_CHARACTER}, - tag_s_pad = {"PAD", " pad = %v", BT_CHARACTER}, - tag_iolength = {"IOLENGTH", " iolength = %v", BT_INTEGER}, - tag_convert = {"CONVERT", " convert = %e", BT_CHARACTER}, - tag_strm_out = {"POS", " pos = %v", BT_INTEGER}, - tag_err = {"ERR", " err = %l", BT_UNKNOWN}, - tag_end = {"END", " end = %l", BT_UNKNOWN}, - tag_eor = {"EOR", " eor = %l", BT_UNKNOWN}; + tag_file = { "FILE", " file =", " %e", BT_CHARACTER }, + tag_status = { "STATUS", " status =", " %e", BT_CHARACTER}, + tag_e_access = {"ACCESS", " access =", " %e", BT_CHARACTER}, + tag_e_form = {"FORM", " form =", " %e", BT_CHARACTER}, + tag_e_recl = {"RECL", " recl =", " %e", BT_INTEGER}, + tag_e_blank = {"BLANK", " blank =", " %e", BT_CHARACTER}, + tag_e_position = {"POSITION", " position =", " %e", BT_CHARACTER}, + tag_e_action = {"ACTION", " action =", " %e", BT_CHARACTER}, + tag_e_delim = {"DELIM", " delim =", " %e", BT_CHARACTER}, + tag_e_pad = {"PAD", " pad =", " %e", BT_CHARACTER}, + tag_e_decimal = {"DECIMAL", " decimal =", " %e", BT_CHARACTER}, + tag_e_encoding = {"ENCODING", " encoding =", " %e", BT_CHARACTER}, + tag_e_async = {"ASYNCHRONOUS", " asynchronous =", " %e", BT_CHARACTER}, + tag_e_round = {"ROUND", " round =", " %e", BT_CHARACTER}, + tag_e_sign = {"SIGN", " sign =", " %e", BT_CHARACTER}, + tag_unit = {"UNIT", " unit =", " %e", BT_INTEGER}, + tag_advance = {"ADVANCE", " advance =", " %e", BT_CHARACTER}, + tag_rec = {"REC", " rec =", " %e", BT_INTEGER}, + tag_spos = {"POSITION", " pos =", " %e", BT_INTEGER}, + tag_format = {"FORMAT", NULL, NULL, BT_CHARACTER}, + tag_iomsg = {"IOMSG", " iomsg =", " %e", BT_CHARACTER}, + tag_iostat = {"IOSTAT", " iostat =", " %v", BT_INTEGER}, + tag_size = {"SIZE", " size =", " %v", BT_INTEGER}, + tag_exist = {"EXIST", " exist =", " %v", BT_LOGICAL}, + tag_opened = {"OPENED", " opened =", " %v", BT_LOGICAL}, + tag_named = {"NAMED", " named =", " %v", BT_LOGICAL}, + tag_name = {"NAME", " name =", " %v", BT_CHARACTER}, + tag_number = {"NUMBER", " number =", " %v", BT_INTEGER}, + tag_s_access = {"ACCESS", " access =", " %v", BT_CHARACTER}, + tag_sequential = {"SEQUENTIAL", " sequential =", " %v", BT_CHARACTER}, + tag_direct = {"DIRECT", " direct =", " %v", BT_CHARACTER}, + tag_s_form = {"FORM", " form =", " %v", BT_CHARACTER}, + tag_formatted = {"FORMATTED", " formatted =", " %v", BT_CHARACTER}, + tag_unformatted = {"UNFORMATTED", " unformatted =", " %v", BT_CHARACTER}, + tag_s_recl = {"RECL", " recl =", " %v", BT_INTEGER}, + tag_nextrec = {"NEXTREC", " nextrec =", " %v", BT_INTEGER}, + tag_s_blank = {"BLANK", " blank =", " %v", BT_CHARACTER}, + tag_s_position = {"POSITION", " position =", " %v", BT_CHARACTER}, + tag_s_action = {"ACTION", " action =", " %v", BT_CHARACTER}, + tag_read = {"READ", " read =", " %v", BT_CHARACTER}, + tag_write = {"WRITE", " write =", " %v", BT_CHARACTER}, + tag_readwrite = {"READWRITE", " readwrite =", " %v", BT_CHARACTER}, + tag_s_delim = {"DELIM", " delim =", " %v", BT_CHARACTER}, + tag_s_pad = {"PAD", " pad =", " %v", BT_CHARACTER}, + tag_s_decimal = {"DECIMAL", " decimal =", " %v", BT_CHARACTER}, + tag_s_encoding = {"ENCODING", " encoding =", " %v", BT_CHARACTER}, + tag_s_async = {"ASYNCHRONOUS", " asynchronous =", " %v", BT_CHARACTER}, + tag_s_round = {"ROUND", " round =", " %v", BT_CHARACTER}, + tag_s_sign = {"SIGN", " sign =", " %v", BT_CHARACTER}, + tag_iolength = {"IOLENGTH", " iolength =", " %v", BT_INTEGER}, + tag_convert = {"CONVERT", " convert =", " %e", BT_CHARACTER}, + tag_strm_out = {"POS", " pos =", " %v", BT_INTEGER}, + tag_err = {"ERR", " err =", " %l", BT_UNKNOWN}, + tag_end = {"END", " end =", " %l", BT_UNKNOWN}, + tag_eor = {"EOR", " eor =", " %l", BT_UNKNOWN}, + tag_id = {"ID", " id =", " %v", BT_INTEGER}, + tag_pending = {"PENDING", " pending =", " %v", BT_LOGICAL}; static gfc_dt *current_dt; @@ -97,7 +109,8 @@ typedef enum FMT_NONE, FMT_UNKNOWN, FMT_SIGNED_INT, FMT_ZERO, FMT_POSINT, FMT_PERIOD, FMT_COMMA, FMT_COLON, FMT_SLASH, FMT_DOLLAR, FMT_POS, FMT_LPAREN, FMT_RPAREN, FMT_X, FMT_SIGN, FMT_BLANK, FMT_CHAR, FMT_P, FMT_IBOZ, FMT_F, - FMT_E, FMT_EXT, FMT_G, FMT_L, FMT_A, FMT_D, FMT_H, FMT_END, FMT_ERROR + FMT_E, FMT_EXT, FMT_G, FMT_L, FMT_A, FMT_D, FMT_H, FMT_END, FMT_ERROR, FMT_DC, + FMT_DP } format_token; @@ -420,7 +433,26 @@ format_lex (void) break; case 'D': - token = FMT_D; + c = next_char_not_space (&error); + if (c == 'P') + { + if (gfc_notify_std (GFC_STD_F2003, "Fortran 2003: DP format " + "specifier not allowed at %C") == FAILURE) + return FMT_ERROR; + token = FMT_DP; + } + else if (c == 'C') + { + if (gfc_notify_std (GFC_STD_F2003, "Fortran 2003: DC format " + "specifier not allowed at %C") == FAILURE) + return FMT_ERROR; + token = FMT_DC; + } + else + { + token = FMT_D; + unget_char (); + } break; case '\0': @@ -537,6 +569,8 @@ format_item_1: case FMT_SIGN: case FMT_BLANK: + case FMT_DP: + case FMT_DC: goto between_desc; case FMT_CHAR: @@ -590,6 +624,8 @@ data_desc: { case FMT_SIGN: case FMT_BLANK: + case FMT_DP: + case FMT_DC: case FMT_X: break; @@ -1001,10 +1037,17 @@ match_etag (const io_tag *tag, gfc_expr **v) gfc_expr *result; match m; - m = gfc_match (tag->spec, &result); + m = gfc_match (tag->spec); if (m != MATCH_YES) return m; + m = gfc_match (tag->value, &result); + if (m != MATCH_YES) + { + gfc_error ("Invalid value for %s specification at %C", tag->name); + return MATCH_ERROR; + } + if (*v != NULL) { gfc_error ("Duplicate %s specification at %C", tag->name); @@ -1025,10 +1068,17 @@ match_vtag (const io_tag *tag, gfc_expr **v) gfc_expr *result; match m; - m = gfc_match (tag->spec, &result); + m = gfc_match (tag->spec); if (m != MATCH_YES) return m; + m = gfc_match (tag->value, &result); + if (m != MATCH_YES) + { + gfc_error ("Invalid value for %s specification at %C", tag->name); + return MATCH_ERROR; + } + if (*v != NULL) { gfc_error ("Duplicate %s specification at %C", tag->name); @@ -1079,15 +1129,24 @@ match_ltag (const io_tag *tag, gfc_st_label ** label) gfc_st_label *old; old = *label; - m = gfc_match (tag->spec, label); - if (m == MATCH_YES && old != 0) + m = gfc_match (tag->spec); + if (m != MATCH_YES) + return m; + + m = gfc_match (tag->value, label); + if (m != MATCH_YES) + { + gfc_error ("Invalid value for %s specification at %C", tag->name); + return MATCH_ERROR; + } + + if (old) { gfc_error ("Duplicate %s label specification at %C", tag->name); return MATCH_ERROR; } - if (m == MATCH_YES - && gfc_reference_st_label (*label, ST_LABEL_TARGET) == FAILURE) + if (gfc_reference_st_label (*label, ST_LABEL_TARGET) == FAILURE) return MATCH_ERROR; return m; @@ -1224,6 +1283,9 @@ match_open_element (gfc_open *open) { match m; + m = match_etag (&tag_e_async, &open->asynchronous); + if (m != MATCH_NO) + return m; m = match_etag (&tag_unit, &open->unit); if (m != MATCH_NO) return m; @@ -1263,6 +1325,18 @@ match_open_element (gfc_open *open) m = match_etag (&tag_e_pad, &open->pad); if (m != MATCH_NO) return m; + m = match_etag (&tag_e_decimal, &open->decimal); + if (m != MATCH_NO) + return m; + m = match_etag (&tag_e_encoding, &open->encoding); + if (m != MATCH_NO) + return m; + m = match_etag (&tag_e_round, &open->round); + if (m != MATCH_NO) + return m; + m = match_etag (&tag_e_sign, &open->sign); + if (m != MATCH_NO) + return m; m = match_ltag (&tag_err, &open->err); if (m != MATCH_NO) return m; @@ -1295,7 +1369,12 @@ gfc_free_open (gfc_open *open) gfc_free_expr (open->action); gfc_free_expr (open->delim); gfc_free_expr (open->pad); + gfc_free_expr (open->decimal); + gfc_free_expr (open->encoding); + gfc_free_expr (open->round); + gfc_free_expr (open->sign); gfc_free_expr (open->convert); + gfc_free_expr (open->asynchronous); gfc_free (open); } @@ -1319,6 +1398,11 @@ gfc_resolve_open (gfc_open *open) RESOLVE_TAG (&tag_e_action, open->action); RESOLVE_TAG (&tag_e_delim, open->delim); RESOLVE_TAG (&tag_e_pad, open->pad); + RESOLVE_TAG (&tag_e_decimal, open->decimal); + RESOLVE_TAG (&tag_e_encoding, open->encoding); + RESOLVE_TAG (&tag_e_async, open->asynchronous); + RESOLVE_TAG (&tag_e_round, open->round); + RESOLVE_TAG (&tag_e_sign, open->sign); RESOLVE_TAG (&tag_convert, open->convert); if (gfc_reference_st_label (open->err, ST_LABEL_TARGET) == FAILURE) @@ -1501,63 +1585,95 @@ gfc_match_open (void) } /* Checks on the ASYNCHRONOUS specifier. */ - /* TODO: code is ready, just needs uncommenting when async I/O support - is added ;-) - if (open->asynchronous && open->asynchronous->expr_type == EXPR_CONSTANT) + if (open->asynchronous) { - static const char * asynchronous[] = { "YES", "NO", NULL }; - - if (!compare_to_allowed_values - ("action", asynchronous, NULL, NULL, - open->asynchronous->value.character.string, "OPEN", warn)) + if (gfc_notify_std (GFC_STD_F2003, "Fortran 2003: ASYNCHRONOUS= at %C " + "not allowed in Fortran 95") == FAILURE) goto cleanup; - }*/ - + + if (open->asynchronous->expr_type == EXPR_CONSTANT) + { + static const char * asynchronous[] = { "YES", "NO", NULL }; + + if (!compare_to_allowed_values ("ASYNCHRONOUS", asynchronous, + NULL, NULL, open->asynchronous->value.character.string, + "OPEN", warn)) + goto cleanup; + } + } + /* Checks on the BLANK specifier. */ - if (open->blank && open->blank->expr_type == EXPR_CONSTANT) + if (open->blank) { - static const char *blank[] = { "ZERO", "NULL", NULL }; - - if (!compare_to_allowed_values ("BLANK", blank, NULL, NULL, - open->blank->value.character.string, - "OPEN", warn)) + if (gfc_notify_std (GFC_STD_F2003, "Fortran 2003: BLANK= at %C " + "not allowed in Fortran 95") == FAILURE) goto cleanup; + + if (open->blank->expr_type == EXPR_CONSTANT) + { + static const char *blank[] = { "ZERO", "NULL", NULL }; + + if (!compare_to_allowed_values ("BLANK", blank, NULL, NULL, + open->blank->value.character.string, + "OPEN", warn)) + goto cleanup; + } } /* Checks on the DECIMAL specifier. */ - /* TODO: uncomment this code when DECIMAL support is added - if (open->decimal && open->decimal->expr_type == EXPR_CONSTANT) + if (open->decimal) { - static const char * decimal[] = { "COMMA", "POINT", NULL }; - - if (!compare_to_allowed_values ("DECIMAL", decimal, NULL, NULL, - open->decimal->value.character.string, - "OPEN", warn)) + if (gfc_notify_std (GFC_STD_F2003, "Fortran 2003: DECIMAL= at %C " + "not allowed in Fortran 95") == FAILURE) goto cleanup; - } */ + + if (open->decimal->expr_type == EXPR_CONSTANT) + { + static const char * decimal[] = { "COMMA", "POINT", NULL }; + + if (!compare_to_allowed_values ("DECIMAL", decimal, NULL, NULL, + open->decimal->value.character.string, + "OPEN", warn)) + goto cleanup; + } + } /* Checks on the DELIM specifier. */ - if (open->delim && open->delim->expr_type == EXPR_CONSTANT) + if (open->delim) { - static const char *delim[] = { "APOSTROPHE", "QUOTE", "NONE", NULL }; - - if (!compare_to_allowed_values ("DELIM", delim, NULL, NULL, - open->delim->value.character.string, - "OPEN", warn)) + if (gfc_notify_std (GFC_STD_F2003, "Fortran 2003: DELIM= at %C " + "not allowed in Fortran 95") == FAILURE) goto cleanup; + + if (open->delim->expr_type == EXPR_CONSTANT) + { + static const char *delim[] = { "APOSTROPHE", "QUOTE", "NONE", NULL }; + + if (!compare_to_allowed_values ("DELIM", delim, NULL, NULL, + open->delim->value.character.string, + "OPEN", warn)) + goto cleanup; + } } /* Checks on the ENCODING specifier. */ - /* TODO: uncomment this code when ENCODING support is added - if (open->encoding && open->encoding->expr_type == EXPR_CONSTANT) + if (open->encoding) { - static const char * encoding[] = { "UTF-8", "DEFAULT", NULL }; - - if (!compare_to_allowed_values ("ENCODING", encoding, NULL, NULL, - open->encoding->value.character.string, - "OPEN", warn)) + if (gfc_notify_std (GFC_STD_F2003, "Fortran 2003: ENCODING= at %C " + "not allowed in Fortran 95") == FAILURE) goto cleanup; - } */ + + if (open->encoding->expr_type == EXPR_CONSTANT) + { + /* TODO: Implement UTF-8 here. */ + static const char * encoding[] = { "DEFAULT", NULL }; + + if (!compare_to_allowed_values ("ENCODING", encoding, NULL, NULL, + open->encoding->value.character.string, + "OPEN", warn)) + goto cleanup; + } + } /* Checks on the FORM specifier. */ if (open->form && open->form->expr_type == EXPR_CONSTANT) @@ -1593,30 +1709,43 @@ gfc_match_open (void) } /* Checks on the ROUND specifier. */ - /* TODO: uncomment this code when ROUND support is added - if (open->round && open->round->expr_type == EXPR_CONSTANT) + if (open->round) { - static const char * round[] = { "UP", "DOWN", "ZERO", "NEAREST", - "COMPATIBLE", "PROCESSOR_DEFINED", NULL }; + /* When implemented, change the following to use gfc_notify_std F2003. */ + gfc_error ("F2003 Feature: ROUND= specifier at %C not implemented"); + goto cleanup; - if (!compare_to_allowed_values ("ROUND", round, NULL, NULL, - open->round->value.character.string, - "OPEN", warn)) - goto cleanup; - } */ + if (open->round->expr_type == EXPR_CONSTANT) + { + static const char * round[] = { "UP", "DOWN", "ZERO", "NEAREST", + "COMPATIBLE", "PROCESSOR_DEFINED", + NULL }; + + if (!compare_to_allowed_values ("ROUND", round, NULL, NULL, + open->round->value.character.string, + "OPEN", warn)) + goto cleanup; + } + } /* Checks on the SIGN specifier. */ - /* TODO: uncomment this code when SIGN support is added - if (open->sign && open->sign->expr_type == EXPR_CONSTANT) + if (open->sign) { - static const char * sign[] = { "PLUS", "SUPPRESS", "PROCESSOR_DEFINED", - NULL }; - - if (!compare_to_allowed_values ("SIGN", sign, NULL, NULL, - open->sign->value.character.string, - "OPEN", warn)) + if (gfc_notify_std (GFC_STD_F2003, "Fortran 2003: SIGN= at %C " + "not allowed in Fortran 95") == FAILURE) goto cleanup; - } */ + + if (open->sign->expr_type == EXPR_CONSTANT) + { + static const char * sign[] = { "PLUS", "SUPPRESS", "PROCESSOR_DEFINED", + NULL }; + + if (!compare_to_allowed_values ("SIGN", sign, NULL, NULL, + open->sign->value.character.string, + "OPEN", warn)) + goto cleanup; + } + } #define warn_or_error(...) \ { \ @@ -1674,11 +1803,8 @@ gfc_match_open (void) /* Things that are not allowed for unformatted I/O. */ if (open->form && open->form->expr_type == EXPR_CONSTANT - && (open->delim - /* TODO uncomment this code when F2003 support is finished */ - /* || open->decimal || open->encoding || open->round - || open->sign */ - || open->pad || open->blank) + && (open->delim || open->decimal || open->encoding || open->round + || open->sign || open->pad || open->blank) && strncasecmp (open->form->value.character.string, "unformatted", 11) == 0) { @@ -2203,6 +2329,30 @@ match_dt_element (io_kind k, gfc_dt *dt) return MATCH_YES; } + m = match_etag (&tag_e_async, &dt->asynchronous); + if (m != MATCH_NO) + return m; + m = match_etag (&tag_e_blank, &dt->blank); + if (m != MATCH_NO) + return m; + m = match_etag (&tag_e_delim, &dt->delim); + if (m != MATCH_NO) + return m; + m = match_etag (&tag_e_pad, &dt->pad); + if (m != MATCH_NO) + return m; + m = match_etag (&tag_e_sign, &dt->sign); + if (m != MATCH_NO) + return m; + m = match_etag (&tag_e_round, &dt->round); + if (m != MATCH_NO) + return m; + m = match_out_tag (&tag_id, &dt->id); + if (m != MATCH_NO) + return m; + m = match_etag (&tag_e_decimal, &dt->decimal); + if (m != MATCH_NO) + return m; m = match_etag (&tag_rec, &dt->rec); if (m != MATCH_NO) return m; @@ -2265,6 +2415,12 @@ gfc_free_dt (gfc_dt *dt) gfc_free_expr (dt->iomsg); gfc_free_expr (dt->iostat); gfc_free_expr (dt->size); + gfc_free_expr (dt->pad); + gfc_free_expr (dt->delim); + gfc_free_expr (dt->sign); + gfc_free_expr (dt->round); + gfc_free_expr (dt->blank); + gfc_free_expr (dt->decimal); gfc_free (dt); } @@ -2283,6 +2439,12 @@ gfc_resolve_dt (gfc_dt *dt) RESOLVE_TAG (&tag_iomsg, dt->iomsg); RESOLVE_TAG (&tag_iostat, dt->iostat); RESOLVE_TAG (&tag_size, dt->size); + RESOLVE_TAG (&tag_e_pad, dt->pad); + RESOLVE_TAG (&tag_e_delim, dt->delim); + RESOLVE_TAG (&tag_e_sign, dt->sign); + RESOLVE_TAG (&tag_e_round, dt->round); + RESOLVE_TAG (&tag_e_blank, dt->blank); + RESOLVE_TAG (&tag_e_decimal, dt->decimal); e = dt->io_unit; if (gfc_resolve_expr (e) == SUCCESS @@ -2648,6 +2810,11 @@ if (condition) \ match m; gfc_expr *expr; gfc_symbol *sym = NULL; + bool warn, unformatted; + + warn = (dt->err || dt->iostat) ? true : false; + unformatted = dt->format_expr == NULL && dt->format_label == NULL + && dt->namelist == NULL; m = MATCH_YES; @@ -2669,11 +2836,14 @@ if (condition) \ "REC tag at %L is incompatible with internal file", &dt->rec->where); - io_constraint (dt->format_expr == NULL && dt->format_label == NULL - && dt->namelist == NULL, + io_constraint (unformatted, "Unformatted I/O not allowed with internal unit at %L", &dt->io_unit->where); + io_constraint (dt->asynchronous != NULL, + "ASYNCHRONOUS tag at %L not allowed with internal file", + &dt->asynchronous->where); + if (dt->namelist != NULL) { if (gfc_notify_std (GFC_STD_F2003, "Fortran 2003: Internal file " @@ -2696,7 +2866,6 @@ if (condition) \ io_kind_name (k)); } - if (k != M_READ) { io_constraint (dt->end, "END tag not allowed with output at %L", @@ -2705,8 +2874,13 @@ if (condition) \ io_constraint (dt->eor, "EOR tag not allowed with output at %L", &dt->eor_where); - io_constraint (k != M_READ && dt->size, - "SIZE=specifier not allowed with output at %L", + io_constraint (dt->blank, "BLANK= specifier not allowed with output at %L", + &dt->blank->where); + + io_constraint (dt->pad, "PAD= specifier not allowed with output at %L", + &dt->pad->where); + + io_constraint (dt->size, "SIZE= specifier not allowed with output at %L", &dt->size->where); } else @@ -2720,8 +2894,174 @@ if (condition) \ &dt->eor_where); } + if (dt->asynchronous) + { + static const char * asynchronous[] = { "YES", "NO", NULL }; + if (dt->asynchronous->expr_type != EXPR_CONSTANT) + { + gfc_error ("ASYNCHRONOUS= specifier at %L must be an initialization " + "expression", &dt->asynchronous->where); + return MATCH_ERROR; + } + + if (!compare_to_allowed_values + ("ASYNCHRONOUS", asynchronous, NULL, NULL, + dt->asynchronous->value.character.string, + io_kind_name (k), warn)) + return MATCH_ERROR; + } + + if (dt->id) + { + io_constraint (!dt->asynchronous + || strcmp (dt->asynchronous->value.character.string, + "yes"), + "ID= specifier at %L must be with ASYNCHRONOUS='yes' " + "specifier", &dt->id->where); + } + + if (dt->decimal) + { + if (gfc_notify_std (GFC_STD_F2003, "Fortran 2003: DECIMAL= at %C " + "not allowed in Fortran 95") == FAILURE) + return MATCH_ERROR; + if (dt->decimal->expr_type == EXPR_CONSTANT) + { + static const char * decimal[] = { "COMMA", "POINT", NULL }; + + if (!compare_to_allowed_values ("DECIMAL", decimal, NULL, NULL, + dt->decimal->value.character.string, + io_kind_name (k), warn)) + return MATCH_ERROR; + + io_constraint (unformatted, + "the DECIMAL= specifier at %L must be with an " + "explicit format expression", &dt->decimal->where); + } + } + + if (dt->blank) + { + if (gfc_notify_std (GFC_STD_F2003, "Fortran 2003: BLANK= at %C " + "not allowed in Fortran 95") == FAILURE) + return MATCH_ERROR; + + if (dt->blank->expr_type == EXPR_CONSTANT) + { + static const char * blank[] = { "NULL", "ZERO", NULL }; + + if (!compare_to_allowed_values ("BLANK", blank, NULL, NULL, + dt->blank->value.character.string, + io_kind_name (k), warn)) + return MATCH_ERROR; + + io_constraint (unformatted, + "the BLANK= specifier at %L must be with an " + "explicit format expression", &dt->blank->where); + } + } + + if (dt->pad) + { + if (gfc_notify_std (GFC_STD_F2003, "Fortran 2003: PAD= at %C " + "not allowed in Fortran 95") == FAILURE) + return MATCH_ERROR; + + if (dt->pad->expr_type == EXPR_CONSTANT) + { + static const char * pad[] = { "YES", "NO", NULL }; + + if (!compare_to_allowed_values ("PAD", pad, NULL, NULL, + dt->pad->value.character.string, + io_kind_name (k), warn)) + return MATCH_ERROR; + + io_constraint (unformatted, + "the PAD= specifier at %L must be with an " + "explicit format expression", &dt->pad->where); + } + } + + if (dt->round) + { + /* When implemented, change the following to use gfc_notify_std F2003. + if (gfc_notify_std (GFC_STD_F2003, "Fortran 2003: ROUND= at %C " + "not allowed in Fortran 95") == FAILURE) + return MATCH_ERROR; */ + gfc_error ("F2003 Feature: ROUND= specifier at %C not implemented"); + return MATCH_ERROR; + + if (dt->round->expr_type == EXPR_CONSTANT) + { + static const char * round[] = { "UP", "DOWN", "ZERO", "NEAREST", + "COMPATIBLE", "PROCESSOR_DEFINED", + NULL }; + + if (!compare_to_allowed_values ("ROUND", round, NULL, NULL, + dt->round->value.character.string, + io_kind_name (k), warn)) + return MATCH_ERROR; + } + } + + if (dt->sign) + { + /* When implemented, change the following to use gfc_notify_std F2003. + if (gfc_notify_std (GFC_STD_F2003, "Fortran 2003: SIGN= at %C " + "not allowed in Fortran 95") == FAILURE) + return MATCH_ERROR; */ + if (dt->sign->expr_type == EXPR_CONSTANT) + { + static const char * sign[] = { "PLUS", "SUPPRESS", "PROCESSOR_DEFINED", + NULL }; + + if (!compare_to_allowed_values ("SIGN", sign, NULL, NULL, + dt->sign->value.character.string, + io_kind_name (k), warn)) + return MATCH_ERROR; + + io_constraint (unformatted, + "SIGN= specifier at %L must be with an " + "explicit format expression", &dt->sign->where); + + io_constraint (k == M_READ, + "SIGN= specifier at %L not allowed in a " + "READ statement", &dt->sign->where); + } + } + + if (dt->delim) + { + if (gfc_notify_std (GFC_STD_F2003, "Fortran 2003: DELIM= at %C " + "not allowed in Fortran 95") == FAILURE) + return MATCH_ERROR; + + if (dt->delim->expr_type == EXPR_CONSTANT) + { + static const char *delim[] = { "APOSTROPHE", "QUOTE", "NONE", NULL }; + + if (!compare_to_allowed_values ("DELIM", delim, NULL, NULL, + dt->delim->value.character.string, + io_kind_name (k), warn)) + return MATCH_ERROR; + + io_constraint (k == M_READ, + "DELIM= specifier at %L not allowed in a " + "READ statement", &dt->delim->where); + + io_constraint (dt->format_label != &format_asterisk + && dt->namelist == NULL, + "DELIM= specifier at %L must have FMT=*", + &dt->delim->where); + + io_constraint (unformatted && dt->namelist == NULL, + "DELIM= specifier at %L must be with FMT=* or " + "NML= specifier ", &dt->delim->where); + } + } + if (dt->namelist) { io_constraint (io_code && dt->namelist, @@ -2738,11 +3078,11 @@ if (condition) \ "and format label at %L", spec_end); io_constraint (dt->rec, - "NAMELIST IO is not allowed with a REC=specifier " + "NAMELIST IO is not allowed with a REC= specifier " "at %L.", &dt->rec->where); io_constraint (dt->advance, - "NAMELIST IO is not allowed with a ADVANCE=specifier " + "NAMELIST IO is not allowed with a ADVANCE= specifier " "at %L.", &dt->advance->where); } @@ -2750,11 +3090,10 @@ if (condition) \ { io_constraint (dt->end, "An END tag is not allowed with a " - "REC=specifier at %L.", &dt->end_where); - + "REC= specifier at %L.", &dt->end_where); io_constraint (dt->format_label == &format_asterisk, - "FMT=* is not allowed with a REC=specifier " + "FMT=* is not allowed with a REC= specifier " "at %L.", spec_end); } @@ -2765,11 +3104,10 @@ if (condition) \ io_constraint (dt->format_label == &format_asterisk, "List directed format(*) is not allowed with a " - "ADVANCE=specifier at %L.", &expr->where); + "ADVANCE= specifier at %L.", &expr->where); - io_constraint (dt->format_expr == NULL && dt->format_label == NULL - && dt->namelist == NULL, - "the ADVANCE=specifier at %L must appear with an " + io_constraint (unformatted, + "the ADVANCE= specifier at %L must appear with an " "explicit format expression", &expr->where); if (expr->expr_type == EXPR_CONSTANT && expr->ts.type == BT_CHARACTER) @@ -2785,7 +3123,7 @@ if (condition) \ } io_constraint (not_no && not_yes, - "ADVANCE=specifier at %L must have value = " + "ADVANCE= specifier at %L must have value = " "YES or NO.", &expr->where); io_constraint (dt->size && not_no && k == M_READ, @@ -3025,12 +3363,14 @@ gfc_match_read (void) return match_io (M_READ); } + match gfc_match_write (void) { return match_io (M_WRITE); } + match gfc_match_print (void) { @@ -3083,10 +3423,16 @@ gfc_free_inquire (gfc_inquire *inquire) gfc_free_expr (inquire->write); gfc_free_expr (inquire->readwrite); gfc_free_expr (inquire->delim); + gfc_free_expr (inquire->encoding); gfc_free_expr (inquire->pad); gfc_free_expr (inquire->iolength); gfc_free_expr (inquire->convert); gfc_free_expr (inquire->strm_pos); + gfc_free_expr (inquire->asynchronous); + gfc_free_expr (inquire->pending); + gfc_free_expr (inquire->id); + gfc_free_expr (inquire->sign); + gfc_free_expr (inquire->round); gfc_free (inquire); } @@ -3124,11 +3470,19 @@ match_inquire_element (gfc_inquire *inquire) RETM m = match_vtag (&tag_read, &inquire->read); RETM m = match_vtag (&tag_write, &inquire->write); RETM m = match_vtag (&tag_readwrite, &inquire->readwrite); + RETM m = match_vtag (&tag_s_async, &inquire->asynchronous); RETM m = match_vtag (&tag_s_delim, &inquire->delim); + RETM m = match_vtag (&tag_s_decimal, &inquire->decimal); + RETM m = match_vtag (&tag_s_blank, &inquire->blank); + RETM m = match_vtag (&tag_s_encoding, &inquire->encoding); + RETM m = match_vtag (&tag_s_round, &inquire->round); + RETM m = match_vtag (&tag_s_sign, &inquire->sign); RETM m = match_vtag (&tag_s_pad, &inquire->pad); RETM m = match_vtag (&tag_iolength, &inquire->iolength); RETM m = match_vtag (&tag_convert, &inquire->convert); RETM m = match_out_tag (&tag_strm_out, &inquire->strm_pos); + RETM m = match_vtag (&tag_pending, &inquire->pending); + RETM m = match_vtag (&tag_id, &inquire->id); RETM return MATCH_NO; } @@ -3236,6 +3590,13 @@ gfc_match_inquire (void) gfc_error ("INQUIRE statement not allowed in PURE procedure at %C"); goto cleanup; } + + if (inquire->id != NULL && inquire->pending == NULL) + { + gfc_error ("INQUIRE statement at %L requires a PENDING= specifier with " + "the ID= specifier", &loc); + goto cleanup; + } new_st.op = EXEC_INQUIRE; new_st.ext.inquire = inquire; @@ -3280,12 +3641,136 @@ gfc_resolve_inquire (gfc_inquire *inquire) RESOLVE_TAG (&tag_readwrite, inquire->readwrite); RESOLVE_TAG (&tag_s_delim, inquire->delim); RESOLVE_TAG (&tag_s_pad, inquire->pad); + RESOLVE_TAG (&tag_s_encoding, inquire->encoding); + RESOLVE_TAG (&tag_s_round, inquire->round); RESOLVE_TAG (&tag_iolength, inquire->iolength); RESOLVE_TAG (&tag_convert, inquire->convert); RESOLVE_TAG (&tag_strm_out, inquire->strm_pos); + RESOLVE_TAG (&tag_s_async, inquire->asynchronous); + RESOLVE_TAG (&tag_s_sign, inquire->sign); + RESOLVE_TAG (&tag_s_round, inquire->round); + RESOLVE_TAG (&tag_pending, inquire->pending); + RESOLVE_TAG (&tag_id, inquire->id); if (gfc_reference_st_label (inquire->err, ST_LABEL_TARGET) == FAILURE) return FAILURE; return SUCCESS; } + + +void +gfc_free_wait (gfc_wait *wait) +{ + if (wait == NULL) + return; + + gfc_free_expr (wait->unit); + gfc_free_expr (wait->iostat); + gfc_free_expr (wait->iomsg); + gfc_free_expr (wait->id); +} + + +try +gfc_resolve_wait (gfc_wait *wait) +{ + RESOLVE_TAG (&tag_unit, wait->unit); + RESOLVE_TAG (&tag_iomsg, wait->iomsg); + RESOLVE_TAG (&tag_iostat, wait->iostat); + RESOLVE_TAG (&tag_id, wait->id); + + if (gfc_reference_st_label (wait->err, ST_LABEL_TARGET) == FAILURE) + return FAILURE; + + if (gfc_reference_st_label (wait->end, ST_LABEL_TARGET) == FAILURE) + return FAILURE; + + return SUCCESS; +} + +/* Match an element of a WAIT statement. */ + +#define RETM if (m != MATCH_NO) return m; + +static match +match_wait_element (gfc_wait *wait) +{ + match m; + + m = match_etag (&tag_unit, &wait->unit); + RETM m = match_ltag (&tag_err, &wait->err); + RETM m = match_ltag (&tag_end, &wait->eor); + RETM m = match_ltag (&tag_eor, &wait->end); + RETM m = match_out_tag (&tag_iomsg, &wait->iomsg); + RETM m = match_out_tag (&tag_iostat, &wait->iostat); + RETM m = match_etag (&tag_id, &wait->id); + RETM return MATCH_NO; +} + +#undef RETM + + +match +gfc_match_wait (void) +{ + gfc_wait *wait; + match m; + locus loc; + + m = gfc_match_char ('('); + if (m == MATCH_NO) + return m; + + wait = gfc_getmem (sizeof (gfc_wait)); + + loc = gfc_current_locus; + + m = match_wait_element (wait); + if (m == MATCH_ERROR) + goto cleanup; + if (m == MATCH_NO) + { + m = gfc_match_expr (&wait->unit); + if (m == MATCH_ERROR) + goto cleanup; + if (m == MATCH_NO) + goto syntax; + } + + for (;;) + { + if (gfc_match_char (')') == MATCH_YES) + break; + if (gfc_match_char (',') != MATCH_YES) + goto syntax; + + m = match_wait_element (wait); + if (m == MATCH_ERROR) + goto cleanup; + if (m == MATCH_NO) + goto syntax; + } + + if (gfc_notify_std (GFC_STD_F2003, "Fortran 2003: WAIT at %C " + "not allowed in Fortran 95") == FAILURE) + goto cleanup; + + if (gfc_pure (NULL)) + { + gfc_error ("WAIT statement not allowed in PURE procedure at %C"); + goto cleanup; + } + + new_st.op = EXEC_WAIT; + new_st.ext.wait = wait; + + return MATCH_YES; + +syntax: + gfc_syntax_error (ST_WAIT); + +cleanup: + gfc_free_wait (wait); + return MATCH_ERROR; +} diff --git a/gcc/fortran/ioparm.def b/gcc/fortran/ioparm.def index 57a5db9ef78..deb1b98389c 100644 --- a/gcc/fortran/ioparm.def +++ b/gcc/fortran/ioparm.def @@ -8,10 +8,10 @@ #define IOPARM_common_end (1 << 3) #define IOPARM_common_eor (1 << 4) #endif -IOPARM (common, flags, 0, int4) -IOPARM (common, unit, 0, int4) -IOPARM (common, filename, 0, pchar) -IOPARM (common, line, 0, int4) +IOPARM (common, flags, 0, int4) +IOPARM (common, unit, 0, int4) +IOPARM (common, filename, 0, pchar) +IOPARM (common, line, 0, int4) IOPARM (common, iomsg, 1 << 6, char2) IOPARM (common, iostat, 1 << 5, pint4) IOPARM (open, common, 0, common) @@ -25,7 +25,12 @@ IOPARM (open, position, 1 << 13, char1) IOPARM (open, action, 1 << 14, char2) IOPARM (open, delim, 1 << 15, char1) IOPARM (open, pad, 1 << 16, char2) -IOPARM (open, convert, 1 << 17, char1) +IOPARM (open, convert, 1 << 17, char1) +IOPARM (open, decimal, 1 << 18, char2) +IOPARM (open, encoding, 1 << 19, char1) +IOPARM (open, round, 1 << 20, char2) +IOPARM (open, sign, 1 << 21, char1) +IOPARM (open, asynchronous, 1 << 22, char2) IOPARM (close, common, 0, common) IOPARM (close, status, 1 << 7, char1) IOPARM (filepos, common, 0, common) @@ -53,7 +58,18 @@ IOPARM (inquire, unformatted, 1 << 26, char1) IOPARM (inquire, read, 1 << 27, char2) IOPARM (inquire, write, 1 << 28, char1) IOPARM (inquire, readwrite, 1 << 29, char2) -IOPARM (inquire, convert, 1 << 30, char1) +IOPARM (inquire, convert, 1 << 30, char1) +IOPARM (inquire, flags2, 1 << 31, int4) +IOPARM (inquire, asynchronous, 1 << 0, char1) +IOPARM (inquire, decimal, 1 << 1, char2) +IOPARM (inquire, encoding, 1 << 2, char1) +IOPARM (inquire, pending, 1 << 3, pint4) +IOPARM (inquire, round, 1 << 4, char1) +IOPARM (inquire, sign, 1 << 5, char2) +IOPARM (inquire, size, 1 << 6, pint4) +IOPARM (inquire, id, 1 << 7, pint4) +IOPARM (wait, common, 0, common) +IOPARM (wait, id, 1 << 7, pint4) #ifndef IOPARM_dt_list_format #define IOPARM_dt_list_format (1 << 7) #define IOPARM_dt_namelist_read_mode (1 << 8) @@ -67,4 +83,13 @@ IOPARM (dt, format, 1 << 12, char1) IOPARM (dt, advance, 1 << 13, char2) IOPARM (dt, internal_unit, 1 << 14, char1) IOPARM (dt, namelist_name, 1 << 15, char2) -IOPARM (dt, u, 0, pad) +IOPARM (dt, id, 1 << 16, pint4) +IOPARM (dt, pos, 1 << 17, intio) +IOPARM (dt, asynchronous, 1 << 18, char1) +IOPARM (dt, blank, 1 << 19, char2) +IOPARM (dt, decimal, 1 << 20, char1) +IOPARM (dt, delim, 1 << 21, char2) +IOPARM (dt, pad, 1 << 22, char1) +IOPARM (dt, round, 1 << 23, char2) +IOPARM (dt, sign, 1 << 24, char1) +IOPARM (dt, u, 0, pad) diff --git a/gcc/fortran/match.c b/gcc/fortran/match.c index 25edd4aca4c..8512d03a0fb 100644 --- a/gcc/fortran/match.c +++ b/gcc/fortran/match.c @@ -1533,6 +1533,7 @@ gfc_match_if (gfc_statement *if_type) match ("return", gfc_match_return, ST_RETURN) match ("rewind", gfc_match_rewind, ST_REWIND) match ("stop", gfc_match_stop, ST_STOP) + match ("wait", gfc_match_wait, ST_WAIT) match ("where", match_simple_where, ST_WHERE) match ("write", gfc_match_write, ST_WRITE) diff --git a/gcc/fortran/match.h b/gcc/fortran/match.h index 34f1af1738d..4a3776e2cd8 100644 --- a/gcc/fortran/match.h +++ b/gcc/fortran/match.h @@ -212,6 +212,7 @@ match gfc_match_rewind (void); match gfc_match_flush (void); match gfc_match_inquire (void); match gfc_match_read (void); +match gfc_match_wait (void); match gfc_match_write (void); match gfc_match_print (void); diff --git a/gcc/fortran/options.c b/gcc/fortran/options.c index 61481b3a9d0..06a462205b4 100644 --- a/gcc/fortran/options.c +++ b/gcc/fortran/options.c @@ -58,13 +58,13 @@ gfc_init_options (unsigned int argc ATTRIBUTE_UNUSED, gfc_option.source_form = FORM_UNKNOWN; gfc_option.fixed_line_length = 72; gfc_option.free_line_length = 132; - gfc_option.max_continue_fixed = 19; - gfc_option.max_continue_free = 39; + gfc_option.max_continue_fixed = 255; + gfc_option.max_continue_free = 255; gfc_option.max_identifier_length = GFC_MAX_SYMBOL_LEN; gfc_option.max_subrecord_length = 0; gfc_option.convert = GFC_CONVERT_NATIVE; gfc_option.record_marker = 0; - gfc_option.verbose = 0; + gfc_option.dump_parse_tree = 0; gfc_option.warn_aliasing = 0; gfc_option.warn_ampersand = 0; @@ -391,16 +391,10 @@ gfc_handle_module_path_options (const char *arg) { if (gfc_option.module_dir != NULL) - { - gfc_status ("gfortran: Only one -M option allowed\n"); - exit (3); - } + gfc_fatal_error ("gfortran: Only one -M option allowed"); if (arg == NULL) - { - gfc_status ("gfortran: Directory required after -M\n"); - exit (3); - } + gfc_fatal_error ("gfortran: Directory required after -M"); gfc_option.module_dir = (char *) gfc_getmem (strlen (arg) + 2); strcpy (gfc_option.module_dir, arg); @@ -564,7 +558,7 @@ gfc_handle_option (size_t scode, const char *arg, int value) break; case OPT_fdump_parse_tree: - gfc_option.verbose = value; + gfc_option.dump_parse_tree = value; break; case OPT_ffixed_form: @@ -739,6 +733,8 @@ gfc_handle_option (size_t scode, const char *arg, int value) case OPT_std_f95: gfc_option.allow_std = GFC_STD_F95_OBS | GFC_STD_F95 | GFC_STD_F77; gfc_option.warn_std = GFC_STD_F95_OBS; + gfc_option.max_continue_fixed = 19; + gfc_option.max_continue_free = 39; gfc_option.max_identifier_length = 31; gfc_option.warn_ampersand = 1; gfc_option.warn_tabs = 0; @@ -748,8 +744,6 @@ gfc_handle_option (size_t scode, const char *arg, int value) gfc_option.allow_std = GFC_STD_F95_OBS | GFC_STD_F77 | GFC_STD_F2003 | GFC_STD_F95; gfc_option.warn_std = GFC_STD_F95_OBS; - gfc_option.max_continue_fixed = 255; - gfc_option.max_continue_free = 255; gfc_option.max_identifier_length = 63; gfc_option.warn_ampersand = 1; gfc_option.warn_tabs = 0; @@ -759,8 +753,6 @@ gfc_handle_option (size_t scode, const char *arg, int value) gfc_option.allow_std = GFC_STD_F95_OBS | GFC_STD_F77 | GFC_STD_F2003 | GFC_STD_F95 | GFC_STD_F2008; gfc_option.warn_std = GFC_STD_F95_OBS; - gfc_option.max_continue_fixed = 255; - gfc_option.max_continue_free = 255; gfc_option.max_identifier_length = 63; gfc_option.warn_ampersand = 1; gfc_option.warn_tabs = 0; diff --git a/gcc/fortran/parse.c b/gcc/fortran/parse.c index ff1d56548c8..b133743c739 100644 --- a/gcc/fortran/parse.c +++ b/gcc/fortran/parse.c @@ -440,6 +440,7 @@ decode_statement (void) break; case 'w': + match ("wait", gfc_match_wait, ST_WAIT); match ("write", gfc_match_write, ST_WRITE); break; } @@ -861,9 +862,9 @@ next_statement (void) case ST_CLOSE: case ST_CONTINUE: case ST_DEALLOCATE: case ST_END_FILE: \ case ST_GOTO: case ST_INQUIRE: case ST_NULLIFY: case ST_OPEN: \ case ST_READ: case ST_RETURN: case ST_REWIND: case ST_SIMPLE_IF: \ - case ST_PAUSE: case ST_STOP: case ST_WRITE: case ST_ASSIGNMENT: \ + case ST_PAUSE: case ST_STOP: case ST_WAIT: case ST_WRITE: \ case ST_POINTER_ASSIGNMENT: case ST_EXIT: case ST_CYCLE: \ - case ST_ARITHMETIC_IF: case ST_WHERE: case ST_FORALL: \ + case ST_ASSIGNMENT: case ST_ARITHMETIC_IF: case ST_WHERE: case ST_FORALL: \ case ST_LABEL_ASSIGNMENT: case ST_FLUSH: case ST_OMP_FLUSH: \ case ST_OMP_BARRIER @@ -1268,6 +1269,9 @@ gfc_ascii_statement (gfc_statement st) case ST_WHERE: p = "WHERE"; break; + case ST_WAIT: + p = "WAIT"; + break; case ST_WRITE: p = "WRITE"; break; @@ -3562,8 +3566,8 @@ loop: gfc_resolve (gfc_current_ns); /* Dump the parse tree if requested. */ - if (gfc_option.verbose) - gfc_show_namespace (gfc_current_ns); + if (gfc_option.dump_parse_tree) + gfc_dump_parse_tree (gfc_current_ns, stdout); gfc_get_errors (NULL, &errors); if (s.state == COMP_MODULE) diff --git a/gcc/fortran/resolve.c b/gcc/fortran/resolve.c index af9ef55ce41..65d1a162cac 100644 --- a/gcc/fortran/resolve.c +++ b/gcc/fortran/resolve.c @@ -5964,6 +5964,7 @@ gfc_resolve_blocks (gfc_code *b, gfc_namespace *ns) case EXEC_READ: case EXEC_WRITE: case EXEC_IOLENGTH: + case EXEC_WAIT: break; case EXEC_OMP_ATOMIC: @@ -6373,6 +6374,15 @@ resolve_code (gfc_code *code, gfc_namespace *ns) resolve_branch (code->ext.inquire->err, code); break; + case EXEC_WAIT: + if (gfc_resolve_wait (code->ext.wait) == FAILURE) + break; + + resolve_branch (code->ext.wait->err, code); + resolve_branch (code->ext.wait->end, code); + resolve_branch (code->ext.wait->eor, code); + break; + case EXEC_READ: case EXEC_WRITE: if (gfc_resolve_dt (code->ext.dt) == FAILURE) diff --git a/gcc/fortran/scanner.c b/gcc/fortran/scanner.c index b93e1c65478..dcdac64e725 100644 --- a/gcc/fortran/scanner.c +++ b/gcc/fortran/scanner.c @@ -821,7 +821,8 @@ restart: "statement at %C", gfc_option.max_continue_free); } } - continue_line = gfc_linebuf_linenum (gfc_current_locus.lb); + if (continue_line < gfc_linebuf_linenum (gfc_current_locus.lb)) + continue_line = gfc_linebuf_linenum (gfc_current_locus.lb); /* Now find where it continues. First eat any comment lines. */ openmp_cond_flag = skip_free_comments (); @@ -1684,10 +1685,8 @@ gfc_new_file (void) #if 0 /* Debugging aid. */ for (; line_head; line_head = line_head->next) - gfc_status ("%s:%3d %s\n", - LOCATION_FILE (line_head->location), - LOCATION_LINE (line_head->location), - line_head->line); + printf ("%s:%3d %s\n", LOCATION_FILE (line_head->location), + LOCATION_LINE (line_head->location), line_head->line); exit (0); #endif diff --git a/gcc/fortran/st.c b/gcc/fortran/st.c index 5f65846fb0d..0f0e4813d28 100644 --- a/gcc/fortran/st.c +++ b/gcc/fortran/st.c @@ -146,6 +146,10 @@ gfc_free_statement (gfc_code *p) gfc_free_inquire (p->ext.inquire); break; + case EXEC_WAIT: + gfc_free_wait (p->ext.wait); + break; + case EXEC_READ: case EXEC_WRITE: gfc_free_dt (p->ext.dt); diff --git a/gcc/fortran/trans-io.c b/gcc/fortran/trans-io.c index f5f1df0c7c2..6316a426918 100644 --- a/gcc/fortran/trans-io.c +++ b/gcc/fortran/trans-io.c @@ -45,6 +45,7 @@ enum ioparam_type IOPARM_ptype_filepos, IOPARM_ptype_inquire, IOPARM_ptype_dt, + IOPARM_ptype_wait, IOPARM_ptype_num }; @@ -96,7 +97,8 @@ static GTY(()) gfc_st_parameter st_parameter[] = { "close", NULL }, { "filepos", NULL }, { "inquire", NULL }, - { "dt", NULL } + { "dt", NULL }, + { "wait", NULL } }; static GTY(()) gfc_st_parameter_field st_parameter_field[] = @@ -133,6 +135,7 @@ enum iocall IOCALL_FLUSH, IOCALL_SET_NML_VAL, IOCALL_SET_NML_VAL_DIM, + IOCALL_WAIT, IOCALL_NUM }; @@ -372,6 +375,11 @@ gfc_build_io_library_fndecls (void) gfc_build_library_function_decl(get_identifier (PREFIX("st_iolength")), void_type_node, 1, dt_parm_type); + parm_type = build_pointer_type (st_parameter[IOPARM_ptype_wait].type); + iocall[IOCALL_WAIT] = + gfc_build_library_function_decl (get_identifier (PREFIX("st_wait")), + gfc_int4_type_node, 1, parm_type); + parm_type = build_pointer_type (st_parameter[IOPARM_ptype_filepos].type); iocall[IOCALL_REWIND] = gfc_build_library_function_decl (get_identifier (PREFIX("st_rewind")), @@ -921,6 +929,24 @@ gfc_trans_open (gfc_code * code) if (p->pad) mask |= set_string (&block, &post_block, var, IOPARM_open_pad, p->pad); + if (p->decimal) + mask |= set_string (&block, &post_block, var, IOPARM_open_decimal, + p->decimal); + + if (p->encoding) + mask |= set_string (&block, &post_block, var, IOPARM_open_encoding, + p->encoding); + + if (p->round) + mask |= set_string (&block, &post_block, var, IOPARM_open_round, p->round); + + if (p->sign) + mask |= set_string (&block, &post_block, var, IOPARM_open_sign, p->sign); + + if (p->asynchronous) + mask |= set_string (&block, &post_block, var, IOPARM_open_asynchronous, + p->asynchronous); + if (p->convert) mask |= set_string (&block, &post_block, var, IOPARM_open_convert, p->convert); @@ -1117,7 +1143,7 @@ gfc_trans_inquire (gfc_code * code) stmtblock_t block, post_block; gfc_inquire *p; tree tmp, var; - unsigned int mask = 0; + unsigned int mask = 0, mask2 = 0; gfc_start_block (&block); gfc_init_block (&post_block); @@ -1212,6 +1238,10 @@ gfc_trans_inquire (gfc_code * code) mask |= set_string (&block, &post_block, var, IOPARM_inquire_blank, p->blank); + if (p->delim) + mask |= set_string (&block, &post_block, var, IOPARM_inquire_delim, + p->delim); + if (p->position) mask |= set_string (&block, &post_block, var, IOPARM_inquire_position, p->position); @@ -1232,14 +1262,10 @@ gfc_trans_inquire (gfc_code * code) mask |= set_string (&block, &post_block, var, IOPARM_inquire_readwrite, p->readwrite); - if (p->delim) - mask |= set_string (&block, &post_block, var, IOPARM_inquire_delim, - p->delim); - if (p->pad) mask |= set_string (&block, &post_block, var, IOPARM_inquire_pad, p->pad); - + if (p->convert) mask |= set_string (&block, &post_block, var, IOPARM_inquire_convert, p->convert); @@ -1248,6 +1274,44 @@ gfc_trans_inquire (gfc_code * code) mask |= set_parameter_ref (&block, &post_block, var, IOPARM_inquire_strm_pos_out, p->strm_pos); + /* The second series of flags. */ + if (p->asynchronous) + mask2 |= set_string (&block, &post_block, var, IOPARM_inquire_asynchronous, + p->asynchronous); + + if (p->decimal) + mask2 |= set_string (&block, &post_block, var, IOPARM_inquire_decimal, + p->decimal); + + if (p->encoding) + mask2 |= set_string (&block, &post_block, var, IOPARM_inquire_encoding, + p->encoding); + + if (p->round) + mask2 |= set_string (&block, &post_block, var, IOPARM_inquire_round, + p->round); + + if (p->sign) + mask2 |= set_string (&block, &post_block, var, IOPARM_inquire_sign, + p->sign); + + if (p->pending) + mask2 |= set_parameter_ref (&block, &post_block, var, + IOPARM_inquire_pending, p->pending); + + if (p->size) + mask2 |= set_parameter_ref (&block, &post_block, var, IOPARM_inquire_size, + p->size); + + if (p->id) + mask2 |= set_parameter_ref (&block, &post_block,var, IOPARM_inquire_id, + p->id); + + set_parameter_const (&block, var, IOPARM_inquire_flags2, mask2); + + if (mask2) + mask |= IOPARM_inquire_flags2; + set_parameter_const (&block, var, IOPARM_common_flags, mask); if (p->unit) @@ -1266,6 +1330,56 @@ gfc_trans_inquire (gfc_code * code) return gfc_finish_block (&block); } + +tree +gfc_trans_wait (gfc_code * code) +{ + stmtblock_t block, post_block; + gfc_wait *p; + tree tmp, var; + unsigned int mask = 0; + + gfc_start_block (&block); + gfc_init_block (&post_block); + + var = gfc_create_var (st_parameter[IOPARM_ptype_wait].type, + "wait_parm"); + + set_error_locus (&block, var, &code->loc); + p = code->ext.wait; + + /* Set parameters here. */ + if (p->iomsg) + mask |= set_string (&block, &post_block, var, IOPARM_common_iomsg, + p->iomsg); + + if (p->iostat) + mask |= set_parameter_ref (&block, &post_block, var, IOPARM_common_iostat, + p->iostat); + + if (p->err) + mask |= IOPARM_common_err; + + if (p->id) + mask |= set_parameter_value (&block, var, IOPARM_wait_id, p->id); + + set_parameter_const (&block, var, IOPARM_common_flags, mask); + + if (p->unit) + set_parameter_value (&block, var, IOPARM_common_unit, p->unit); + + tmp = build_fold_addr_expr (var); + tmp = build_call_expr (iocall[IOCALL_WAIT], 1, tmp); + gfc_add_expr_to_block (&block, tmp); + + gfc_add_block_to_block (&block, &post_block); + + io_result (&block, var, p->err, NULL, NULL); + + return gfc_finish_block (&block); + +} + static gfc_expr * gfc_new_nml_name_expr (const char * name) { @@ -1583,6 +1697,41 @@ build_dt (tree function, gfc_code * code) if (dt->end) mask |= IOPARM_common_end; + if (dt->id) + mask |= set_parameter_ref (&block, &post_end_block, var, + IOPARM_dt_id, dt->id); + + if (dt->pos) + mask |= set_parameter_value (&block, var, IOPARM_dt_pos, dt->pos); + + if (dt->asynchronous) + mask |= set_string (&block, &post_block, var, IOPARM_dt_asynchronous, + dt->asynchronous); + + if (dt->blank) + mask |= set_string (&block, &post_block, var, IOPARM_dt_blank, + dt->blank); + + if (dt->decimal) + mask |= set_string (&block, &post_block, var, IOPARM_dt_decimal, + dt->decimal); + + if (dt->delim) + mask |= set_string (&block, &post_block, var, IOPARM_dt_delim, + dt->delim); + + if (dt->pad) + mask |= set_string (&block, &post_block, var, IOPARM_dt_pad, + dt->pad); + + if (dt->round) + mask |= set_string (&block, &post_block, var, IOPARM_dt_round, + dt->round); + + if (dt->sign) + mask |= set_string (&block, &post_block, var, IOPARM_dt_sign, + dt->sign); + if (dt->rec) mask |= set_parameter_value (&block, var, IOPARM_dt_rec, dt->rec); diff --git a/gcc/fortran/trans-stmt.h b/gcc/fortran/trans-stmt.h index f2b9b84f41a..5d92a9c756f 100644 --- a/gcc/fortran/trans-stmt.h +++ b/gcc/fortran/trans-stmt.h @@ -69,3 +69,4 @@ tree gfc_trans_flush (gfc_code *); tree gfc_trans_transfer (gfc_code *); tree gfc_trans_dt_end (gfc_code *); +tree gfc_trans_wait (gfc_code *); diff --git a/gcc/fortran/trans.c b/gcc/fortran/trans.c index 36a7f122c0b..a9951e48c57 100644 --- a/gcc/fortran/trans.c +++ b/gcc/fortran/trans.c @@ -1108,6 +1108,10 @@ gfc_trans_code (gfc_code * code) res = gfc_trans_inquire (code); break; + case EXEC_WAIT: + res = gfc_trans_wait (code); + break; + case EXEC_REWIND: res = gfc_trans_rewind (code); break; diff --git a/gcc/function.c b/gcc/function.c index 240a3e7615b..7f34de3997b 100644 --- a/gcc/function.c +++ b/gcc/function.c @@ -207,9 +207,6 @@ static int contains (const_rtx, VEC(int,heap) **); #ifdef HAVE_return static void emit_return_into_block (basic_block); #endif -#if defined(HAVE_epilogue) && defined(INCOMING_RETURN_ADDR_RTX) -static rtx keep_stack_depressed (rtx); -#endif static void prepare_function_start (void); static void do_clobber_return_reg (rtx, void *); static void do_use_return_reg (rtx, void *); @@ -284,18 +281,16 @@ free_after_compilation (struct function *f) VEC_free (int, heap, prologue); VEC_free (int, heap, epilogue); VEC_free (int, heap, sibcall_epilogue); - if (rtl.emit.regno_pointer_align) - free (rtl.emit.regno_pointer_align); + if (crtl->emit.regno_pointer_align) + free (crtl->emit.regno_pointer_align); - memset (&rtl, 0, sizeof (rtl)); + memset (crtl, 0, sizeof (struct rtl_data)); f->eh = NULL; f->machine = NULL; f->cfg = NULL; - f->arg_offset_rtx = NULL; - f->return_rtx = NULL; - f->internal_arg_pointer = NULL; f->epilogue_delay_list = NULL; + regno_reg_rtx = NULL; } /* Return size needed for stack frame based on slots so far allocated. @@ -1146,18 +1141,18 @@ static int cfa_offset; parameters. However, if OUTGOING_REG_PARM_STACK space is not defined, stack space for register parameters is not pushed by the caller, but rather part of the fixed stack areas and hence not included in - `current_function_outgoing_args_size'. Nevertheless, we must allow + `crtl->outgoing_args_size'. Nevertheless, we must allow for it when allocating stack dynamic objects. */ #if defined(REG_PARM_STACK_SPACE) #define STACK_DYNAMIC_OFFSET(FNDECL) \ ((ACCUMULATE_OUTGOING_ARGS \ - ? (current_function_outgoing_args_size \ + ? (crtl->outgoing_args_size \ + (OUTGOING_REG_PARM_STACK_SPACE ? 0 : REG_PARM_STACK_SPACE (FNDECL))) \ : 0) + (STACK_POINTER_OFFSET)) #else #define STACK_DYNAMIC_OFFSET(FNDECL) \ -((ACCUMULATE_OUTGOING_ARGS ? current_function_outgoing_args_size : 0) \ +((ACCUMULATE_OUTGOING_ARGS ? crtl->outgoing_args_size : 0) \ + (STACK_POINTER_OFFSET)) #endif #endif @@ -2266,7 +2261,7 @@ assign_parm_find_stack_rtl (tree parm, struct assign_parm_data_one *data) else offset_rtx = ARGS_SIZE_RTX (data->locate.offset); - stack_parm = current_function_internal_arg_pointer; + stack_parm = crtl->args.internal_arg_pointer; if (offset_rtx != const0_rtx) stack_parm = gen_rtx_PLUS (Pmode, stack_parm, offset_rtx); stack_parm = gen_rtx_MEM (data->promoted_mode, stack_parm); @@ -2952,7 +2947,7 @@ assign_parms (tree fndecl) struct assign_parm_data_all all; tree fnargs, parm; - current_function_internal_arg_pointer + crtl->args.internal_arg_pointer = targetm.calls.internal_arg_pointer (); assign_parms_initialize_all (&all); @@ -3032,48 +3027,48 @@ assign_parms (tree fndecl) } /* We have aligned all the args, so add space for the pretend args. */ - current_function_pretend_args_size = all.pretend_args_size; + crtl->args.pretend_args_size = all.pretend_args_size; all.stack_args_size.constant += all.extra_pretend_bytes; - current_function_args_size = all.stack_args_size.constant; + crtl->args.size = all.stack_args_size.constant; /* Adjust function incoming argument size for alignment and minimum length. */ #ifdef REG_PARM_STACK_SPACE - current_function_args_size = MAX (current_function_args_size, + crtl->args.size = MAX (crtl->args.size, REG_PARM_STACK_SPACE (fndecl)); #endif - current_function_args_size = CEIL_ROUND (current_function_args_size, + crtl->args.size = CEIL_ROUND (crtl->args.size, PARM_BOUNDARY / BITS_PER_UNIT); #ifdef ARGS_GROW_DOWNWARD - current_function_arg_offset_rtx + crtl->args.arg_offset_rtx = (all.stack_args_size.var == 0 ? GEN_INT (-all.stack_args_size.constant) : expand_expr (size_diffop (all.stack_args_size.var, size_int (-all.stack_args_size.constant)), NULL_RTX, VOIDmode, 0)); #else - current_function_arg_offset_rtx = ARGS_SIZE_RTX (all.stack_args_size); + crtl->args.arg_offset_rtx = ARGS_SIZE_RTX (all.stack_args_size); #endif /* See how many bytes, if any, of its args a function should try to pop on return. */ - current_function_pops_args = RETURN_POPS_ARGS (fndecl, TREE_TYPE (fndecl), - current_function_args_size); + crtl->args.pops_args = RETURN_POPS_ARGS (fndecl, TREE_TYPE (fndecl), + crtl->args.size); /* For stdarg.h function, save info about regs and stack space used by the named args. */ - current_function_args_info = all.args_so_far; + crtl->args.info = all.args_so_far; /* Set the rtx used for the function return value. Put this in its own variable so any optimizers that need this information don't have to include tree.h. Do this here so it gets done when an inlined function gets output. */ - current_function_return_rtx + crtl->return_rtx = (DECL_RTL_SET_P (DECL_RESULT (fndecl)) ? DECL_RTL (DECL_RESULT (fndecl)) : NULL_RTX); @@ -3094,10 +3089,10 @@ assign_parms (tree fndecl) real_decl_rtl = targetm.calls.function_value (TREE_TYPE (decl_result), fndecl, true); REG_FUNCTION_VALUE_P (real_decl_rtl) = 1; - /* The delay slot scheduler assumes that current_function_return_rtx + /* The delay slot scheduler assumes that crtl->return_rtx holds the hard register containing the return value, not a temporary pseudo. */ - current_function_return_rtx = real_decl_rtl; + crtl->return_rtx = real_decl_rtl; } } } @@ -3907,7 +3902,7 @@ push_struct_function (tree fndecl) static void prepare_function_start (void) { - gcc_assert (!rtl.emit.x_last_insn); + gcc_assert (!crtl->emit.x_last_insn); init_emit (); init_varasm_status (); init_expr (); @@ -4294,7 +4289,7 @@ expand_dummy_function_end (void) void diddle_return_value (void (*doit) (rtx, void *), void *arg) { - rtx outgoing = current_function_return_rtx; + rtx outgoing = crtl->return_rtx; if (! outgoing) return; @@ -4455,7 +4450,7 @@ expand_function_end (void) ? REGNO (decl_rtl) >= FIRST_PSEUDO_REGISTER : DECL_REGISTER (decl_result)) { - rtx real_decl_rtl = current_function_return_rtx; + rtx real_decl_rtl = crtl->return_rtx; /* This should be set in assign_parms. */ gcc_assert (REG_FUNCTION_VALUE_P (real_decl_rtl)); @@ -4463,7 +4458,7 @@ expand_function_end (void) /* If this is a BLKmode structure being returned in registers, then use the mode computed in expand_return. Note that if decl_rtl is memory, then its mode may have been changed, - but that current_function_return_rtx has not. */ + but that crtl->return_rtx has not. */ if (GET_MODE (real_decl_rtl) == BLKmode) PUT_MODE (real_decl_rtl, GET_MODE (decl_rtl)); @@ -4560,7 +4555,7 @@ expand_function_end (void) /* Show return register used to hold result (in this case the address of the result. */ - current_function_return_rtx = outgoing; + crtl->return_rtx = outgoing; } /* Emit the actual code to clobber return register. */ @@ -4720,383 +4715,6 @@ emit_return_into_block (basic_block bb) } #endif /* HAVE_return */ -#if defined(HAVE_epilogue) && defined(INCOMING_RETURN_ADDR_RTX) - -/* These functions convert the epilogue into a variant that does not - modify the stack pointer. This is used in cases where a function - returns an object whose size is not known until it is computed. - The called function leaves the object on the stack, leaves the - stack depressed, and returns a pointer to the object. - - What we need to do is track all modifications and references to the - stack pointer, deleting the modifications and changing the - references to point to the location the stack pointer would have - pointed to had the modifications taken place. - - These functions need to be portable so we need to make as few - assumptions about the epilogue as we can. However, the epilogue - basically contains three things: instructions to reset the stack - pointer, instructions to reload registers, possibly including the - frame pointer, and an instruction to return to the caller. - - We must be sure of what a relevant epilogue insn is doing. We also - make no attempt to validate the insns we make since if they are - invalid, we probably can't do anything valid. The intent is that - these routines get "smarter" as more and more machines start to use - them and they try operating on different epilogues. - - We use the following structure to track what the part of the - epilogue that we've already processed has done. We keep two copies - of the SP equivalence, one for use during the insn we are - processing and one for use in the next insn. The difference is - because one part of a PARALLEL may adjust SP and the other may use - it. */ - -struct epi_info -{ - rtx sp_equiv_reg; /* REG that SP is set from, perhaps SP. */ - HOST_WIDE_INT sp_offset; /* Offset from SP_EQUIV_REG of present SP. */ - rtx new_sp_equiv_reg; /* REG to be used at end of insn. */ - HOST_WIDE_INT new_sp_offset; /* Offset to be used at end of insn. */ - rtx equiv_reg_src; /* If nonzero, the value that SP_EQUIV_REG - should be set to once we no longer need - its value. */ - rtx const_equiv[FIRST_PSEUDO_REGISTER]; /* Any known constant equivalences - for registers. */ -}; - -static void handle_epilogue_set (rtx, struct epi_info *); -static void update_epilogue_consts (rtx, const_rtx, void *); -static void emit_equiv_load (struct epi_info *); - -/* Modify INSN, a list of one or more insns that is part of the epilogue, to - no modifications to the stack pointer. Return the new list of insns. */ - -static rtx -keep_stack_depressed (rtx insns) -{ - int j; - struct epi_info info; - rtx insn, next; - - /* If the epilogue is just a single instruction, it must be OK as is. */ - if (NEXT_INSN (insns) == NULL_RTX) - return insns; - - /* Otherwise, start a sequence, initialize the information we have, and - process all the insns we were given. */ - start_sequence (); - - info.sp_equiv_reg = stack_pointer_rtx; - info.sp_offset = 0; - info.equiv_reg_src = 0; - - for (j = 0; j < FIRST_PSEUDO_REGISTER; j++) - info.const_equiv[j] = 0; - - insn = insns; - next = NULL_RTX; - while (insn != NULL_RTX) - { - next = NEXT_INSN (insn); - - if (!INSN_P (insn)) - { - add_insn (insn); - insn = next; - continue; - } - - /* If this insn references the register that SP is equivalent to and - we have a pending load to that register, we must force out the load - first and then indicate we no longer know what SP's equivalent is. */ - if (info.equiv_reg_src != 0 - && reg_referenced_p (info.sp_equiv_reg, PATTERN (insn))) - { - emit_equiv_load (&info); - info.sp_equiv_reg = 0; - } - - info.new_sp_equiv_reg = info.sp_equiv_reg; - info.new_sp_offset = info.sp_offset; - - /* If this is a (RETURN) and the return address is on the stack, - update the address and change to an indirect jump. */ - if (GET_CODE (PATTERN (insn)) == RETURN - || (GET_CODE (PATTERN (insn)) == PARALLEL - && GET_CODE (XVECEXP (PATTERN (insn), 0, 0)) == RETURN)) - { - rtx retaddr = INCOMING_RETURN_ADDR_RTX; - rtx base = 0; - HOST_WIDE_INT offset = 0; - rtx jump_insn, jump_set; - - /* If the return address is in a register, we can emit the insn - unchanged. Otherwise, it must be a MEM and we see what the - base register and offset are. In any case, we have to emit any - pending load to the equivalent reg of SP, if any. */ - if (REG_P (retaddr)) - { - emit_equiv_load (&info); - add_insn (insn); - insn = next; - continue; - } - else - { - rtx ret_ptr; - gcc_assert (MEM_P (retaddr)); - - ret_ptr = XEXP (retaddr, 0); - - if (REG_P (ret_ptr)) - { - base = gen_rtx_REG (Pmode, REGNO (ret_ptr)); - offset = 0; - } - else - { - gcc_assert (GET_CODE (ret_ptr) == PLUS - && REG_P (XEXP (ret_ptr, 0)) - && GET_CODE (XEXP (ret_ptr, 1)) == CONST_INT); - base = gen_rtx_REG (Pmode, REGNO (XEXP (ret_ptr, 0))); - offset = INTVAL (XEXP (ret_ptr, 1)); - } - } - - /* If the base of the location containing the return pointer - is SP, we must update it with the replacement address. Otherwise, - just build the necessary MEM. */ - retaddr = plus_constant (base, offset); - if (base == stack_pointer_rtx) - retaddr = simplify_replace_rtx (retaddr, stack_pointer_rtx, - plus_constant (info.sp_equiv_reg, - info.sp_offset)); - - retaddr = gen_rtx_MEM (Pmode, retaddr); - MEM_NOTRAP_P (retaddr) = 1; - - /* If there is a pending load to the equivalent register for SP - and we reference that register, we must load our address into - a scratch register and then do that load. */ - if (info.equiv_reg_src - && reg_overlap_mentioned_p (info.equiv_reg_src, retaddr)) - { - unsigned int regno; - rtx reg; - - for (regno = 0; regno < FIRST_PSEUDO_REGISTER; regno++) - if (HARD_REGNO_MODE_OK (regno, Pmode) - && !fixed_regs[regno] - && TEST_HARD_REG_BIT (regs_invalidated_by_call, regno) - && !REGNO_REG_SET_P - (DF_LR_IN (EXIT_BLOCK_PTR), regno) - && !refers_to_regno_p (regno, - end_hard_regno (Pmode, regno), - info.equiv_reg_src, NULL) - && info.const_equiv[regno] == 0) - break; - - gcc_assert (regno < FIRST_PSEUDO_REGISTER); - - reg = gen_rtx_REG (Pmode, regno); - emit_move_insn (reg, retaddr); - retaddr = reg; - } - - emit_equiv_load (&info); - jump_insn = emit_jump_insn (gen_indirect_jump (retaddr)); - - /* Show the SET in the above insn is a RETURN. */ - jump_set = single_set (jump_insn); - gcc_assert (jump_set); - SET_IS_RETURN_P (jump_set) = 1; - } - - /* If SP is not mentioned in the pattern and its equivalent register, if - any, is not modified, just emit it. Otherwise, if neither is set, - replace the reference to SP and emit the insn. If none of those are - true, handle each SET individually. */ - else if (!reg_mentioned_p (stack_pointer_rtx, PATTERN (insn)) - && (info.sp_equiv_reg == stack_pointer_rtx - || !reg_set_p (info.sp_equiv_reg, insn))) - add_insn (insn); - else if (! reg_set_p (stack_pointer_rtx, insn) - && (info.sp_equiv_reg == stack_pointer_rtx - || !reg_set_p (info.sp_equiv_reg, insn))) - { - int changed; - - changed = validate_replace_rtx (stack_pointer_rtx, - plus_constant (info.sp_equiv_reg, - info.sp_offset), - insn); - gcc_assert (changed); - - add_insn (insn); - } - else if (GET_CODE (PATTERN (insn)) == SET) - handle_epilogue_set (PATTERN (insn), &info); - else if (GET_CODE (PATTERN (insn)) == PARALLEL) - { - for (j = 0; j < XVECLEN (PATTERN (insn), 0); j++) - if (GET_CODE (XVECEXP (PATTERN (insn), 0, j)) == SET) - handle_epilogue_set (XVECEXP (PATTERN (insn), 0, j), &info); - } - else - add_insn (insn); - - info.sp_equiv_reg = info.new_sp_equiv_reg; - info.sp_offset = info.new_sp_offset; - - /* Now update any constants this insn sets. */ - note_stores (PATTERN (insn), update_epilogue_consts, &info); - insn = next; - } - - insns = get_insns (); - end_sequence (); - return insns; -} - -/* SET is a SET from an insn in the epilogue. P is a pointer to the epi_info - structure that contains information about what we've seen so far. We - process this SET by either updating that data or by emitting one or - more insns. */ - -static void -handle_epilogue_set (rtx set, struct epi_info *p) -{ - /* First handle the case where we are setting SP. Record what it is being - set from, which we must be able to determine */ - if (reg_set_p (stack_pointer_rtx, set)) - { - gcc_assert (SET_DEST (set) == stack_pointer_rtx); - - if (GET_CODE (SET_SRC (set)) == PLUS) - { - p->new_sp_equiv_reg = XEXP (SET_SRC (set), 0); - if (GET_CODE (XEXP (SET_SRC (set), 1)) == CONST_INT) - p->new_sp_offset = INTVAL (XEXP (SET_SRC (set), 1)); - else - { - gcc_assert (REG_P (XEXP (SET_SRC (set), 1)) - && (REGNO (XEXP (SET_SRC (set), 1)) - < FIRST_PSEUDO_REGISTER) - && p->const_equiv[REGNO (XEXP (SET_SRC (set), 1))]); - p->new_sp_offset - = INTVAL (p->const_equiv[REGNO (XEXP (SET_SRC (set), 1))]); - } - } - else - p->new_sp_equiv_reg = SET_SRC (set), p->new_sp_offset = 0; - - /* If we are adjusting SP, we adjust from the old data. */ - if (p->new_sp_equiv_reg == stack_pointer_rtx) - { - p->new_sp_equiv_reg = p->sp_equiv_reg; - p->new_sp_offset += p->sp_offset; - } - - gcc_assert (p->new_sp_equiv_reg && REG_P (p->new_sp_equiv_reg)); - - return; - } - - /* Next handle the case where we are setting SP's equivalent - register. We must not already have a value to set it to. We - could update, but there seems little point in handling that case. - Note that we have to allow for the case where we are setting the - register set in the previous part of a PARALLEL inside a single - insn. But use the old offset for any updates within this insn. - We must allow for the case where the register is being set in a - different (usually wider) mode than Pmode). */ - else if (p->new_sp_equiv_reg != 0 && reg_set_p (p->new_sp_equiv_reg, set)) - { - gcc_assert (!p->equiv_reg_src - && REG_P (p->new_sp_equiv_reg) - && REG_P (SET_DEST (set)) - && (GET_MODE_BITSIZE (GET_MODE (SET_DEST (set))) - <= BITS_PER_WORD) - && REGNO (p->new_sp_equiv_reg) == REGNO (SET_DEST (set))); - p->equiv_reg_src - = simplify_replace_rtx (SET_SRC (set), stack_pointer_rtx, - plus_constant (p->sp_equiv_reg, - p->sp_offset)); - } - - /* Otherwise, replace any references to SP in the insn to its new value - and emit the insn. */ - else - { - SET_SRC (set) = simplify_replace_rtx (SET_SRC (set), stack_pointer_rtx, - plus_constant (p->sp_equiv_reg, - p->sp_offset)); - SET_DEST (set) = simplify_replace_rtx (SET_DEST (set), stack_pointer_rtx, - plus_constant (p->sp_equiv_reg, - p->sp_offset)); - emit_insn (set); - } -} - -/* Update the tracking information for registers set to constants. */ - -static void -update_epilogue_consts (rtx dest, const_rtx x, void *data) -{ - struct epi_info *p = (struct epi_info *) data; - rtx new; - - if (!REG_P (dest) || REGNO (dest) >= FIRST_PSEUDO_REGISTER) - return; - - /* If we are either clobbering a register or doing a partial set, - show we don't know the value. */ - else if (GET_CODE (x) == CLOBBER || ! rtx_equal_p (dest, SET_DEST (x))) - p->const_equiv[REGNO (dest)] = 0; - - /* If we are setting it to a constant, record that constant. */ - else if (GET_CODE (SET_SRC (x)) == CONST_INT) - p->const_equiv[REGNO (dest)] = SET_SRC (x); - - /* If this is a binary operation between a register we have been tracking - and a constant, see if we can compute a new constant value. */ - else if (ARITHMETIC_P (SET_SRC (x)) - && REG_P (XEXP (SET_SRC (x), 0)) - && REGNO (XEXP (SET_SRC (x), 0)) < FIRST_PSEUDO_REGISTER - && p->const_equiv[REGNO (XEXP (SET_SRC (x), 0))] != 0 - && GET_CODE (XEXP (SET_SRC (x), 1)) == CONST_INT - && 0 != (new = simplify_binary_operation - (GET_CODE (SET_SRC (x)), GET_MODE (dest), - p->const_equiv[REGNO (XEXP (SET_SRC (x), 0))], - XEXP (SET_SRC (x), 1))) - && GET_CODE (new) == CONST_INT) - p->const_equiv[REGNO (dest)] = new; - - /* Otherwise, we can't do anything with this value. */ - else - p->const_equiv[REGNO (dest)] = 0; -} - -/* Emit an insn to do the load shown in p->equiv_reg_src, if needed. */ - -static void -emit_equiv_load (struct epi_info *p) -{ - if (p->equiv_reg_src != 0) - { - rtx dest = p->sp_equiv_reg; - - if (GET_MODE (p->equiv_reg_src) != GET_MODE (dest)) - dest = gen_rtx_REG (GET_MODE (p->equiv_reg_src), - REGNO (p->sp_equiv_reg)); - - emit_move_insn (dest, p->equiv_reg_src); - p->equiv_reg_src = 0; - } -} -#endif - /* Generate the prologue and epilogue RTL if the machine supports it. Thread this into place with notes indicating where the prologue ends and where the epilogue begins. Update the basic block information when possible. */ @@ -5274,17 +4892,7 @@ thread_prologue_and_epilogue_insns (void) { start_sequence (); epilogue_end = emit_note (NOTE_INSN_EPILOGUE_BEG); - seq = gen_epilogue (); - -#ifdef INCOMING_RETURN_ADDR_RTX - /* If this function returns with the stack depressed and we can support - it, massage the epilogue to actually do that. */ - if (TREE_CODE (TREE_TYPE (current_function_decl)) == FUNCTION_TYPE - && TYPE_RETURNS_STACK_DEPRESSED (TREE_TYPE (current_function_decl))) - seq = keep_stack_depressed (seq); -#endif - emit_jump_insn (seq); /* Retain a map of the epilogue insns. */ diff --git a/gcc/function.h b/gcc/function.h index 6c95dcd1435..edc7216e751 100644 --- a/gcc/function.h +++ b/gcc/function.h @@ -87,13 +87,13 @@ struct emit_status GTY(()) FIXME: We could put it into emit_status struct, but gengtype is not able to deal with length attribute nested in top level structures. */ -extern GTY ((length ("rtl.emit.x_reg_rtx_no"))) rtx * regno_reg_rtx; +extern GTY ((length ("crtl->emit.x_reg_rtx_no"))) rtx * regno_reg_rtx; /* For backward compatibility... eventually these should all go away. */ -#define reg_rtx_no (rtl.emit.x_reg_rtx_no) -#define seq_stack (rtl.emit.sequence_stack) +#define reg_rtx_no (crtl->emit.x_reg_rtx_no) +#define seq_stack (crtl->emit.sequence_stack) -#define REGNO_POINTER_ALIGN(REGNO) (rtl.emit.regno_pointer_align[REGNO]) +#define REGNO_POINTER_ALIGN(REGNO) (crtl->emit.regno_pointer_align[REGNO]) struct expr_status GTY(()) { @@ -136,12 +136,12 @@ struct expr_status GTY(()) rtx x_forced_labels; }; -#define pending_stack_adjust (rtl.expr.x_pending_stack_adjust) -#define inhibit_defer_pop (rtl.expr.x_inhibit_defer_pop) -#define saveregs_value (rtl.expr.x_saveregs_value) -#define apply_args_value (rtl.expr.x_apply_args_value) -#define forced_labels (rtl.expr.x_forced_labels) -#define stack_pointer_delta (rtl.expr.x_stack_pointer_delta) +#define pending_stack_adjust (crtl->expr.x_pending_stack_adjust) +#define inhibit_defer_pop (crtl->expr.x_inhibit_defer_pop) +#define saveregs_value (crtl->expr.x_saveregs_value) +#define apply_args_value (crtl->expr.x_apply_args_value) +#define forced_labels (crtl->expr.x_forced_labels) +#define stack_pointer_delta (crtl->expr.x_stack_pointer_delta) struct gimple_df; struct temp_slot; @@ -171,12 +171,78 @@ struct varasm_status GTY(()) unsigned int deferred_constants; }; +/* Information mainlined about RTL representation of incoming arguments. */ +struct incoming_args GTY(()) +{ + /* Number of bytes of args popped by function being compiled on its return. + Zero if no bytes are to be popped. + May affect compilation of return insn or of function epilogue. */ + int pops_args; + + /* If function's args have a fixed size, this is that size, in bytes. + Otherwise, it is -1. + May affect compilation of return insn or of function epilogue. */ + int size; + + /* # bytes the prologue should push and pretend that the caller pushed them. + The prologue must do this, but only if parms can be passed in + registers. */ + int pretend_args_size; + + /* This is the offset from the arg pointer to the place where the first + anonymous arg can be found, if there is one. */ + rtx arg_offset_rtx; + + /* Quantities of various kinds of registers + used for the current function's args. */ + CUMULATIVE_ARGS info; + + /* The arg pointer hard register, or the pseudo into which it was copied. */ + rtx internal_arg_pointer; +}; + +/* Data for function partitioning. */ +struct function_subsections GTY(()) +{ + /* Assembly labels for the hot and cold text sections, to + be used by debugger functions for determining the size of text + sections. */ + + const char *hot_section_label; + const char *cold_section_label; + const char *hot_section_end_label; + const char *cold_section_end_label; + + /* String to be used for name of cold text sections, via + targetm.asm_out.named_section. */ + + const char *unlikely_text_section_name; +}; + /* Datastructures maintained for currently processed function in RTL form. */ struct rtl_data GTY(()) { struct expr_status expr; struct emit_status emit; struct varasm_status varasm; + struct incoming_args args; + struct function_subsections subsections; + + /* For function.c */ + + /* # of bytes of outgoing arguments. If ACCUMULATE_OUTGOING_ARGS is + defined, the needed space is pushed by the prologue. */ + int outgoing_args_size; + + /* If nonzero, an RTL expression for the location at which the current + function returns its result. If the current function returns its + result in a register, current_function_return_rtx will always be + the hard register containing the result. */ + rtx return_rtx; + + /* Opaque pointer used by get_hard_reg_initial_val and + has_hard_reg_initial_val (see integrate.[hc]). */ + struct initial_value_struct *hard_reg_initial_vals; /* List (chain of EXPR_LIST) of labels heading the current handlers for nonlocal gotos. */ @@ -193,7 +259,7 @@ struct rtl_data GTY(()) rtx x_naked_return_label; /* List (chain of EXPR_LISTs) of all stack slots in this function. - Made for the sake of unshare_all_rtl. */ + Made for the sake of unshare_all_crtl-> */ rtx x_stack_slot_list; /* Place after which to insert the tail_recursion_label if we need one. */ @@ -222,23 +288,26 @@ struct rtl_data GTY(()) /* Current nesting level for temporaries. */ int x_temp_slot_level; - /* Highest label number in current function. */ - int inl_max_label_num; }; -#define return_label (rtl.x_return_label) -#define naked_return_label (rtl.x_naked_return_label) -#define stack_slot_list (rtl.x_stack_slot_list) -#define parm_birth_insn (rtl.x_parm_birth_insn) -#define frame_offset (rtl.x_frame_offset) -#define stack_check_probe_note (rtl.x_stack_check_probe_note) -#define arg_pointer_save_area (rtl.x_arg_pointer_save_area) -#define used_temp_slots (rtl.x_used_temp_slots) -#define avail_temp_slots (rtl.x_avail_temp_slots) -#define temp_slot_level (rtl.x_temp_slot_level) -#define nonlocal_goto_handler_labels (rtl.x_nonlocal_goto_handler_labels) - -extern GTY(()) struct rtl_data rtl; +#define return_label (crtl->x_return_label) +#define naked_return_label (crtl->x_naked_return_label) +#define stack_slot_list (crtl->x_stack_slot_list) +#define parm_birth_insn (crtl->x_parm_birth_insn) +#define frame_offset (crtl->x_frame_offset) +#define stack_check_probe_note (crtl->x_stack_check_probe_note) +#define arg_pointer_save_area (crtl->x_arg_pointer_save_area) +#define used_temp_slots (crtl->x_used_temp_slots) +#define avail_temp_slots (crtl->x_avail_temp_slots) +#define temp_slot_level (crtl->x_temp_slot_level) +#define nonlocal_goto_handler_labels (crtl->x_nonlocal_goto_handler_labels) + +extern GTY(()) struct rtl_data x_rtl; + +/* Accestor to RTL datastructures. We keep them statically allocated now since + we never keep multiple functions. For threaded compiler we might however + want to do differntly. */ +#define crtl (&x_rtl) /* This structure can save all the important global and static variables describing the status of the current function. */ @@ -266,46 +335,6 @@ struct function GTY(()) /* Function containing this function, if any. */ struct function *outer; - /* Number of bytes of args popped by function being compiled on its return. - Zero if no bytes are to be popped. - May affect compilation of return insn or of function epilogue. */ - int pops_args; - - /* If function's args have a fixed size, this is that size, in bytes. - Otherwise, it is -1. - May affect compilation of return insn or of function epilogue. */ - int args_size; - - /* # bytes the prologue should push and pretend that the caller pushed them. - The prologue must do this, but only if parms can be passed in - registers. */ - int pretend_args_size; - - /* # of bytes of outgoing arguments. If ACCUMULATE_OUTGOING_ARGS is - defined, the needed space is pushed by the prologue. */ - int outgoing_args_size; - - /* This is the offset from the arg pointer to the place where the first - anonymous arg can be found, if there is one. */ - rtx arg_offset_rtx; - - /* Quantities of various kinds of registers - used for the current function's args. */ - CUMULATIVE_ARGS args_info; - - /* If nonzero, an RTL expression for the location at which the current - function returns its result. If the current function returns its - result in a register, current_function_return_rtx will always be - the hard register containing the result. */ - rtx return_rtx; - - /* The arg pointer hard register, or the pseudo into which it was copied. */ - rtx internal_arg_pointer; - - /* Opaque pointer used by get_hard_reg_initial_val and - has_hard_reg_initial_val (see integrate.[hc]). */ - struct initial_value_struct *hard_reg_initial_vals; - /* A PARM_DECL that should contain the static chain for this function. It will be initialized at the beginning of the function. */ tree static_chain_decl; @@ -354,20 +383,6 @@ struct function GTY(()) /* The variables unexpanded so far. */ tree unexpanded_var_list; - /* Assembly labels for the hot and cold text sections, to - be used by debugger functions for determining the size of text - sections. */ - - const char *hot_section_label; - const char *cold_section_label; - const char *hot_section_end_label; - const char *cold_section_end_label; - - /* String to be used for name of cold text sections, via - targetm.asm_out.named_section. */ - - const char *unlikely_text_section_name; - /* A variable living at the top of the frame that holds a known value. Used for detecting stack clobbers. */ tree stack_protect_guard; @@ -525,7 +540,6 @@ extern void pop_cfun (void); extern void instantiate_decl_rtl (rtx x); /* For backward compatibility... eventually these should all go away. */ -#define current_function_pops_args (cfun->pops_args) #define current_function_returns_struct (cfun->returns_struct) #define current_function_returns_pcc_struct (cfun->returns_pcc_struct) #define current_function_calls_setjmp (cfun->calls_setjmp) @@ -533,14 +547,7 @@ extern void instantiate_decl_rtl (rtx x); #define current_function_accesses_prior_frames (cfun->accesses_prior_frames) #define current_function_calls_eh_return (cfun->calls_eh_return) #define current_function_is_thunk (cfun->is_thunk) -#define current_function_args_info (cfun->args_info) -#define current_function_args_size (cfun->args_size) -#define current_function_pretend_args_size (cfun->pretend_args_size) -#define current_function_outgoing_args_size (cfun->outgoing_args_size) -#define current_function_arg_offset_rtx (cfun->arg_offset_rtx) #define current_function_stdarg (cfun->stdarg) -#define current_function_internal_arg_pointer (cfun->internal_arg_pointer) -#define current_function_return_rtx (cfun->return_rtx) #define current_function_profile (cfun->profile) #define current_function_funcdef_no (cfun->funcdef_no) #define current_function_limit_stack (cfun->limit_stack) diff --git a/gcc/gcc.c b/gcc/gcc.c index 087fdfe0af3..0636579644f 100644 --- a/gcc/gcc.c +++ b/gcc/gcc.c @@ -966,11 +966,14 @@ static const struct compiler default_compilers[] = {".c++", "#C++", 0, 0, 0}, {".C", "#C++", 0, 0, 0}, {".CPP", "#C++", 0, 0, 0}, {".ii", "#C++", 0, 0, 0}, {".ads", "#Ada", 0, 0, 0}, {".adb", "#Ada", 0, 0, 0}, - {".f", "#Fortran", 0, 0, 0}, {".for", "#Fortran", 0, 0, 0}, - {".fpp", "#Fortran", 0, 0, 0}, {".F", "#Fortran", 0, 0, 0}, - {".FOR", "#Fortran", 0, 0, 0}, {".FPP", "#Fortran", 0, 0, 0}, - {".f90", "#Fortran", 0, 0, 0}, {".f95", "#Fortran", 0, 0, 0}, - {".F90", "#Fortran", 0, 0, 0}, {".F95", "#Fortran", 0, 0, 0}, + {".f", "#Fortran", 0, 0, 0}, {".F", "#Fortran", 0, 0, 0}, + {".for", "#Fortran", 0, 0, 0}, {".FOR", "#Fortran", 0, 0, 0}, + {".ftn", "#Fortran", 0, 0, 0}, {".FTN", "#Fortran", 0, 0, 0}, + {".fpp", "#Fortran", 0, 0, 0}, {".FPP", "#Fortran", 0, 0, 0}, + {".f90", "#Fortran", 0, 0, 0}, {".F90", "#Fortran", 0, 0, 0}, + {".f95", "#Fortran", 0, 0, 0}, {".F95", "#Fortran", 0, 0, 0}, + {".f03", "#Fortran", 0, 0, 0}, {".F03", "#Fortran", 0, 0, 0}, + {".f08", "#Fortran", 0, 0, 0}, {".F08", "#Fortran", 0, 0, 0}, {".r", "#Ratfor", 0, 0, 0}, {".p", "#Pascal", 0, 0, 0}, {".pas", "#Pascal", 0, 0, 0}, {".java", "#Java", 0, 0, 0}, {".class", "#Java", 0, 0, 0}, diff --git a/gcc/gcov-dump.c b/gcc/gcov-dump.c index 916d73ce698..ae8504669fb 100644 --- a/gcc/gcov-dump.c +++ b/gcc/gcov-dump.c @@ -420,7 +420,7 @@ tag_summary (const char *filename ATTRIBUTE_UNUSED, gcov_read_summary (&summary); printf (" checksum=0x%08x", summary.checksum); - for (ix = 0; ix != GCOV_COUNTERS; ix++) + for (ix = 0; ix != GCOV_COUNTERS_SUMMABLE; ix++) { printf ("\n"); print_prefix (filename, 0, 0); diff --git a/gcc/gcse.c b/gcc/gcse.c index 201e42c5a97..20bb0804d2e 100644 --- a/gcc/gcse.c +++ b/gcc/gcse.c @@ -1,7 +1,7 @@ /* Global common subexpression elimination/Partial redundancy elimination and global constant/copy propagation for GNU compiler. Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, - 2006, 2007 Free Software Foundation, Inc. + 2006, 2007, 2008 Free Software Foundation, Inc. This file is part of GCC. @@ -4463,8 +4463,7 @@ pre_delete (void) expressions into. Get the mode for the new pseudo from the mode of the original destination pseudo. */ if (expr->reaching_reg == NULL) - expr->reaching_reg - = gen_reg_rtx (GET_MODE (SET_DEST (set))); + expr->reaching_reg = gen_reg_rtx_and_attrs (SET_DEST (set)); gcse_emit_move_after (expr->reaching_reg, SET_DEST (set), insn); delete_insn (insn); @@ -4988,7 +4987,7 @@ hoist_code (void) from the mode of the original destination pseudo. */ if (expr->reaching_reg == NULL) expr->reaching_reg - = gen_reg_rtx (GET_MODE (SET_DEST (set))); + = gen_reg_rtx_and_attrs (SET_DEST (set)); gcse_emit_move_after (expr->reaching_reg, SET_DEST (set), insn); delete_insn (insn); @@ -6121,7 +6120,7 @@ build_store_vectors (void) are any side effects. */ if (TEST_BIT (ae_gen[bb->index], ptr->index)) { - rtx r = gen_reg_rtx (GET_MODE (ptr->pattern)); + rtx r = gen_reg_rtx_and_attrs (ptr->pattern); if (dump_file) fprintf (dump_file, "Removing redundant store:\n"); replace_store_insn (r, XEXP (st, 0), bb, ptr); @@ -6444,7 +6443,7 @@ delete_store (struct ls_expr * expr, basic_block bb) rtx reg, i, del; if (expr->reaching_reg == NULL_RTX) - expr->reaching_reg = gen_reg_rtx (GET_MODE (expr->pattern)); + expr->reaching_reg = gen_reg_rtx_and_attrs (expr->pattern); reg = expr->reaching_reg; diff --git a/gcc/gthr-posix95.h b/gcc/gthr-posix95.h index 625f799e8fc..b6332816c99 100644 --- a/gcc/gthr-posix95.h +++ b/gcc/gthr-posix95.h @@ -750,7 +750,7 @@ static inline int __gthread_cond_wait_recursive (__gthread_cond_t *cond, __gthread_recursive_mutex_t *mutex) { - return __gthrw_(pthread_cond_wait) (cond, mutex->actual); + return __gthrw_(pthread_cond_wait) (cond, &mutex->actual); } #endif /* _LIBOBJC */ diff --git a/gcc/integrate.c b/gcc/integrate.c index 55ac31ddf93..4ed42ef896a 100644 --- a/gcc/integrate.c +++ b/gcc/integrate.c @@ -206,9 +206,9 @@ set_decl_abstract_flags (tree decl, int setting) the function. */ rtx -get_hard_reg_initial_reg (struct function *fun, rtx reg) +get_hard_reg_initial_reg (rtx reg) { - struct initial_value_struct *ivs = fun->hard_reg_initial_vals; + struct initial_value_struct *ivs = crtl->hard_reg_initial_vals; int i; if (ivs == 0) @@ -234,14 +234,14 @@ get_hard_reg_initial_val (enum machine_mode mode, unsigned int regno) if (rv) return rv; - ivs = cfun->hard_reg_initial_vals; + ivs = crtl->hard_reg_initial_vals; if (ivs == 0) { ivs = ggc_alloc (sizeof (initial_value_struct)); ivs->num_entries = 0; ivs->max_entries = 5; ivs->entries = ggc_alloc (5 * sizeof (initial_value_pair)); - cfun->hard_reg_initial_vals = ivs; + crtl->hard_reg_initial_vals = ivs; } if (ivs->num_entries >= ivs->max_entries) @@ -268,7 +268,7 @@ has_hard_reg_initial_val (enum machine_mode mode, unsigned int regno) struct initial_value_struct *ivs; int i; - ivs = cfun->hard_reg_initial_vals; + ivs = crtl->hard_reg_initial_vals; if (ivs != 0) for (i = 0; i < ivs->num_entries; i++) if (GET_MODE (ivs->entries[i].hard_reg) == mode @@ -281,7 +281,7 @@ has_hard_reg_initial_val (enum machine_mode mode, unsigned int regno) unsigned int emit_initial_value_sets (void) { - struct initial_value_struct *ivs = cfun->hard_reg_initial_vals; + struct initial_value_struct *ivs = crtl->hard_reg_initial_vals; int i; rtx seq; @@ -324,7 +324,7 @@ allocate_initial_values (rtx *reg_equiv_memory_loc) { if (targetm.allocate_initial_value) { - struct initial_value_struct *ivs = cfun->hard_reg_initial_vals; + struct initial_value_struct *ivs = crtl->hard_reg_initial_vals; int i; if (ivs == 0) diff --git a/gcc/integrate.h b/gcc/integrate.h index c074047084d..9651a997469 100644 --- a/gcc/integrate.h +++ b/gcc/integrate.h @@ -24,7 +24,7 @@ extern rtx get_hard_reg_initial_val (enum machine_mode, unsigned int); extern rtx has_hard_reg_initial_val (enum machine_mode, unsigned int); /* If a pseudo represents an initial hard reg (or expression), return it, else return NULL_RTX. */ -extern rtx get_hard_reg_initial_reg (struct function *, rtx); +extern rtx get_hard_reg_initial_reg (rtx); /* Called from rest_of_compilation. */ extern unsigned int emit_initial_value_sets (void); extern void allocate_initial_values (rtx *); diff --git a/gcc/local-alloc.c b/gcc/local-alloc.c index 0d6d908581a..33e5a297c1d 100644 --- a/gcc/local-alloc.c +++ b/gcc/local-alloc.c @@ -1415,7 +1415,7 @@ block_alloc (int b) /* Avoid making a call-saved register unnecessarily clobbered. */ - hard_reg = get_hard_reg_initial_reg (cfun, r1); + hard_reg = get_hard_reg_initial_reg (r1); if (hard_reg != NULL_RTX) { if (REG_P (hard_reg) diff --git a/gcc/loop-invariant.c b/gcc/loop-invariant.c index 64c16a98423..f043884b15a 100644 --- a/gcc/loop-invariant.c +++ b/gcc/loop-invariant.c @@ -1,5 +1,5 @@ /* RTL-level loop invariant motion. - Copyright (C) 2004, 2005, 2006, 2007 Free Software Foundation, Inc. + Copyright (C) 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. This file is part of GCC. @@ -1193,7 +1193,7 @@ move_invariant_reg (struct loop *loop, unsigned invno) need to create a temporary register. */ set = single_set (inv->insn); dest = SET_DEST (set); - reg = gen_reg_rtx (GET_MODE (dest)); + reg = gen_reg_rtx_and_attrs (dest); /* Try replacing the destination by a new pseudoregister. */ if (!validate_change (inv->insn, &SET_DEST (set), reg, false)) diff --git a/gcc/print-tree.c b/gcc/print-tree.c index 889f1c5f511..f7097a415d4 100644 --- a/gcc/print-tree.c +++ b/gcc/print-tree.c @@ -565,9 +565,6 @@ print_node (FILE *file, const char *prefix, tree node, int indent) else if (TREE_CODE (node) == INTEGER_TYPE && TYPE_IS_SIZETYPE (node)) fputs (" sizetype", file); - else if (TREE_CODE (node) == FUNCTION_TYPE - && TYPE_RETURNS_STACK_DEPRESSED (node)) - fputs (" returns-stack-depressed", file); if (TYPE_STRING_FLAG (node)) fputs (" string-flag", file); diff --git a/gcc/reload.c b/gcc/reload.c index d880097a164..0492ee8cc64 100644 --- a/gcc/reload.c +++ b/gcc/reload.c @@ -454,6 +454,8 @@ push_secondary_reload (int in_p, rtx x, int opnum, int optional, if (MERGE_TO_OTHER (secondary_type, rld[s_reload].when_needed, opnum, rld[s_reload].opnum)) rld[s_reload].when_needed = RELOAD_OTHER; + + break; } if (s_reload == n_reloads) diff --git a/gcc/resource.c b/gcc/resource.c index d7e3339aa90..05308491f61 100644 --- a/gcc/resource.c +++ b/gcc/resource.c @@ -1150,8 +1150,8 @@ init_resource_info (rtx epilogue_insn) else SET_HARD_REG_BIT (end_of_function_needs.regs, STACK_POINTER_REGNUM); - if (current_function_return_rtx != 0) - mark_referenced_resources (current_function_return_rtx, + if (crtl->return_rtx != 0) + mark_referenced_resources (crtl->return_rtx, &end_of_function_needs, 1); for (i = 0; i < FIRST_PSEUDO_REGISTER; i++) diff --git a/gcc/rtl.h b/gcc/rtl.h index 604d0967895..aaa1a925a9d 100644 --- a/gcc/rtl.h +++ b/gcc/rtl.h @@ -1502,6 +1502,7 @@ extern rtvec gen_rtvec_v (int, rtx *); extern rtx gen_reg_rtx (enum machine_mode); extern rtx gen_rtx_REG_offset (rtx, enum machine_mode, unsigned int, int); extern rtx gen_reg_rtx_offset (rtx, enum machine_mode, int); +extern rtx gen_reg_rtx_and_attrs (rtx); extern rtx gen_label_rtx (void); extern rtx gen_lowpart_common (enum machine_mode, rtx); diff --git a/gcc/rtlanal.c b/gcc/rtlanal.c index 804d6c88e5c..93833a3e951 100644 --- a/gcc/rtlanal.c +++ b/gcc/rtlanal.c @@ -1,6 +1,6 @@ /* Analyze RTL for GNU compiler. Copyright (C) 1987, 1988, 1992, 1993, 1994, 1995, 1996, 1997, 1998, - 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 Free Software + 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. This file is part of GCC. diff --git a/gcc/system.h b/gcc/system.h index 682d4541257..22f3d0dc8d9 100644 --- a/gcc/system.h +++ b/gcc/system.h @@ -811,7 +811,7 @@ extern void fancy_abort (const char *, int, const char *) ATTRIBUTE_NORETURN; #pragma GCC diagnostic warning "-Wcast-qual" /* If asserts are disabled, activate -Wuninitialized as a warning (not an error/-Werror). */ -#ifndef ASSERT_CHECKING +#ifndef ENABLE_ASSERT_CHECKING #pragma GCC diagnostic warning "-Wuninitialized" #endif #endif diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 08e354548bb..8af67f7b0b7 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,235 @@ +2008-04-14 Samuel Tardieu <sam@rfc1149.net> + + PR ada/18680 + * gnat.dg/specs/linker_section.ads: New. + +2008-04-14 Samuel Tardieu <sam@rfc1149.net> + + PR ada/16098 + * gnat.dg/specs/renamings.ads: New. + +2008-04-14 Samuel Tardieu <sam@rfc1149.net> + + PR ada/15915 + * gnat.dg/specs/storage.ads: New. + +2008-04-14 Samuel Tardieu <sam@rfc1149.net> + + * gnat.dg/deep_old.adb: New. + +2008-04-14 Eric Botcazou <ebotcazou@adacore.com> + + * gnat.dg/loop_address2.adb: New test. + +2008-04-13 Jerry DeLisle <jvdelisle@gcc.gnu.org> + + PR fortran/35882 + * gfortran.dg/continuation_3.f90: Update test. + * gfortran.dg/continuation_5.f: Update test. + * gfortran.dg/continuation_10.f90: New test. + +2008-04-13 Thomas Koenig <tkoenig@gcc.gnu.org> + + PR libfortran/32972 + PR libfortran/32512 + * gfortran.dg/internal_pack_1.f90: Add test for derived type. + * gfortran.dg/intrinsic_spread_1.f90: Likewise. + * gfortran.dg/intrinsic_pack_1.f90: Likewise. + * gfortran.dg/intrinsic_unpack_1.f90: Likewise. + +2008-04-13 Samuel Tardieu <sam@rfc1149.net> + + PR ada/17985 + * gnat.dg/ancestor_type.ads, gnat.dg/ancestor_type.adb: New test. + +2008-04-12 Andrew Pinski <pinskia@gmail.com> + + * gcc.target/powerpc/darwin-save-world-1.c: New test. + +2008-04-11 Richard Guenther <rguenther@suse.de> + + PR tree-optimization/35869 + * gcc.c-torture/compile/pr35869.c: New testcase. + +2008-04-11 H.J. Lu <hongjiu.lu@intel.com> + + * gcc.target/i386/sse-13.c: Move __builtin_ia32_round* to new + /* mmintrin-common.h */ section. + + * gcc.target/i386/sse-14.c: Add tests for mmintrin-common.h. + +2008-04-11 Volker Reichelt <v.reichelt@netcologne.de> + + PR c/35744 + * gcc.dg/attr-error-1.c: New test. + +2008-04-10 Adam Nemet <anemet@caviumnetworks.com> + + * gcc.target/mips/scc-2.c: New test. + * gcc.target/mips/scc-3.c: New test. + * gcc.target/mips/scc-4.c: New test. + +2008-04-10 Ira Rosen <irar@il.ibm.com> + + PR tree-optimization/35821 + * gcc.dg/vect/pr35821-altivec.c: New. + * gcc.dg/vect/pr35821-spu.c: New. + +2008-04-09 Andy Hutchinson <hutchinsonandy@aim.com> + + PR testsuite/34894 + PR testsuite/33782 + * lib/target-supports.dg: Add check_effective_target_trampolines. + Disable profiling for avr-*-*. + * gcc.c-torture/compile/pr27889.c: dg-requires trampolines. + * gcc.c-torture/compile/nested-1.c: Ditto. + * gcc.c-torture/compile/20050122-2.c: Ditto. + * gcc.c-torture/compile/20010226-1.c: Ditto. + * gcc.c-torture/compile/20010327-1.c: Skip for avr-*-*. + * gcc.c-torture/compile/980506-1.c: Ditto. + * gcc.c-torture/compile/20020604-1.c: Ditto. + * gcc.c-torture/compile/limits-stringlit.c: Ditto + * gcc.c-torture/compile/20001226-1.c: Ditto + +2008-04-09 Jason Merrill <jason@redhat.com> + + PR c++/35708 + * g++.dg/ext/complit9.C: New. + +2008-04-09 Samuel Tardieu <sam@rfc1149.net> + + PR ada/28305 + * gnat.dg/specs/fe_inlining.ads, gnat.dg/specs/fe_inlining_helper.ads, + gnat.dg/specs/fe_inlining_helper.adb: New test. + +2008-04-09 Kai Tietz <kai.tietz@onevision.com> + + * gcc.dg/torture/fp-int-convert.h: Use TImode type for + x86_64-pc-mingw target. + * gcc.dg/titype-1.c: Likewise. + +2008-04-09 Richard Sandiford <richard@codesourcery.com> + + * lib/target-supports.exp (check_effective_target_vxworks_kernel): + Fix comment. + (check_effective_target_vxworks_rtp): New procedure. + * g++.dg/opt/20050511-1.C: Rename UINT32 for VxWorks kernel mode. + * g++.dg/warn/miss-format-1.C: XFAIL for VxWorks. + * g++.old-deja/g++.abi/cxa_vec.C: XFAIL for VxWorks kernels. + * g++.old-deja/g++.brendan/new3.C: Likewise. + * g++.old-deja/g++.eh/badalloc1.C: XFAIL for VxWorks RTPs. + * g++.old-deja/g++.law/missed-error2.C: Undefine max for + VxWorks kernel mode. + * g++.old-deja/g++.mike/init1.C: XFAIL for VxWorks kernel mode. + * g++.old-deja/g++.mike/p2736.C: Likewise. + * g++.old-deja/g++.mike/p658.C: Undefine OK for VxWorks kernel mode. + * g++.old-deja/g++.other/headers1.C: Likewise min and max. + * g++.old-deja/g++.robertl/eb79.C: Undefine max for VxWorks + kernel mode. + +2008-04-09 Jakub Jelinek <jakub@redhat.com> + + * gfortran.dg/namelist_47.f90: New test. + +2008-04-09 Richard Guenther <rguenther@suse.de> + + * gfortran.dg/bind_c_usage_14.f03: Adjust. + +2008-04-08 Andy Hutchinson <hutchinsonandy@aim.com> + + PR target/35005 + * execute/20071221-1.c: Adapt test for 16 bit int targets. + * execute/pr35163.c: Ditto. + +2008-04-08 Richard Guenther <rguenther@suse.de> + + * gcc.c-torture/execute/20080408-1.c: New testcase. + +2008-04-08 Eric Botcazou <ebotcazou@adacore.com> + + * gnat.dg/pack6.adb: New test. + * gnat.dg/pack7.adb: Likewise. + * gnat.dg/pack8.adb: Likewise. + +2008-04-08 Arnaud Charlet <charlet@adacore.com> + + * gnat.dg/parent_ltd_with-child_full_view.adb: New test. + * gnat.dg/rt1.adb: New test. + * gnat.dg/test_time_stamp.adb: New test. + * gnat.dg/specs/warn_star.ads: New test. + * gnat.dg/specs/aggr1.ads: New test. + +2008-04-07 Jerry DeLisle <jvdelisle@gcc.gnu.org> + + PR fortran/25829 28655 + * gfortran.dg/write_check2.f90: Update dg-error. + * gfortran.dg/io_constraints_1.f90: Udate dg-error. + +2008-04-07 Jason Merrill <jason@redhat.com> + + PR c++/35734 + * g++.dg/warn/ctor1.C: New. + +2008-04-07 Kai Tietz <kai.tietz@onevision.com> + + PR/35842 + * gcc.dg/torture/pr35842.c: New. + +2008-04-07 Eric Botcazou <ebotcazou@adacore.com> + + * gnat.dg/array4.adb: New test. + * gnat.dg/specs/static_initializer2.ads: Likewise. + +2008-04-06 Richard Guenther <rguenther@suse.de> + + PR tree-optimization/35400 + * gcc.dg/torture/pr35400.c: New testcase. + * g++.dg/torture/pr35400.C: Likewise. + +2008-04-06 Paul Thomas <pault@gcc.gnu.org> + + PR fortran/35780 + * gfortran.dg/simplify_argN_1.f90: New test. + +2008-04-06 Tobias Schl�ter <tobi@gcc.gnu.org> + + PR fortran/35832 + * gfortran.dg/io_constraints_2.f90: Adapt to new error message. + +2008-04-06 Tobias Burnus <burnus@net-b.de> + + * gfortran.dg/f2003_io_1.f03: Make standard conform. + * gfortran.dg/f2003_io_8.f03: New. + +2008-04-06 Eric Botcazou <ebotcazou@adacore.com> + + * gnat.dg/pack5.adb: New test. + +2008-04-06 Uros Bizjak <ubizjak@gmail.com> + + PR target/12329 + * gcc.target/i386/pr12329.c: New test. + +2008-04-05 Eric Botcazou <ebotcazou@adacore.com> + + * gnat.dg/pr35823.adb: Rename to size_attribute.adb. + +2008-04-05 Jerry DeLisle <jvdelisle@gcc.gnu.org> + + PR fortran/25829 28655 + * gfortran.dg/f2003_io_1.f03: New test. + * gfortran.dg/f2003_io_2.f03: New test. + * gfortran.dg/f2003_io_3.f03: New test. + * gfortran.dg/f2003_io_4.f03: New test. + * gfortran.dg/f2003_io_5.f03: New test. + * gfortran.dg/f2003_io_6.f03: New test. + * gfortran.dg/f2003_io_7.f03: New test. + +2008-04-05 Richard Guenther <rguenther@suse.de> + + PR tree-optimization/35833 + * gcc.dg/torture/pr35833.c: New testcase. + 2008-04-04 Naveen.H.S <naveen.hs@kpitcummins.com> * gcc.target/sh/sh2a-band.c: New test. @@ -143,12 +375,12 @@ * lib/gfortran-dg.exp: New harness to compile Fortran progs with all combinations of debug options available on target. - * gfortran.dg/debug/debug.exp: Ditto. - * gfortran.dg/debug/trivial.f: Ditto. - * gfortran.dg/debug/pr35154-stabs.f: New test case for - .stabs functionality. - * gfortran.dg/debug/pr35154-dwarf2.f: New test case for - DWARF functionality. + * gfortran.dg/debug/debug.exp: Ditto. + * gfortran.dg/debug/trivial.f: Ditto. + * gfortran.dg/debug/pr35154-stabs.f: New test case for + .stabs functionality. + * gfortran.dg/debug/pr35154-dwarf2.f: New test case for + DWARF functionality. 2008-04-01 Volker Reichelt <v.reichelt@netcologne.de> diff --git a/gcc/testsuite/g++.dg/ext/complit9.C b/gcc/testsuite/g++.dg/ext/complit9.C new file mode 100644 index 00000000000..5b7fbe75cd8 --- /dev/null +++ b/gcc/testsuite/g++.dg/ext/complit9.C @@ -0,0 +1,15 @@ +// PR c++/35708 +// { dg-options "" } + +struct object { int one_o; int allocstamp; }; +int pgci_pointable (object obj); +void foo(void); +int main (int argc, char *argv[]) +{ + if (pgci_pointable((object){7,100})) + { + bad_rehash_size: + foo(); + } + goto bad_rehash_size; +} diff --git a/gcc/testsuite/g++.dg/opt/20050511-1.C b/gcc/testsuite/g++.dg/opt/20050511-1.C index 2fbd3e1be5e..a8929030af4 100644 --- a/gcc/testsuite/g++.dg/opt/20050511-1.C +++ b/gcc/testsuite/g++.dg/opt/20050511-1.C @@ -4,6 +4,11 @@ #include <stdio.h> #include <stdlib.h> +// The VxWorks kernel headers define their own UINT32 +#if defined __vxworks && !defined __RTP__ +#define UINT32 my_UINT32 +#endif + typedef signed short SINT16 ; typedef unsigned long UINT32 ; typedef unsigned int UINT ; diff --git a/gcc/testsuite/g++.dg/torture/pr35400.C b/gcc/testsuite/g++.dg/torture/pr35400.C new file mode 100644 index 00000000000..021135df813 --- /dev/null +++ b/gcc/testsuite/g++.dg/torture/pr35400.C @@ -0,0 +1,13 @@ +/* { dg-do compile } */ +/* { dg-options "-Wtype-limits" } */ + +struct A +{ + A(); + ~A(); +}; + +void foo() +{ + A x[1]; +} diff --git a/gcc/testsuite/g++.dg/warn/ctor1.C b/gcc/testsuite/g++.dg/warn/ctor1.C new file mode 100644 index 00000000000..00a6c952b64 --- /dev/null +++ b/gcc/testsuite/g++.dg/warn/ctor1.C @@ -0,0 +1,13 @@ +// PR c++/35734 +// { dg-options "-W" } + +struct A +{ + A(); + template<typename T> A(const T&); +}; + +struct B : A +{ + B(const B&) {} // { dg-warning "base class" } +}; diff --git a/gcc/testsuite/g++.dg/warn/miss-format-1.C b/gcc/testsuite/g++.dg/warn/miss-format-1.C index 56a5c7b1383..ec9dbc1c3bd 100644 --- a/gcc/testsuite/g++.dg/warn/miss-format-1.C +++ b/gcc/testsuite/g++.dg/warn/miss-format-1.C @@ -2,7 +2,8 @@ /* Origin: Joseph Myers <jsm28@cam.ac.uk> */ /* { dg-do compile } */ /* { dg-options "-Wmissing-format-attribute" } */ -/* { dg-error "not declared" "" { target *-*-solaris2.5.1 *-*-solaris2.[5-8] } 24 } */ +/* VxWorks does not provide vscanf, either in kernel or RTP mode. */ +/* { dg-error "not declared" "" { target *-*-solaris2.5.1 *-*-solaris2.[5-8] *-*-vxworks* } 25 } */ #include <stdio.h> #include <stdarg.h> @@ -21,7 +22,7 @@ bar (const char *fmt, ...) { va_list ap; va_start (ap, fmt); - vscanf (fmt, ap); /* { dg-warning "candidate" "scanf attribute warning" { xfail *-*-solaris2.5.1 *-*-solaris2.[5-8] } } */ + vscanf (fmt, ap); /* { dg-warning "candidate" "scanf attribute warning" { xfail *-*-solaris2.5.1 *-*-solaris2.[5-8] *-*-vxworks* } } */ va_end (ap); } diff --git a/gcc/testsuite/g++.old-deja/g++.abi/cxa_vec.C b/gcc/testsuite/g++.old-deja/g++.abi/cxa_vec.C index 7be9185638b..5370fb8981d 100644 --- a/gcc/testsuite/g++.old-deja/g++.abi/cxa_vec.C +++ b/gcc/testsuite/g++.old-deja/g++.abi/cxa_vec.C @@ -1,4 +1,9 @@ -// { dg-do run { xfail powerpc-ibm-aix* } } +// This test fails on VxWorks in kernel mode because it depends on the +// library version of "::operator new[]" calling the "::operator new" +// defined in this module. This doesn't work because the library version +// of "::operator new[]" is built into the kernel itself; library relocations +// are resolved when the kernel is linked. +// { dg-do run { xfail { powerpc-ibm-aix* || vxworks_kernel } } } // { dg-options "-flat_namespace" { target *-*-darwin[67]* } } // Test __cxa_vec routines // Copyright (C) 2000, 2005 Free Software Foundation, Inc. diff --git a/gcc/testsuite/g++.old-deja/g++.brendan/new3.C b/gcc/testsuite/g++.old-deja/g++.brendan/new3.C index b5bfb4a83b0..791d00bac96 100644 --- a/gcc/testsuite/g++.old-deja/g++.brendan/new3.C +++ b/gcc/testsuite/g++.old-deja/g++.brendan/new3.C @@ -1,4 +1,9 @@ -// { dg-do run { xfail powerpc-ibm-aix* } } +// This test fails on VxWorks in kernel mode because it depends on the +// library version of "::operator new[]" calling the "::operator new" +// defined in this module. This doesn't work because the library version +// of "::operator new[]" is built into the kernel itself; library relocations +// are resolved when the kernel is linked. +// { dg-do run { xfail { powerpc-ibm-aix* || vxworks_kernel } } } // { dg-options "-flat_namespace" { target *-*-darwin[67]* } } // GROUPS passed operator-new #include <stdio.h> diff --git a/gcc/testsuite/g++.old-deja/g++.eh/badalloc1.C b/gcc/testsuite/g++.old-deja/g++.eh/badalloc1.C index 3c9941d65c8..b2e7f62b9b3 100644 --- a/gcc/testsuite/g++.old-deja/g++.eh/badalloc1.C +++ b/gcc/testsuite/g++.old-deja/g++.eh/badalloc1.C @@ -1,4 +1,8 @@ -// { dg-do run { xfail xstormy16-*-* *-*-darwin[1-7]* } } +// This fails for VxWorks RTPs because the initialization of +// __cxa_allocate_exception's emergency buffer mutex will +// itself call malloc(), and will fail if there is no more +// memory available. +// { dg-do run { xfail { { xstormy16-*-* *-*-darwin[1-7]* } || vxworks_rtp } } } // Copyright (C) 2000, 2002, 2003 Free Software Foundation, Inc. // Contributed by Nathan Sidwell 6 June 2000 <nathan@codesourcery.com> diff --git a/gcc/testsuite/g++.old-deja/g++.law/missed-error2.C b/gcc/testsuite/g++.old-deja/g++.law/missed-error2.C index d9d6195dfe8..a26f456f20a 100644 --- a/gcc/testsuite/g++.old-deja/g++.law/missed-error2.C +++ b/gcc/testsuite/g++.old-deja/g++.law/missed-error2.C @@ -8,6 +8,12 @@ #include <iostream> +// The VxWorks kernel-mode headers define a macro named "max", which is not +// ISO-compliant, but is part of the VxWorks API. +#if defined __vxworks && !defined __RTP__ +#undef max +#endif + inline int max(int a, int b) {return a > b ? a : b;}; // { dg-error "" } candidate inline double max(double a, double b) {return a > b ? a : b;}; // { dg-error "" } candidate diff --git a/gcc/testsuite/g++.old-deja/g++.mike/init1.C b/gcc/testsuite/g++.old-deja/g++.mike/init1.C index 0b47fb7e705..5bc1ea4a9ac 100644 --- a/gcc/testsuite/g++.old-deja/g++.mike/init1.C +++ b/gcc/testsuite/g++.old-deja/g++.mike/init1.C @@ -1,4 +1,6 @@ -// { dg-do run } +// The VxWorks kernel has no implementation of atexit, so local statics +// are never destroyed. +// { dg-do run { xfail vxworks_kernel } } int count; extern "C" void _exit(int); diff --git a/gcc/testsuite/g++.old-deja/g++.mike/p2736.C b/gcc/testsuite/g++.old-deja/g++.mike/p2736.C index a0a8b314338..6ae61e89260 100644 --- a/gcc/testsuite/g++.old-deja/g++.mike/p2736.C +++ b/gcc/testsuite/g++.old-deja/g++.mike/p2736.C @@ -1,4 +1,6 @@ -// { dg-do run } +// The VxWorks kernel has no implementation of atexit, so local statics +// are never destroyed. +// { dg-do run { xfail vxworks_kernel } } // This is a poor test case, it is meant to ensure that function local // statics are destroyed at the right time. See PR 2736 for details. // prms-id: 2736 diff --git a/gcc/testsuite/g++.old-deja/g++.mike/p658.C b/gcc/testsuite/g++.old-deja/g++.mike/p658.C index 1a4fefddc07..8fc7cd51b2b 100644 --- a/gcc/testsuite/g++.old-deja/g++.mike/p658.C +++ b/gcc/testsuite/g++.old-deja/g++.mike/p658.C @@ -12,6 +12,12 @@ #define TRUE true #endif +// The VxWorks kernel-mode headers define a macro named "OK", which is not +// ISO-compliant, but is part of the VxWorks API. +#if defined __vxworks && !defined __RTP__ +#undef OK +#endif + class Object { public: Object(); diff --git a/gcc/testsuite/g++.old-deja/g++.other/headers1.C b/gcc/testsuite/g++.old-deja/g++.other/headers1.C index 31de3558f1e..1080fe38c8a 100644 --- a/gcc/testsuite/g++.old-deja/g++.other/headers1.C +++ b/gcc/testsuite/g++.old-deja/g++.other/headers1.C @@ -44,6 +44,12 @@ #include <string> #include <typeinfo> #include <utility> +// The VxWorks kernel-mode headers define macros named "max" and +// "min", which is not ISO-compliant, but is part of the VxWorks API. +#if defined __vxworks && !defined __RTP__ +#undef max +#undef min +#endif #include <valarray> #include <vector> diff --git a/gcc/testsuite/g++.old-deja/g++.robertl/eb79.C b/gcc/testsuite/g++.old-deja/g++.robertl/eb79.C index e5905ffbec0..8d1c94d168f 100644 --- a/gcc/testsuite/g++.old-deja/g++.robertl/eb79.C +++ b/gcc/testsuite/g++.old-deja/g++.robertl/eb79.C @@ -2,6 +2,12 @@ // Makes bogus x86 assembly code. #include <iostream> +// The VxWorks kernel-mode headers define a macro named "max", which is not +// ISO-compliant, but is part of the VxWorks API. +#if defined __vxworks && !defined __RTP__ +#undef max +#endif + using namespace std; template<class T> diff --git a/gcc/testsuite/gcc.c-torture/compile/20001226-1.c b/gcc/testsuite/gcc.c-torture/compile/20001226-1.c index ddea0aa0bdf..cfcf546e157 100644 --- a/gcc/testsuite/gcc.c-torture/compile/20001226-1.c +++ b/gcc/testsuite/gcc.c-torture/compile/20001226-1.c @@ -2,6 +2,7 @@ than 64K. */ /* { dg-do assemble } */ /* { dg-xfail-if "function larger than 64K" { m6811-*-* } { "*" } { "" } } */ +/* { dg-skip-if "too much code for avr" { "avr-*-*" } { "*" } { "" } } */ /* { dg-xfail-if "jump beyond 128K not supported" { xtensa-*-* } { "-O0" } { "" } } */ /* { dg-skip-if "" { m32c-*-* } { "*" } { "" } } */ diff --git a/gcc/testsuite/gcc.c-torture/compile/20010226-1.c b/gcc/testsuite/gcc.c-torture/compile/20010226-1.c index c06be53dc52..f25b48390d5 100644 --- a/gcc/testsuite/gcc.c-torture/compile/20010226-1.c +++ b/gcc/testsuite/gcc.c-torture/compile/20010226-1.c @@ -1,3 +1,5 @@ +/* { dg-require-effective-target trampolines } */ + void f1 (void *); void f3 (void *, void (*)(void *)); void f2 (void *); diff --git a/gcc/testsuite/gcc.c-torture/compile/20010327-1.c b/gcc/testsuite/gcc.c-torture/compile/20010327-1.c index 189990ade3f..59639e6ed96 100644 --- a/gcc/testsuite/gcc.c-torture/compile/20010327-1.c +++ b/gcc/testsuite/gcc.c-torture/compile/20010327-1.c @@ -1,4 +1,5 @@ /* { dg-skip-if "non-SI pointers" { m32c-*-* } { "*" } { "" } } */ +/* { dg-skip-if "HI mode pointer for avr" { "avr-*-*" } { "*" } { "" } } */ /* This testcase tests whether GCC can produce static initialized data that references addresses of size 'unsigned long', even if that's not diff --git a/gcc/testsuite/gcc.c-torture/compile/20020604-1.c b/gcc/testsuite/gcc.c-torture/compile/20020604-1.c index 539b9f5b27f..17b9b2165ba 100644 --- a/gcc/testsuite/gcc.c-torture/compile/20020604-1.c +++ b/gcc/testsuite/gcc.c-torture/compile/20020604-1.c @@ -1,5 +1,6 @@ /* { dg-do assemble } */ /* { dg-xfail-if "The array is too big" { "m6811-*-* m6812-*-*" } { "*" } { "" } } */ +/* { dg-skip-if "The array is too big" { "avr-*-*" } { "*" } { "" } } */ /* { dg-xfail-if "The array too big" { "h8300-*-*" } { "-mno-h" "-mn" } { "" } } */ /* { dg-skip-if "" { m32c-*-* } { } { } } */ diff --git a/gcc/testsuite/gcc.c-torture/compile/20050122-2.c b/gcc/testsuite/gcc.c-torture/compile/20050122-2.c index d73f6243ddd..1e297be8cb6 100644 --- a/gcc/testsuite/gcc.c-torture/compile/20050122-2.c +++ b/gcc/testsuite/gcc.c-torture/compile/20050122-2.c @@ -1,4 +1,6 @@ /* Related to PR 19484. */ +/* { dg-require-effective-target trampolines } */ + extern void foo (void) __attribute__((noreturn)); int n; diff --git a/gcc/testsuite/gcc.c-torture/compile/980506-1.c b/gcc/testsuite/gcc.c-torture/compile/980506-1.c index 619e18d05e4..5c22e7e508f 100644 --- a/gcc/testsuite/gcc.c-torture/compile/980506-1.c +++ b/gcc/testsuite/gcc.c-torture/compile/980506-1.c @@ -2,6 +2,7 @@ /* { dg-do assemble } */ /* { dg-require-effective-target size32plus } */ /* { dg-xfail-if "The array too big" { m6811-*-* m6812-*-* } { "*" } { "" } } /* +/* { dg-skip-if "Array too big" { "avr-*-*" } { "*" } { "" } } */ /* { dg-xfail-if "The array too big" { h8300-*-* } { "-mno-h" "-mn" } { "" } } */ unsigned char TIFFFax2DMode[20][256]; diff --git a/gcc/testsuite/gcc.c-torture/compile/limits-stringlit.c b/gcc/testsuite/gcc.c-torture/compile/limits-stringlit.c index 22dc19b3c6e..5b52c83b061 100644 --- a/gcc/testsuite/gcc.c-torture/compile/limits-stringlit.c +++ b/gcc/testsuite/gcc.c-torture/compile/limits-stringlit.c @@ -1,3 +1,5 @@ +/* { dg-skip-if "Array too big" { "avr-*-*" } { "*" } { "" } } */ + #define STR2 "012345678901234567890123456789012345678901234567890123456789\ 0123456789012345678901234567890123456789" #define STR3 STR2 STR2 STR2 STR2 STR2 STR2 STR2 STR2 STR2 STR2 diff --git a/gcc/testsuite/gcc.c-torture/compile/nested-1.c b/gcc/testsuite/gcc.c-torture/compile/nested-1.c index b6aa79d77aa..135538a8524 100644 --- a/gcc/testsuite/gcc.c-torture/compile/nested-1.c +++ b/gcc/testsuite/gcc.c-torture/compile/nested-1.c @@ -1,3 +1,5 @@ +/* { dg-require-effective-target trampolines } */ + typedef __SIZE_TYPE__ size_t; extern int printf (const char *, ...); extern void *memset (void *, int, size_t); diff --git a/gcc/testsuite/gcc.c-torture/compile/pr27889.c b/gcc/testsuite/gcc.c-torture/compile/pr27889.c index ca50fce707d..4e76caa5663 100644 --- a/gcc/testsuite/gcc.c-torture/compile/pr27889.c +++ b/gcc/testsuite/gcc.c-torture/compile/pr27889.c @@ -1,3 +1,5 @@ +/* { dg-require-effective-target trampolines } */ + void h(void (*)(void)); _Complex int g (void) { diff --git a/gcc/testsuite/gcc.c-torture/compile/pr35869.c b/gcc/testsuite/gcc.c-torture/compile/pr35869.c new file mode 100644 index 00000000000..e83c0e86bed --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr35869.c @@ -0,0 +1,47 @@ +struct texture_stage_op +{ + unsigned int carg1, carg2, carg0; + unsigned int aarg1, aarg2, aarg0; + unsigned int dst; +}; + +static const char *debug_register(unsigned int reg) { + switch(reg) { + case 0x8921: return "GL_REG_0_ATI"; + case 0x8923: return "GL_REG_2_ATI"; + case 0x0: return "GL_ZERO"; + case 0x1: return "GL_ONE"; + default: return "Unknown register\n"; + } +} + +static unsigned int find_tmpreg(struct texture_stage_op op[8]) { + int i; + int tex_used[8]; + + for(i = 0; i < 8; i++) { + if(op[i].carg1 == 0x00000002 ) { + tex_used[i] = 1; + } + } + + for(i = 1; i < 6; i++) { + if(!tex_used[i]) { + return 0x8921 + i; + } + } + return 0; +} + +extern f(const char*); + +void g() { + struct texture_stage_op op[8]; + unsigned int tmparg = find_tmpreg(op); + unsigned int dstreg; + + if(tmparg == 0x0) return; + dstreg = tmparg; + f(debug_register(dstreg)); + return; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20071211-1.c b/gcc/testsuite/gcc.c-torture/execute/20071211-1.c index f3786a2f407..4a4f1fefc90 100644 --- a/gcc/testsuite/gcc.c-torture/execute/20071211-1.c +++ b/gcc/testsuite/gcc.c-torture/execute/20071211-1.c @@ -3,7 +3,11 @@ extern void abort() __attribute__ ((noreturn)); struct s { unsigned long long f1 : 40; +#if(__SIZEOF_INT__ >= 4) unsigned int f2 : 24; +#else + unsigned long int f2 : 24; +#endif } sv; int main() diff --git a/gcc/testsuite/gcc.c-torture/execute/20080408-1.c b/gcc/testsuite/gcc.c-torture/execute/20080408-1.c new file mode 100644 index 00000000000..9e1ff639517 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20080408-1.c @@ -0,0 +1,11 @@ +extern void abort (void); +int main () +{ + short ssi = 126; + unsigned short usi = 65280; + int fail = !(ssi < usi); + if (fail) + abort (); + return 0; +} + diff --git a/gcc/testsuite/gcc.c-torture/execute/pr35163.c b/gcc/testsuite/gcc.c-torture/execute/pr35163.c index 4950d6d2027..93b180d5d82 100644 --- a/gcc/testsuite/gcc.c-torture/execute/pr35163.c +++ b/gcc/testsuite/gcc.c-torture/execute/pr35163.c @@ -4,7 +4,11 @@ int main() { signed char a = -30; signed char b = -31; + #if(__SIZEOF_INT__ >= 4) if (a > (unsigned short)b) +#else + if ((long) a > (unsigned short)b) +#endif abort (); return 0; } diff --git a/gcc/testsuite/gcc.dg/attr-error-1.c b/gcc/testsuite/gcc.dg/attr-error-1.c new file mode 100644 index 00000000000..c136484a151 --- /dev/null +++ b/gcc/testsuite/gcc.dg/attr-error-1.c @@ -0,0 +1,12 @@ +/* PR c/35744 */ + +typedef char a[N] __attribute__((aligned(4))); /* { dg-error "undeclared" } */ + +void c[1] __attribute__((vector_size(8))); /* { dg-error "array of voids" } */ + +void b[1] __attribute__((may_alias)); /* { dg-error "array of voids" } */ + +struct A +{ + void d[1] __attribute__((packed)); /* { dg-error "array of voids" } */ +}; diff --git a/gcc/testsuite/gcc.dg/titype-1.c b/gcc/testsuite/gcc.dg/titype-1.c index 1d0c570dafa..31c01a681a3 100644 --- a/gcc/testsuite/gcc.dg/titype-1.c +++ b/gcc/testsuite/gcc.dg/titype-1.c @@ -1,7 +1,7 @@ /* { dg-do run } */ /* Not all platforms support TImode integers. */ -#if defined(__LP64__) && !defined(__hppa__) +#if (defined(__LP64__) && !defined(__hppa__)) || defined(_WIN64) typedef int TItype __attribute__ ((mode (TI))); #else typedef long TItype; diff --git a/gcc/testsuite/gcc.dg/torture/fp-int-convert.h b/gcc/testsuite/gcc.dg/torture/fp-int-convert.h index c4cb5fbb2d3..8c1968e9be2 100644 --- a/gcc/testsuite/gcc.dg/torture/fp-int-convert.h +++ b/gcc/testsuite/gcc.dg/torture/fp-int-convert.h @@ -7,7 +7,7 @@ extern void exit (int); /* Not all platforms support TImode integers; logic as in gcc.dg/titype-1.c. */ -#if defined(__LP64__) && !defined(__hppa__) +#if (defined(__LP64__) && !defined(__hppa__)) || defined(_WIN64) typedef int TItype __attribute__ ((mode (TI))); typedef unsigned int UTItype __attribute__ ((mode (TI))); #else diff --git a/gcc/testsuite/gcc.dg/torture/pr35400.c b/gcc/testsuite/gcc.dg/torture/pr35400.c new file mode 100644 index 00000000000..285dc72e3a3 --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr35400.c @@ -0,0 +1,22 @@ +/* { dg-do compile } */ +/* { dg-options "-Wtype-limits" } */ + +struct A +{ + struct A *p; +}; + +int foo(const struct A *q) +{ + return q->p == q; +} + +void bar(int); + +void baz() +{ + struct A a; + + while (foo(&a)) + bar(foo(&a)); +} diff --git a/gcc/testsuite/gcc.dg/torture/pr35833.c b/gcc/testsuite/gcc.dg/torture/pr35833.c new file mode 100644 index 00000000000..2e740f29f84 --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr35833.c @@ -0,0 +1,22 @@ +/* { dg-do run } */ +/* { dg-options "-ftree-vrp" } */ + +struct S {struct S *field;}; +struct S True, False, Z; +static inline int f(void) {return 1;} +static inline int g(struct S **obj) { + return f() && *obj == &Z; +} +struct S **h(struct S **x) { + if (x) + return g(x) ? &True.field : &False.field; + else + return &True.field; +} +extern void abort (void); +int main() +{ + if (h(&False.field) != &False.field) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.dg/torture/pr35842.c b/gcc/testsuite/gcc.dg/torture/pr35842.c new file mode 100755 index 00000000000..05b26d84c11 --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr35842.c @@ -0,0 +1,12 @@ +/* { dg-do compile { target { *-*-mingw* } } } */ +extern __attribute__((dllimport)) const int SSL_ImplementedCiphers[]; +extern void SSL_GetCipherSuiteInfo(int cipherSuite); +void nsCipherInfo(int SSL_NumImplementedCiphers) +{ + int i; + for (i = 0; i < SSL_NumImplementedCiphers; ++i) + { + const int i_id = SSL_ImplementedCiphers[i]; + SSL_GetCipherSuiteInfo(i_id); + } +} diff --git a/gcc/testsuite/gcc.dg/vect/pr35821-altivec.c b/gcc/testsuite/gcc.dg/vect/pr35821-altivec.c new file mode 100644 index 00000000000..79fa926ec67 --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/pr35821-altivec.c @@ -0,0 +1,24 @@ +/* { dg-do compile { target { powerpc_altivec_ok } } } */ + +#include "altivec.h" + +void +foo (float f_gain1, int n_tail, float * __restrict__ f_in_hptr, + float * __restrict__ f_out_hptr) +{ + int i; + vector float *v_f_in_hptr, *v_f_out_hptr; + + f_in_hptr = ( float* )v_f_in_hptr; + f_out_hptr = ( float* )v_f_out_hptr; + + for( i = 0 ; i < n_tail ; i++ ) { + f_out_hptr[0] = f_in_hptr[0] * f_gain1; + f_in_hptr++; + f_out_hptr++; + } +} + +/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } } */ +/* { dg-final { cleanup-tree-dump "vect" } } */ + diff --git a/gcc/testsuite/gcc.dg/vect/pr35821-spu.c b/gcc/testsuite/gcc.dg/vect/pr35821-spu.c new file mode 100644 index 00000000000..4cc255f07ee --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/pr35821-spu.c @@ -0,0 +1,22 @@ +/* { dg-do compile { target { spu-*-* } } } */ + +void +foo (float f_gain1, int n_tail, float * __restrict__ f_in_hptr, + float * __restrict__ f_out_hptr) +{ + int i; + __attribute__((__spu_vector__)) float *v_f_in_hptr, *v_f_out_hptr; + + f_in_hptr = ( float* )v_f_in_hptr; + f_out_hptr = ( float* )v_f_out_hptr; + + for( i = 0 ; i < n_tail ; i++ ) { + f_out_hptr[0] = f_in_hptr[0] * f_gain1; + f_in_hptr++; + f_out_hptr++; + } +} + +/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } } */ +/* { dg-final { cleanup-tree-dump "vect" } } */ + diff --git a/gcc/testsuite/gcc.target/i386/pr12329.c b/gcc/testsuite/gcc.target/i386/pr12329.c new file mode 100644 index 00000000000..aeefeb0ce80 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr12329.c @@ -0,0 +1,15 @@ +/* { dg-do compile } */ +/* { dg-require-effective-target ilp32 } */ +/* { dg-options "-O2" } */ + +extern void abort (void); + +int test_nested (int i) +{ + int __attribute__ ((__noinline__, __regparm__(3))) foo(int j, int k, int l) + { /* { dg-error "nested functions are limited to 2 register parameters" } */ + return i + j + k + l; + } + + return foo (i, i+1, i+2); +} diff --git a/gcc/testsuite/gcc.target/i386/sse-13.c b/gcc/testsuite/gcc.target/i386/sse-13.c index aa6bc69e978..e3deeca3549 100644 --- a/gcc/testsuite/gcc.target/i386/sse-13.c +++ b/gcc/testsuite/gcc.target/i386/sse-13.c @@ -21,6 +21,12 @@ #define __builtin_ia32_aeskeygenassist128(X, C) __builtin_ia32_aeskeygenassist128(X, 1) #define __builtin_ia32_pclmulqdq128(X, Y, I) __builtin_ia32_pclmulqdq128(X, Y, 1) +/* mmintrin-common.h */ +#define __builtin_ia32_roundpd(V, M) __builtin_ia32_roundpd(V, 1) +#define __builtin_ia32_roundsd(D, V, M) __builtin_ia32_roundsd(D, V, 1) +#define __builtin_ia32_roundps(V, M) __builtin_ia32_roundps(V, 1) +#define __builtin_ia32_roundss(D, V, M) __builtin_ia32_roundss(D, V, 1) + /* smmintrin.h */ #define __builtin_ia32_pblendw128(X, Y, M) __builtin_ia32_pblendw128 (X, Y, 1) #define __builtin_ia32_blendps(X, Y, M) __builtin_ia32_blendps(X, Y, 1) @@ -35,10 +41,6 @@ #define __builtin_ia32_vec_ext_v16qi(X, N) __builtin_ia32_vec_ext_v16qi(X, 1) #define __builtin_ia32_vec_ext_v4si(X, N) __builtin_ia32_vec_ext_v4si(X, 1) #define __builtin_ia32_vec_ext_v2di(X, N) __builtin_ia32_vec_ext_v2di(X, 1) -#define __builtin_ia32_roundpd(V, M) __builtin_ia32_roundpd(V, 1) -#define __builtin_ia32_roundsd(D, V, M) __builtin_ia32_roundsd(D, V, 1) -#define __builtin_ia32_roundps(V, M) __builtin_ia32_roundps(V, 1) -#define __builtin_ia32_roundss(D, V, M) __builtin_ia32_roundss(D, V, 1) #define __builtin_ia32_mpsadbw128(X, Y, M) __builtin_ia32_mpsadbw128(X, Y, 1) #define __builtin_ia32_pcmpistrm128(X, Y, M) \ __builtin_ia32_pcmpistrm128(X, Y, 1) diff --git a/gcc/testsuite/gcc.target/i386/sse-14.c b/gcc/testsuite/gcc.target/i386/sse-14.c index 264cdb63c66..35db725def8 100644 --- a/gcc/testsuite/gcc.target/i386/sse-14.c +++ b/gcc/testsuite/gcc.target/i386/sse-14.c @@ -51,6 +51,12 @@ test_2x (_mm_inserti_si64, __m128i, __m128i, __m128i, 1, 1) test_1 (_mm_aeskeygenassist_si128, __m128i, __m128i, 1) test_2 (_mm_clmulepi64_si128, __m128i, __m128i, __m128i, 1) +/* mmintrin-common.h */ +test_1 (_mm_round_pd, __m128d, __m128d, 1) +test_1 (_mm_round_ps, __m128, __m128, 1) +test_2 (_mm_round_sd, __m128d, __m128d, __m128d, 1) +test_2 (_mm_round_ss, __m128, __m128, __m128, 1) + /* smmintrin.h */ test_2 (_mm_blend_epi16, __m128i, __m128i, __m128i, 1) test_2 (_mm_blend_ps, __m128, __m128, __m128, 1) diff --git a/gcc/testsuite/gcc.target/mips/scc-2.c b/gcc/testsuite/gcc.target/mips/scc-2.c new file mode 100644 index 00000000000..7964227a8d7 --- /dev/null +++ b/gcc/testsuite/gcc.target/mips/scc-2.c @@ -0,0 +1,17 @@ +/* { dg-do compile } */ +/* { dg-mips-options "-O -mgp64" } */ + +/* { dg-final { scan-assembler-not "and\t\|andi\t\|ext\t\|sll\t\|srl\t" } } */ +/* { dg-final { scan-assembler-times "slt\t\|sltu\t" 12 } } */ + + +#define TEST(N, LHS, REL, RHS) \ + NOMIPS16 long long w##N (int a, int b) {return LHS REL RHS;} \ + NOMIPS16 int n##N (long long a, long long b) {return LHS REL RHS;} \ + +TEST (eq, a, ==, 0); +TEST (ne, a, !=, 0); +TEST (gt, a, >, b); +TEST (ge, a, >=, 1); +TEST (lt, a, <, b); +TEST (le, a, <=, 11); diff --git a/gcc/testsuite/gcc.target/mips/scc-3.c b/gcc/testsuite/gcc.target/mips/scc-3.c new file mode 100644 index 00000000000..e496d401dd4 --- /dev/null +++ b/gcc/testsuite/gcc.target/mips/scc-3.c @@ -0,0 +1,17 @@ +/* { dg-do compile } */ +/* { dg-mips-options "-O -mabi=o64" } */ + +/* { dg-final { scan-assembler-not "and\t\|andi\t\|ext\t\|sll\t\|srl\t" } } */ +/* { dg-final { scan-assembler-times "slt\t\|sltu\t" 8 } } */ + + +#define TEST(N, LHS, REL, RHS) \ + MIPS16 long long w##N (int a, int b) {return LHS REL RHS;} \ + MIPS16 int n##N (long long a, long long b) {return LHS REL RHS;} \ + +TEST (eq, a, ==, 0); + +TEST (gt, a, >, b); + +TEST (lt, a, <, b); +TEST (le, a, <=, 11); diff --git a/gcc/testsuite/gcc.target/mips/scc-4.c b/gcc/testsuite/gcc.target/mips/scc-4.c new file mode 100644 index 00000000000..fd6e9326789 --- /dev/null +++ b/gcc/testsuite/gcc.target/mips/scc-4.c @@ -0,0 +1,13 @@ +/* { dg-do compile } */ +/* { dg-mips-options "-O -mabi=o64" } */ + +/* { dg-final { scan-assembler "slt\t" } } */ +/* { dg-final { scan-assembler "sltu\t\|xor\t\|xori\t" } } */ + +/* This test should work both in mips16 and non-mips16 mode. */ + +int +f (long long a, long long b) +{ + return a > 5; +} diff --git a/gcc/testsuite/gcc.target/powerpc/darwin-save-world-1.c b/gcc/testsuite/gcc.target/powerpc/darwin-save-world-1.c new file mode 100644 index 00000000000..452060e9f61 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/darwin-save-world-1.c @@ -0,0 +1,18 @@ +/* { dg-do run { target powerpc*-*-* } } */ +/* { dg-require-effective-target powerpc_altivec_ok } */ +/* { dg-options "-maltivec" } */ + +/* With altivec turned on, Darwin wants to save the world but we did not mark lr as being saved any more + as saving the lr is not needed for saving altivec registers. */ + +int main (void) +{ + __label__ l1; + void __attribute__((used)) q(void) + { + goto l1; + } + + l1:; + return 0; +} diff --git a/gcc/testsuite/gfortran.dg/bind_c_usage_14.f03 b/gcc/testsuite/gfortran.dg/bind_c_usage_14.f03 index abcc46e7e39..2d6726af8ba 100644 --- a/gcc/testsuite/gfortran.dg/bind_c_usage_14.f03 +++ b/gcc/testsuite/gfortran.dg/bind_c_usage_14.f03 @@ -81,24 +81,24 @@ end subroutine sub6NoIso ! The subroutines (including entry) should have ! only a char-length parameter if they are not bind(C). ! -! { dg-final { scan-tree-dump "sub1noiso .a, b, _a, _b\\)" "original" } } -! { dg-final { scan-tree-dump "sub2 .a, b\\)" "original" } } -! { dg-final { scan-tree-dump "sub3noiso .a, b, _a, _b\\)" "original" } } -! { dg-final { scan-tree-dump "sub3noisoentry .x, y, z, _x, _z\\)" "original" } } -! { dg-final { scan-tree-dump "sub4iso .a, b\\)" "original" } } -! { dg-final { scan-tree-dump "sub4isoentry .x, y, z, _x, _z\\)" "original" } } -! { dg-final { scan-tree-dump "sub5iso .a, b\\)" "original" } } -! { dg-final { scan-tree-dump "sub5noisoentry .x, y, z, _x, _z\\)" "original" } } -! { dg-final { scan-tree-dump "sub6noiso .a, b, _a, _b\\)" "original" } } -! { dg-final { scan-tree-dump "sub6isoentry .x, y, z, _x, _z\\)" "original" } } +! { dg-final { scan-tree-dump "sub1noiso \\(\[^.\]*a, \[^.\]*b, \[^.\]*_a, \[^.\]*_b\\)" "original" } } +! { dg-final { scan-tree-dump "sub2 \\(\[^.\]*a, \[^.\]*b\\)" "original" } } +! { dg-final { scan-tree-dump "sub3noiso \\(\[^.\]*a, \[^.\]*b, \[^.\]*_a, \[^.\]*_b\\)" "original" } } +! { dg-final { scan-tree-dump "sub3noisoentry \\(\[^.\]*x, \[^.\]*y, \[^.\]*z, \[^.\]*_x, \[^.\]*_z\\)" "original" } } +! { dg-final { scan-tree-dump "sub4iso \\(\[^.\]*a, \[^.\]*b\\)" "original" } } +! { dg-final { scan-tree-dump "sub4isoentry \\(\[^.\]*x, \[^.\]*y, \[^.\]*z, \[^.\]*_x, \[^.\]*_z\\)" "original" } } +! { dg-final { scan-tree-dump "sub5iso \\(\[^.\]*a, \[^.\]*b\\)" "original" } } +! { dg-final { scan-tree-dump "sub5noisoentry \\(\[^.\]*x, \[^.\]*y, \[^.\]*z, \[^.\]*_x, \[^.\]*_z\\)" "original" } } +! { dg-final { scan-tree-dump "sub6noiso \\(\[^.\]*a, \[^.\]*b, \[^.\]*_a, \[^.\]*_b\\)" "original" } } +! { dg-final { scan-tree-dump "sub6isoentry \\(\[^.\]*x, \[^.\]*y, \[^.\]*z, \[^.\]*_x, \[^.\]*_z\\)" "original" } } ! The master functions should have always a length parameter ! to ensure sharing a parameter between bind(C) and non-bind(C) works ! -! { dg-final { scan-tree-dump "master.0.sub3noiso .__entry, z, y, x, b, a, _z, _x, _b, _a\\)" "original" } } -! { dg-final { scan-tree-dump "master.1.sub4iso .__entry, z, y, x, b, a, _z, _x, _b, _a\\)" "original" } } -! { dg-final { scan-tree-dump "master.2.sub5iso .__entry, z, y, x, b, a, _z, _x, _b, _a\\)" "original" } } -! { dg-final { scan-tree-dump "master.3.sub6noiso .__entry, z, y, x, b, a, _z, _x, _b, _a\\)" "original" } } +! { dg-final { scan-tree-dump "master.0.sub3noiso \\(\[^.\]*__entry, \[^.\]*z, \[^.\]*y, \[^.\]*x, \[^.\]*b, \[^.\]*a, \[^.\]*_z, \[^.\]*_x, \[^.\]*_b, \[^.\]*_a\\)" "original" } } +! { dg-final { scan-tree-dump "master.1.sub4iso \\(\[^.\]*__entry, \[^.\]*z, \[^.\]*y, \[^.\]*x, \[^.\]*b, \[^.\]*a, \[^.\]*_z, \[^.\]*_x, \[^.\]*_b, \[^.\]*_a\\)" "original" } } +! { dg-final { scan-tree-dump "master.2.sub5iso \\(\[^.\]*__entry, \[^.\]*z, \[^.\]*y, \[^.\]*x, \[^.\]*b, \[^.\]*a, \[^.\]*_z, \[^.\]*_x, \[^.\]*_b, \[^.\]*_a\\)" "original" } } +! { dg-final { scan-tree-dump "master.3.sub6noiso \\(\[^.\]*__entry, \[^.\]*z, \[^.\]*y, \[^.\]*x, \[^.\]*b, \[^.\]*a, \[^.\]*_z, \[^.\]*_x, \[^.\]*_b, \[^.\]*_a\\)" "original" } } ! Thus, the master functions need to be called with length arguments ! present diff --git a/gcc/testsuite/gfortran.dg/continuation_10.f90 b/gcc/testsuite/gfortran.dg/continuation_10.f90 new file mode 100644 index 00000000000..8071dd7b695 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/continuation_10.f90 @@ -0,0 +1,55 @@ +! { dg-do compile } +! { dg-options -std=f95 } +! PR35882 Miscounted continuation lines when interspersed with data +program test_mod + implicit none + + integer, dimension(50) :: array + + array = 1 + + print "(a, i8)", & + "Line 1", & + array(2), & + "Line 3", & + array(4), & + "Line 5", & + array(6), & + "Line 7", & + array(8), & + "Line 9", & + array(10), & + "Line 11", & + array(12), & + "Line 13", & + array(14), & + "Line 15", & + array(16), & + "Line 17", & + array(18), & + "Line 19", & + array(20), & + "Line 21", & + array(22), & + "Line 23", & + array(24), & + "Line 25", & + array(26), & + "Line 27", & + array(28), & + "Line 29", & + array(30), & + "Line 31", & + array(32), & + "Line 33", & + array(34), & + "Line 35", & + array(36), & + "Line 37", & + array(38), & + "Line 39", & + array(40), & ! { dg-warning "Limit of 39 continuations exceeded" } + "Line 41", & + array(42), & + "Line 43" +end program diff --git a/gcc/testsuite/gfortran.dg/continuation_3.f90 b/gcc/testsuite/gfortran.dg/continuation_3.f90 index a7f0d1d1dd1..238f8cc7b8f 100644 --- a/gcc/testsuite/gfortran.dg/continuation_3.f90 +++ b/gcc/testsuite/gfortran.dg/continuation_3.f90 @@ -1,5 +1,5 @@ ! { dg-do compile } -! { dg-options -pedantic } +! { dg-options -std=f95 } ! PR 19262 Test limit on line continuations. Test case derived form case in PR ! by Steve Kargl. Submitted by Jerry DeLisle <jvdelisle@gcc.gnu.org> print *, & diff --git a/gcc/testsuite/gfortran.dg/continuation_5.f b/gcc/testsuite/gfortran.dg/continuation_5.f index b0ecd706390..15e06077ff3 100644 --- a/gcc/testsuite/gfortran.dg/continuation_5.f +++ b/gcc/testsuite/gfortran.dg/continuation_5.f @@ -1,5 +1,5 @@ ! { dg-do compile } -! { dg-options -pedantic } +! { dg-options -std=f95 } ! PR 19262 Test limit on line continuations. Test case derived form case in PR ! by Steve Kargl. Submitted by Jerry DeLisle <jvdelisle@gcc.gnu.org> print *, diff --git a/gcc/testsuite/gfortran.dg/f2003_io_1.f03 b/gcc/testsuite/gfortran.dg/f2003_io_1.f03 new file mode 100644 index 00000000000..6ec14aa053f --- /dev/null +++ b/gcc/testsuite/gfortran.dg/f2003_io_1.f03 @@ -0,0 +1,37 @@ +! { dg-do run } +! { dg-options "-std=gnu" } +! Test case prepared by Jerry DeLisle <jvdelisle@gcc.gnu.org> +real :: a(4), b(4) +real :: c +integer :: istat, j +character(25) :: msg + +a = 23.45 +b = 0.0 +open(10, file='mydata', asynchronous="yes", blank="null") + +write(10,'(10f8.3)', asynchronous="yes", decimal="comma", id=j) a +rewind(10) +read(10,'(10f8.3)', asynchronous="yes", decimal="comma", blank="zero") b +if (any(b.ne.23.45)) call abort + +c = 3.14 +write(msg, *, decimal="comma") c +if (msg(1:7).ne." 3,14") call abort + +b = 0.0 +rewind(10) +write(10,'(10f8.3)', asynchronous="yes", decimal="point") a +rewind(10) +read(10,'(10f8.3)', asynchronous="yes", decimal="point") b +if (any(b.ne.23.45)) call abort + +wait(unit=10, err=25, iostat=istat, iomsg=msg, end=35, id=j) + +! do some stuff with a +25 continue + +35 continue + +close(10, status="delete") +end diff --git a/gcc/testsuite/gfortran.dg/f2003_io_2.f03 b/gcc/testsuite/gfortran.dg/f2003_io_2.f03 new file mode 100644 index 00000000000..54c0516dfed --- /dev/null +++ b/gcc/testsuite/gfortran.dg/f2003_io_2.f03 @@ -0,0 +1,22 @@ +! { dg-do compile } +! { dg-options "-std=f2003" } +! Test case prepared by Jerry DeLisle <jvdelisle@gcc.gnu.org> + +integer :: istat, idvar +character(25) :: msg +real, dimension(10) :: a, b + +a = 43.21 +open(10, file='mydata', asynchronous="yes") +write(10,'(10f8.3)', asynchronous="yes", decimal="comma") a +rewind(10) +read(10,'(10f8.3)', asynchronous="yes", decimal="comma", id=idvar) b +istat = 123456 +wait(unit=10, err=25, iostat=istat, iomsg=msg, end=35, id=idvar) + +print *, istat + +25 continue + +35 continue +end diff --git a/gcc/testsuite/gfortran.dg/f2003_io_3.f03 b/gcc/testsuite/gfortran.dg/f2003_io_3.f03 new file mode 100644 index 00000000000..5b3fb59b0d7 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/f2003_io_3.f03 @@ -0,0 +1,21 @@ +! { dg-do compile } +! { dg-options "-std=f2003" } +! Test case prepared by Jerry DeLisle <jvdelisle@gcc.gnu.org> + +integer :: istat +character(25) :: msg +real, dimension(10) :: a, b +namelist /mynml/ a, b +msg = "null" +a = 43.21 +WRITE(99,'(10f8.3)',decimal="comma") a +rewind(99) +read(99,'(dc,10f8.3)',blank=msg) b +write(99,'(dp,10f8.3)',round="up") ! { dg-error "not implemented" } +rewind(99) +read(99,'(10f8.3)',pad="yes") +msg="suppress" +write(99,'(10f8.3)',sign=msg) +write(99,delim="apostrophe", fmt=*) +write(99,nml=mynml,delim="none") +end diff --git a/gcc/testsuite/gfortran.dg/f2003_io_4.f03 b/gcc/testsuite/gfortran.dg/f2003_io_4.f03 new file mode 100644 index 00000000000..d253a81bb64 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/f2003_io_4.f03 @@ -0,0 +1,33 @@ +! { dg-do run } +! Test case prepared by Jerry DeLisle <jvdelisle@gcc.gnu.org> +! Test of decimal= feature + +integer :: istat +character(80) :: msg +real, dimension(4) :: a, b, c +namelist /mynml/ a, b +msg = "yes" +a = 43.21 +b = 3.131 +c = 5.432 +open(99, decimal="comma") +write(99,'(10f8.3)') a +a = 0.0 +rewind(99) +read(99,'(10f8.3)') a +if (any(a.ne.43.21)) call abort + +write(msg,'(dp,f8.3,dc,f8.2,dp,f8.3)', decimal="comma") a(1), b(1), c(1) +if (trim(msg).ne." 43.210 3,13 5.432") call abort + +close(99, status="delete") +open(99, decimal="comma") +write(99,nml=mynml) +a = 0.0 +b = 0.0 +rewind(99) +read(99,nml=mynml) +if (any(a.ne.43.21)) call abort +if (any(b.ne.3.131)) call abort +close(99, status="delete") +end diff --git a/gcc/testsuite/gfortran.dg/f2003_io_5.f03 b/gcc/testsuite/gfortran.dg/f2003_io_5.f03 new file mode 100644 index 00000000000..b816ded69c5 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/f2003_io_5.f03 @@ -0,0 +1,26 @@ +! { dg-do run } +! Test case prepared by Jerry DeLisle <jvdelisle@gcc.gnu.org> +! Test of decimal="comma" in namelist and complex +integer :: i +real :: a(10) = [ (i*1.3, i=1,10) ] +real :: b(10) +complex :: c +character(34) :: complex +namelist /nm/ a + +open(99,file="mynml",form="formatted",decimal="point",status="replace") +write(99,nml=nm,decimal="comma") +a = 5.55 +rewind(99) +read(99,nml=nm,decimal="comma") +if (any (a /= [ (i*1.3, i=1,10) ])) call abort +close(99, status="delete") + +c = (3.123,4.456) +write(complex,*,decimal="comma") c +if (complex.ne." ( 3,1229999 ; 4,4559999 )") call abort +c = (0.0, 0.0) +read(complex,*,decimal="comma") c +if (complex.ne." ( 3,1229999 ; 4,4559999 )") call abort + +end diff --git a/gcc/testsuite/gfortran.dg/f2003_io_6.f03 b/gcc/testsuite/gfortran.dg/f2003_io_6.f03 new file mode 100644 index 00000000000..40758e2232d --- /dev/null +++ b/gcc/testsuite/gfortran.dg/f2003_io_6.f03 @@ -0,0 +1,11 @@ +! { dg-do run } +! Test case prepared by Jerry DeLisle <jvdelisle@gcc.gnu.org> +! Test of decimal="comma" in namelist, checks separators +implicit none +integer :: i +real :: a(6) = 0.0 +character(len=30) :: str = '&nm a = 1,3; 4, 5; 5; 7; /' +namelist /nm/ a +read(str,nml=nm,decimal='comma') +if (any(a.ne.[ 1.3, 4.0, 5.0, 5.0, 7.0, 0.0 ])) call abort +end diff --git a/gcc/testsuite/gfortran.dg/f2003_io_7.f03 b/gcc/testsuite/gfortran.dg/f2003_io_7.f03 new file mode 100644 index 00000000000..6d2c11dfcbe --- /dev/null +++ b/gcc/testsuite/gfortran.dg/f2003_io_7.f03 @@ -0,0 +1,27 @@ +! { dg-do run } +! Test case prepared by Jerry DeLisle <jvdelisle@gcc.gnu.org> +! Test of sign=, decimal=, and blank= . +program iotests + implicit none + character(len=45) :: a + character(len=4) :: mode = "what" + real, parameter :: pi = 3.14159265358979323846 + real(kind=8), dimension(3) :: b + ! + write(a,'(f10.3,s,f10.3,sp,f10.3,ss,f10.3)',SIGN='PLUS') pi, pi, pi, pi + if (a /= " +3.142 3.142 +3.142 3.142") call abort + ! + open(8,sign="plus") + write(8,'(f10.3,dc,f10.3,dp,f10.3)',DECIMAL='COMMA',& + & sign="suppress") pi, pi, pi + rewind(8) + read(8,'(a)') a + if (a /= " 3,142 3,142 3.142") call abort + close(8,status="delete") + ! + ! "123456789 123456789 12345678901 + write(a,'(a)') "53 256.84, 2 2 2. ; 33.3 3 1 " + read(a, '(f9.2,1x,f8.2,2x,f11.7)', blank="zero") b(1),b(2),b(3) + if (any(abs(b - [530256.84, 20202.00, 33.3030001]) > .03)) call abort +end program iotests + diff --git a/gcc/testsuite/gfortran.dg/f2003_io_8.f03 b/gcc/testsuite/gfortran.dg/f2003_io_8.f03 new file mode 100644 index 00000000000..2362697c6bb --- /dev/null +++ b/gcc/testsuite/gfortran.dg/f2003_io_8.f03 @@ -0,0 +1,13 @@ +! { dg-do compile } +! { dg-options "-std=gnu" } +! +real :: a(4), b(4) +real :: c +integer :: istat, j +character(25) :: msg + +open(10, file='mydata', asynchronous="yes", blank="null") +write(10,'(10f8.3)', asynchronous='no', decimal="comma", id=j) a ! { dg-error "must be with ASYNCHRONOUS=" } +read(10,'(10f8.3)', id=j, decimal="comma", blank="zero") b ! { dg-error "must be with ASYNCHRONOUS=" } +read(10,'(10f8.3)', asynchronous=msg, decimal="comma", blank="zero") b ! { dg-error "must be an initialization expression" } +end diff --git a/gcc/testsuite/gfortran.dg/internal_pack_1.f90 b/gcc/testsuite/gfortran.dg/internal_pack_1.f90 index 6c3781ba9b2..aded78dc26a 100644 --- a/gcc/testsuite/gfortran.dg/internal_pack_1.f90 +++ b/gcc/testsuite/gfortran.dg/internal_pack_1.f90 @@ -11,6 +11,11 @@ program main real(kind=8), dimension(3) :: r8 complex(kind=4), dimension(3) :: c4 complex(kind=8), dimension(3) :: c8 + type i8_t + sequence + integer(kind=8) :: v + end type i8_t + type(i8_t), dimension(3) :: d_i8 i1 = (/ -1, 1, -3 /) call sub_i1(i1(1:3:2)) @@ -46,6 +51,10 @@ program main if (any(real(c8) /= (/ 3.0_4, 1.0_4, 2.0_4/))) call abort if (any(aimag(c8) /= 0._4)) call abort + d_i8%v = (/ -1, 1, -3 /) + call sub_d_i8(d_i8(1:3:2)) + if (any(d_i8%v /= (/ 3, 1, 2 /))) call abort + end program main subroutine sub_i1(i) @@ -113,3 +122,15 @@ subroutine sub_c4(r) r(1) = 3._4 r(2) = 2._4 end subroutine sub_c4 + +subroutine sub_d_i8(i) + type i8_t + sequence + integer(kind=8) :: v + end type i8_t + type(i8_t), dimension(2) :: i + if (i(1)%v /= -1) call abort + if (i(2)%v /= -3) call abort + i(1)%v = 3 + i(2)%v = 2 +end subroutine sub_d_i8 diff --git a/gcc/testsuite/gfortran.dg/intrinsic_pack_1.f90 b/gcc/testsuite/gfortran.dg/intrinsic_pack_1.f90 index e464503c963..22d110ba77c 100644 --- a/gcc/testsuite/gfortran.dg/intrinsic_pack_1.f90 +++ b/gcc/testsuite/gfortran.dg/intrinsic_pack_1.f90 @@ -29,6 +29,34 @@ program main integer(kind=8), dimension(9) :: vi8 integer(kind=8), dimension(9) :: ri8 + type i1_t + integer(kind=1) :: v + end type i1_t + type(i1_t), dimension(3,3) :: d_i1 + type(i1_t), dimension(9) :: d_vi1 + type(i1_t), dimension(9) :: d_ri1 + + type i4_t + integer(kind=4) :: v + end type i4_t + type(i4_t), dimension(3,3) :: d_i4 + type(i4_t), dimension(9) :: d_vi4 + type(i4_t), dimension(9) :: d_ri4 + + d_vi1%v = (/(i+10,i=1,9)/) + d_i1%v = reshape((/1_1, -1_1, 2_1, -2_1, 3_1, -3_1, 4_1, & + & -4_1, 5_1/), shape(i1)) + d_ri1 = pack(d_i1,d_i1%v>0,d_vi1) + if (any(d_ri1%v /= (/1_1, 2_1, 3_1, 4_1, 5_1, 16_1, 17_1, 18_1, 19_1/))) & + & call abort + + d_vi4%v = (/(i+10,i=1,9)/) + d_i4%v = reshape((/1_4, -1_4, 2_4, -2_4, 3_4, -3_4, 4_4, & + & -4_4, 5_4/), shape(d_i4)) + d_ri4 = pack(d_i4,d_i4%v>0,d_vi4) + if (any(d_ri4%v /= (/1_4, 2_4, 3_4, 4_4, 5_4, 16_4, 17_4, 18_4, 19_4/))) & + & call abort + vr4 = (/(i+10,i=1,9)/) r4 = reshape((/1.0_4, -3.0_4, 2.1_4, -4.21_4, 1.2_4, 0.98_4, -1.2_4, & & -7.1_4, -9.9_4, 0.3_4 /), shape(r4)) diff --git a/gcc/testsuite/gfortran.dg/intrinsic_spread_1.f90 b/gcc/testsuite/gfortran.dg/intrinsic_spread_1.f90 index 1fe09d478bb..04e4c577ac6 100644 --- a/gcc/testsuite/gfortran.dg/intrinsic_spread_1.f90 +++ b/gcc/testsuite/gfortran.dg/intrinsic_spread_1.f90 @@ -25,6 +25,14 @@ program foo complex(kind=8), dimension (10) :: c_8 complex(kind=8), dimension (2, 3) :: ac_8 complex(kind=8), dimension (2, 2, 3) :: bc_8 + type i4_t + integer(kind=4) :: v + end type i4_t + type(i4_t), dimension (10) :: it_4 + type(i4_t), dimension (2, 3) :: at_4 + type(i4_t), dimension (2, 2, 3) :: bt_4 + type(i4_t) :: iv_4 + character (len=200) line1, line2, line3 a_1 = reshape ((/1_1, 2_1, 3_1, 4_1, 5_1, 6_1/), (/2, 3/)) @@ -159,6 +167,17 @@ program foo c_8 = spread((1._8,-1._8),1,10) if (any(c_8 /= (1._8,-1._8))) call abort + + at_4%v = reshape ((/1_4, 2_4, 3_4, 4_4, 5_4, 6_4/), (/2, 3/)) + bt_4 = spread (at_4, 1, 2) + if (any (bt_4%v .ne. reshape ((/1_4, 1_4, 2_4, 2_4, 3_4, 3_4, 4_4, & + & 4_4, 5_4, 5_4, 6_4, 6_4/), (/2, 2, 3/)))) & + call abort + iv_4%v = 123_4 + it_4 = spread(iv_4,1,10) + if (any(it_4%v /= 123_4)) call abort + + 9000 format(12I3) 9010 format(12F7.3) 9020 format(25F7.3) diff --git a/gcc/testsuite/gfortran.dg/intrinsic_unpack_1.f90 b/gcc/testsuite/gfortran.dg/intrinsic_unpack_1.f90 index 71cce798ca5..47b9aef2e3f 100644 --- a/gcc/testsuite/gfortran.dg/intrinsic_unpack_1.f90 +++ b/gcc/testsuite/gfortran.dg/intrinsic_unpack_1.f90 @@ -10,6 +10,12 @@ program intrinsic_unpack real(kind=8), dimension(3,3) :: ar8, br8 complex(kind=4), dimension(3,3) :: ac4, bc4 complex(kind=8), dimension(3,3) :: ac8, bc8 + type i4_t + integer(kind=4) :: v + end type i4_t + type(i4_t), dimension(3,3) :: at4, bt4 + type(i4_t), dimension(3) :: vt4 + logical, dimension(3, 3) :: mask character(len=500) line1, line2 integer i @@ -116,4 +122,14 @@ program intrinsic_unpack mask, ac8) if (line1 .ne. line2) call abort + at4%v = reshape ((/1, 0, 0, 0, 1, 0, 0, 0, 1/), (/3, 3/)); + vt4%v = (/2_4, 3_4, 4_4/) + bt4 = unpack (vt4, mask, at4) + if (any (bt4%v .ne. reshape ((/1, 2, 0, 3, 1, 0, 0, 0, 4/), (/3, 3/)))) & + call abort + bt4%v = -1 + bt4 = unpack (vt4, mask, i4_t(0_4)) + if (any (bt4%v .ne. reshape ((/0, 2, 0, 3, 0, 0, 0, 0, 4/), (/3, 3/)))) & + call abort + end program diff --git a/gcc/testsuite/gfortran.dg/io_constraints_1.f90 b/gcc/testsuite/gfortran.dg/io_constraints_1.f90 index 05f52faae76..5f2c776b128 100644 --- a/gcc/testsuite/gfortran.dg/io_constraints_1.f90 +++ b/gcc/testsuite/gfortran.dg/io_constraints_1.f90 @@ -62,7 +62,7 @@ end module global !Was correctly picked up before patch. write(1, fmt='(i6)', eor = 100) a ! { dg-error "EOR tag" } !Was correctly picked up before patch. - write(1, fmt='(i6)', size = b) a ! { dg-error "SIZE=specifier not allowed" } + write(1, fmt='(i6)', size = b) a ! { dg-error "SIZE= specifier not allowed" } READ(1, fmt='(i6)', end = 900) a ! { dg-error "not defined" } diff --git a/gcc/testsuite/gfortran.dg/io_constraints_2.f90 b/gcc/testsuite/gfortran.dg/io_constraints_2.f90 index fa6cbdbca6b..8bf48d72ff2 100644 --- a/gcc/testsuite/gfortran.dg/io_constraints_2.f90 +++ b/gcc/testsuite/gfortran.dg/io_constraints_2.f90 @@ -66,7 +66,7 @@ end module global READ(1, fmt='(i6)', advance='NO', size = buffer) a ! { dg-error "INTEGER" } !Was correctly picked up before patch. -correct syntax error - READ(1, fmt='(i6)', advance='YES', size = 10) a ! { dg-error "Syntax error" } + READ(1, fmt='(i6)', advance='YES', size = 10) a ! { dg-error "Invalid value for SIZE specification" } READ(1, fmt='(i6)', advance='MAYBE') ! { dg-error "YES or NO" } diff --git a/gcc/testsuite/gfortran.dg/namelist_47.f90 b/gcc/testsuite/gfortran.dg/namelist_47.f90 new file mode 100644 index 00000000000..bc9110fa3cd --- /dev/null +++ b/gcc/testsuite/gfortran.dg/namelist_47.f90 @@ -0,0 +1,52 @@ +! { dg-do run } + +module nml_47 + type :: mt + character(len=2) :: c012345678901234567890123456789012345678901234567890123456789h(2) = (/"aa","bb"/) + end type mt + type :: bt + integer :: i(2) = (/1,2/) + type(mt) :: m(2) + end type bt +end module nml_47 + +program namelist_47 + use nml_47 + type(bt) :: x(2) + character(140) :: teststring + namelist /mynml/ x + + teststring = " x(2)%m%c012345678901234567890123456789012345678901234567890123456789h(:)(2:2) = 'z','z'," + call writenml (teststring) + teststring = " x(2)%m(2)%c012345678901234567890123456789012345678901234567890123456789h(:)(2) = 'z','z'," + call writenml (teststring) + teststring = " x(2)%m(2)%c012345678901234567890123456789012345678901234567890123456789h(:)(:3) = 'z','z'," + call writenml (teststring) + teststring = " x(2)%m(2)%c012345678901234567890123456789012345678901234567890123456789h(1:2)(k:) = 'z','z'," + call writenml (teststring) + +contains + +subroutine writenml (astring) + character(140), intent(in) :: astring + character(300) :: errmessage + integer :: ierror + + open (10, status="scratch", delim='apostrophe') + write (10, '(A)') "&MYNML" + write (10, '(A)') astring + write (10, '(A)') "/" + rewind (10) + read (10, nml = mynml, iostat=ierror, iomsg=errmessage) + if (ierror == 0) call abort + print '(a)', trim(errmessage) + close (10) + +end subroutine writenml + +end program namelist_47 +! { dg-output "Multiple sub-objects with non-zero rank in namelist object x(\n|\r\n|\r)" } +! { dg-output "Missing colon in substring qualifier for namelist variable x%m%c012345678901234567890123456789012345678901234567890123456789h(\n|\r\n|\r)" } +! { dg-output "Substring out of range for namelist variable x%m%c012345678901234567890123456789012345678901234567890123456789h(\n|\r\n|\r)" } +! { dg-output "Bad character in substring qualifier for namelist variable x%m%c012345678901234567890123456789012345678901234567890123456789h(\n|\r\n|\r)" } +! { dg-final { cleanup-modules "nml_47" } } diff --git a/gcc/testsuite/gfortran.dg/simplify_argN_1.f90 b/gcc/testsuite/gfortran.dg/simplify_argN_1.f90 new file mode 100644 index 00000000000..933b1f32af7 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/simplify_argN_1.f90 @@ -0,0 +1,26 @@ +! { dg-do run } +! Tests the fix for PR35780, in which the assignment for C was not +! scalarized in expr.c. +! +! Contributed by Dick Hendrickson <dick.hendrickson@gmail.com> +! +MODULE MODS + integer, parameter :: N = 10 + INTEGER, PARAMETER, DIMENSION(N) :: A = [(i, i = 1, N)] + INTEGER, PARAMETER, DIMENSION(N) :: B = [(i - 5, i = 1, N)] + INTEGER, PARAMETER, DIMENSION(N) :: C = ISHFTC(3, B, 5) !ICE + INTEGER, PARAMETER, DIMENSION(N) :: D = ISHFTC(A, 3, 5) ! OK + INTEGER, PARAMETER, DIMENSION(N) :: E = ISHFTC(A, B, 5) ! OK + +END MODULE MODS + + use mods + integer, dimension(N) :: X = A + integer, dimension(N) :: Y = B + +! Check the simplifed expressions against the library + if (any (ISHFTC(3, Y, 5) /= C)) call abort () + if (any (ISHFTC(X, 3, 5) /= D)) call abort () + if (any (ISHFTC(X, Y, 5) /= E)) call abort () +end +! { dg-final { cleanup-modules "mods" } } diff --git a/gcc/testsuite/gfortran.dg/write_check2.f90 b/gcc/testsuite/gfortran.dg/write_check2.f90 index 52f32bb121c..1447f8d14f9 100644 --- a/gcc/testsuite/gfortran.dg/write_check2.f90 +++ b/gcc/testsuite/gfortran.dg/write_check2.f90 @@ -4,7 +4,7 @@ character(len=20) :: str write(13,'(a)',advance='yes') 'Hello:' write(13,'(a)',advance='no') 'Hello:' - write(13,'(a)',advance='y') 'Hello:' ! { dg-error "ADVANCE=specifier at \\(1\\) must have value = YES or NO." } - write(13,'(a)',advance='yet') 'Hello:' ! { dg-error "ADVANCE=specifier at \\(1\\) must have value = YES or NO." } - write(13,'(a)',advance='yess') 'Hello:' ! { dg-error "ADVANCE=specifier at \\(1\\) must have value = YES or NO." } + write(13,'(a)',advance='y') 'Hello:' ! { dg-error "ADVANCE= specifier at \\(1\\) must have value = YES or NO." } + write(13,'(a)',advance='yet') 'Hello:' ! { dg-error "ADVANCE= specifier at \\(1\\) must have value = YES or NO." } + write(13,'(a)',advance='yess') 'Hello:' ! { dg-error "ADVANCE= specifier at \\(1\\) must have value = YES or NO." } end diff --git a/gcc/testsuite/gnat.dg/ancestor_type.adb b/gcc/testsuite/gnat.dg/ancestor_type.adb new file mode 100644 index 00000000000..b5e9e2c5c1d --- /dev/null +++ b/gcc/testsuite/gnat.dg/ancestor_type.adb @@ -0,0 +1,13 @@ +-- { dg-do compile } + +package body Ancestor_Type is + + package body B is + function make return T is + begin + return (T with n => 0); -- { dg-error "expect ancestor" } + end make; + + end B; + +end Ancestor_Type; diff --git a/gcc/testsuite/gnat.dg/ancestor_type.ads b/gcc/testsuite/gnat.dg/ancestor_type.ads new file mode 100644 index 00000000000..2ed1f19c2c8 --- /dev/null +++ b/gcc/testsuite/gnat.dg/ancestor_type.ads @@ -0,0 +1,13 @@ +package Ancestor_Type is + + type T is tagged private; + + package B is + function make return T; + end B; + +private + type T is tagged record + n: Natural; + end record; +end Ancestor_Type; diff --git a/gcc/testsuite/gnat.dg/array4.adb b/gcc/testsuite/gnat.dg/array4.adb new file mode 100644 index 00000000000..048698a54e1 --- /dev/null +++ b/gcc/testsuite/gnat.dg/array4.adb @@ -0,0 +1,37 @@ +-- { dg-do run } + +procedure Array4 is + + type A is array (1..5) of Integer; + f : constant A := (1, 2, 3, 4, 5); + + i1 : integer renames f(1); + i2 : integer renames f(2); + i3 : integer renames f(3); + i4 : integer renames f(4); + i5 : integer renames f(5); + + procedure Link_Failure; + pragma Import (C, Link_Failure); + +begin + if i1 /= 1 then + Link_Failure; + end if; + + if i2 /= 2 then + Link_Failure; + end if; + + if i3 /= 3 then + Link_Failure; + end if; + + if i4 /= 4 then + Link_Failure; + end if; + + if i5 /= 5 then + Link_Failure; + end if; +end; diff --git a/gcc/testsuite/gnat.dg/deep_old.adb b/gcc/testsuite/gnat.dg/deep_old.adb new file mode 100644 index 00000000000..6aca027f4ac --- /dev/null +++ b/gcc/testsuite/gnat.dg/deep_old.adb @@ -0,0 +1,8 @@ +procedure Deep_Old (X : Integer) is +begin + begin + if X = X'Old then + null; + end if; + end; +end Deep_Old; diff --git a/gcc/testsuite/gnat.dg/loop_address2.adb b/gcc/testsuite/gnat.dg/loop_address2.adb new file mode 100644 index 00000000000..aa955d771b2 --- /dev/null +++ b/gcc/testsuite/gnat.dg/loop_address2.adb @@ -0,0 +1,26 @@ +-- { dg-do compile }
+-- { dg-options "-O" }
+
+with System, Ada.Unchecked_Conversion;
+with System.Storage_Elements; use System.Storage_Elements;
+
+procedure Loop_Address2 is
+
+ type Ptr is access all Integer;
+
+ function To_Ptr is new Ada.Unchecked_Conversion (System.Address, Ptr);
+
+ function F (BM : System.Address; I : Integer) return System.Address is
+ begin
+ return BM + Storage_Offset (4*I);
+ end;
+
+ B : Integer;
+ P : Ptr;
+
+begin
+ for I in 0 .. 2 loop
+ P := To_Ptr (F (B'Address, I));
+ P.all := 0;
+ end loop;
+end ;
diff --git a/gcc/testsuite/gnat.dg/pack5.adb b/gcc/testsuite/gnat.dg/pack5.adb new file mode 100644 index 00000000000..12bea11a311 --- /dev/null +++ b/gcc/testsuite/gnat.dg/pack5.adb @@ -0,0 +1,32 @@ +-- { dg-do compile } + +procedure Pack5 is + + type Kind is (v1, v2, v3); + + type Error (k : Kind := Kind'First) is record + case k is + when v1 => + null; + when v2 => + null; + when Others => + B : Boolean; + end case; + end record; + pragma Pack (Error); + for Error'Size use 16; + + No_Error: constant Error := (k => v2); + + type R (B : Boolean) is record + E : Error; + end record; + pragma Pack(R); + type Ptr is access R; + + C : Ptr := new R (True); + +begin + C.E := No_Error; +end; diff --git a/gcc/testsuite/gnat.dg/pack6.adb b/gcc/testsuite/gnat.dg/pack6.adb new file mode 100644 index 00000000000..d846ed12ce0 --- /dev/null +++ b/gcc/testsuite/gnat.dg/pack6.adb @@ -0,0 +1,27 @@ +-- { dg-do compile } +-- { dg-options "-gnatws" } + +procedure Pack6 is + + type R is record + I : Integer; + a, b, c, d, e : Character; + end record; + + type Ar1 is array (1..4) of R; + type Ar2 is array (1..4) of R; + pragma Pack (Ar2); + + type R2 is record + A : Ar2; + end record; + for R2 use record + A at 0 range 0 .. 72*4-1; + end record; + + X : Ar1; + Y : Ar2; + +begin + Y (1) := X (1); +end; diff --git a/gcc/testsuite/gnat.dg/pack7.adb b/gcc/testsuite/gnat.dg/pack7.adb new file mode 100644 index 00000000000..000e7fa8163 --- /dev/null +++ b/gcc/testsuite/gnat.dg/pack7.adb @@ -0,0 +1,27 @@ +-- { dg-do compile } +-- { dg-options "-gnatws" } + +procedure Pack7 is + + type R is record + I : Integer; + a, b : Character; + end record; + + type Ar1 is array (1..4) of R; + type Ar2 is array (1..4) of R; + pragma Pack (Ar2); + + type R2 is record + A : Ar2; + end record; + for R2 use record + A at 0 range 0 .. 48*4-1; + end record; + + X : Ar1; + Y : Ar2; + +begin + Y (1) := X (1); +end; diff --git a/gcc/testsuite/gnat.dg/pack8.adb b/gcc/testsuite/gnat.dg/pack8.adb new file mode 100644 index 00000000000..a3a83bab0a9 --- /dev/null +++ b/gcc/testsuite/gnat.dg/pack8.adb @@ -0,0 +1,27 @@ +-- { dg-do compile } +-- { dg-options "-gnatws" } + +procedure Pack8 is + + type R is record + I : Integer; + a, b : Character; + end record; + + type Ar1 is array (1..4) of R; + type Ar2 is array (1..4) of R; + pragma Pack (Ar2); + + type R2 is record + A : Ar2; + end record; + for R2 use record + A at 0 range 0 .. 48*4-1-1; -- { dg-error "too small" } + end record; + + X : Ar1; + Y : Ar2; + +begin + Y (1) := X (1); +end; diff --git a/gcc/testsuite/gnat.dg/parent_ltd_with-child_full_view.adb b/gcc/testsuite/gnat.dg/parent_ltd_with-child_full_view.adb new file mode 100644 index 00000000000..cd8cf4240d4 --- /dev/null +++ b/gcc/testsuite/gnat.dg/parent_ltd_with-child_full_view.adb @@ -0,0 +1,12 @@ +-- { dg-do compile } + +package body Parent_Ltd_With.Child_Full_View is + + function New_Child_Symbol return Child_Symbol_Access is + Sym : constant Child_Symbol_Access := new Child_Symbol'(Comp => 10); + + begin + return Sym; + end New_Child_Symbol; + +end Parent_Ltd_With.Child_Full_View; diff --git a/gcc/testsuite/gnat.dg/parent_ltd_with-child_full_view.ads b/gcc/testsuite/gnat.dg/parent_ltd_with-child_full_view.ads new file mode 100644 index 00000000000..3f7aa2e99fc --- /dev/null +++ b/gcc/testsuite/gnat.dg/parent_ltd_with-child_full_view.ads @@ -0,0 +1,12 @@ +package Parent_Ltd_With.Child_Full_View is + + type Child_Symbol is new Parent_Ltd_With.Symbol with private; + type Child_Symbol_Access is access all Child_Symbol; + + function New_Child_Symbol return Child_Symbol_Access; + +private + + type Child_Symbol is new Parent_Ltd_With.Symbol with null record; + +end Parent_Ltd_With.Child_Full_View; diff --git a/gcc/testsuite/gnat.dg/parent_ltd_with.ads b/gcc/testsuite/gnat.dg/parent_ltd_with.ads new file mode 100644 index 00000000000..637aa7c3beb --- /dev/null +++ b/gcc/testsuite/gnat.dg/parent_ltd_with.ads @@ -0,0 +1,15 @@ +limited with Parent_Ltd_With.Child_Full_View; + +package Parent_Ltd_With is + + type Symbol is abstract tagged limited private; + + type Symbol_Access is access all Symbol'Class; + +private + + type Symbol is abstract tagged limited record + Comp : Integer; + end record; + +end Parent_Ltd_With; diff --git a/gcc/testsuite/gnat.dg/pr35823.adb b/gcc/testsuite/gnat.dg/pr35823.adb deleted file mode 100644 index e882aa3682f..00000000000 --- a/gcc/testsuite/gnat.dg/pr35823.adb +++ /dev/null @@ -1,6 +0,0 @@ -procedure pr35823 (Arg : in String) is - Size : constant Natural := Arg'Size; -begin - null; -end pr35823; - diff --git a/gcc/testsuite/gnat.dg/rt1.adb b/gcc/testsuite/gnat.dg/rt1.adb new file mode 100644 index 00000000000..ce94928caca --- /dev/null +++ b/gcc/testsuite/gnat.dg/rt1.adb @@ -0,0 +1,9 @@ +-- { dg-do compile } + +package body RT1 is + procedure P (S : access Root_Stream_Type'Class) is + Val : constant Ptr := Ptr'Input (S); + begin + null; + end P; +end RT1; diff --git a/gcc/testsuite/gnat.dg/rt1.ads b/gcc/testsuite/gnat.dg/rt1.ads new file mode 100644 index 00000000000..50cbbf0ff74 --- /dev/null +++ b/gcc/testsuite/gnat.dg/rt1.ads @@ -0,0 +1,14 @@ +with Ada.Streams; use Ada.Streams; +package RT1 is + pragma Remote_Types; + + type Ptr is private; + procedure Read (X : access Root_Stream_Type'Class; V : out Ptr) is null; + procedure Write (X : access Root_Stream_Type'Class; V : Ptr) is null; + for Ptr'Read use Read; + for Ptr'Write use Write; + + procedure P (S : access Root_Stream_Type'Class); +private + type Ptr is not null access all Integer; +end RT1; diff --git a/gcc/testsuite/gnat.dg/size_attribute.adb b/gcc/testsuite/gnat.dg/size_attribute.adb new file mode 100644 index 00000000000..25642e0b0aa --- /dev/null +++ b/gcc/testsuite/gnat.dg/size_attribute.adb @@ -0,0 +1,8 @@ +-- PR middle-end/35823 +-- { dg-do compile ] + +procedure Size_Attribute (Arg : in String) is + Size : constant Natural := Arg'Size; +begin + null; +end; diff --git a/gcc/testsuite/gnat.dg/specs/aggr1.ads b/gcc/testsuite/gnat.dg/specs/aggr1.ads new file mode 100644 index 00000000000..6c766351374 --- /dev/null +++ b/gcc/testsuite/gnat.dg/specs/aggr1.ads @@ -0,0 +1,8 @@ +-- { dg-do compile } + +package aggr1 is + type Buffer_Array is array (1 .. 2 ** 23) of Integer; + type Message is record + Data : Buffer_Array := (others => 0); + end record; +end; diff --git a/gcc/testsuite/gnat.dg/specs/fe_inlining.ads b/gcc/testsuite/gnat.dg/specs/fe_inlining.ads new file mode 100644 index 00000000000..ef5f4694210 --- /dev/null +++ b/gcc/testsuite/gnat.dg/specs/fe_inlining.ads @@ -0,0 +1,4 @@ +-- { dg-do compile } +-- { dg-options "-O -gnatN" } +with FE_Inlining_Helper; +procedure FE_Inlining is new FE_Inlining_Helper; diff --git a/gcc/testsuite/gnat.dg/specs/fe_inlining_helper.adb b/gcc/testsuite/gnat.dg/specs/fe_inlining_helper.adb new file mode 100644 index 00000000000..c149ea3c798 --- /dev/null +++ b/gcc/testsuite/gnat.dg/specs/fe_inlining_helper.adb @@ -0,0 +1,4 @@ +procedure FE_Inlining_Helper is +begin + null; +end FE_Inlining_Helper; diff --git a/gcc/testsuite/gnat.dg/specs/fe_inlining_helper.ads b/gcc/testsuite/gnat.dg/specs/fe_inlining_helper.ads new file mode 100644 index 00000000000..733268c65e7 --- /dev/null +++ b/gcc/testsuite/gnat.dg/specs/fe_inlining_helper.ads @@ -0,0 +1,3 @@ +-- { dg-excess-errors "no code generated" } +generic +procedure FE_Inlining_Helper; diff --git a/gcc/testsuite/gnat.dg/specs/linker_section.ads b/gcc/testsuite/gnat.dg/specs/linker_section.ads new file mode 100644 index 00000000000..ae2d4029cf9 --- /dev/null +++ b/gcc/testsuite/gnat.dg/specs/linker_section.ads @@ -0,0 +1,10 @@ +package Linker_Section is + Data1 : constant String := "12345678901234567"; + pragma Linker_Section (Entity => Data1, + Section => ".eeprom"); + type EEPROM_String is new String; + pragma Linker_Section (Entity => EEPROM_String, -- { dg-error "type" } + Section => ".eeprom"); + Data2 : constant EEPROM_String := "12345678901234567"; +end Linker_Section; + diff --git a/gcc/testsuite/gnat.dg/specs/renamings.ads b/gcc/testsuite/gnat.dg/specs/renamings.ads new file mode 100644 index 00000000000..3b90827e9fb --- /dev/null +++ b/gcc/testsuite/gnat.dg/specs/renamings.ads @@ -0,0 +1,14 @@ +package Renamings is + + package Inner is + procedure PI (X : Integer); + end Inner; + + procedure P (X : Integer) renames Inner.PI; + procedure P (X : Float); + pragma Convention (C, P); -- { dg-error "non-local renaming" } + + procedure Q (X : Float); + procedure Q (X : Integer) renames Inner.PI; + pragma Convention (C, Q); -- { dg-error "non-local renaming" } +end Renamings; diff --git a/gcc/testsuite/gnat.dg/specs/static_initializer2.ads b/gcc/testsuite/gnat.dg/specs/static_initializer2.ads new file mode 100644 index 00000000000..3b27f26bde7 --- /dev/null +++ b/gcc/testsuite/gnat.dg/specs/static_initializer2.ads @@ -0,0 +1,22 @@ +-- { dg-do compile } + +package Static_Initializer2 is + + type A is array (1..5) of Integer; + f : constant A := (1, 2, 3, 4, 5); + + i1 : integer renames f(1); + i2 : integer renames f(2); + i3 : integer renames f(3); + i4 : integer renames f(4); + i5 : integer renames f(5); + + b1 : boolean := i1 = 1; + b2 : boolean := i2 = 2; + b3 : boolean := i3 = 3; + b4 : boolean := i4 = 4; + b5 : boolean := i5 = 5; + +end Static_Initializer2; + +-- { dg-final { scan-assembler-not "elabs" } } diff --git a/gcc/testsuite/gnat.dg/specs/storage.ads b/gcc/testsuite/gnat.dg/specs/storage.ads new file mode 100644 index 00000000000..85a91d0724e --- /dev/null +++ b/gcc/testsuite/gnat.dg/specs/storage.ads @@ -0,0 +1,10 @@ +-- { dg-do compile } +with System.Pool_Global; +package Storage is + x1: System.Pool_Global.Unbounded_No_Reclaim_Pool; + type T1 is access integer; + for T1'Storage_Pool use (x1); -- { dg-error "denote a variable" } + type T2 is access Integer; + for T2'Storage_Pool use x1; +end Storage; + diff --git a/gcc/testsuite/gnat.dg/specs/warnstar.ads b/gcc/testsuite/gnat.dg/specs/warnstar.ads new file mode 100644 index 00000000000..325cbb6f329 --- /dev/null +++ b/gcc/testsuite/gnat.dg/specs/warnstar.ads @@ -0,0 +1,12 @@ +-- { dg-do compile } + +pragma Warnings (Off, "*bits of*unused"); +package warnstar is + type r is record + a : integer; + end record; + + for r use record + a at 0 range 0 .. 1023; + end record; +end warnstar; diff --git a/gcc/testsuite/gnat.dg/test_time_stamp.adb b/gcc/testsuite/gnat.dg/test_time_stamp.adb new file mode 100644 index 00000000000..1e25f878041 --- /dev/null +++ b/gcc/testsuite/gnat.dg/test_time_stamp.adb @@ -0,0 +1,37 @@ +-- { dg-do run } + +with GNAT.Time_Stamp; +use GNAT.Time_Stamp; + +procedure test_time_stamp is + S : constant String := Current_Time; + + function NN (S : String) return Boolean is + begin + for J in S'Range loop + if S (J) not in '0' .. '9' then + return True; + end if; + end loop; + return False; + end NN; + +begin + if S'Length /= 22 + or else S (5) /= '-' + or else S (8) /= '-' + or else S (11) /= ' ' + or else S (14) /= ':' + or else S (17) /= ':' + or else S (20) /= '.' + or else NN (S (1 .. 4)) + or else NN (S (6 .. 7)) + or else NN (S (9 .. 10)) + or else NN (S (12 .. 13)) + or else NN (S (15 .. 16)) + or else NN (S (18 .. 19)) + or else NN (S (21 .. 22)) + then + raise Program_Error; + end if; +end; diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp index 2d50643485b..180ce86da2e 100644 --- a/gcc/testsuite/lib/target-supports.exp +++ b/gcc/testsuite/lib/target-supports.exp @@ -383,6 +383,21 @@ proc check_gc_sections_available { } { return $gc_sections_available_saved } +# Return 1 if according to target_info struct and explicit target list +# target is supposed to support trampolines. + +proc check_effective_target_trampolines { } { + if [target_info exists no_trampolines] { + return 0 + } + if { [istarget avr-*-*] + || [istarget hppa2.0w-hp-hpux11.23] + || [istarget hppa64-hp-hpux11.23] } { + return 0; + } + return 1 +} + # Return true if profiling is supported on the target. proc check_profiling_available { test_what } { @@ -435,6 +450,7 @@ proc check_profiling_available { test_what } { || [istarget arm*-*-eabi*] || [istarget arm*-*-elf] || [istarget arm*-*-symbianelf*] + || [istarget avr-*-*] || [istarget bfin-*-*] || [istarget powerpc-*-eabi*] || [istarget strongarm*-*-elf] @@ -2221,7 +2237,7 @@ proc check_effective_target_simulator { } { return 0 } -# Return 1 if the target is a VxWorks RTP. +# Return 1 if the target is a VxWorks kernel. proc check_effective_target_vxworks_kernel { } { return [check_no_compiler_messages vxworks_kernel assembly { @@ -2231,6 +2247,16 @@ proc check_effective_target_vxworks_kernel { } { }] } +# Return 1 if the target is a VxWorks RTP. + +proc check_effective_target_vxworks_rtp { } { + return [check_no_compiler_messages vxworks_rtp assembly { + #if !defined __vxworks || !defined __RTP__ + #error NO + #endif + }] +} + # Return 1 if the target is expected to provide wide character support. proc check_effective_target_wchar { } { diff --git a/gcc/toplev.c b/gcc/toplev.c index c468bb3af09..4ad05950283 100644 --- a/gcc/toplev.c +++ b/gcc/toplev.c @@ -1925,13 +1925,6 @@ process_options (void) flag_prefetch_loop_arrays = 0; } -#ifndef OBJECT_FORMAT_ELF -#ifndef OBJECT_FORMAT_MACHO - if (flag_function_sections && write_symbols != NO_DEBUG) - warning (0, "-ffunction-sections may affect debugging on some targets"); -#endif -#endif - /* The presence of IEEE signaling NaNs, implies all math can trap. */ if (flag_signaling_nans) flag_trapping_math = 1; diff --git a/gcc/tree-cfg.c b/gcc/tree-cfg.c index cf2001faae3..fec1d64c029 100644 --- a/gcc/tree-cfg.c +++ b/gcc/tree-cfg.c @@ -3854,6 +3854,8 @@ verify_gimple_expr (tree expr) case TRUTH_ANDIF_EXPR: case TRUTH_ORIF_EXPR: + gcc_unreachable (); + case TRUTH_AND_EXPR: case TRUTH_OR_EXPR: case TRUTH_XOR_EXPR: @@ -4181,6 +4183,11 @@ verify_stmt (tree stmt, bool last_in_block) if (addr) { debug_generic_stmt (addr); + if (addr != stmt) + { + inform ("in statement"); + debug_generic_stmt (stmt); + } return true; } @@ -6130,6 +6137,8 @@ dump_function_to_file (tree fn, FILE *file, int flags) arg = DECL_ARGUMENTS (fn); while (arg) { + print_generic_expr (file, TREE_TYPE (arg), dump_flags); + fprintf (file, " "); print_generic_expr (file, arg, dump_flags); if (TREE_CHAIN (arg)) fprintf (file, ", "); diff --git a/gcc/tree-ssa-address.c b/gcc/tree-ssa-address.c index 90a01dca034..a5119d8c2bd 100644 --- a/gcc/tree-ssa-address.c +++ b/gcc/tree-ssa-address.c @@ -345,7 +345,8 @@ fixed_address_object_p (tree obj) { return (TREE_CODE (obj) == VAR_DECL && (TREE_STATIC (obj) - || DECL_EXTERNAL (obj))); + || DECL_EXTERNAL (obj)) + && ! DECL_DLLIMPORT_P (obj)); } /* If ADDR contains an address of object that is a link time constant, @@ -639,9 +640,9 @@ create_mem_ref (block_stmt_iterator *bsi, tree type, aff_tree *addr) { atype = TREE_TYPE (parts.base); parts.base = force_gimple_operand_bsi (bsi, - fold_build2 (PLUS_EXPR, atype, + fold_build2 (POINTER_PLUS_EXPR, atype, parts.base, - fold_convert (atype, parts.index)), + parts.index), true, NULL_TREE, true, BSI_SAME_STMT); } else diff --git a/gcc/tree-vect-transform.c b/gcc/tree-vect-transform.c index 59fa6d5de80..6168fdab74d 100644 --- a/gcc/tree-vect-transform.c +++ b/gcc/tree-vect-transform.c @@ -1102,8 +1102,12 @@ vect_create_data_ref_ptr (tree stmt, struct loop *at_loop, new_temp = vect_create_addr_base_for_vector_ref (stmt, &new_stmt_list, offset, loop); pe = loop_preheader_edge (loop); - new_bb = bsi_insert_on_edge_immediate (pe, new_stmt_list); - gcc_assert (!new_bb); + if (new_stmt_list) + { + new_bb = bsi_insert_on_edge_immediate (pe, new_stmt_list); + gcc_assert (!new_bb); + } + *initial_address = new_temp; /* Create: p = (vectype *) initial_base */ diff --git a/gcc/tree-vrp.c b/gcc/tree-vrp.c index 9741262dba2..76477c850ac 100644 --- a/gcc/tree-vrp.c +++ b/gcc/tree-vrp.c @@ -1887,8 +1887,6 @@ extract_range_from_binary_expr (value_range_t *vr, && code != MIN_EXPR && code != MAX_EXPR && code != BIT_AND_EXPR - && code != TRUTH_ANDIF_EXPR - && code != TRUTH_ORIF_EXPR && code != TRUTH_AND_EXPR && code != TRUTH_OR_EXPR) { @@ -1975,9 +1973,7 @@ extract_range_from_binary_expr (value_range_t *vr, /* For integer ranges, apply the operation to each end of the range and see what we end up with. */ - if (code == TRUTH_ANDIF_EXPR - || code == TRUTH_ORIF_EXPR - || code == TRUTH_AND_EXPR + if (code == TRUTH_AND_EXPR || code == TRUTH_OR_EXPR) { /* If one of the operands is zero, we know that the whole @@ -2751,8 +2747,6 @@ extract_range_from_expr (value_range_t *vr, tree expr) else if (code == SSA_NAME) extract_range_from_ssa_name (vr, expr); else if (TREE_CODE_CLASS (code) == tcc_binary - || code == TRUTH_ANDIF_EXPR - || code == TRUTH_ORIF_EXPR || code == TRUTH_AND_EXPR || code == TRUTH_OR_EXPR || code == TRUTH_XOR_EXPR) @@ -5385,7 +5379,8 @@ vrp_evaluate_conditional (tree cond, tree stmt) if (warn_type_limits && ret - && TREE_CODE_CLASS (TREE_CODE (cond)) == tcc_comparison) + && TREE_CODE_CLASS (TREE_CODE (cond)) == tcc_comparison + && TREE_CODE (TREE_OPERAND (cond, 0)) == SSA_NAME) { /* If the comparison is being folded and the operand on the LHS is being compared against a constant value that is outside of @@ -6739,20 +6734,6 @@ execute_vrp (void) ssa_propagate (vrp_visit_stmt, vrp_visit_phi_node); vrp_finalize (); - /* Remove dead edges from SWITCH_EXPR optimization. This leaves the - CFG in a broken state and requires a cfg_cleanup run. */ - for (i = 0; VEC_iterate (edge, to_remove_edges, i, e); ++i) - remove_edge (e); - /* Update SWITCH_EXPR case label vector. */ - for (i = 0; VEC_iterate (switch_update, to_update_switch_stmts, i, su); ++i) - SWITCH_LABELS (su->stmt) = su->vec; - - if (VEC_length (edge, to_remove_edges) > 0) - free_dominance_info (CDI_DOMINATORS); - - VEC_free (edge, heap, to_remove_edges); - VEC_free (switch_update, heap, to_update_switch_stmts); - /* ASSERT_EXPRs must be removed before finalizing jump threads as finalizing jump threads calls the CFG cleanup code which does not properly handle ASSERT_EXPRs. */ @@ -6766,6 +6747,24 @@ execute_vrp (void) update_ssa (TODO_update_ssa); finalize_jump_threads (); + + /* Remove dead edges from SWITCH_EXPR optimization. This leaves the + CFG in a broken state and requires a cfg_cleanup run. */ + for (i = 0; VEC_iterate (edge, to_remove_edges, i, e); ++i) + remove_edge (e); + /* Update SWITCH_EXPR case label vector. */ + for (i = 0; VEC_iterate (switch_update, to_update_switch_stmts, i, su); ++i) + SWITCH_LABELS (su->stmt) = su->vec; + + if (VEC_length (edge, to_remove_edges) > 0) + { + free_dominance_info (CDI_DOMINATORS); + cleanup_tree_cfg (); + } + + VEC_free (edge, heap, to_remove_edges); + VEC_free (switch_update, heap, to_update_switch_stmts); + scev_finalize (); loop_optimizer_finalize (); diff --git a/gcc/tree.h b/gcc/tree.h index 9eac3e8b2fa..bdaf8d0f53d 100644 --- a/gcc/tree.h +++ b/gcc/tree.h @@ -389,6 +389,7 @@ struct tree_base GTY(()) unsigned deprecated_flag : 1; unsigned invariant_flag : 1; unsigned saturating_flag : 1; + unsigned default_def_flag : 1; unsigned lang_flag_0 : 1; unsigned lang_flag_1 : 1; @@ -399,7 +400,7 @@ struct tree_base GTY(()) unsigned lang_flag_6 : 1; unsigned visited : 1; - unsigned spare : 23; + unsigned spare : 22; /* FIXME tuples: Eventually, we need to move this somewhere external to the trees. */ @@ -1881,7 +1882,7 @@ struct tree_exp GTY(()) Default definitions are always created by an empty statement and belong to no basic block. */ #define SSA_NAME_IS_DEFAULT_DEF(NODE) \ - SSA_NAME_CHECK (NODE)->base.volatile_flag + SSA_NAME_CHECK (NODE)->base.default_def_flag /* Attributes for SSA_NAMEs for pointer-type variables. */ #define SSA_NAME_PTR_INFO(N) \ @@ -2207,11 +2208,6 @@ struct tree_block GTY(()) #define TYPE_IS_SIZETYPE(NODE) \ (INTEGER_TYPE_CHECK (NODE)->type.no_force_blk_flag) -/* In a FUNCTION_TYPE, indicates that the function returns with the stack - pointer depressed. */ -#define TYPE_RETURNS_STACK_DEPRESSED(NODE) \ - (FUNCTION_TYPE_CHECK (NODE)->type.no_force_blk_flag) - /* Nonzero in a type considered volatile as a whole. */ #define TYPE_VOLATILE(NODE) (TYPE_CHECK (NODE)->base.volatile_flag) @@ -4851,6 +4847,9 @@ extern bool tree_binary_nonnegative_warnv_p (enum tree_code, tree, tree, tree, bool *); extern bool tree_single_nonnegative_warnv_p (tree t, bool *strict_overflow_p); extern bool tree_invalid_nonnegative_warnv_p (tree t, bool *strict_overflow_p); +extern bool tree_call_nonnegative_warnv_p (enum tree_code code, tree, tree, + tree, tree, bool *); + extern bool tree_expr_nonzero_warnv_p (tree, bool *); extern bool fold_real_zero_addition_p (const_tree, const_tree, int); @@ -5002,14 +5001,11 @@ extern tree build_duplicate_type (tree); /* Nonzero if this is a call to "pure" function (like const function, but may read memory. */ #define ECF_PURE 128 -/* Nonzero if this is a call to a function that returns with the stack - pointer depressed. */ -#define ECF_SP_DEPRESSED 256 /* Create libcall block around the call. */ -#define ECF_LIBCALL_BLOCK 512 +#define ECF_LIBCALL_BLOCK 256 /* Function does not read or write memory (but may have side effects, so it does not necessarily fit ECF_CONST). */ -#define ECF_NOVOPS 1024 +#define ECF_NOVOPS 512 extern int flags_from_decl_or_type (const_tree); extern int call_expr_flags (const_tree); diff --git a/gcc/varasm.c b/gcc/varasm.c index 73110497c8b..b3d3bb1ce75 100644 --- a/gcc/varasm.c +++ b/gcc/varasm.c @@ -70,7 +70,7 @@ struct addr_const; struct constant_descriptor_rtx; struct rtx_constant_pool; -#define n_deferred_constants (rtl.varasm.deferred_constants) +#define n_deferred_constants (crtl->varasm.deferred_constants) /* Number for making the label on the next constant that is stored in memory. */ @@ -611,7 +611,7 @@ initialize_cold_section_name (void) tree dsn; gcc_assert (cfun && current_function_decl); - if (cfun->unlikely_text_section_name) + if (crtl->subsections.unlikely_text_section_name) return; dsn = DECL_SECTION_NAME (current_function_decl); @@ -623,10 +623,10 @@ initialize_cold_section_name (void) stripped_name = targetm.strip_name_encoding (name); buffer = ACONCAT ((stripped_name, "_unlikely", NULL)); - cfun->unlikely_text_section_name = ggc_strdup (buffer); + crtl->subsections.unlikely_text_section_name = ggc_strdup (buffer); } else - cfun->unlikely_text_section_name = UNLIKELY_EXECUTED_TEXT_SECTION_NAME; + crtl->subsections.unlikely_text_section_name = UNLIKELY_EXECUTED_TEXT_SECTION_NAME; } /* Tell assembler to switch to unlikely-to-be-executed text section. */ @@ -636,10 +636,10 @@ unlikely_text_section (void) { if (cfun) { - if (!cfun->unlikely_text_section_name) + if (!crtl->subsections.unlikely_text_section_name) initialize_cold_section_name (); - return get_named_section (NULL, cfun->unlikely_text_section_name, 0); + return get_named_section (NULL, crtl->subsections.unlikely_text_section_name, 0); } else return get_named_section (NULL, UNLIKELY_EXECUTED_TEXT_SECTION_NAME, 0); @@ -656,7 +656,7 @@ unlikely_text_section_p (section *sect) const char *name; if (cfun) - name = cfun->unlikely_text_section_name; + name = crtl->subsections.unlikely_text_section_name; else name = UNLIKELY_EXECUTED_TEXT_SECTION_NAME; @@ -1587,27 +1587,27 @@ assemble_start_function (tree decl, const char *fnname) char tmp_label[100]; bool hot_label_written = false; - cfun->unlikely_text_section_name = NULL; + crtl->subsections.unlikely_text_section_name = NULL; first_function_block_is_cold = false; if (flag_reorder_blocks_and_partition) { ASM_GENERATE_INTERNAL_LABEL (tmp_label, "LHOTB", const_labelno); - cfun->hot_section_label = ggc_strdup (tmp_label); + crtl->subsections.hot_section_label = ggc_strdup (tmp_label); ASM_GENERATE_INTERNAL_LABEL (tmp_label, "LCOLDB", const_labelno); - cfun->cold_section_label = ggc_strdup (tmp_label); + crtl->subsections.cold_section_label = ggc_strdup (tmp_label); ASM_GENERATE_INTERNAL_LABEL (tmp_label, "LHOTE", const_labelno); - cfun->hot_section_end_label = ggc_strdup (tmp_label); + crtl->subsections.hot_section_end_label = ggc_strdup (tmp_label); ASM_GENERATE_INTERNAL_LABEL (tmp_label, "LCOLDE", const_labelno); - cfun->cold_section_end_label = ggc_strdup (tmp_label); + crtl->subsections.cold_section_end_label = ggc_strdup (tmp_label); const_labelno++; } else { - cfun->hot_section_label = NULL; - cfun->cold_section_label = NULL; - cfun->hot_section_end_label = NULL; - cfun->cold_section_end_label = NULL; + crtl->subsections.hot_section_label = NULL; + crtl->subsections.cold_section_label = NULL; + crtl->subsections.hot_section_end_label = NULL; + crtl->subsections.cold_section_end_label = NULL; } /* The following code does not need preprocessing in the assembler. */ @@ -1628,7 +1628,7 @@ assemble_start_function (tree decl, const char *fnname) { switch_to_section (unlikely_text_section ()); assemble_align (DECL_ALIGN (decl)); - ASM_OUTPUT_LABEL (asm_out_file, cfun->cold_section_label); + ASM_OUTPUT_LABEL (asm_out_file, crtl->subsections.cold_section_label); /* When the function starts with a cold section, we need to explicitly align the hot section and write out the hot section label. @@ -1638,7 +1638,7 @@ assemble_start_function (tree decl, const char *fnname) { switch_to_section (text_section); assemble_align (DECL_ALIGN (decl)); - ASM_OUTPUT_LABEL (asm_out_file, cfun->hot_section_label); + ASM_OUTPUT_LABEL (asm_out_file, crtl->subsections.hot_section_label); hot_label_written = true; first_function_block_is_cold = true; } @@ -1652,9 +1652,9 @@ assemble_start_function (tree decl, const char *fnname) initialize_cold_section_name (); - if (cfun->unlikely_text_section_name + if (crtl->subsections.unlikely_text_section_name && strcmp (TREE_STRING_POINTER (DECL_SECTION_NAME (decl)), - cfun->unlikely_text_section_name) == 0) + crtl->subsections.unlikely_text_section_name) == 0) first_function_block_is_cold = true; } @@ -1665,7 +1665,7 @@ assemble_start_function (tree decl, const char *fnname) switch_to_section (function_section (decl)); if (flag_reorder_blocks_and_partition && !hot_label_written) - ASM_OUTPUT_LABEL (asm_out_file, cfun->hot_section_label); + ASM_OUTPUT_LABEL (asm_out_file, crtl->subsections.hot_section_label); /* Tell assembler to move to target machine's alignment for functions. */ align = floor_log2 (DECL_ALIGN (decl) / BITS_PER_UNIT); @@ -1743,12 +1743,12 @@ assemble_end_function (tree decl, const char *fnname ATTRIBUTE_UNUSED) save_text_section = in_section; switch_to_section (unlikely_text_section ()); - ASM_OUTPUT_LABEL (asm_out_file, cfun->cold_section_end_label); + ASM_OUTPUT_LABEL (asm_out_file, crtl->subsections.cold_section_end_label); if (first_function_block_is_cold) switch_to_section (text_section); else switch_to_section (function_section (decl)); - ASM_OUTPUT_LABEL (asm_out_file, cfun->hot_section_end_label); + ASM_OUTPUT_LABEL (asm_out_file, crtl->subsections.hot_section_end_label); switch_to_section (save_text_section); } } @@ -3456,8 +3456,8 @@ create_constant_pool (void) void init_varasm_status (void) { - rtl.varasm.pool = create_constant_pool (); - rtl.varasm.deferred_constants = 0; + crtl->varasm.pool = create_constant_pool (); + crtl->varasm.deferred_constants = 0; } /* Given a MINUS expression, simplify it if both sides @@ -3494,7 +3494,7 @@ force_const_mem (enum machine_mode mode, rtx x) /* Decide which pool to use. */ pool = (targetm.use_blocks_for_constant_p (mode, x) ? shared_constant_pool - : rtl.varasm.pool); + : crtl->varasm.pool); /* Lookup the value in the hashtable. */ tmp.constant = x; @@ -3606,7 +3606,7 @@ get_pool_mode (const_rtx addr) int get_pool_size (void) { - return rtl.varasm.pool->offset; + return crtl->varasm.pool->offset; } /* Worker function for output_constant_pool_1. Emit assembly for X @@ -3848,7 +3848,7 @@ static void output_constant_pool (const char *fnname ATTRIBUTE_UNUSED, tree fndecl ATTRIBUTE_UNUSED) { - struct rtx_constant_pool *pool = rtl.varasm.pool; + struct rtx_constant_pool *pool = crtl->varasm.pool; /* It is possible for gcc to call force_const_mem and then to later discard the instructions which refer to the constant. In such a @@ -5540,8 +5540,8 @@ default_section_type_flags (tree decl, const char *name, int reloc) flags = 0; else if (current_function_decl && cfun - && cfun->unlikely_text_section_name - && strcmp (name, cfun->unlikely_text_section_name) == 0) + && crtl->subsections.unlikely_text_section_name + && strcmp (name, crtl->subsections.unlikely_text_section_name) == 0) flags = SECTION_CODE; else if (!decl && (!current_function_decl || !cfun) @@ -6316,10 +6316,10 @@ switch_to_section (section *new_section) { case SECTION_NAMED: if (cfun - && !cfun->unlikely_text_section_name + && !crtl->subsections.unlikely_text_section_name && strcmp (new_section->named.name, UNLIKELY_EXECUTED_TEXT_SECTION_NAME) == 0) - cfun->unlikely_text_section_name = UNLIKELY_EXECUTED_TEXT_SECTION_NAME; + crtl->subsections.unlikely_text_section_name = UNLIKELY_EXECUTED_TEXT_SECTION_NAME; targetm.asm_out.named_section (new_section->named.name, new_section->named.common.flags, diff --git a/gnattools/ChangeLog b/gnattools/ChangeLog index ad836eaeb29..34f5ef7c0ac 100644 --- a/gnattools/ChangeLog +++ b/gnattools/ChangeLog @@ -1,3 +1,7 @@ +2008-04-05 Arnaud Charlet <charlet@adacore.com> + + * Makefile.in: Remove handling of gnatbl. + 2007-12-05 Bechir Zalila <bechir.zalila@gmail.com> PR ada/34284 diff --git a/gnattools/Makefile.in b/gnattools/Makefile.in index 64830a0fd60..eb90a9fd09f 100644 --- a/gnattools/Makefile.in +++ b/gnattools/Makefile.in @@ -199,7 +199,7 @@ gnattools-native: $(GCC_DIR)/stamp-tools $(GCC_DIR)/stamp-gnatlib # gnattools1 $(MAKE) -C $(GCC_DIR)/ada/tools -f ../Makefile \ $(TOOLS_FLAGS_TO_PASS_1) \ - ../../gnatmake$(exeext) ../../gnatlink$(exeext) ../../gnatbl$(exeext) + ../../gnatmake$(exeext) ../../gnatlink$(exeext) # gnattools2 $(MAKE) -C $(GCC_DIR)/ada/tools -f ../Makefile \ $(TOOLS_FLAGS_TO_PASS_NATIVE) \ @@ -242,9 +242,6 @@ gnattools-cross: $(GCC_DIR)/stamp-tools if [ -f $(GCC_DIR)/gnatbind$(exeext) ] ; then \ mv $(GCC_DIR)/gnatbind$(exeext) $(GCC_DIR)/gnatbind-cross$(exeext); \ fi - if [ -f $(GCC_DIR)/gnatbl$(exeext) ] ; then \ - mv $(GCC_DIR)/gnatbl$(exeext) $(GCC_DIR)/gnatbl-cross$(exeext); \ - fi if [ -f $(GCC_DIR)/gnatchop$(exeext) ] ; then \ mv $(GCC_DIR)/gnatchop$(exeext) $(GCC_DIR)/gnatchop-cross$(exeext); \ fi diff --git a/libcpp/ChangeLog b/libcpp/ChangeLog index f5c623db910..02de9d0c515 100644 --- a/libcpp/ChangeLog +++ b/libcpp/ChangeLog @@ -1,3 +1,9 @@ +2008-04-11 Kaz Kojima <kkojima@gcc.gnu.org> + + * configure.ac: (need_64bit_hwint): Need 64bit hwint for sh-*-* + and shbe-*-*. + * configure: Rebuilt. + 2008-04-02 Joseph Myers <joseph@codesourcery.com> * include/cpplib.h (struct cpp_callbacks): Add used_define, diff --git a/libcpp/config.in b/libcpp/config.in index 5d52ec12210..4f3fcc7ab20 100644 --- a/libcpp/config.in +++ b/libcpp/config.in @@ -240,15 +240,15 @@ /* Define to the version of this package. */ #undef PACKAGE_VERSION -/* The size of a `int', as computed by sizeof. */ +/* The size of `int', as computed by sizeof. */ #undef SIZEOF_INT -/* The size of a `long', as computed by sizeof. */ +/* The size of `long', as computed by sizeof. */ #undef SIZEOF_LONG /* If using the C implementation of alloca, define if you know the direction of stack growth for your system; otherwise it will be - automatically deduced at run-time. + automatically deduced at runtime. STACK_DIRECTION > 0 => grows toward higher addresses STACK_DIRECTION < 0 => grows toward lower addresses STACK_DIRECTION = 0 => direction of growth unknown */ @@ -275,10 +275,10 @@ #undef inline #endif -/* Define to `long' if <sys/types.h> does not define. */ +/* Define to `long int' if <sys/types.h> does not define. */ #undef off_t -/* Define to `unsigned' if <sys/types.h> does not define. */ +/* Define to `unsigned int' if <sys/types.h> does not define. */ #undef size_t /* Define to `int' if <sys/types.h> does not define. */ diff --git a/libcpp/configure b/libcpp/configure index f93910c2870..c94499f4499 100755 --- a/libcpp/configure +++ b/libcpp/configure @@ -8797,7 +8797,7 @@ case $target in sparcv9-*-solaris2* | \ sparc-*-solaris2.[789] | sparc-*-solaris2.1[0-9]* | \ spu-*-* | \ - sh[123456789l]*-*-*) + sh[123456789lbe]*-*-* | sh-*-*) need_64bit_hwint=yes ;; i[34567]86-*-linux*) if test "x$enable_targets" = xall; then diff --git a/libcpp/configure.ac b/libcpp/configure.ac index 40f62715acd..b92f390a40a 100644 --- a/libcpp/configure.ac +++ b/libcpp/configure.ac @@ -130,7 +130,7 @@ case $target in sparcv9-*-solaris2* | \ sparc-*-solaris2.[789] | sparc-*-solaris2.1[0-9]* | \ spu-*-* | \ - sh[123456789l]*-*-*) + sh[123456789lbe]*-*-* | sh-*-*) need_64bit_hwint=yes ;; i[34567]86-*-linux*) if test "x$enable_targets" = xall; then diff --git a/libgcc/ChangeLog b/libgcc/ChangeLog index 589f44b5369..ad0bf65f4ed 100644 --- a/libgcc/ChangeLog +++ b/libgcc/ChangeLog @@ -1,3 +1,10 @@ +2008-04-07 Andy Hutchinson <hutchinsonandy@aim.com> + + PR target/34210 + PR target/35508 + * config.host (avr-*-*): Add avr cpu_type and avr tmake_file. + * config/t-avr: New file. Build 16bit libgcc functions. + 2008-03-02 Jakub Jelinek <jakub@redhat.com> PR target/35401 diff --git a/libgcc/config.host b/libgcc/config.host index 9496842f9bb..d695b44182d 100644 --- a/libgcc/config.host +++ b/libgcc/config.host @@ -77,6 +77,9 @@ strongarm*-*-*) arm*-*-*) cpu_type=arm ;; +avr-*-*) + cpu_type=avr + ;; bfin*-*) cpu_type=bfin ;; @@ -243,6 +246,8 @@ arm*-*-kaos*) avr-*-rtems*) ;; avr-*-*) + # Make HImode functions for AVR + tmake_file=${cpu_type}/t-avr ;; bfin*-elf*) ;; diff --git a/libgcc/config/avr/t-avr b/libgcc/config/avr/t-avr new file mode 100644 index 00000000000..ee570724171 --- /dev/null +++ b/libgcc/config/avr/t-avr @@ -0,0 +1,19 @@ +# Extra 16-bit integer functions.
+intfuncs16 = _absvXX2 _addvXX3 _subvXX3 _mulvXX3 _negvXX2 _ffsXX2 _clzXX2 \
+ _ctzXX2 _popcountXX2 _parityXX2
+hiintfuncs16 = $(subst XX,hi,$(intfuncs16))
+siintfuncs16 = $(subst XX,si,$(intfuncs16))
+
+iter-items := $(hiintfuncs16)
+iter-labels := $(siintfuncs16)
+iter-sizes := $(patsubst %,2,$(siintfuncs16)) $(patsubst %,2,$(hiintfuncs16))
+
+
+include $(srcdir)/empty.mk $(patsubst %,$(srcdir)/siditi-object.mk,$(iter-items))
+libgcc-objects += $(patsubst %,%$(objext),$(hiintfuncs16))
+
+ifeq ($(enable_shared),yes)
+libgcc-s-objects += $(patsubst %,%_s$(objext),$(hiintfuncs16))
+endif
+
+
diff --git a/libgfortran/ChangeLog b/libgfortran/ChangeLog index 11592e4b4cc..e228cf6db8c 100644 --- a/libgfortran/ChangeLog +++ b/libgfortran/ChangeLog @@ -1,3 +1,111 @@ +2008-04-13 Thomas Koenig <tkoenig@gcc.gnu.org> + Francois-Xavier Coudert <fxcoudert@gcc.gnu.org> + + PR libfortran/32972 + PR libfortran/32512 + configure.ac: Add test for uintptr_t. + configure: Regenerated. + config.h.in: Regenerated. + * libgfortran.h: GFC_DTYPE_DERIVED_1: New macro. + GFC_DTYPE_DERIVED_2: New macro. + GFC_DTYPE_DERIVED_4: New macro. + GFC_DTYPE_DERIVED_8: New macro. + GFC_DTYPE_DERIVED_16: New macro. + GFC_UNALIGNED_2: New macro. + GFC_UNALIGNED_4: New macro. + GFC_UNALIGNED_8: New macro. + GFC_UNALIGNED_16: New macro. + intptr_t: Define if we don't have it. + uintptr_t: Likewise. + * runtime/backtrace.c (show_backtrace): Use intptr_t. + * intrinsics/signal.c (signal_sub): Likewise. + (signal_sub_int): Likewise. + (alarm_sub_int_i4): Likewise. + * intrinsics/spread_generic.c (spread): Use the integer + routines for handling derived types of sizes 1, 2, 4, 8 and 16 + if the alignment of all pointers is correct. + (spread_scalar): Likewise. + * intrinsics/pack_generic.c (pack): Likewise. + Use GFD_DTYPE_TYPE_SIZE to avoid nested switch statements. + * intrinsics/unpack_generic.c (unpack1): Likewise. + (unpack0): Likewise. + * runtime/in_pack_generic.c (internal_pack): Likewise. + * runtime/in_unpack_generic.c (internal_unpack): Likewise. + +2008-04-09 Jakub Jelinek <jakub@redhat.com> + + * io/list_read.c (snprintf): Define if HAVE_SNPRINTF isn't defined. + (nml_read_obj): Add nml_err_msg_size argument. Pass it down to + recursive call. Use snprintf instead of sprintf when %s nl->var_name + is used. + (nml_get_obj_data): Add nml_err_msg_size argument. Pass it down to + nml_read_obj call. Use snprintf instead of sprintf when %s + nl->var_name is used. Pass nml_err_msg to nml_parse_qualifier instead + of parse_err_msg array. Append " for namelist variable " and + nl->var_name to it. + (namelist_read): Increase size of nml_err_msg array to 200. Pass + sizeof nml_err_msg as extra argument to nml_get_obj_data. + +2008-04-07 Jerry DeLisle <jvdelisle@gcc.gnu.org> + + PR fortran/25829 28655 + * io/open.c (edit_modes): Set flags.async. (new_unit) Set flags.async + and flags.status. (st_open): Initialize flags.async. + * io/list_read.c (read_charactor): Use delim_status instead of + flags.delim. + * io/read.c (read_x): Use pad_status instead of flags.pad. + * io/inquire.c (inquire_via_unit): Add new checks. + (inquire_via_filename): Likewise. + * io/io.h (st_parameter_inquire): Add new flags. + (st_parameter_dt): Likewise. + * io/unit.c (get_internal_unit): Set flags.async. (init_units): Set + flags.async. + * io/transfer.c: Add delim and pad option arrays. (read_sf): Use + pad_status instead of flags.pad. (read_block): Likewise. + (data_transfer_init): Set flags.async and add checks. + * io/write.c (write_character): Use delim_status. + (list_formatted_write_scalar): Likewise. (nml_write_obj): Likewise. + (namelist_write): Likewise. + +2008-04-05 Jerry DeLisle <jvdelisle@gcc.gnu.org> + + PR fortran/25829 28655 + * gfortran.map: Add new symbol, _gfortran_st_wait. + * libgfortran.h (st_paramter_common): Add new I/O parameters. + * open.c (st_option decimal_opt[], st_option encoding_opt[], + st_option round_opt[], st_option sign_opt[], st_option async_opt[]): New + parameter option arrays. (edit_modes): Add checks for new parameters. + (new_unit): Likewise. (st_open): Likewise. + * list_read.c (CASE_SEPERATORS): Add ';' as a valid separator. + (eat_separator): Handle deimal comma. (read_logical): Fix whitespace. + (parse_real): Handle decimal comma. (read_real): Handle decimal comma. + * read.c (read_a): Use decimal status flag to allow comma in place of a + decimal point. (read_f): Allow comma as acceptable character in float. + According to decimal flag, substitute a period for a comma. + (read_x): If decimal status flag is comma, disable the read_comma flag, + not allowing comma as a delimiter, an extension otherwise. + * io.h: (unit_decimal, unit_encoding, unit_round, unit_sign, + unit_async): New enumerators. Add all new I/O parameters. + * unix.c (unix_stream, int_stream): Add io_mode asychronous I/O control. + (move_pos_offset, fd_alloc_w_at): Fix some whitespace. + (fd_sfree): Use new enumerator. (fd_read): Likewise. + (fd_write): Likewise. (fd_close): Fix whitespace. + (fd_open): Use new enumertors. (tempfile, regular_file, + open_external): Fix whitespace. (output_stream, error_stream): Set + method. (stream_offset): Fix whitespace. + * transfer.c: (st_option decimal_opt[], sign_opt[], blank_opt[]): New + option arrays. (formatted_transfer_scalar): Set sf_read_comma flag + based on new decimal_status flag. (data_transfer_init): Initialize new + parameters. Add checks for decimal, sign, and blank. (st_wait): New stub. + * format.c: (format_lex): Add format specifiers DP, DC, and D. + (parse_format_list): Parse the new specifiers. + * write.c (write_decimal): Use new sign enumerators to set the sign. + (write_complex): Handle decimal comma and semi-colon separator. + (nml_write_obj): Likewise. + * write_float.def: Revise sign enumerators. (calculate_sign): Use new + sign enumerators. (output_float): Likewise. Use new decimal_status flag + to set the decimal character to a point or a comma. + 2008-03-28 Thomas Koenig <tkoenig@gcc.gnu.org> PR libfortran/32972 diff --git a/libgfortran/config.h.in b/libgfortran/config.h.in index ddf8dd57620..1f291a48e27 100644 --- a/libgfortran/config.h.in +++ b/libgfortran/config.h.in @@ -744,6 +744,9 @@ /* Define to 1 if you have the `ttyname' function. */ #undef HAVE_TTYNAME +/* Define to 1 if the system has the type `uintptr_t'. */ +#undef HAVE_UINTPTR_T + /* Define to 1 if you have the <unistd.h> header file. */ #undef HAVE_UNISTD_H @@ -805,19 +808,19 @@ /* Define to the version of this package. */ #undef PACKAGE_VERSION -/* The size of `char', as computed by sizeof. */ +/* The size of a `char', as computed by sizeof. */ #undef SIZEOF_CHAR -/* The size of `int', as computed by sizeof. */ +/* The size of a `int', as computed by sizeof. */ #undef SIZEOF_INT -/* The size of `long', as computed by sizeof. */ +/* The size of a `long', as computed by sizeof. */ #undef SIZEOF_LONG -/* The size of `short', as computed by sizeof. */ +/* The size of a `short', as computed by sizeof. */ #undef SIZEOF_SHORT -/* The size of `void *', as computed by sizeof. */ +/* The size of a `void *', as computed by sizeof. */ #undef SIZEOF_VOID_P /* Define to 1 if you have the ANSI C header files. */ @@ -835,5 +838,5 @@ /* Define for large files, on AIX-style hosts. */ #undef _LARGE_FILES -/* Define to `long int' if <sys/types.h> does not define. */ +/* Define to `long' if <sys/types.h> does not define. */ #undef off_t diff --git a/libgfortran/configure b/libgfortran/configure index 4622d5e3848..8018012daca 100755 --- a/libgfortran/configure +++ b/libgfortran/configure @@ -18793,6 +18793,71 @@ _ACEOF fi +echo "$as_me:$LINENO: checking for uintptr_t" >&5 +echo $ECHO_N "checking for uintptr_t... $ECHO_C" >&6 +if test "${ac_cv_type_uintptr_t+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +if ((uintptr_t *) 0) + return 0; +if (sizeof (uintptr_t)) + return 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_type_uintptr_t=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_type_uintptr_t=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_type_uintptr_t" >&5 +echo "${ECHO_T}$ac_cv_type_uintptr_t" >&6 +if test $ac_cv_type_uintptr_t = yes; then + +cat >>confdefs.h <<_ACEOF +#define HAVE_UINTPTR_T 1 +_ACEOF + + +fi + # Check libc for getgid, getpid, getuid echo "$as_me:$LINENO: checking for getgid in -lc" >&5 diff --git a/libgfortran/configure.ac b/libgfortran/configure.ac index a1caf3b47eb..657ca4f6d9e 100644 --- a/libgfortran/configure.ac +++ b/libgfortran/configure.ac @@ -211,6 +211,7 @@ AC_CHECK_FUNCS(backtrace backtrace_symbols) # Check for types AC_CHECK_TYPES([intptr_t]) +AC_CHECK_TYPES([uintptr_t]) # Check libc for getgid, getpid, getuid AC_CHECK_LIB([c],[getgid],[AC_DEFINE([HAVE_GETGID],[1],[libc includes getgid])]) diff --git a/libgfortran/gfortran.map b/libgfortran/gfortran.map index 61b0d44ad29..2d0537246e3 100644 --- a/libgfortran/gfortran.map +++ b/libgfortran/gfortran.map @@ -1037,6 +1037,7 @@ GFORTRAN_1.1 { _gfortran_erfc_scaled_r8; _gfortran_erfc_scaled_r10; _gfortran_erfc_scaled_r16; + _gfortran_st_wait; } GFORTRAN_1.0; F2C_1.0 { diff --git a/libgfortran/intrinsics/pack_generic.c b/libgfortran/intrinsics/pack_generic.c index 2bd09913f00..e282c916502 100644 --- a/libgfortran/intrinsics/pack_generic.c +++ b/libgfortran/intrinsics/pack_generic.c @@ -313,101 +313,147 @@ void pack (gfc_array_char *ret, const gfc_array_char *array, const gfc_array_l1 *mask, const gfc_array_char *vector) { - int type; + index_type type_size; index_type size; - type = GFC_DESCRIPTOR_TYPE (array); - size = GFC_DESCRIPTOR_SIZE (array); + type_size = GFC_DTYPE_TYPE_SIZE(array); - switch(type) + switch(type_size) { - case GFC_DTYPE_INTEGER: - case GFC_DTYPE_LOGICAL: - switch(size) - { - case sizeof (GFC_INTEGER_1): - pack_i1 ((gfc_array_i1 *) ret, (gfc_array_i1 *) array, - (gfc_array_l1 *) mask, (gfc_array_i1 *) vector); - return; + case GFC_DTYPE_LOGICAL_1: + case GFC_DTYPE_INTEGER_1: + case GFC_DTYPE_DERIVED_1: + pack_i1 ((gfc_array_i1 *) ret, (gfc_array_i1 *) array, + (gfc_array_l1 *) mask, (gfc_array_i1 *) vector); + return; - case sizeof (GFC_INTEGER_2): - pack_i2 ((gfc_array_i2 *) ret, (gfc_array_i2 *) array, - (gfc_array_l1 *) mask, (gfc_array_i2 *) vector); - return; + case GFC_DTYPE_LOGICAL_2: + case GFC_DTYPE_INTEGER_2: + pack_i2 ((gfc_array_i2 *) ret, (gfc_array_i2 *) array, + (gfc_array_l1 *) mask, (gfc_array_i2 *) vector); + return; - case sizeof (GFC_INTEGER_4): - pack_i4 ((gfc_array_i4 *) ret, (gfc_array_i4 *) array, - (gfc_array_l1 *) mask, (gfc_array_i4 *) vector); - return; + case GFC_DTYPE_LOGICAL_4: + case GFC_DTYPE_INTEGER_4: - case sizeof (GFC_INTEGER_8): - pack_i8 ((gfc_array_i8 *) ret, (gfc_array_i8 *) array, - (gfc_array_l1 *) mask, (gfc_array_i8 *) vector); - return; + pack_i4 ((gfc_array_i4 *) ret, (gfc_array_i4 *) array, + (gfc_array_l1 *) mask, (gfc_array_i4 *) vector); + return; + + case GFC_DTYPE_LOGICAL_8: + case GFC_DTYPE_INTEGER_8: + + pack_i8 ((gfc_array_i8 *) ret, (gfc_array_i8 *) array, + (gfc_array_l1 *) mask, (gfc_array_i8 *) vector); + return; #ifdef HAVE_GFC_INTEGER_16 - case sizeof (GFC_INTEGER_16): - pack_i16 ((gfc_array_i16 *) ret, (gfc_array_i16 *) array, - (gfc_array_l1 *) mask, (gfc_array_i16 *) vector); - return; + case GFC_DTYPE_LOGICAL_16: + case GFC_DTYPE_INTEGER_16: + + pack_i16 ((gfc_array_i16 *) ret, (gfc_array_i16 *) array, + (gfc_array_l1 *) mask, (gfc_array_i16 *) vector); + return; #endif - } - case GFC_DTYPE_REAL: - switch(size) - { - case sizeof (GFC_REAL_4): - pack_r4 ((gfc_array_r4 *) ret, (gfc_array_r4 *) array, - (gfc_array_l1 *) mask, (gfc_array_r4 *) vector); - return; + case GFC_DTYPE_REAL_4: + pack_r4 ((gfc_array_r4 *) ret, (gfc_array_r4 *) array, + (gfc_array_l1 *) mask, (gfc_array_r4 *) vector); + return; - case sizeof (GFC_REAL_8): - pack_r8 ((gfc_array_r8 *) ret, (gfc_array_r8 *) array, - (gfc_array_l1 *) mask, (gfc_array_r8 *) vector); - return; + case GFC_DTYPE_REAL_8: + pack_r8 ((gfc_array_r8 *) ret, (gfc_array_r8 *) array, + (gfc_array_l1 *) mask, (gfc_array_r8 *) vector); + return; #ifdef HAVE_GFC_REAL_10 - case sizeof (GFC_REAL_10): - pack_r10 ((gfc_array_r10 *) ret, (gfc_array_r10 *) array, - (gfc_array_l1 *) mask, (gfc_array_r10 *) vector); - return; + case GFC_DTYPE_REAL_10: + pack_r10 ((gfc_array_r10 *) ret, (gfc_array_r10 *) array, + (gfc_array_l1 *) mask, (gfc_array_r10 *) vector); + return; #endif #ifdef HAVE_GFC_REAL_16 - case sizeof (GFC_REAL_16): - pack_r16 ((gfc_array_r16 *) ret, (gfc_array_r16 *) array, - (gfc_array_l1 *) mask, (gfc_array_r16 *) vector); - return; + case GFC_DTYPE_REAL_16: + pack_r16 ((gfc_array_r16 *) ret, (gfc_array_r16 *) array, + (gfc_array_l1 *) mask, (gfc_array_r16 *) vector); + return; #endif - } - case GFC_DTYPE_COMPLEX: - switch(size) - { - case sizeof (GFC_COMPLEX_4): - pack_c4 ((gfc_array_c4 *) ret, (gfc_array_c4 *) array, - (gfc_array_l1 *) mask, (gfc_array_c4 *) vector); - return; + case GFC_DTYPE_COMPLEX_4: + pack_c4 ((gfc_array_c4 *) ret, (gfc_array_c4 *) array, + (gfc_array_l1 *) mask, (gfc_array_c4 *) vector); + return; - case sizeof (GFC_COMPLEX_8): - pack_c8 ((gfc_array_c8 *) ret, (gfc_array_c8 *) array, - (gfc_array_l1 *) mask, (gfc_array_c8 *) vector); - return; + case GFC_DTYPE_COMPLEX_8: + pack_c8 ((gfc_array_c8 *) ret, (gfc_array_c8 *) array, + (gfc_array_l1 *) mask, (gfc_array_c8 *) vector); + return; #ifdef HAVE_GFC_COMPLEX_10 - case sizeof (GFC_COMPLEX_10): - pack_c10 ((gfc_array_c10 *) ret, (gfc_array_c10 *) array, - (gfc_array_l1 *) mask, (gfc_array_c10 *) vector); - return; + case GFC_DTYPE_COMPLEX_10: + pack_c10 ((gfc_array_c10 *) ret, (gfc_array_c10 *) array, + (gfc_array_l1 *) mask, (gfc_array_c10 *) vector); + return; #endif #ifdef HAVE_GFC_COMPLEX_16 - case sizeof (GFC_COMPLEX_16): - pack_c16 ((gfc_array_c16 *) ret, (gfc_array_c16 *) array, - (gfc_array_l1 *) mask, (gfc_array_c16 *) vector); - return; + case GFC_DTYPE_COMPLEX_16: + pack_c16 ((gfc_array_c16 *) ret, (gfc_array_c16 *) array, + (gfc_array_l1 *) mask, (gfc_array_c16 *) vector); + return; #endif + /* For derived types, let's check the actual alignment of the + data pointers. If they are aligned, we can safely call + the unpack functions. */ + + case GFC_DTYPE_DERIVED_2: + if (GFC_UNALIGNED_2(ret->data) || GFC_UNALIGNED_2(array->data) + || GFC_UNALIGNED_2(vector->data)) + break; + else + { + pack_i2 ((gfc_array_i2 *) ret, (gfc_array_i2 *) array, + (gfc_array_l1 *) mask, (gfc_array_i2 *) vector); + return; + } + + case GFC_DTYPE_DERIVED_4: + if (GFC_UNALIGNED_4(ret->data) || GFC_UNALIGNED_4(array->data) + || GFC_UNALIGNED_4(vector->data)) + break; + else + { + pack_i4 ((gfc_array_i4 *) ret, (gfc_array_i4 *) array, + (gfc_array_l1 *) mask, (gfc_array_i4 *) vector); + return; + } + + case GFC_DTYPE_DERIVED_8: + if (GFC_UNALIGNED_8(ret->data) || GFC_UNALIGNED_8(array->data) + || GFC_UNALIGNED_8(vector->data)) + break; + else + { + pack_i8 ((gfc_array_i8 *) ret, (gfc_array_i8 *) array, + (gfc_array_l1 *) mask, (gfc_array_i8 *) vector); } + +#ifdef HAVE_GFC_INTEGER_16 + case GFC_DTYPE_DERIVED_16: + if (GFC_UNALIGNED_16(ret->data) || GFC_UNALIGNED_16(array->data) + || GFC_UNALIGNED_16(vector->data)) + break; + else + { + pack_i16 ((gfc_array_i16 *) ret, (gfc_array_i16 *) array, + (gfc_array_l1 *) mask, (gfc_array_i16 *) vector); + return; + } +#endif + } + + size = GFC_DESCRIPTOR_SIZE (array); pack_internal (ret, array, mask, vector, size); } diff --git a/libgfortran/intrinsics/signal.c b/libgfortran/intrinsics/signal.c index 27d6222cf4e..bd03f6d1afe 100644 --- a/libgfortran/intrinsics/signal.c +++ b/libgfortran/intrinsics/signal.c @@ -44,12 +44,6 @@ Boston, MA 02110-1301, USA. */ #include <errno.h> -#ifdef HAVE_INTPTR_T -# define INTPTR_T intptr_t -#else -# define INTPTR_T int -#endif - /* SIGNAL subroutine with PROCEDURE as handler */ extern void signal_sub (int *, void (*)(int), int *); iexport_proto(signal_sub); @@ -58,11 +52,11 @@ void signal_sub (int *number, void (*handler)(int), int *status) { #ifdef HAVE_SIGNAL - INTPTR_T ret; + intptr_t ret; if (status != NULL) { - ret = (INTPTR_T) signal (*number, handler); + ret = (intptr_t) signal (*number, handler); *status = (int) ret; } else @@ -84,11 +78,11 @@ void signal_sub_int (int *number, int *handler, int *status) { #ifdef HAVE_SIGNAL - INTPTR_T ptr = *handler, ret; + intptr_t ptr = *handler, ret; if (status != NULL) { - ret = (INTPTR_T) signal (*number, (void (*)(int)) ptr); + ret = (intptr_t) signal (*number, (void (*)(int)) ptr); *status = (int) ret; } else @@ -204,14 +198,14 @@ alarm_sub_int_i4 (int *seconds __attribute__ ((unused)), #if defined (SIGALRM) && defined (HAVE_ALARM) && defined (HAVE_SIGNAL) if (status != NULL) { - if (signal (SIGALRM, (void (*)(int)) (INTPTR_T) *handler) == SIG_ERR) + if (signal (SIGALRM, (void (*)(int)) (intptr_t) *handler) == SIG_ERR) *status = -1; else *status = alarm (*seconds); } else { - signal (SIGALRM, (void (*)(int)) (INTPTR_T) *handler); + signal (SIGALRM, (void (*)(int)) (intptr_t) *handler); alarm (*seconds); } #else @@ -234,14 +228,14 @@ alarm_sub_int_i8 (int *seconds __attribute__ ((unused)), #if defined (SIGALRM) && defined (HAVE_ALARM) && defined (HAVE_SIGNAL) if (status != NULL) { - if (signal (SIGALRM, (void (*)(int)) (INTPTR_T) *handler) == SIG_ERR) + if (signal (SIGALRM, (void (*)(int)) (intptr_t) *handler) == SIG_ERR) *status = -1; else *status = alarm (*seconds); } else { - signal (SIGALRM, (void (*)(int)) (INTPTR_T) *handler); + signal (SIGALRM, (void (*)(int)) (intptr_t) *handler); alarm (*seconds); } #else diff --git a/libgfortran/intrinsics/spread_generic.c b/libgfortran/intrinsics/spread_generic.c index 16578f788fc..e50598a97c3 100644 --- a/libgfortran/intrinsics/spread_generic.c +++ b/libgfortran/intrinsics/spread_generic.c @@ -281,6 +281,7 @@ spread (gfc_array_char *ret, const gfc_array_char *source, type_size = GFC_DTYPE_TYPE_SIZE(ret); switch(type_size) { + case GFC_DTYPE_DERIVED_1: case GFC_DTYPE_LOGICAL_1: case GFC_DTYPE_INTEGER_1: spread_i1 ((gfc_array_i1 *) ret, (gfc_array_i1 *) source, @@ -361,7 +362,49 @@ spread (gfc_array_char *ret, const gfc_array_char *source, return; #endif + case GFC_DTYPE_DERIVED_2: + if (GFC_UNALIGNED_2(ret->data) || GFC_UNALIGNED_2(source->data)) + break; + else + { + spread_i1 ((gfc_array_i1 *) ret, (gfc_array_i1 *) source, + *along, *pncopies); + return; + } + + case GFC_DTYPE_DERIVED_4: + if (GFC_UNALIGNED_4(ret->data) || GFC_UNALIGNED_4(source->data)) + break; + else + { + spread_i4 ((gfc_array_i4 *) ret, (gfc_array_i4 *) source, + *along, *pncopies); + return; + } + + case GFC_DTYPE_DERIVED_8: + if (GFC_UNALIGNED_8(ret->data) || GFC_UNALIGNED_8(source->data)) + break; + else + { + spread_i8 ((gfc_array_i8 *) ret, (gfc_array_i8 *) source, + *along, *pncopies); + return; + } + +#ifdef HAVE_GFC_INTEGER_16 + case GFC_DTYPE_DERIVED_16: + if (GFC_UNALIGNED_16(ret->data) || GFC_UNALIGNED_16(source->data)) + break; + else + { + spread_i16 ((gfc_array_i16 *) ret, (gfc_array_i16 *) source, + *along, *pncopies); + return; + } +#endif } + spread_internal (ret, source, along, pncopies, GFC_DESCRIPTOR_SIZE (source)); } @@ -398,6 +441,7 @@ spread_scalar (gfc_array_char *ret, const char *source, type_size = GFC_DTYPE_TYPE_SIZE(ret); switch(type_size) { + case GFC_DTYPE_DERIVED_1: case GFC_DTYPE_LOGICAL_1: case GFC_DTYPE_INTEGER_1: spread_scalar_i1 ((gfc_array_i1 *) ret, (GFC_INTEGER_1 *) source, @@ -478,6 +522,46 @@ spread_scalar (gfc_array_char *ret, const char *source, return; #endif + case GFC_DTYPE_DERIVED_2: + if (GFC_UNALIGNED_2(ret->data) || GFC_UNALIGNED_2(source)) + break; + else + { + spread_scalar_i2 ((gfc_array_i2 *) ret, (GFC_INTEGER_2 *) source, + *along, *pncopies); + return; + } + + case GFC_DTYPE_DERIVED_4: + if (GFC_UNALIGNED_4(ret->data) || GFC_UNALIGNED_4(source)) + break; + else + { + spread_scalar_i4 ((gfc_array_i4 *) ret, (GFC_INTEGER_4 *) source, + *along, *pncopies); + return; + } + + case GFC_DTYPE_DERIVED_8: + if (GFC_UNALIGNED_8(ret->data) || GFC_UNALIGNED_8(source)) + break; + else + { + spread_scalar_i8 ((gfc_array_i8 *) ret, (GFC_INTEGER_8 *) source, + *along, *pncopies); + return; + } +#ifdef HAVE_GFC_INTEGER_16 + case GFC_DTYPE_DERIVED_16: + if (GFC_UNALIGNED_16(ret->data) || GFC_UNALIGNED_16(source)) + break; + else + { + spread_scalar_i16 ((gfc_array_i16 *) ret, (GFC_INTEGER_16 *) source, + *along, *pncopies); + return; + } +#endif } spread_internal_scalar (ret, source, along, pncopies, GFC_DESCRIPTOR_SIZE (ret)); diff --git a/libgfortran/intrinsics/unpack_generic.c b/libgfortran/intrinsics/unpack_generic.c index 145dd350568..82607bd5897 100644 --- a/libgfortran/intrinsics/unpack_generic.c +++ b/libgfortran/intrinsics/unpack_generic.c @@ -196,102 +196,141 @@ void unpack1 (gfc_array_char *ret, const gfc_array_char *vector, const gfc_array_l1 *mask, const gfc_array_char *field) { - int type; + index_type type_size; index_type size; - type = GFC_DESCRIPTOR_TYPE (vector); + type_size = GFC_DTYPE_TYPE_SIZE (vector); size = GFC_DESCRIPTOR_SIZE (vector); - switch(type) + switch(type_size) { - case GFC_DTYPE_INTEGER: - case GFC_DTYPE_LOGICAL: - switch(size) - { - case sizeof (GFC_INTEGER_1): - unpack1_i1 ((gfc_array_i1 *) ret, (gfc_array_i1 *) vector, - mask, (gfc_array_i1 *) field); - return; - - case sizeof (GFC_INTEGER_2): - unpack1_i2 ((gfc_array_i2 *) ret, (gfc_array_i2 *) vector, - mask, (gfc_array_i2 *) field); - return; - - case sizeof (GFC_INTEGER_4): - unpack1_i4 ((gfc_array_i4 *) ret, (gfc_array_i4 *) vector, - mask, (gfc_array_i4 *) field); - return; - - case sizeof (GFC_INTEGER_8): - unpack1_i8 ((gfc_array_i8 *) ret, (gfc_array_i8 *) vector, - mask, (gfc_array_i8 *) field); - return; + case GFC_DTYPE_LOGICAL_1: + case GFC_DTYPE_INTEGER_1: + case GFC_DTYPE_DERIVED_1: + unpack1_i1 ((gfc_array_i1 *) ret, (gfc_array_i1 *) vector, + mask, (gfc_array_i1 *) field); + return; + + case GFC_DTYPE_LOGICAL_2: + case GFC_DTYPE_INTEGER_2: + unpack1_i2 ((gfc_array_i2 *) ret, (gfc_array_i2 *) vector, + mask, (gfc_array_i2 *) field); + return; + + case GFC_DTYPE_LOGICAL_4: + case GFC_DTYPE_INTEGER_4: + unpack1_i4 ((gfc_array_i4 *) ret, (gfc_array_i4 *) vector, + mask, (gfc_array_i4 *) field); + return; + + case GFC_DTYPE_LOGICAL_8: + case GFC_DTYPE_INTEGER_8: + unpack1_i8 ((gfc_array_i8 *) ret, (gfc_array_i8 *) vector, + mask, (gfc_array_i8 *) field); + return; #ifdef HAVE_GFC_INTEGER_16 - case sizeof (GFC_INTEGER_16): - unpack1_i16 ((gfc_array_i16 *) ret, (gfc_array_i16 *) vector, - mask, (gfc_array_i16 *) field); - return; + case GFC_DTYPE_LOGICAL_16: + case GFC_DTYPE_INTEGER_16: + unpack1_i16 ((gfc_array_i16 *) ret, (gfc_array_i16 *) vector, + mask, (gfc_array_i16 *) field); + return; #endif - } - case GFC_DTYPE_REAL: - switch (size) - { - case sizeof (GFC_REAL_4): - unpack1_r4 ((gfc_array_r4 *) ret, (gfc_array_r4 *) vector, - mask, (gfc_array_r4 *) field); - return; + case GFC_DTYPE_REAL_4: + unpack1_r4 ((gfc_array_r4 *) ret, (gfc_array_r4 *) vector, + mask, (gfc_array_r4 *) field); + return; - case sizeof (GFC_REAL_8): - unpack1_r8 ((gfc_array_r8 *) ret, (gfc_array_r8 *) vector, - mask, (gfc_array_r8 *) field); - return; + case GFC_DTYPE_REAL_8: + unpack1_r8 ((gfc_array_r8 *) ret, (gfc_array_r8 *) vector, + mask, (gfc_array_r8 *) field); + return; #ifdef HAVE_GFC_REAL_10 - case sizeof (GFC_REAL_10): - unpack1_r10 ((gfc_array_r10 *) ret, (gfc_array_r10 *) vector, - mask, (gfc_array_r10 *) field); + case GFC_DTYPE_REAL_10: + unpack1_r10 ((gfc_array_r10 *) ret, (gfc_array_r10 *) vector, + mask, (gfc_array_r10 *) field); return; #endif #ifdef HAVE_GFC_REAL_16 - case sizeof (GFC_REAL_16): - unpack1_r16 ((gfc_array_r16 *) ret, (gfc_array_r16 *) vector, - mask, (gfc_array_r16 *) field); - return; + case GFC_DTYPE_REAL_16: + unpack1_r16 ((gfc_array_r16 *) ret, (gfc_array_r16 *) vector, + mask, (gfc_array_r16 *) field); + return; #endif - } - case GFC_DTYPE_COMPLEX: - switch (size) - { - case sizeof (GFC_COMPLEX_4): - unpack1_c4 ((gfc_array_c4 *) ret, (gfc_array_c4 *) vector, - mask, (gfc_array_c4 *) field); - return; + case GFC_DTYPE_COMPLEX_4: + unpack1_c4 ((gfc_array_c4 *) ret, (gfc_array_c4 *) vector, + mask, (gfc_array_c4 *) field); + return; - case sizeof (GFC_COMPLEX_8): - unpack1_c8 ((gfc_array_c8 *) ret, (gfc_array_c8 *) vector, - mask, (gfc_array_c8 *) field); - return; + case GFC_DTYPE_COMPLEX_8: + unpack1_c8 ((gfc_array_c8 *) ret, (gfc_array_c8 *) vector, + mask, (gfc_array_c8 *) field); + return; #ifdef HAVE_GFC_COMPLEX_10 - case sizeof (GFC_COMPLEX_10): - unpack1_c10 ((gfc_array_c10 *) ret, (gfc_array_c10 *) vector, - mask, (gfc_array_c10 *) field); - return; + case GFC_DTYPE_COMPLEX_10: + unpack1_c10 ((gfc_array_c10 *) ret, (gfc_array_c10 *) vector, + mask, (gfc_array_c10 *) field); + return; #endif #ifdef HAVE_GFC_COMPLEX_16 - case sizeof (GFC_COMPLEX_16): - unpack1_c16 ((gfc_array_c16 *) ret, (gfc_array_c16 *) vector, - mask, (gfc_array_c16 *) field); - return; + case GFC_DTYPE_COMPLEX_16: + unpack1_c16 ((gfc_array_c16 *) ret, (gfc_array_c16 *) vector, + mask, (gfc_array_c16 *) field); + return; #endif + + case GFC_DTYPE_DERIVED_2: + if (GFC_UNALIGNED_2(ret->data) || GFC_UNALIGNED_2(vector->data) + || GFC_UNALIGNED_2(field->data)) + break; + else + { + unpack1_i2 ((gfc_array_i2 *) ret, (gfc_array_i2 *) vector, + mask, (gfc_array_i2 *) field); + return; + } + + case GFC_DTYPE_DERIVED_4: + if (GFC_UNALIGNED_4(ret->data) || GFC_UNALIGNED_4(vector->data) + || GFC_UNALIGNED_4(field->data)) + break; + else + { + unpack1_i4 ((gfc_array_i4 *) ret, (gfc_array_i4 *) vector, + mask, (gfc_array_i4 *) field); + return; + } + + case GFC_DTYPE_DERIVED_8: + if (GFC_UNALIGNED_8(ret->data) || GFC_UNALIGNED_8(vector->data) + || GFC_UNALIGNED_8(field->data)) + break; + else + { + unpack1_i8 ((gfc_array_i8 *) ret, (gfc_array_i8 *) vector, + mask, (gfc_array_i8 *) field); + return; } +#ifdef HAVE_GFC_INTEGER_16 + case GFC_DTYPE_DERIVED_16: + if (GFC_UNALIGNED_16(ret->data) || GFC_UNALIGNED_16(vector->data) + || GFC_UNALIGNED_16(field->data)) + break; + else + { + unpack1_i16 ((gfc_array_i16 *) ret, (gfc_array_i16 *) vector, + mask, (gfc_array_i16 *) field); + return; + } +#endif } + unpack_internal (ret, vector, mask, field, size, GFC_DESCRIPTOR_SIZE (field)); } @@ -322,102 +361,139 @@ unpack0 (gfc_array_char *ret, const gfc_array_char *vector, { gfc_array_char tmp; - int type; + index_type type_size; index_type size; - type = GFC_DESCRIPTOR_TYPE (vector); + type_size = GFC_DTYPE_TYPE_SIZE (vector); size = GFC_DESCRIPTOR_SIZE (vector); - switch(type) + switch(type_size) { - case GFC_DTYPE_INTEGER: - case GFC_DTYPE_LOGICAL: - switch(size) - { - case sizeof (GFC_INTEGER_1): - unpack0_i1 ((gfc_array_i1 *) ret, (gfc_array_i1 *) vector, - mask, (GFC_INTEGER_1 *) field); - return; - - case sizeof (GFC_INTEGER_2): - unpack0_i2 ((gfc_array_i2 *) ret, (gfc_array_i2 *) vector, - mask, (GFC_INTEGER_2 *) field); - return; - - case sizeof (GFC_INTEGER_4): - unpack0_i4 ((gfc_array_i4 *) ret, (gfc_array_i4 *) vector, - mask, (GFC_INTEGER_4 *) field); - return; - - case sizeof (GFC_INTEGER_8): - unpack0_i8 ((gfc_array_i8 *) ret, (gfc_array_i8 *) vector, - mask, (GFC_INTEGER_8 *) field); - return; + case GFC_DTYPE_LOGICAL_1: + case GFC_DTYPE_INTEGER_1: + case GFC_DTYPE_DERIVED_1: + unpack0_i1 ((gfc_array_i1 *) ret, (gfc_array_i1 *) vector, + mask, (GFC_INTEGER_1 *) field); + return; + + case GFC_DTYPE_LOGICAL_2: + case GFC_DTYPE_INTEGER_2: + unpack0_i2 ((gfc_array_i2 *) ret, (gfc_array_i2 *) vector, + mask, (GFC_INTEGER_2 *) field); + return; + + case GFC_DTYPE_LOGICAL_4: + case GFC_DTYPE_INTEGER_4: + unpack0_i4 ((gfc_array_i4 *) ret, (gfc_array_i4 *) vector, + mask, (GFC_INTEGER_4 *) field); + return; + + case GFC_DTYPE_LOGICAL_8: + case GFC_DTYPE_INTEGER_8: + unpack0_i8 ((gfc_array_i8 *) ret, (gfc_array_i8 *) vector, + mask, (GFC_INTEGER_8 *) field); + return; #ifdef HAVE_GFC_INTEGER_16 - case sizeof (GFC_INTEGER_16): - unpack0_i16 ((gfc_array_i16 *) ret, (gfc_array_i16 *) vector, - mask, (GFC_INTEGER_16 *) field); - return; + case GFC_DTYPE_LOGICAL_16: + case GFC_DTYPE_INTEGER_16: + unpack0_i16 ((gfc_array_i16 *) ret, (gfc_array_i16 *) vector, + mask, (GFC_INTEGER_16 *) field); + return; #endif - } + case GFC_DTYPE_REAL_4: + unpack0_r4 ((gfc_array_r4 *) ret, (gfc_array_r4 *) vector, + mask, (GFC_REAL_4 *) field); + return; - case GFC_DTYPE_REAL: - switch(size) - { - case sizeof (GFC_REAL_4): - unpack0_r4 ((gfc_array_r4 *) ret, (gfc_array_r4 *) vector, - mask, (GFC_REAL_4 *) field); - return; - - case sizeof (GFC_REAL_8): - unpack0_r8 ((gfc_array_r8 *) ret, (gfc_array_r8*) vector, - mask, (GFC_REAL_8 *) field); - return; + case GFC_DTYPE_REAL_8: + unpack0_r8 ((gfc_array_r8 *) ret, (gfc_array_r8*) vector, + mask, (GFC_REAL_8 *) field); + return; #ifdef HAVE_GFC_REAL_10 - case sizeof (GFC_REAL_10): - unpack0_r10 ((gfc_array_r10 *) ret, (gfc_array_r10 *) vector, - mask, (GFC_REAL_10 *) field); - return; + case GFC_DTYPE_REAL_10: + unpack0_r10 ((gfc_array_r10 *) ret, (gfc_array_r10 *) vector, + mask, (GFC_REAL_10 *) field); + return; #endif #ifdef HAVE_GFC_REAL_16 - case sizeof (GFC_REAL_16): - unpack0_r16 ((gfc_array_r16 *) ret, (gfc_array_r16 *) vector, - mask, (GFC_REAL_16 *) field); - return; + case GFC_DTYPE_REAL_16: + unpack0_r16 ((gfc_array_r16 *) ret, (gfc_array_r16 *) vector, + mask, (GFC_REAL_16 *) field); + return; #endif - } - case GFC_DTYPE_COMPLEX: - switch(size) - { - case sizeof (GFC_COMPLEX_4): - unpack0_c4 ((gfc_array_c4 *) ret, (gfc_array_c4 *) vector, - mask, (GFC_COMPLEX_4 *) field); - return; + case GFC_DTYPE_COMPLEX_4: + unpack0_c4 ((gfc_array_c4 *) ret, (gfc_array_c4 *) vector, + mask, (GFC_COMPLEX_4 *) field); + return; - case sizeof (GFC_COMPLEX_8): - unpack0_c8 ((gfc_array_c8 *) ret, (gfc_array_c8 *) vector, - mask, (GFC_COMPLEX_8 *) field); - return; + case GFC_DTYPE_COMPLEX_8: + unpack0_c8 ((gfc_array_c8 *) ret, (gfc_array_c8 *) vector, + mask, (GFC_COMPLEX_8 *) field); + return; #ifdef HAVE_GFC_COMPLEX_10 - case sizeof (GFC_COMPLEX_10): - unpack0_c10 ((gfc_array_c10 *) ret, (gfc_array_c10 *) vector, - mask, (GFC_COMPLEX_10 *) field); - return; + case GFC_DTYPE_COMPLEX_10: + unpack0_c10 ((gfc_array_c10 *) ret, (gfc_array_c10 *) vector, + mask, (GFC_COMPLEX_10 *) field); + return; #endif #ifdef HAVE_GFC_COMPLEX_16 - case sizeof (GFC_COMPLEX_16): - unpack0_c16 ((gfc_array_c16 *) ret, (gfc_array_c16 *) vector, - mask, (GFC_COMPLEX_16 *) field); - return; + case GFC_DTYPE_COMPLEX_16: + unpack0_c16 ((gfc_array_c16 *) ret, (gfc_array_c16 *) vector, + mask, (GFC_COMPLEX_16 *) field); + return; #endif + case GFC_DTYPE_DERIVED_2: + if (GFC_UNALIGNED_2(ret->data) || GFC_UNALIGNED_2(vector->data) + || GFC_UNALIGNED_2(field)) + break; + else + { + unpack0_i2 ((gfc_array_i2 *) ret, (gfc_array_i2 *) vector, + mask, (GFC_INTEGER_2 *) field); + return; + } + + case GFC_DTYPE_DERIVED_4: + if (GFC_UNALIGNED_4(ret->data) || GFC_UNALIGNED_4(vector->data) + || GFC_UNALIGNED_4(field)) + break; + else + { + unpack0_i4 ((gfc_array_i4 *) ret, (gfc_array_i4 *) vector, + mask, (GFC_INTEGER_4 *) field); + return; + } + + case GFC_DTYPE_DERIVED_8: + if (GFC_UNALIGNED_8(ret->data) || GFC_UNALIGNED_8(vector->data) + || GFC_UNALIGNED_8(field)) + break; + else + { + unpack0_i8 ((gfc_array_i8 *) ret, (gfc_array_i8 *) vector, + mask, (GFC_INTEGER_8 *) field); + return; + } +#ifdef HAVE_GFC_INTEGER_16 + case GFC_DTYPE_DERIVED_16: + if (GFC_UNALIGNED_16(ret->data) || GFC_UNALIGNED_16(vector->data) + || GFC_UNALIGNED_16(field)) + break; + else + { + unpack0_i16 ((gfc_array_i16 *) ret, (gfc_array_i16 *) vector, + mask, (GFC_INTEGER_16 *) field); + return; } +#endif } + memset (&tmp, 0, sizeof (tmp)); tmp.dtype = 0; tmp.data = field; diff --git a/libgfortran/io/format.c b/libgfortran/io/format.c index 0f7a2e5bb84..734b633de06 100644 --- a/libgfortran/io/format.c +++ b/libgfortran/io/format.c @@ -1,6 +1,7 @@ -/* Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007 +/* Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. Contributed by Andy Vaught + F2003 I/O support contributed by Jerry DeLisle This file is part of the GNU Fortran 95 runtime library (libgfortran). @@ -395,7 +396,6 @@ format_lex (format_data *fmt) unget_char (fmt); break; } - break; case 'G': @@ -415,7 +415,19 @@ format_lex (format_data *fmt) break; case 'D': - token = FMT_D; + switch (next_char (fmt, 0)) + { + case 'P': + token = FMT_DP; + break; + case 'C': + token = FMT_DC; + break; + default: + token = FMT_D; + unget_char (fmt); + break; + } break; case -1: @@ -550,6 +562,11 @@ parse_format_list (st_parameter_dt *dtp) tail->repeat = 1; goto optional_comma; + case FMT_DC: + case FMT_DP: + notify_std (&dtp->common, GFC_STD_F2003, "Fortran 2003: DC or DP " + "descriptor not allowed"); + /* Fall through. */ case FMT_S: case FMT_SS: case FMT_SP: @@ -576,6 +593,7 @@ parse_format_list (st_parameter_dt *dtp) notify_std (&dtp->common, GFC_STD_GNU, "Extension: $ descriptor"); goto between_desc; + case FMT_T: case FMT_TL: case FMT_TR: diff --git a/libgfortran/io/inquire.c b/libgfortran/io/inquire.c index ec462858f67..5e0cf3e646c 100644 --- a/libgfortran/io/inquire.c +++ b/libgfortran/io/inquire.c @@ -43,6 +43,7 @@ inquire_via_unit (st_parameter_inquire *iqp, gfc_unit * u) { const char *p; GFC_INTEGER_4 cf = iqp->common.flags; + GFC_INTEGER_4 cf2 = iqp->flags2; if ((cf & IOPARM_INQUIRE_HAS_EXIST) != 0) { @@ -213,7 +214,7 @@ inquire_via_unit (st_parameter_inquire *iqp, gfc_unit * u) if ((cf & IOPARM_INQUIRE_HAS_BLANK) != 0) { - if (u == NULL) + if (u == NULL || u->flags.form != FORM_FORMATTED) p = undefined; else switch (u->flags.blank) @@ -231,6 +232,148 @@ inquire_via_unit (st_parameter_inquire *iqp, gfc_unit * u) cf_strcpy (iqp->blank, iqp->blank_len, p); } + if ((cf & IOPARM_INQUIRE_HAS_PAD) != 0) + { + if (u == NULL || u->flags.form != FORM_FORMATTED) + p = undefined; + else + switch (u->flags.pad) + { + case PAD_YES: + p = "YES"; + break; + case PAD_NO: + p = "NO"; + break; + default: + internal_error (&iqp->common, "inquire_via_unit(): Bad pad"); + } + + cf_strcpy (iqp->pad, iqp->pad_len, p); + } + + if ((cf2 & IOPARM_INQUIRE_HAS_PENDING) != 0) + *iqp->pending = 0; + + if ((cf2 & IOPARM_INQUIRE_HAS_ID) != 0) + *iqp->id = 0; + + if ((cf2 & IOPARM_INQUIRE_HAS_ENCODING) != 0) + { + if (u == NULL || u->flags.form != FORM_FORMATTED) + p = undefined; + else + switch (u->flags.encoding) + { + case ENCODING_DEFAULT: + p = "UNKNOWN"; + break; + /* TODO: Enable UTF-8 case here when implemented. + case ENCODING_UTF8: + p = "UTF-8"; + break; */ + default: + internal_error (&iqp->common, "inquire_via_unit(): Bad encoding"); + } + + cf_strcpy (iqp->encoding, iqp->encoding_len, p); + } + + if ((cf2 & IOPARM_INQUIRE_HAS_DECIMAL) != 0) + { + if (u == NULL || u->flags.form != FORM_FORMATTED) + p = undefined; + else + switch (u->flags.decimal) + { + case DECIMAL_POINT: + p = "POINT"; + break; + case DECIMAL_COMMA: + p = "COMMA"; + break; + default: + internal_error (&iqp->common, "inquire_via_unit(): Bad comma"); + } + + cf_strcpy (iqp->decimal, iqp->decimal_len, p); + } + + if ((cf2 & IOPARM_INQUIRE_HAS_ASYNCHRONOUS) != 0) + { + if (u == NULL) + p = undefined; + else + switch (u->flags.async) + { + case ASYNC_YES: + p = "YES"; + break; + case ASYNC_NO: + p = "NO"; + break; + default: + internal_error (&iqp->common, "inquire_via_unit(): Bad async"); + } + + cf_strcpy (iqp->asynchronous, iqp->asynchronous_len, p); + } + + if ((cf2 & IOPARM_INQUIRE_HAS_SIGN) != 0) + { + if (u == NULL) + p = undefined; + else + switch (u->flags.sign) + { + case SIGN_PROCDEFINED: + p = "PROCESSOR_DEFINED"; + break; + case SIGN_SUPPRESS: + p = "SUPPRESS"; + break; + case SIGN_PLUS: + p = "PLUS"; + break; + default: + internal_error (&iqp->common, "inquire_via_unit(): Bad sign"); + } + + cf_strcpy (iqp->sign, iqp->sign_len, p); + } + + if ((cf2 & IOPARM_INQUIRE_HAS_ROUND) != 0) + { + if (u == NULL) + p = undefined; + else + switch (u->flags.round) + { + case ROUND_UP: + p = "UP"; + break; + case ROUND_DOWN: + p = "DOWN"; + break; + case ROUND_ZERO: + p = "ZERO"; + break; + case ROUND_NEAREST: + p = "NEAREST"; + break; + case ROUND_COMPATIBLE: + p = "COMPATIBLE"; + break; + case ROUND_PROCDEFINED: + p = "PROCESSOR_DEFINED"; + break; + default: + internal_error (&iqp->common, "inquire_via_unit(): Bad round"); + } + + cf_strcpy (iqp->round, iqp->round_len, p); + } + if ((cf & IOPARM_INQUIRE_HAS_POSITION) != 0) { if (u == NULL || u->flags.access == ACCESS_DIRECT) @@ -380,6 +523,7 @@ inquire_via_filename (st_parameter_inquire *iqp) { const char *p; GFC_INTEGER_4 cf = iqp->common.flags; + GFC_INTEGER_4 cf2 = iqp->flags2; if ((cf & IOPARM_INQUIRE_HAS_EXIST) != 0) *iqp->exist = file_exists (iqp->file, iqp->file_len); @@ -435,6 +579,18 @@ inquire_via_filename (st_parameter_inquire *iqp) if ((cf & IOPARM_INQUIRE_HAS_BLANK) != 0) cf_strcpy (iqp->blank, iqp->blank_len, undefined); + if ((cf & IOPARM_INQUIRE_HAS_PAD) != 0) + cf_strcpy (iqp->pad, iqp->pad_len, undefined); + + if ((cf2 & IOPARM_INQUIRE_HAS_ENCODING) != 0) + cf_strcpy (iqp->encoding, iqp->encoding_len, undefined); + + if ((cf2 & IOPARM_INQUIRE_HAS_DELIM) != 0) + cf_strcpy (iqp->delim, iqp->delim_len, undefined); + + if ((cf2 & IOPARM_INQUIRE_HAS_DECIMAL) != 0) + cf_strcpy (iqp->decimal, iqp->decimal_len, undefined); + if ((cf & IOPARM_INQUIRE_HAS_POSITION) != 0) cf_strcpy (iqp->position, iqp->position_len, undefined); @@ -459,11 +615,14 @@ inquire_via_filename (st_parameter_inquire *iqp) cf_strcpy (iqp->readwrite, iqp->readwrite_len, p); } - if ((cf & IOPARM_INQUIRE_HAS_DELIM) != 0) + if ((cf2 & IOPARM_INQUIRE_HAS_DELIM) != 0) cf_strcpy (iqp->delim, iqp->delim_len, undefined); - if ((cf & IOPARM_INQUIRE_HAS_PAD) != 0) + if ((cf2 & IOPARM_INQUIRE_HAS_PAD) != 0) cf_strcpy (iqp->pad, iqp->pad_len, undefined); + + if ((cf2 & IOPARM_INQUIRE_HAS_ENCODING) != 0) + cf_strcpy (iqp->encoding, iqp->encoding_len, undefined); } diff --git a/libgfortran/io/io.h b/libgfortran/io/io.h index 3e020ec90de..30d4051f126 100644 --- a/libgfortran/io/io.h +++ b/libgfortran/io/io.h @@ -1,6 +1,7 @@ -/* Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007 +/* Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. Contributed by Andy Vaught + F2003 I/O support contributed by Jerry DeLisle This file is part of the GNU Fortran 95 runtime library (libgfortran). @@ -44,7 +45,6 @@ typedef enum } bt; - struct st_parameter_dt; typedef struct stream @@ -61,6 +61,9 @@ typedef struct stream } stream; +typedef enum +{ SYNC_BUFFERED, SYNC_UNBUFFERED, ASYNC } +io_mode; /* Macros for doing file I/O given a stream. */ @@ -205,6 +208,25 @@ typedef enum unit_pad; typedef enum +{ DECIMAL_POINT, DECIMAL_COMMA, DECIMAL_UNSPECIFIED } +unit_decimal; + +typedef enum +{ ENCODING_UTF8, ENCODING_DEFAULT, ENCODING_UNSPECIFIED } +unit_encoding; + +typedef enum +{ ROUND_UP, ROUND_DOWN, ROUND_ZERO, ROUND_NEAREST, ROUND_COMPATIBLE, + ROUND_PROCDEFINED, ROUND_UNSPECIFIED } +unit_round; + +/* NOTE: unit_sign must correspond with the sign_status enumerator in + st_parameter_dt to not break the ABI. */ +typedef enum +{ SIGN_PROCDEFINED, SIGN_SUPPRESS, SIGN_PLUS, SIGN_UNSPECIFIED } +unit_sign; + +typedef enum { ADVANCE_YES, ADVANCE_NO, ADVANCE_UNSPECIFIED } unit_advance; @@ -212,6 +234,10 @@ typedef enum {READING, WRITING} unit_mode; +typedef enum +{ ASYNC_YES, ASYNC_NO, ASYNC_UNSPECIFIED } +unit_async; + #define CHARACTER1(name) \ char * name; \ gfc_charlen_type name ## _len @@ -233,6 +259,11 @@ typedef struct CHARACTER1 (delim); CHARACTER2 (pad); CHARACTER1 (convert); + CHARACTER2 (decimal); + CHARACTER1 (encoding); + CHARACTER2 (round); + CHARACTER1 (sign); + CHARACTER2 (asynchronous); } st_parameter_open; @@ -275,6 +306,16 @@ st_parameter_filepos; #define IOPARM_INQUIRE_HAS_WRITE (1 << 28) #define IOPARM_INQUIRE_HAS_READWRITE (1 << 29) #define IOPARM_INQUIRE_HAS_CONVERT (1 << 30) +#define IOPARM_INQUIRE_HAS_FLAGS2 (1 << 31) + +#define IOPARM_INQUIRE_HAS_ASYNCHRONOUS (1 << 0) +#define IOPARM_INQUIRE_HAS_DECIMAL (1 << 1) +#define IOPARM_INQUIRE_HAS_ENCODING (1 << 2) +#define IOPARM_INQUIRE_HAS_PENDING (1 << 3) +#define IOPARM_INQUIRE_HAS_ROUND (1 << 4) +#define IOPARM_INQUIRE_HAS_SIGN (1 << 5) +#define IOPARM_INQUIRE_HAS_SIZE (1 << 6) +#define IOPARM_INQUIRE_HAS_ID (1 << 7) typedef struct { @@ -299,6 +340,15 @@ typedef struct CHARACTER1 (write); CHARACTER2 (readwrite); CHARACTER1 (convert); + GFC_INTEGER_4 flags2; + CHARACTER1 (asynchronous); + CHARACTER2 (decimal); + CHARACTER1 (encoding); + CHARACTER2 (pending); + CHARACTER1 (round); + CHARACTER2 (sign); + GFC_INTEGER_4 *size; + GFC_INTEGER_4 *id; } st_parameter_inquire; @@ -314,6 +364,15 @@ struct format_data; #define IOPARM_DT_HAS_ADVANCE (1 << 13) #define IOPARM_DT_HAS_INTERNAL_UNIT (1 << 14) #define IOPARM_DT_HAS_NAMELIST_NAME (1 << 15) +#define IOPARM_DT_HAS_ID (1 << 16) +#define IOPARM_DT_HAS_POS (1 << 17) +#define IOPARM_DT_HAS_ASYNCHRONOUS (1 << 18) +#define IOPARM_DT_HAS_BLANK (1 << 19) +#define IOPARM_DT_HAS_DECIMAL (1 << 20) +#define IOPARM_DT_HAS_DELIM (1 << 21) +#define IOPARM_DT_HAS_PAD (1 << 22) +#define IOPARM_DT_HAS_ROUND (1 << 23) +#define IOPARM_DT_HAS_SIGN (1 << 24) /* Internal use bit. */ #define IOPARM_DT_IONML_SET (1 << 31) @@ -327,6 +386,15 @@ typedef struct st_parameter_dt CHARACTER2 (advance); CHARACTER1 (internal_unit); CHARACTER2 (namelist_name); + GFC_IO_INT *id; + GFC_IO_INT pos; + CHARACTER1 (asynchronous); + CHARACTER2 (blank); + CHARACTER1 (decimal); + CHARACTER2 (delim); + CHARACTER1 (pad); + CHARACTER2 (round); + CHARACTER1 (sign); /* Private part of the structure. The compiler just needs to reserve enough space. */ union @@ -341,7 +409,8 @@ typedef struct st_parameter_dt int item_count; unit_mode mode; unit_blank blank_status; - enum {SIGN_S, SIGN_SS, SIGN_SP} sign_status; + unit_pad pad_status; + enum { SIGN_S, SIGN_SS, SIGN_SP } sign_status; int scale_factor; int max_pos; /* Maximum righthand column written to. */ /* Number of skips + spaces to be done for T and X-editing. */ @@ -354,6 +423,8 @@ typedef struct st_parameter_dt 2 if an EOR was encountered due to a 2-bytes marker (CRLF) */ int sf_seen_eor; unit_advance advance_status; + unit_decimal decimal_status; + unit_delim delim_status; unsigned reversion_flag : 1; /* Format reversion has occurred. */ unsigned first_item : 1; @@ -422,6 +493,16 @@ extern char check_st_parameter_dt[sizeof (((st_parameter_dt *) 0)->u.pad) >= sizeof (((st_parameter_dt *) 0)->u.p) ? 1 : -1]; +#define IOPARM_WAIT_HAS_ID (1 << 7) + +typedef struct +{ + st_parameter_common common; + CHARACTER1 (id); +} +st_parameter_wait; + + #undef CHARACTER1 #undef CHARACTER2 @@ -436,8 +517,13 @@ typedef struct unit_position position; unit_status status; unit_pad pad; + unit_decimal decimal; + unit_encoding encoding; + unit_round round; + unit_sign sign; unit_convert convert; int has_recl; + unit_async async; } unit_flags; @@ -504,7 +590,8 @@ typedef enum FMT_COMMA, FMT_COLON, FMT_SLASH, FMT_DOLLAR, FMT_T, FMT_TR, FMT_TL, FMT_LPAREN, FMT_RPAREN, FMT_X, FMT_S, FMT_SS, FMT_SP, FMT_STRING, FMT_BADSTRING, FMT_P, FMT_I, FMT_B, FMT_BN, FMT_BZ, FMT_O, FMT_Z, FMT_F, - FMT_E, FMT_EN, FMT_ES, FMT_G, FMT_L, FMT_A, FMT_D, FMT_H, FMT_END + FMT_E, FMT_EN, FMT_ES, FMT_G, FMT_L, FMT_A, FMT_D, FMT_H, FMT_END, FMT_DC, + FMT_DP } format_token; @@ -748,6 +835,9 @@ internal_proto(next_record); extern void reverse_memcpy (void *, const void *, size_t); internal_proto (reverse_memcpy); +extern void st_wait (st_parameter_wait *); +export_proto(st_wait); + /* read.c */ extern void set_integer (void *, GFC_INTEGER_LARGEST, int); diff --git a/libgfortran/io/list_read.c b/libgfortran/io/list_read.c index d295431bc3a..802bf9e7706 100644 --- a/libgfortran/io/list_read.c +++ b/libgfortran/io/list_read.c @@ -1,6 +1,8 @@ -/* Copyright (C) 2002, 2003, 2004, 2005, 2007 Free Software Foundation, Inc. +/* Copyright (C) 2002, 2003, 2004, 2005, 2007, 2008 + Free Software Foundation, Inc. Contributed by Andy Vaught Namelist input contributed by Paul Thomas + F2003 I/O support contributed by Jerry DeLisle This file is part of the GNU Fortran 95 runtime library (libgfortran). @@ -52,17 +54,21 @@ Boston, MA 02110-1301, USA. */ case '5': case '6': case '7': case '8': case '9' #define CASE_SEPARATORS case ' ': case ',': case '/': case '\n': case '\t': \ - case '\r' + case '\r': case ';' /* This macro assumes that we're operating on a variable. */ #define is_separator(c) (c == '/' || c == ',' || c == '\n' || c == ' ' \ - || c == '\t' || c == '\r') + || c == '\t' || c == '\r' || c == ';') /* Maximum repeat count. Less than ten times the maximum signed int32. */ #define MAX_REPEAT 200000000 +#ifndef HAVE_SNPRINTF +# undef snprintf +# define snprintf(str, size, ...) sprintf (str, __VA_ARGS__) +#endif /* Save a character to a string buffer, enlarging it as necessary. */ @@ -323,6 +329,13 @@ eat_separator (st_parameter_dt *dtp) switch (c) { case ',': + if (dtp->u.p.decimal_status == DECIMAL_COMMA) + { + unget_char (dtp, c); + break; + } + /* Fall through. */ + case ';': dtp->u.p.comma_flag = 1; eat_spaces (dtp); break; @@ -666,6 +679,7 @@ read_logical (st_parameter_dt *dtp, int length) unget_char (dtp, c); break; + case '.': c = tolower (next_char (dtp)); switch (c) @@ -933,8 +947,8 @@ read_character (st_parameter_dt *dtp, int length __attribute__ ((unused))) default: if (dtp->u.p.namelist_mode) { - if (dtp->u.p.current_unit->flags.delim == DELIM_APOSTROPHE - || dtp->u.p.current_unit->flags.delim == DELIM_QUOTE + if (dtp->u.p.delim_status == DELIM_APOSTROPHE + || dtp->u.p.delim_status == DELIM_QUOTE || c == '&' || c == '$' || c == '/') { unget_char (dtp, c); @@ -1115,6 +1129,9 @@ parse_real (st_parameter_dt *dtp, void *buffer, int length) c = next_char (dtp); } + if (c == ',' && dtp->u.p.decimal_status == DECIMAL_COMMA) + c = '.'; + if (!isdigit (c) && c != '.') { if (c == 'i' || c == 'I' || c == 'n' || c == 'N') @@ -1130,6 +1147,8 @@ parse_real (st_parameter_dt *dtp, void *buffer, int length) for (;;) { c = next_char (dtp); + if (c == ',' && dtp->u.p.decimal_status == DECIMAL_COMMA) + c = '.'; switch (c) { CASE_DIGITS: @@ -1299,7 +1318,8 @@ eol_1: else unget_char (dtp, c); - if (next_char (dtp) != ',') + if (next_char (dtp) + != (dtp->u.p.decimal_status == DECIMAL_POINT ? ',' : ';')) goto bad_complex; eol_2: @@ -1353,6 +1373,8 @@ read_real (st_parameter_dt *dtp, int length) seen_dp = 0; c = next_char (dtp); + if (c == ',' && dtp->u.p.decimal_status == DECIMAL_COMMA) + c = '.'; switch (c) { CASE_DIGITS: @@ -1388,6 +1410,8 @@ read_real (st_parameter_dt *dtp, int length) for (;;) { c = next_char (dtp); + if (c == ',' && dtp->u.p.decimal_status == DECIMAL_COMMA) + c = '.'; switch (c) { CASE_DIGITS: @@ -1395,8 +1419,8 @@ read_real (st_parameter_dt *dtp, int length) break; case '.': - if (seen_dp) - goto bad_real; + if (seen_dp) + goto bad_real; seen_dp = 1; push_char (dtp, c); @@ -1420,7 +1444,7 @@ read_real (st_parameter_dt *dtp, int length) goto got_repeat; CASE_SEPARATORS: - if (c != '\n' && c != ',' && c != '\r') + if (c != '\n' && c != ',' && c != '\r' && c != ';') unget_char (dtp, c); goto done; @@ -1452,6 +1476,9 @@ read_real (st_parameter_dt *dtp, int length) c = next_char (dtp); } + if (c == ',' && dtp->u.p.decimal_status == DECIMAL_COMMA) + c = '.'; + if (!isdigit (c) && c != '.') { if (c == 'i' || c == 'I' || c == 'n' || c == 'N') @@ -1474,6 +1501,8 @@ read_real (st_parameter_dt *dtp, int length) for (;;) { c = next_char (dtp); + if (c == ',' && dtp->u.p.decimal_status == DECIMAL_COMMA) + c = '.'; switch (c) { CASE_DIGITS: @@ -1887,7 +1916,7 @@ calls: static void nml_match_name (char *name, int len) static int nml_query (st_parameter_dt *dtp) static int nml_get_obj_data (st_parameter_dt *dtp, - namelist_info **prev_nl, char *) + namelist_info **prev_nl, char *, size_t) calls: static void nml_untouch_nodes (st_parameter_dt *dtp) static namelist_info * find_nml_node (st_parameter_dt *dtp, @@ -1896,7 +1925,7 @@ calls: array_loop_spec * ls, int rank, char *) static void nml_touch_nodes (namelist_info * nl) static int nml_read_obj (namelist_info *nl, index_type offset, - namelist_info **prev_nl, char *, + namelist_info **prev_nl, char *, size_t, index_type clow, index_type chigh) calls: -itself- */ @@ -2310,7 +2339,7 @@ query_return: static try nml_read_obj (st_parameter_dt *dtp, namelist_info * nl, index_type offset, namelist_info **pprev_nl, char *nml_err_msg, - index_type clow, index_type chigh) + size_t nml_err_msg_size, index_type clow, index_type chigh) { namelist_info * cmp; char * obj_name; @@ -2428,8 +2457,8 @@ nml_read_obj (st_parameter_dt *dtp, namelist_info * nl, index_type offset, { if (nml_read_obj (dtp, cmp, (index_type)(pdata - nl->mem_pos), - pprev_nl, nml_err_msg, clow, chigh) - == FAILURE) + pprev_nl, nml_err_msg, nml_err_msg_size, + clow, chigh) == FAILURE) { free_mem (obj_name); return FAILURE; @@ -2446,8 +2475,8 @@ nml_read_obj (st_parameter_dt *dtp, namelist_info * nl, index_type offset, goto incr_idx; default: - sprintf (nml_err_msg, "Bad type for namelist object %s", - nl->var_name); + snprintf (nml_err_msg, nml_err_msg_size, + "Bad type for namelist object %s", nl->var_name); internal_error (&dtp->common, nml_err_msg); goto nml_err_ret; } @@ -2535,9 +2564,9 @@ incr_idx: if (dtp->u.p.repeat_count > 1) { - sprintf (nml_err_msg, "Repeat count too large for namelist object %s" , - nl->var_name ); - goto nml_err_ret; + snprintf (nml_err_msg, nml_err_msg_size, + "Repeat count too large for namelist object %s", nl->var_name); + goto nml_err_ret; } return SUCCESS; @@ -2555,7 +2584,7 @@ nml_err_ret: static try nml_get_obj_data (st_parameter_dt *dtp, namelist_info **pprev_nl, - char *nml_err_msg) + char *nml_err_msg, size_t nml_err_msg_size) { char c; namelist_info * nl; @@ -2563,7 +2592,6 @@ nml_get_obj_data (st_parameter_dt *dtp, namelist_info **pprev_nl, namelist_info * root_nl = NULL; int dim, parsed_rank; int component_flag; - char parse_err_msg[30]; index_type clow, chigh; int non_zero_rank_count; @@ -2662,12 +2690,13 @@ get_name: if (nl == NULL) { if (dtp->u.p.nml_read_error && *pprev_nl) - sprintf (nml_err_msg, "Bad data for namelist object %s", - (*pprev_nl)->var_name); + snprintf (nml_err_msg, nml_err_msg_size, + "Bad data for namelist object %s", (*pprev_nl)->var_name); else - sprintf (nml_err_msg, "Cannot match namelist object name %s", - dtp->u.p.saved_string); + snprintf (nml_err_msg, nml_err_msg_size, + "Cannot match namelist object name %s", + dtp->u.p.saved_string); goto nml_err_ret; } @@ -2689,10 +2718,12 @@ get_name: { parsed_rank = 0; if (nml_parse_qualifier (dtp, nl->dim, nl->ls, nl->var_rank, - parse_err_msg, &parsed_rank) == FAILURE) + nml_err_msg, &parsed_rank) == FAILURE) { - sprintf (nml_err_msg, "%s for namelist variable %s", - parse_err_msg, nl->var_name); + char *nml_err_msg_end = strchr (nml_err_msg, '\0'); + snprintf (nml_err_msg_end, + nml_err_msg_size - (nml_err_msg_end - nml_err_msg), + " for namelist variable %s", nl->var_name); goto nml_err_ret; } @@ -2713,8 +2744,8 @@ get_name: { if (nl->type != GFC_DTYPE_DERIVED) { - sprintf (nml_err_msg, "Attempt to get derived component for %s", - nl->var_name); + snprintf (nml_err_msg, nml_err_msg_size, + "Attempt to get derived component for %s", nl->var_name); goto nml_err_ret; } @@ -2738,11 +2769,13 @@ get_name: descriptor_dimension chd[1] = { {1, clow, nl->string_length} }; array_loop_spec ind[1] = { {1, clow, nl->string_length, 1} }; - if (nml_parse_qualifier (dtp, chd, ind, -1, parse_err_msg, &parsed_rank) + if (nml_parse_qualifier (dtp, chd, ind, -1, nml_err_msg, &parsed_rank) == FAILURE) { - sprintf (nml_err_msg, "%s for namelist variable %s", - parse_err_msg, nl->var_name); + char *nml_err_msg_end = strchr (nml_err_msg, '\0'); + snprintf (nml_err_msg_end, + nml_err_msg_size - (nml_err_msg_end - nml_err_msg), + " for namelist variable %s", nl->var_name); goto nml_err_ret; } @@ -2751,9 +2784,9 @@ get_name: if (ind[0].step != 1) { - sprintf (nml_err_msg, - "Step not allowed in substring qualifier" - " for namelist object %s", nl->var_name); + snprintf (nml_err_msg, nml_err_msg_size, + "Step not allowed in substring qualifier" + " for namelist object %s", nl->var_name); goto nml_err_ret; } @@ -2774,16 +2807,18 @@ get_name: if (c == '(') { - sprintf (nml_err_msg, "Qualifier for a scalar or non-character" - " namelist object %s", nl->var_name); + snprintf (nml_err_msg, nml_err_msg_size, + "Qualifier for a scalar or non-character namelist object %s", + nl->var_name); goto nml_err_ret; } /* Make sure there is no more than one non-zero rank object. */ if (non_zero_rank_count > 1) { - sprintf (nml_err_msg, "Multiple sub-objects with non-zero rank in" - " namelist object %s", nl->var_name); + snprintf (nml_err_msg, nml_err_msg_size, + "Multiple sub-objects with non-zero rank in namelist object %s", + nl->var_name); non_zero_rank_count = 0; goto nml_err_ret; } @@ -2807,12 +2842,14 @@ get_name: if (c != '=') { - sprintf (nml_err_msg, "Equal sign must follow namelist object name %s", - nl->var_name); + snprintf (nml_err_msg, nml_err_msg_size, + "Equal sign must follow namelist object name %s", + nl->var_name); goto nml_err_ret; } - if (nml_read_obj (dtp, nl, 0, pprev_nl, nml_err_msg, clow, chigh) == FAILURE) + if (nml_read_obj (dtp, nl, 0, pprev_nl, nml_err_msg, nml_err_msg_size, + clow, chigh) == FAILURE) goto nml_err_ret; return SUCCESS; @@ -2831,7 +2868,7 @@ namelist_read (st_parameter_dt *dtp) { char c; jmp_buf eof_jump; - char nml_err_msg[100]; + char nml_err_msg[200]; /* Pointer to the previously read object, in case attempt is made to read new object name. Should this fail, error message can give previous name. */ @@ -2899,7 +2936,8 @@ find_nml_name: while (!dtp->u.p.input_complete) { - if (nml_get_obj_data (dtp, &prev_nl, nml_err_msg) == FAILURE) + if (nml_get_obj_data (dtp, &prev_nl, nml_err_msg, sizeof nml_err_msg) + == FAILURE) { gfc_unit *u; diff --git a/libgfortran/io/open.c b/libgfortran/io/open.c index 0a409ed4ad3..4e904d37df9 100644 --- a/libgfortran/io/open.c +++ b/libgfortran/io/open.c @@ -1,6 +1,7 @@ -/* Copyright (C) 2002, 2003, 2004, 2005, 2007 +/* Copyright (C) 2002, 2003, 2004, 2005, 2007, 2008 Free Software Foundation, Inc. Contributed by Andy Vaught + F2003 I/O support contributed by Jerry DeLisle This file is part of the GNU Fortran 95 runtime library (libgfortran). @@ -97,6 +98,39 @@ static const st_option pad_opt[] = { NULL, 0} }; +static const st_option decimal_opt[] = +{ + { "point", DECIMAL_POINT}, + { "comma", DECIMAL_COMMA}, + { NULL, 0} +}; + +static const st_option encoding_opt[] = +{ + { "utf-8", ENCODING_UTF8}, + { "default", ENCODING_DEFAULT}, + { NULL, 0} +}; + +static const st_option round_opt[] = +{ + { "up", ROUND_UP}, + { "down", ROUND_DOWN}, + { "zero", ROUND_ZERO}, + { "nearest", ROUND_NEAREST}, + { "compatible", ROUND_COMPATIBLE}, + { "processor_defined", ROUND_PROCDEFINED}, + { NULL, 0} +}; + +static const st_option sign_opt[] = +{ + { "plus", SIGN_PLUS}, + { "suppress", SIGN_SUPPRESS}, + { "processor_defined", SIGN_PROCDEFINED}, + { NULL, 0} +}; + static const st_option convert_opt[] = { { "native", GFC_CONVERT_NATIVE}, @@ -106,6 +140,12 @@ static const st_option convert_opt[] = { NULL, 0} }; +static const st_option async_opt[] = +{ + { "yes", ASYNC_YES}, + { "no", ASYNC_NO}, + { NULL, 0} +}; /* Given a unit, test to see if the file is positioned at the terminal point, and if so, change state from NO_ENDFILE flag to AT_ENDFILE. @@ -179,6 +219,26 @@ edit_modes (st_parameter_open *opp, gfc_unit * u, unit_flags * flags) generate_error (&opp->common, LIBERROR_OPTION_CONFLICT, "PAD parameter conflicts with UNFORMATTED form in " "OPEN statement"); + + if (flags->decimal != DECIMAL_UNSPECIFIED) + generate_error (&opp->common, LIBERROR_OPTION_CONFLICT, + "DECIMAL parameter conflicts with UNFORMATTED form in " + "OPEN statement"); + + if (flags->encoding != ENCODING_UNSPECIFIED) + generate_error (&opp->common, LIBERROR_OPTION_CONFLICT, + "ENCODING parameter conflicts with UNFORMATTED form in " + "OPEN statement"); + + if (flags->round != ROUND_UNSPECIFIED) + generate_error (&opp->common, LIBERROR_OPTION_CONFLICT, + "ROUND parameter conflicts with UNFORMATTED form in " + "OPEN statement"); + + if (flags->sign != SIGN_UNSPECIFIED) + generate_error (&opp->common, LIBERROR_OPTION_CONFLICT, + "SIGN parameter conflicts with UNFORMATTED form in " + "OPEN statement"); } if ((opp->common.flags & IOPARM_LIBRETURN_MASK) == IOPARM_LIBRETURN_OK) @@ -190,6 +250,16 @@ edit_modes (st_parameter_open *opp, gfc_unit * u, unit_flags * flags) u->flags.delim = flags->delim; if (flags->pad != PAD_UNSPECIFIED) u->flags.pad = flags->pad; + if (flags->decimal != DECIMAL_UNSPECIFIED) + u->flags.decimal = flags->decimal; + if (flags->encoding != ENCODING_UNSPECIFIED) + u->flags.encoding = flags->encoding; + if (flags->async != ASYNC_UNSPECIFIED) + u->flags.async = flags->async; + if (flags->round != ROUND_UNSPECIFIED) + u->flags.round = flags->round; + if (flags->sign != SIGN_UNSPECIFIED) + u->flags.sign = flags->sign; } /* Reposition the file if necessary. */ @@ -249,6 +319,13 @@ new_unit (st_parameter_open *opp, gfc_unit *u, unit_flags * flags) flags->form = (flags->access == ACCESS_SEQUENTIAL) ? FORM_FORMATTED : FORM_UNFORMATTED; + if (flags->async == ASYNC_UNSPECIFIED) + flags->async = ASYNC_NO; + + if (flags->status == STATUS_UNSPECIFIED) + flags->status = STATUS_UNKNOWN; + + /* Checks. */ if (flags->delim == DELIM_UNSPECIFIED) flags->delim = DELIM_NONE; @@ -289,6 +366,62 @@ new_unit (st_parameter_open *opp, gfc_unit *u, unit_flags * flags) } } + if (flags->decimal == DECIMAL_UNSPECIFIED) + flags->decimal = DECIMAL_POINT; + else + { + if (flags->form == FORM_UNFORMATTED) + { + generate_error (&opp->common, LIBERROR_OPTION_CONFLICT, + "DECIMAL parameter conflicts with UNFORMATTED form " + "in OPEN statement"); + goto fail; + } + } + + if (flags->encoding == ENCODING_UNSPECIFIED) + flags->encoding = ENCODING_DEFAULT; + else + { + if (flags->form == FORM_UNFORMATTED) + { + generate_error (&opp->common, LIBERROR_OPTION_CONFLICT, + "ENCODING parameter conflicts with UNFORMATTED form in " + "OPEN statement"); + goto fail; + } + } + + /* NB: the value for ROUND when it's not specified by the user does not + have to be PROCESSOR_DEFINED; the standard says that it is + processor dependent, and requires that it is one of the + possible value (see F2003, 9.4.5.13). */ + if (flags->round == ROUND_UNSPECIFIED) + flags->round = ROUND_PROCDEFINED; + else + { + if (flags->form == FORM_UNFORMATTED) + { + generate_error (&opp->common, LIBERROR_OPTION_CONFLICT, + "ROUND parameter conflicts with UNFORMATTED form in " + "OPEN statement"); + goto fail; + } + } + + if (flags->sign == SIGN_UNSPECIFIED) + flags->sign = SIGN_PROCDEFINED; + else + { + if (flags->form == FORM_UNFORMATTED) + { + generate_error (&opp->common, LIBERROR_OPTION_CONFLICT, + "SIGN parameter conflicts with UNFORMATTED form in " + "OPEN statement"); + goto fail; + } + } + if (flags->position != POSITION_ASIS && flags->access == ACCESS_DIRECT) { generate_error (&opp->common, LIBERROR_OPTION_CONFLICT, @@ -300,12 +433,6 @@ new_unit (st_parameter_open *opp, gfc_unit *u, unit_flags * flags) if (flags->position == POSITION_UNSPECIFIED) flags->position = POSITION_ASIS; - - if (flags->status == STATUS_UNSPECIFIED) - flags->status = STATUS_UNKNOWN; - - /* Checks. */ - if (flags->access == ACCESS_DIRECT && (opp->common.flags & IOPARM_OPEN_HAS_RECL_IN) == 0) { @@ -607,6 +734,26 @@ st_open (st_parameter_open *opp) find_option (&opp->common, opp->pad, opp->pad_len, pad_opt, "Bad PAD parameter in OPEN statement"); + flags.decimal = !(cf & IOPARM_OPEN_HAS_DECIMAL) ? DECIMAL_UNSPECIFIED : + find_option (&opp->common, opp->decimal, opp->decimal_len, + decimal_opt, "Bad DECIMAL parameter in OPEN statement"); + + flags.encoding = !(cf & IOPARM_OPEN_HAS_ENCODING) ? ENCODING_UNSPECIFIED : + find_option (&opp->common, opp->encoding, opp->encoding_len, + encoding_opt, "Bad ENCODING parameter in OPEN statement"); + + flags.async = !(cf & IOPARM_OPEN_HAS_ASYNCHRONOUS) ? ASYNC_UNSPECIFIED : + find_option (&opp->common, opp->asynchronous, opp->asynchronous_len, + async_opt, "Bad ASYNCHRONOUS parameter in OPEN statement"); + + flags.round = !(cf & IOPARM_OPEN_HAS_ROUND) ? ROUND_UNSPECIFIED : + find_option (&opp->common, opp->round, opp->round_len, + round_opt, "Bad ROUND parameter in OPEN statement"); + + flags.sign = !(cf & IOPARM_OPEN_HAS_SIGN) ? SIGN_UNSPECIFIED : + find_option (&opp->common, opp->sign, opp->sign_len, + sign_opt, "Bad SIGN parameter in OPEN statement"); + flags.form = !(cf & IOPARM_OPEN_HAS_FORM) ? FORM_UNSPECIFIED : find_option (&opp->common, opp->form, opp->form_len, form_opt, "Bad FORM parameter in OPEN statement"); diff --git a/libgfortran/io/read.c b/libgfortran/io/read.c index b5f16ac7260..ce86ec00b8f 100644 --- a/libgfortran/io/read.c +++ b/libgfortran/io/read.c @@ -1,5 +1,6 @@ -/* Copyright (C) 2002, 2003, 2005, 2007 Free Software Foundation, Inc. +/* Copyright (C) 2002, 2003, 2005, 2007, 2008 Free Software Foundation, Inc. Contributed by Andy Vaught + F2003 I/O support contributed by Jerry DeLisle This file is part of the GNU Fortran 95 runtime library (libgfortran). @@ -246,7 +247,8 @@ read_a (st_parameter_dt *dtp, const fnode *f, char *p, int length) dtp->u.p.sf_read_comma = 0; source = read_block (dtp, &w); - dtp->u.p.sf_read_comma = 1; + dtp->u.p.sf_read_comma = + dtp->u.p.decimal_status == DECIMAL_COMMA ? 0 : 1; if (source == NULL) return; if (w > length) @@ -601,7 +603,7 @@ read_f (st_parameter_dt *dtp, const fnode *f, char *dest, int length) /* A digit, a '.' or a exponent character ('e', 'E', 'd' or 'D') is required at this point */ - if (!isdigit (*p) && *p != '.' && *p != 'd' && *p != 'D' + if (!isdigit (*p) && *p != '.' && *p != ',' && *p != 'd' && *p != 'D' && *p != 'e' && *p != 'E') goto bad_float; @@ -614,6 +616,10 @@ read_f (st_parameter_dt *dtp, const fnode *f, char *dest, int length) { switch (*p) { + case ',': + if (dtp->u.p.decimal_status == DECIMAL_COMMA && *p == ',') + *p = '.'; + /* Fall through */ case '.': if (seen_dp) goto bad_float; @@ -848,7 +854,7 @@ read_x (st_parameter_dt *dtp, int n) { if (!is_stream_io (dtp)) { - if ((dtp->u.p.current_unit->flags.pad == PAD_NO || is_internal_unit (dtp)) + if ((dtp->u.p.pad_status == PAD_NO || is_internal_unit (dtp)) && dtp->u.p.current_unit->bytes_left < n) n = dtp->u.p.current_unit->bytes_left; diff --git a/libgfortran/io/transfer.c b/libgfortran/io/transfer.c index dc80fc33f9e..8741758e61d 100644 --- a/libgfortran/io/transfer.c +++ b/libgfortran/io/transfer.c @@ -1,7 +1,8 @@ -/* Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007 +/* Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. Contributed by Andy Vaught Namelist transfer functions contributed by Paul Thomas + F2003 I/O support contributed by Jerry DeLisle This file is part of the GNU Fortran 95 runtime library (libgfortran). @@ -93,6 +94,39 @@ static const st_option advance_opt[] = { }; +static const st_option decimal_opt[] = { + {"point", DECIMAL_POINT}, + {"comma", DECIMAL_COMMA}, + {NULL, 0} +}; + + +static const st_option sign_opt[] = { + {"plus", SIGN_SP}, + {"suppress", SIGN_SS}, + {"processor_defined", SIGN_S}, + {NULL, 0} +}; + +static const st_option blank_opt[] = { + {"null", BLANK_NULL}, + {"zero", BLANK_ZERO}, + {NULL, 0} +}; + +static const st_option delim_opt[] = { + {"apostrophe", DELIM_APOSTROPHE}, + {"quote", DELIM_QUOTE}, + {"none", DELIM_NONE}, + {NULL, 0} +}; + +static const st_option pad_opt[] = { + {"yes", PAD_YES}, + {"no", PAD_NO}, + {NULL, 0} +}; + typedef enum { FORMATTED_SEQUENTIAL, UNFORMATTED_SEQUENTIAL, FORMATTED_DIRECT, UNFORMATTED_DIRECT, FORMATTED_STREAM, UNFORMATTED_STREAM @@ -221,7 +255,7 @@ read_sf (st_parameter_dt *dtp, int *length, int no_error) /* Without padding, terminate the I/O statement without assigning the value. With padding, the value still needs to be assigned, so we can just continue with a short read. */ - if (dtp->u.p.current_unit->flags.pad == PAD_NO) + if (dtp->u.p.pad_status == PAD_NO) { if (no_error) break; @@ -299,7 +333,7 @@ read_block (st_parameter_dt *dtp, int *length) dtp->u.p.current_unit->bytes_left = dtp->u.p.current_unit->recl; else { - if (dtp->u.p.current_unit->flags.pad == PAD_NO) + if (dtp->u.p.pad_status == PAD_NO) { /* Not enough data left. */ generate_error (&dtp->common, LIBERROR_EOR, NULL); @@ -337,7 +371,7 @@ read_block (st_parameter_dt *dtp, int *length) if (nread != *length) { /* Short read, this shouldn't happen. */ - if (dtp->u.p.current_unit->flags.pad == PAD_YES) + if (dtp->u.p.pad_status == PAD_YES) *length = nread; else { @@ -910,7 +944,7 @@ formatted_transfer_scalar (st_parameter_dt *dtp, bt type, void *p, int len, /* Set this flag so that commas in reads cause the read to complete before the entire field has been read. The next read field will start right after the comma in the stream. (Set to 0 for character reads). */ - dtp->u.p.sf_read_comma = 1; + dtp->u.p.sf_read_comma = dtp->u.p.decimal_status == DECIMAL_COMMA ? 0 : 1; dtp->u.p.line_buffer = scratch; for (;;) @@ -923,7 +957,7 @@ formatted_transfer_scalar (st_parameter_dt *dtp, bt type, void *p, int len, next_record (dtp, 0); } - consume_data_flag = 1 ; + consume_data_flag = 1; if ((dtp->common.flags & IOPARM_LIBRETURN_MASK) != IOPARM_LIBRETURN_OK) break; @@ -1162,7 +1196,7 @@ formatted_transfer_scalar (st_parameter_dt *dtp, bt type, void *p, int len, break; case FMT_STRING: - consume_data_flag = 0 ; + consume_data_flag = 0; if (dtp->u.p.mode == READING) { format_error (dtp, f, "Constant string in input format"); @@ -1278,17 +1312,17 @@ formatted_transfer_scalar (st_parameter_dt *dtp, bt type, void *p, int len, break; case FMT_S: - consume_data_flag = 0 ; + consume_data_flag = 0; dtp->u.p.sign_status = SIGN_S; break; case FMT_SS: - consume_data_flag = 0 ; + consume_data_flag = 0; dtp->u.p.sign_status = SIGN_SS; break; case FMT_SP: - consume_data_flag = 0 ; + consume_data_flag = 0; dtp->u.p.sign_status = SIGN_SP; break; @@ -1298,22 +1332,32 @@ formatted_transfer_scalar (st_parameter_dt *dtp, bt type, void *p, int len, break; case FMT_BZ: - consume_data_flag = 0 ; + consume_data_flag = 0; dtp->u.p.blank_status = BLANK_ZERO; break; + case FMT_DC: + consume_data_flag = 0; + dtp->u.p.decimal_status = DECIMAL_COMMA; + break; + + case FMT_DP: + consume_data_flag = 0; + dtp->u.p.decimal_status = DECIMAL_POINT; + break; + case FMT_P: - consume_data_flag = 0 ; + consume_data_flag = 0; dtp->u.p.scale_factor = f->u.k; break; case FMT_DOLLAR: - consume_data_flag = 0 ; + consume_data_flag = 0; dtp->u.p.seen_dollar = 1; break; case FMT_SLASH: - consume_data_flag = 0 ; + consume_data_flag = 0; dtp->u.p.skips = dtp->u.p.pending_spaces = 0; next_record (dtp, 0); break; @@ -1323,7 +1367,7 @@ formatted_transfer_scalar (st_parameter_dt *dtp, bt type, void *p, int len, particular preventing another / descriptor from being processed) unless there is another data item to be transferred. */ - consume_data_flag = 0 ; + consume_data_flag = 0; if (n == 0) return; break; @@ -1769,6 +1813,11 @@ data_transfer_init (st_parameter_dt *dtp, int read_flag) u_flags.delim = DELIM_UNSPECIFIED; u_flags.blank = BLANK_UNSPECIFIED; u_flags.pad = PAD_UNSPECIFIED; + u_flags.decimal = DECIMAL_UNSPECIFIED; + u_flags.encoding = ENCODING_UNSPECIFIED; + u_flags.async = ASYNC_UNSPECIFIED; + u_flags.round = ROUND_UNSPECIFIED; + u_flags.sign = SIGN_UNSPECIFIED; u_flags.status = STATUS_UNKNOWN; conv = get_unformatted_convert (dtp->common.unit); @@ -1958,6 +2007,52 @@ data_transfer_init (st_parameter_dt *dtp, int read_flag) if (dtp->u.p.advance_status == ADVANCE_UNSPECIFIED) dtp->u.p.advance_status = ADVANCE_YES; + /* Check the decimal mode. */ + + dtp->u.p.decimal_status + = !(cf & IOPARM_DT_HAS_DECIMAL) ? DECIMAL_UNSPECIFIED : + find_option (&dtp->common, dtp->decimal, dtp->decimal_len, decimal_opt, + "Bad DECIMAL parameter in data transfer statement"); + + if (dtp->u.p.decimal_status == DECIMAL_UNSPECIFIED) + dtp->u.p.decimal_status = dtp->u.p.current_unit->flags.decimal; + + /* Check the sign mode. */ + dtp->u.p.sign_status + = !(cf & IOPARM_DT_HAS_SIGN) ? SIGN_UNSPECIFIED : + find_option (&dtp->common, dtp->sign, dtp->sign_len, sign_opt, + "Bad SIGN parameter in data transfer statement"); + + if (dtp->u.p.sign_status == SIGN_UNSPECIFIED) + dtp->u.p.sign_status = dtp->u.p.current_unit->flags.sign; + + /* Check the blank mode. */ + dtp->u.p.blank_status + = !(cf & IOPARM_DT_HAS_BLANK) ? BLANK_UNSPECIFIED : + find_option (&dtp->common, dtp->blank, dtp->blank_len, blank_opt, + "Bad BLANK parameter in data transfer statement"); + + if (dtp->u.p.blank_status == BLANK_UNSPECIFIED) + dtp->u.p.blank_status = dtp->u.p.current_unit->flags.blank; + + /* Check the delim mode. */ + dtp->u.p.delim_status + = !(cf & IOPARM_DT_HAS_DELIM) ? DELIM_UNSPECIFIED : + find_option (&dtp->common, dtp->delim, dtp->delim_len, delim_opt, + "Bad DELIM parameter in data transfer statement"); + + if (dtp->u.p.delim_status == DELIM_UNSPECIFIED) + dtp->u.p.delim_status = dtp->u.p.current_unit->flags.delim; + + /* Check the pad mode. */ + dtp->u.p.pad_status + = !(cf & IOPARM_DT_HAS_PAD) ? PAD_UNSPECIFIED : + find_option (&dtp->common, dtp->pad, dtp->pad_len, pad_opt, + "Bad PAD parameter in data transfer statement"); + + if (dtp->u.p.pad_status == PAD_UNSPECIFIED) + dtp->u.p.pad_status = dtp->u.p.current_unit->flags.pad; + /* Sanity checks on the record number. */ if ((cf & IOPARM_DT_HAS_REC) != 0) { @@ -2023,11 +2118,6 @@ data_transfer_init (st_parameter_dt *dtp, int read_flag) dtp->u.p.current_unit->mode = dtp->u.p.mode; - /* Set the initial value of flags. */ - - dtp->u.p.blank_status = dtp->u.p.current_unit->flags.blank; - dtp->u.p.sign_status = SIGN_S; - /* Set the maximum position reached from the previous I/O operation. This could be greater than zero from a previous non-advancing write. */ dtp->u.p.max_pos = dtp->u.p.current_unit->saved_pos; @@ -2926,6 +3016,14 @@ st_write_done (st_parameter_dt *dtp) library_end (); } + +/* F2003: This is a stub for the runtime portion of the WAIT statement. */ +void +st_wait (st_parameter_wait *wtp __attribute__((unused))) +{ +} + + /* Receives the scalar information for namelist objects and stores it in a linked list of namelist_info types. */ diff --git a/libgfortran/io/unit.c b/libgfortran/io/unit.c index a54061d2f84..9f9e3513dab 100644 --- a/libgfortran/io/unit.c +++ b/libgfortran/io/unit.c @@ -1,5 +1,6 @@ -/* Copyright (C) 2002, 2003, 2005, 2007 Free Software Foundation, Inc. +/* Copyright (C) 2002, 2003, 2005, 2007, 2008 Free Software Foundation, Inc. Contributed by Andy Vaught + F2003 I/O support contributed by Jerry DeLisle This file is part of the GNU Fortran 95 runtime library (libgfortran). @@ -430,6 +431,7 @@ get_internal_unit (st_parameter_dt *dtp) iunit->maxrec=0; iunit->current_record=0; iunit->read_bad = 0; + iunit->endfile = NO_ENDFILE; /* Set flags for the internal unit. */ @@ -438,7 +440,10 @@ get_internal_unit (st_parameter_dt *dtp) iunit->flags.form = FORM_FORMATTED; iunit->flags.pad = PAD_YES; iunit->flags.status = STATUS_UNSPECIFIED; - iunit->endfile = NO_ENDFILE; + iunit->flags.sign = SIGN_SUPPRESS; + iunit->flags.decimal = DECIMAL_POINT; + iunit->flags.encoding = ENCODING_DEFAULT; + iunit->flags.async = ASYNC_NO; /* Initialize the data transfer parameters. */ @@ -524,7 +529,11 @@ init_units (void) u->flags.blank = BLANK_NULL; u->flags.pad = PAD_YES; u->flags.position = POSITION_ASIS; - + u->flags.sign = SIGN_SUPPRESS; + u->flags.decimal = DECIMAL_POINT; + u->flags.encoding = ENCODING_DEFAULT; + u->flags.async = ASYNC_NO; + u->recl = options.default_recl; u->endfile = NO_ENDFILE; @@ -547,6 +556,10 @@ init_units (void) u->flags.status = STATUS_OLD; u->flags.blank = BLANK_NULL; u->flags.position = POSITION_ASIS; + u->flags.sign = SIGN_SUPPRESS; + u->flags.decimal = DECIMAL_POINT; + u->flags.encoding = ENCODING_DEFAULT; + u->flags.async = ASYNC_NO; u->recl = options.default_recl; u->endfile = AT_ENDFILE; @@ -570,6 +583,10 @@ init_units (void) u->flags.status = STATUS_OLD; u->flags.blank = BLANK_NULL; u->flags.position = POSITION_ASIS; + u->flags.sign = SIGN_SUPPRESS; + u->flags.decimal = DECIMAL_POINT; + u->flags.encoding = ENCODING_DEFAULT; + u->flags.async = ASYNC_NO; u->recl = options.default_recl; u->endfile = AT_ENDFILE; diff --git a/libgfortran/io/unix.c b/libgfortran/io/unix.c index b6afe8ddfcc..3896f04db61 100644 --- a/libgfortran/io/unix.c +++ b/libgfortran/io/unix.c @@ -1,6 +1,7 @@ -/* Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007 +/* Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. Contributed by Andy Vaught + F2003 I/O support contributed by Jerry DeLisle This file is part of the GNU Fortran 95 runtime library (libgfortran). @@ -93,8 +94,6 @@ id_from_fd (const int fd) #endif - - #ifndef SSIZE_MAX #define SSIZE_MAX SHRT_MAX #endif @@ -153,7 +152,7 @@ typedef struct int special_file; /* =1 if the fd refers to a special file */ - int unbuffered; /* =1 if the stream is not buffered */ + io_mode method; /* Method of stream I/O being used */ char *buffer; char small_buffer[BUFFER_SIZE]; @@ -184,7 +183,7 @@ typedef struct int special_file; /* =1 if the fd refers to a special file */ - int unbuffered; /* =1 if the stream is not buffered */ + io_mode method; /* Method of stream I/O being used */ char *buffer; } @@ -238,15 +237,15 @@ move_pos_offset (stream* st, int pos_off) str->logical_offset += pos_off; if (str->dirty_offset + str->ndirty > str->logical_offset) - { - if (str->ndirty + pos_off > 0) - str->ndirty += pos_off; - else - { - str->dirty_offset += pos_off + pos_off; - str->ndirty = 0; - } - } + { + if (str->ndirty + pos_off > 0) + str->ndirty += pos_off; + else + { + str->dirty_offset += pos_off + pos_off; + str->ndirty = 0; + } + } return pos_off; } @@ -615,23 +614,23 @@ fd_alloc_w_at (unix_stream * s, int *len, gfc_offset where) || where > s->dirty_offset + s->ndirty || s->dirty_offset > where + *len) { /* Discontiguous blocks, start with a clean buffer. */ - /* Flush the buffer. */ - if (s->ndirty != 0) - fd_flush (s); - s->dirty_offset = where; - s->ndirty = *len; + /* Flush the buffer. */ + if (s->ndirty != 0) + fd_flush (s); + s->dirty_offset = where; + s->ndirty = *len; } else { gfc_offset start; /* Merge with the existing data. */ if (where < s->dirty_offset) - start = where; + start = where; else - start = s->dirty_offset; + start = s->dirty_offset; if (where + *len > s->dirty_offset + s->ndirty) - s->ndirty = where + *len - start; + s->ndirty = where + *len - start; else - s->ndirty = s->dirty_offset + s->ndirty - start; + s->ndirty = s->dirty_offset + s->ndirty - start; s->dirty_offset = start; } @@ -655,7 +654,7 @@ fd_sfree (unix_stream * s) { if (s->ndirty != 0 && (s->buffer != s->small_buffer || options.all_unbuffered || - s->unbuffered)) + s->method == SYNC_UNBUFFERED)) return fd_flush (s); return SUCCESS; @@ -777,7 +776,7 @@ fd_read (unix_stream * s, void * buf, size_t * nbytes) void *p; int tmp, status; - if (*nbytes < BUFFER_SIZE && !s->unbuffered) + if (*nbytes < BUFFER_SIZE && s->method == SYNC_BUFFERED) { tmp = *nbytes; p = fd_alloc_r_at (s, &tmp, -1); @@ -825,7 +824,7 @@ fd_write (unix_stream * s, const void * buf, size_t * nbytes) void *p; int tmp, status; - if (*nbytes < BUFFER_SIZE && !s->unbuffered) + if (*nbytes < BUFFER_SIZE && s->method == SYNC_BUFFERED) { tmp = *nbytes; p = fd_alloc_w_at (s, &tmp, -1); @@ -874,7 +873,7 @@ fd_close (unix_stream * s) if (s->fd != STDOUT_FILENO && s->fd != STDERR_FILENO && s->fd != STDIN_FILENO) { if (close (s->fd) < 0) - return FAILURE; + return FAILURE; } free_mem (s); @@ -887,7 +886,9 @@ static void fd_open (unix_stream * s) { if (isatty (s->fd)) - s->unbuffered = 1; + s->method = SYNC_UNBUFFERED; + else + s->method = SYNC_BUFFERED; s->st.alloc_r_at = (void *) fd_alloc_r_at; s->st.alloc_w_at = (void *) fd_alloc_w_at; @@ -1224,7 +1225,7 @@ tempfile (st_parameter_open *opp) do #if defined(HAVE_CRLF) && defined(O_BINARY) fd = open (template, O_RDWR | O_CREAT | O_EXCL | O_BINARY, - S_IREAD | S_IWRITE); + S_IREAD | S_IWRITE); #else fd = open (template, O_RDWR | O_CREAT | O_EXCL, S_IREAD | S_IWRITE); #endif @@ -1335,11 +1336,11 @@ regular_file (st_parameter_open *opp, unit_flags *flags) if (fd >=0) { flags->action = ACTION_READ; - return fd; /* success */ + return fd; /* success */ } if (errno != EACCES) - return fd; /* failure */ + return fd; /* failure */ /* retry for write-only access */ rwflag = O_WRONLY; @@ -1347,9 +1348,9 @@ regular_file (st_parameter_open *opp, unit_flags *flags) if (fd >=0) { flags->action = ACTION_WRITE; - return fd; /* success */ + return fd; /* success */ } - return fd; /* failure */ + return fd; /* failure */ } @@ -1366,7 +1367,7 @@ open_external (st_parameter_open *opp, unit_flags *flags) { fd = tempfile (opp); if (flags->action == ACTION_UNSPECIFIED) - flags->action = ACTION_READWRITE; + flags->action = ACTION_READWRITE; #if HAVE_UNLINK_OPEN_FILE /* We can unlink scratch files now and it will go away when closed. */ @@ -1431,7 +1432,7 @@ output_stream (void) s = fd_to_stream (STDOUT_FILENO, PROT_WRITE); if (options.unbuffered_preconnected) - ((unix_stream *) s)->unbuffered = 1; + ((unix_stream *) s)->method = SYNC_UNBUFFERED; return s; } @@ -1450,7 +1451,7 @@ error_stream (void) s = fd_to_stream (STDERR_FILENO, PROT_WRITE); if (options.unbuffered_preconnected) - ((unix_stream *) s)->unbuffered = 1; + ((unix_stream *) s)->method = SYNC_UNBUFFERED; return s; } @@ -2050,13 +2051,13 @@ stream_offset (stream *s) the solution used by f2c. Each record contains a pair of length markers: - Length of record n in bytes - Data of record n - Length of record n in bytes + Length of record n in bytes + Data of record n + Length of record n in bytes - Length of record n+1 in bytes - Data of record n+1 - Length of record n+1 in bytes + Length of record n+1 in bytes + Data of record n+1 + Length of record n+1 in bytes The length is stored at the end of a record to allow backspacing to the previous record. Between data transfer statements, the file pointer diff --git a/libgfortran/io/write.c b/libgfortran/io/write.c index d1a3d7ad828..ea8ad94b8ca 100644 --- a/libgfortran/io/write.c +++ b/libgfortran/io/write.c @@ -1,6 +1,8 @@ -/* Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc. +/* Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008 + Free Software Foundation, Inc. Contributed by Andy Vaught Namelist output contributed by Paul Thomas + F2003 I/O support contributed by Jerry DeLisle This file is part of the GNU Fortran 95 runtime library (libgfortran). @@ -361,7 +363,7 @@ write_decimal (st_parameter_dt *dtp, const fnode *f, const char *source, if (n < 0) n = -n; - nsign = sign == SIGN_NONE ? 0 : 1; + nsign = sign == S_NONE ? 0 : 1; q = conv (n, itoa_buf, sizeof (itoa_buf)); digits = strlen (q); @@ -395,13 +397,13 @@ write_decimal (st_parameter_dt *dtp, const fnode *f, const char *source, switch (sign) { - case SIGN_PLUS: + case S_PLUS: *p++ = '+'; break; - case SIGN_MINUS: + case S_MINUS: *p++ = '-'; break; - case SIGN_NONE: + case S_NONE: break; } @@ -638,7 +640,7 @@ write_character (st_parameter_dt *dtp, const char *source, int length) int i, extra; char *p, d; - switch (dtp->u.p.current_unit->flags.delim) + switch (dtp->u.p.delim_status) { case DELIM_APOSTROPHE: d = '\''; @@ -729,11 +731,13 @@ write_real (st_parameter_dt *dtp, const char *source, int length) static void write_complex (st_parameter_dt *dtp, const char *source, int kind, size_t size) { + char semi_comma = dtp->u.p.decimal_status == DECIMAL_POINT ? ',' : ';'; + if (write_char (dtp, '(')) return; write_real (dtp, source, kind); - if (write_char (dtp, ',')) + if (write_char (dtp, semi_comma)) return; write_real (dtp, source + size / 2, kind); @@ -775,7 +779,7 @@ list_formatted_write_scalar (st_parameter_dt *dtp, bt type, void *p, int kind, else { if (type != BT_CHARACTER || !dtp->u.p.char_flag || - dtp->u.p.current_unit->flags.delim != DELIM_NONE) + dtp->u.p.delim_status != DELIM_NONE) write_separator (dtp); } @@ -869,6 +873,11 @@ nml_write_obj (st_parameter_dt *dtp, namelist_info * obj, index_type offset, size_t base_var_name_len; size_t tot_len; unit_delim tmp_delim; + + /* Set the character to be used to separate values + to a comma or semi-colon. */ + + char semi_comma = dtp->u.p.decimal_status == DECIMAL_POINT ? ',' : ';'; /* Write namelist variable names in upper case. If a derived type, nothing is output. If a component, base and base_name are set. */ @@ -985,13 +994,13 @@ nml_write_obj (st_parameter_dt *dtp, namelist_info * obj, index_type offset, break; case GFC_DTYPE_CHARACTER: - tmp_delim = dtp->u.p.current_unit->flags.delim; + tmp_delim = dtp->u.p.delim_status; if (dtp->u.p.nml_delim == '"') - dtp->u.p.current_unit->flags.delim = DELIM_QUOTE; + dtp->u.p.delim_status = DELIM_QUOTE; if (dtp->u.p.nml_delim == '\'') - dtp->u.p.current_unit->flags.delim = DELIM_APOSTROPHE; + dtp->u.p.delim_status = DELIM_APOSTROPHE; write_character (dtp, p, obj->string_length); - dtp->u.p.current_unit->flags.delim = tmp_delim; + dtp->u.p.delim_status = tmp_delim; break; case GFC_DTYPE_REAL: @@ -1075,12 +1084,12 @@ nml_write_obj (st_parameter_dt *dtp, namelist_info * obj, index_type offset, internal_error (&dtp->common, "Bad type for namelist write"); } - /* Reset the leading blank suppression, write a comma and, if 5 - values have been output, write a newline and advance to column - 2. Reset the repeat counter. */ + /* Reset the leading blank suppression, write a comma (or semi-colon) + and, if 5 values have been output, write a newline and advance + to column 2. Reset the repeat counter. */ dtp->u.p.no_leading_blank = 0; - write_character (dtp, ",", 1); + write_character (dtp, &semi_comma, 1); if (num > 5) { num = 0; @@ -1132,7 +1141,7 @@ namelist_write (st_parameter_dt *dtp) /* Set the delimiter for namelist output. */ - tmp_delim = dtp->u.p.current_unit->flags.delim; + tmp_delim = dtp->u.p.delim_status; switch (tmp_delim) { case (DELIM_QUOTE): @@ -1149,7 +1158,7 @@ namelist_write (st_parameter_dt *dtp) } /* Temporarily disable namelist delimters. */ - dtp->u.p.current_unit->flags.delim = DELIM_NONE; + dtp->u.p.delim_status = DELIM_NONE; write_character (dtp, "&", 1); @@ -1177,7 +1186,7 @@ namelist_write (st_parameter_dt *dtp) #endif /* Restore the original delimiter. */ - dtp->u.p.current_unit->flags.delim = tmp_delim; + dtp->u.p.delim_status = tmp_delim; } #undef NML_DIGITS diff --git a/libgfortran/io/write_float.def b/libgfortran/io/write_float.def index 028fd27b863..090bd712eb4 100644 --- a/libgfortran/io/write_float.def +++ b/libgfortran/io/write_float.def @@ -1,6 +1,7 @@ -/* Copyright (C) 2007 Free Software Foundation, Inc. +/* Copyright (C) 2007, 2008 Free Software Foundation, Inc. Contributed by Andy Vaught Write float code factoring to this file by Jerry DeLisle + F2003 I/O support contributed by Jerry DeLisle This file is part of the GNU Fortran 95 runtime library (libgfortran). @@ -31,7 +32,7 @@ Boston, MA 02110-1301, USA. */ #include "config.h" typedef enum -{ SIGN_NONE, SIGN_MINUS, SIGN_PLUS } +{ S_NONE, S_MINUS, S_PLUS } sign_t; /* Given a flag that indicates if a value is negative or not, return a @@ -40,21 +41,21 @@ sign_t; static sign_t calculate_sign (st_parameter_dt *dtp, int negative_flag) { - sign_t s = SIGN_NONE; + sign_t s = S_NONE; if (negative_flag) - s = SIGN_MINUS; + s = S_MINUS; else switch (dtp->u.p.sign_status) { - case SIGN_SP: - s = SIGN_PLUS; + case SIGN_SP: /* Show sign. */ + s = S_PLUS; break; - case SIGN_SS: - s = SIGN_NONE; + case SIGN_SS: /* Suppress sign. */ + s = S_NONE; break; - case SIGN_S: - s = options.optional_plus ? SIGN_PLUS : SIGN_NONE; + case SIGN_S: /* Processor defined. */ + s = options.optional_plus ? S_PLUS : S_NONE; break; } @@ -336,7 +337,7 @@ output_float (st_parameter_dt *dtp, const fnode *f, char *buffer, size_t size, /* Pick a field size if none was specified. */ if (w <= 0) - w = nbefore + nzero + nafter + (sign != SIGN_NONE ? 2 : 1); + w = nbefore + nzero + nafter + (sign != S_NONE ? 2 : 1); /* Create the ouput buffer. */ out = write_block (dtp, w); @@ -362,7 +363,7 @@ output_float (st_parameter_dt *dtp, const fnode *f, char *buffer, size_t size, /* Work out how much padding is needed. */ nblanks = w - (nbefore + nzero + nafter + edigits + 1); - if (sign != SIGN_NONE) + if (sign != S_NONE) nblanks--; /* Check the value fits in the specified field width. */ @@ -390,9 +391,9 @@ output_float (st_parameter_dt *dtp, const fnode *f, char *buffer, size_t size, } /* Output the initial sign (if any). */ - if (sign == SIGN_PLUS) + if (sign == S_PLUS) *(out++) = '+'; - else if (sign == SIGN_MINUS) + else if (sign == S_MINUS) *(out++) = '-'; /* Output an optional leading zero. */ @@ -421,7 +422,7 @@ output_float (st_parameter_dt *dtp, const fnode *f, char *buffer, size_t size, out += nbefore; } /* Output the decimal point. */ - *(out++) = '.'; + *(out++) = dtp->u.p.decimal_status == DECIMAL_POINT ? '.' : ','; /* Output leading zeros after the decimal point. */ if (nzero > 0) diff --git a/libgfortran/libgfortran.h b/libgfortran/libgfortran.h index b5cad85c85f..c3c67a1ffdc 100644 --- a/libgfortran/libgfortran.h +++ b/libgfortran/libgfortran.h @@ -1,5 +1,6 @@ /* Common declarations for all of libgfortran. - Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc. + Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008 + Free Software Foundation, Inc. Contributed by Paul Brook <paul@nowt.org>, and Andy Vaught <andy@xena.eas.asu.edu> @@ -70,6 +71,38 @@ typedef off_t gfc_offset; #endif +/* We use intptr_t and uintptr_t, which may not be always defined in + system headers. */ + +#ifndef HAVE_INTPTR_T +#if __SIZEOF_POINTER__ == __SIZEOF_LONG__ +#define intptr_t long +#elif __SIZEOF_POINTER__ == __SIZEOF_LONG_LONG__ +#define intptr_t long long +#elif __SIZEOF_POINTER__ == __SIZEOF_INT__ +#define intptr_t int +#elif __SIZEOF_POINTER__ == __SIZEOF_SHORT__ +#define intptr_t short +#else +#error "Pointer type with unexpected size" +#endif +#endif + +#ifndef HAVE_UINTPTR_T +#if __SIZEOF_POINTER__ == __SIZEOF_LONG__ +#define uintptr_t unsigned long +#elif __SIZEOF_POINTER__ == __SIZEOF_LONG_LONG__ +#define uintptr_t unsigned long long +#elif __SIZEOF_POINTER__ == __SIZEOF_INT__ +#define uintptr_t unsigned int +#elif __SIZEOF_POINTER__ == __SIZEOF_SHORT__ +#define uintptr_t unsigned short +#else +#error "Pointer type with unexpected size" +#endif +#endif + + /* On mingw, work around the buggy Windows snprintf() by using the one mingw provides, __mingw_snprintf(). We also provide a prototype for __mingw_snprintf(), because the mingw headers currently don't have one. */ @@ -368,6 +401,32 @@ typedef GFC_ARRAY_DESCRIPTOR (GFC_MAX_DIMENSIONS, GFC_LOGICAL_16) gfc_array_l16; | (sizeof(GFC_COMPLEX_16) << GFC_DTYPE_SIZE_SHIFT)) #endif +#define GFC_DTYPE_DERIVED_1 ((GFC_DTYPE_DERIVED << GFC_DTYPE_TYPE_SHIFT) \ + | (sizeof(GFC_INTEGER_1) << GFC_DTYPE_SIZE_SHIFT)) +#define GFC_DTYPE_DERIVED_2 ((GFC_DTYPE_DERIVED << GFC_DTYPE_TYPE_SHIFT) \ + | (sizeof(GFC_INTEGER_2) << GFC_DTYPE_SIZE_SHIFT)) +#define GFC_DTYPE_DERIVED_4 ((GFC_DTYPE_DERIVED << GFC_DTYPE_TYPE_SHIFT) \ + | (sizeof(GFC_INTEGER_4) << GFC_DTYPE_SIZE_SHIFT)) +#define GFC_DTYPE_DERIVED_8 ((GFC_DTYPE_DERIVED << GFC_DTYPE_TYPE_SHIFT) \ + | (sizeof(GFC_INTEGER_8) << GFC_DTYPE_SIZE_SHIFT)) +#ifdef HAVE_GFC_INTEGER_16 +#define GFC_DTYPE_DERIVED_16 ((GFC_DTYPE_DERIVED << GFC_DTYPE_TYPE_SHIFT) \ + | (sizeof(GFC_INTEGER_16) << GFC_DTYPE_SIZE_SHIFT)) +#endif + +/* Macros to determine the alignment of pointers. */ + +#define GFC_UNALIGNED_2(x) (((uintptr_t)(x)) & \ + (__alignof__(GFC_INTEGER_2) - 1)) +#define GFC_UNALIGNED_4(x) (((uintptr_t)(x)) & \ + (__alignof__(GFC_INTEGER_4) - 1)) +#define GFC_UNALIGNED_8(x) (((uintptr_t)(x)) & \ + (__alignof__(GFC_INTEGER_8) - 1)) +#ifdef HAVE_GFC_INTEGER_16 +#define GFC_UNALIGNED_16(x) (((uintptr_t)(x)) & \ + (__alignof__(GFC_INTEGER_16) - 1)) +#endif + /* Runtime library include. */ #define stringize(x) expand_macro(x) #define expand_macro(x) # x @@ -507,6 +566,11 @@ st_parameter_common; #define IOPARM_OPEN_HAS_DELIM (1 << 15) #define IOPARM_OPEN_HAS_PAD (1 << 16) #define IOPARM_OPEN_HAS_CONVERT (1 << 17) +#define IOPARM_OPEN_HAS_DECIMAL (1 << 18) +#define IOPARM_OPEN_HAS_ENCODING (1 << 19) +#define IOPARM_OPEN_HAS_ROUND (1 << 20) +#define IOPARM_OPEN_HAS_SIGN (1 << 21) +#define IOPARM_OPEN_HAS_ASYNCHRONOUS (1 << 22) /* library start function and end macro. These can be expanded if needed in the future. cmp is st_parameter_common *cmp */ diff --git a/libgfortran/runtime/backtrace.c b/libgfortran/runtime/backtrace.c index 00605b50d3f..4a3388841f8 100644 --- a/libgfortran/runtime/backtrace.c +++ b/libgfortran/runtime/backtrace.c @@ -43,12 +43,6 @@ Boston, MA 02110-1301, USA. */ #include <unistd.h> #endif -#ifdef HAVE_INTPTR_T -# define INTPTR_T intptr_t -#else -# define INTPTR_T int -#endif - #ifdef HAVE_EXECINFO_H #include <execinfo.h> #endif @@ -158,7 +152,7 @@ show_backtrace (void) /* Write the list of addresses in hexadecimal format. */ for (i = 0; i < depth; i++) - addr[i] = xtoa ((GFC_UINTEGER_LARGEST) (INTPTR_T) trace[i], addr_buf[i], + addr[i] = xtoa ((GFC_UINTEGER_LARGEST) (intptr_t) trace[i], addr_buf[i], sizeof (addr_buf[i])); /* Don't output an error message if something goes wrong, we'll simply diff --git a/libgfortran/runtime/in_pack_generic.c b/libgfortran/runtime/in_pack_generic.c index 067cd280e08..79cbbd7df29 100644 --- a/libgfortran/runtime/in_pack_generic.c +++ b/libgfortran/runtime/in_pack_generic.c @@ -51,7 +51,7 @@ internal_pack (gfc_array_char * source) int n; int packed; index_type size; - int type; + index_type type_size; if (source->dim[0].stride == 0) { @@ -59,73 +59,88 @@ internal_pack (gfc_array_char * source) return source->data; } - type = GFC_DESCRIPTOR_TYPE (source); + type_size = GFC_DTYPE_TYPE_SIZE(source); size = GFC_DESCRIPTOR_SIZE (source); - switch (type) + switch (type_size) { - case GFC_DTYPE_INTEGER: - case GFC_DTYPE_LOGICAL: - switch (size) - { - case sizeof (GFC_INTEGER_1): - return internal_pack_1 ((gfc_array_i1 *) source); - - case sizeof (GFC_INTEGER_2): - return internal_pack_2 ((gfc_array_i2 *) source); - - case sizeof (GFC_INTEGER_4): - return internal_pack_4 ((gfc_array_i4 *) source); - - case sizeof (GFC_INTEGER_8): - return internal_pack_8 ((gfc_array_i8 *) source); + case GFC_DTYPE_INTEGER_1: + case GFC_DTYPE_LOGICAL_1: + case GFC_DTYPE_DERIVED_1: + return internal_pack_1 ((gfc_array_i1 *) source); + + case GFC_DTYPE_INTEGER_2: + case GFC_DTYPE_LOGICAL_2: + return internal_pack_2 ((gfc_array_i2 *) source); + + case GFC_DTYPE_INTEGER_4: + case GFC_DTYPE_LOGICAL_4: + return internal_pack_4 ((gfc_array_i4 *) source); + + case GFC_DTYPE_INTEGER_8: + case GFC_DTYPE_LOGICAL_8: + return internal_pack_8 ((gfc_array_i8 *) source); #if defined(HAVE_GFC_INTEGER_16) - case sizeof (GFC_INTEGER_16): - return internal_pack_16 ((gfc_array_i16 *) source); + case GFC_DTYPE_INTEGER_16: + case GFC_DTYPE_LOGICAL_16: + return internal_pack_16 ((gfc_array_i16 *) source); #endif - } - break; - - case GFC_DTYPE_REAL: - switch (size) - { - case sizeof (GFC_REAL_4): - return internal_pack_r4 ((gfc_array_r4 *) source); + case GFC_DTYPE_REAL_4: + return internal_pack_r4 ((gfc_array_r4 *) source); - case sizeof (GFC_REAL_8): - return internal_pack_r8 ((gfc_array_r8 *) source); + case GFC_DTYPE_REAL_8: + return internal_pack_r8 ((gfc_array_r8 *) source); #if defined (HAVE_GFC_REAL_10) - case sizeof (GFC_REAL_10): - return internal_pack_r10 ((gfc_array_r10 *) source); + case GFC_DTYPE_REAL_10: + return internal_pack_r10 ((gfc_array_r10 *) source); #endif #if defined (HAVE_GFC_REAL_16) - case sizeof (GFC_REAL_16): - return internal_pack_r16 ((gfc_array_r16 *) source); + case GFC_DTYPE_REAL_16: + return internal_pack_r16 ((gfc_array_r16 *) source); #endif - } - case GFC_DTYPE_COMPLEX: - switch (size) - { - case sizeof (GFC_COMPLEX_4): - return internal_pack_c4 ((gfc_array_c4 *) source); - - case sizeof (GFC_COMPLEX_8): - return internal_pack_c8 ((gfc_array_c8 *) source); + case GFC_DTYPE_COMPLEX_4: + return internal_pack_c4 ((gfc_array_c4 *) source); + + case GFC_DTYPE_COMPLEX_8: + return internal_pack_c8 ((gfc_array_c8 *) source); #if defined (HAVE_GFC_COMPLEX_10) - case sizeof (GFC_COMPLEX_10): - return internal_pack_c10 ((gfc_array_c10 *) source); + case GFC_DTYPE_COMPLEX_10: + return internal_pack_c10 ((gfc_array_c10 *) source); #endif #if defined (HAVE_GFC_COMPLEX_16) - case sizeof (GFC_COMPLEX_16): - return internal_pack_c16 ((gfc_array_c16 *) source); + case GFC_DTYPE_COMPLEX_16: + return internal_pack_c16 ((gfc_array_c16 *) source); #endif - } - break; + case GFC_DTYPE_DERIVED_2: + if (GFC_UNALIGNED_2(source->data)) + break; + else + return internal_pack_2 ((gfc_array_i2 *) source); + + case GFC_DTYPE_DERIVED_4: + if (GFC_UNALIGNED_4(source->data)) + break; + else + return internal_pack_4 ((gfc_array_i4 *) source); + + case GFC_DTYPE_DERIVED_8: + if (GFC_UNALIGNED_8(source->data)) + break; + else + return internal_pack_8 ((gfc_array_i8 *) source); + +#ifdef HAVE_GFC_INTEGER_16 + case GFC_DTYPE_DERIVED_16: + if (GFC_UNALIGNED_16(source->data)) + break; + else + return internal_pack_16 ((gfc_array_i16 *) source); +#endif default: break; diff --git a/libgfortran/runtime/in_unpack_generic.c b/libgfortran/runtime/in_unpack_generic.c index 8b51fe92e72..81d1f0485ec 100644 --- a/libgfortran/runtime/in_unpack_generic.c +++ b/libgfortran/runtime/in_unpack_generic.c @@ -49,98 +49,124 @@ internal_unpack (gfc_array_char * d, const void * s) const char *src; int n; int size; - int type; + int type_size; dest = d->data; /* This check may be redundant, but do it anyway. */ if (s == dest || !s) return; - type = GFC_DESCRIPTOR_TYPE (d); - size = GFC_DESCRIPTOR_SIZE (d); - switch (type) + type_size = GFC_DTYPE_TYPE_SIZE (d); + switch (type_size) { - case GFC_DTYPE_INTEGER: - case GFC_DTYPE_LOGICAL: - switch (size) - { - case sizeof (GFC_INTEGER_1): - internal_unpack_1 ((gfc_array_i1 *) d, (const GFC_INTEGER_1 *) s); - return; + case GFC_DTYPE_INTEGER_1: + case GFC_DTYPE_LOGICAL_1: + case GFC_DTYPE_DERIVED_1: + internal_unpack_1 ((gfc_array_i1 *) d, (const GFC_INTEGER_1 *) s); + return; - case sizeof (GFC_INTEGER_2): - internal_unpack_2 ((gfc_array_i2 *) d, (const GFC_INTEGER_2 *) s); - return; + case GFC_DTYPE_INTEGER_2: + case GFC_DTYPE_LOGICAL_2: + internal_unpack_2 ((gfc_array_i2 *) d, (const GFC_INTEGER_2 *) s); + return; - case sizeof (GFC_INTEGER_4): - internal_unpack_4 ((gfc_array_i4 *) d, (const GFC_INTEGER_4 *) s); - return; + case GFC_DTYPE_INTEGER_4: + case GFC_DTYPE_LOGICAL_4: + internal_unpack_4 ((gfc_array_i4 *) d, (const GFC_INTEGER_4 *) s); + return; - case sizeof (GFC_INTEGER_8): - internal_unpack_8 ((gfc_array_i8 *) d, (const GFC_INTEGER_8 *) s); - return; + case GFC_DTYPE_INTEGER_8: + case GFC_DTYPE_LOGICAL_8: + internal_unpack_8 ((gfc_array_i8 *) d, (const GFC_INTEGER_8 *) s); + return; #if defined (HAVE_GFC_INTEGER_16) - case sizeof (GFC_INTEGER_16): - internal_unpack_16 ((gfc_array_i16 *) d, (const GFC_INTEGER_16 *) s); - return; + case GFC_DTYPE_INTEGER_16: + case GFC_DTYPE_LOGICAL_16: + internal_unpack_16 ((gfc_array_i16 *) d, (const GFC_INTEGER_16 *) s); + return; #endif - } - break; - - case GFC_DTYPE_REAL: - switch (size) - { - case sizeof (GFC_REAL_4): - internal_unpack_r4 ((gfc_array_r4 *) d, (const GFC_REAL_4 *) s); - return; + case GFC_DTYPE_REAL_4: + internal_unpack_r4 ((gfc_array_r4 *) d, (const GFC_REAL_4 *) s); + return; - case sizeof (GFC_REAL_8): - internal_unpack_r8 ((gfc_array_r8 *) d, (const GFC_REAL_8 *) s); - return; + case GFC_DTYPE_REAL_8: + internal_unpack_r8 ((gfc_array_r8 *) d, (const GFC_REAL_8 *) s); + return; #if defined(HAVE_GFC_REAL_10) - case sizeof (GFC_REAL_10): - internal_unpack_r10 ((gfc_array_r10 *) d, (const GFC_REAL_10 *) s); - return; + case GFC_DTYPE_REAL_10: + internal_unpack_r10 ((gfc_array_r10 *) d, (const GFC_REAL_10 *) s); + return; #endif #if defined(HAVE_GFC_REAL_16) - case sizeof (GFC_REAL_16): - internal_unpack_r16 ((gfc_array_r16 *) d, (const GFC_REAL_16 *) s); - return; + case GFC_DTYPE_REAL_16: + internal_unpack_r16 ((gfc_array_r16 *) d, (const GFC_REAL_16 *) s); + return; #endif + case GFC_DTYPE_COMPLEX_4: + internal_unpack_c4 ((gfc_array_c4 *)d, (const GFC_COMPLEX_4 *)s); + return; - } + case GFC_DTYPE_COMPLEX_8: + internal_unpack_c8 ((gfc_array_c8 *)d, (const GFC_COMPLEX_8 *)s); + return; + +#if defined(HAVE_GFC_COMPLEX_10) + case GFC_DTYPE_COMPLEX_10: + internal_unpack_c10 ((gfc_array_c10 *) d, (const GFC_COMPLEX_10 *) s); + return; +#endif - case GFC_DTYPE_COMPLEX: - switch (size) +#if defined(HAVE_GFC_COMPLEX_16) + case GFC_DTYPE_COMPLEX_16: + internal_unpack_c16 ((gfc_array_c16 *) d, (const GFC_COMPLEX_16 *) s); + return; +#endif + case GFC_DTYPE_DERIVED_2: + if (GFC_UNALIGNED_2(d->data) || GFC_UNALIGNED_2(s)) + break; + else { - case sizeof (GFC_COMPLEX_4): - internal_unpack_c4 ((gfc_array_c4 *)d, (const GFC_COMPLEX_4 *)s); + internal_unpack_2 ((gfc_array_i2 *) d, (const GFC_INTEGER_2 *) s); return; - - case sizeof (GFC_COMPLEX_8): - internal_unpack_c8 ((gfc_array_c8 *)d, (const GFC_COMPLEX_8 *)s); + } + case GFC_DTYPE_DERIVED_4: + if (GFC_UNALIGNED_4(d->data) || GFC_UNALIGNED_4(s)) + break; + else + { + internal_unpack_4 ((gfc_array_i4 *) d, (const GFC_INTEGER_4 *) s); return; + } -#if defined(HAVE_GFC_COMPLEX_10) - case sizeof (GFC_COMPLEX_10): - internal_unpack_c10 ((gfc_array_c10 *) d, (const GFC_COMPLEX_10 *) s); + case GFC_DTYPE_DERIVED_8: + if (GFC_UNALIGNED_8(d->data) || GFC_UNALIGNED_8(s)) + break; + else + { + internal_unpack_8 ((gfc_array_i8 *) d, (const GFC_INTEGER_8 *) s); return; -#endif + } -#if defined(HAVE_GFC_COMPLEX_16) - case sizeof (GFC_COMPLEX_16): - internal_unpack_c16 ((gfc_array_c16 *) d, (const GFC_COMPLEX_16 *) s); +#ifdef HAVE_GFC_INTEGER_16 + case GFC_DTYPE_DERIVED_16: + if (GFC_UNALIGNED_16(d->data) || GFC_UNALIGNED_16(s)) + break; + else + { + internal_unpack_16 ((gfc_array_i16 *) d, (const GFC_INTEGER_16 *) s); return; + } #endif - } default: break; } + size = GFC_DESCRIPTOR_SIZE (d); + if (d->dim[0].stride == 0) d->dim[0].stride = 1; diff --git a/libmudflap/configure b/libmudflap/configure index 1fb5ada2203..99b693e0341 100755 --- a/libmudflap/configure +++ b/libmudflap/configure @@ -2115,6 +2115,7 @@ am__api_version="1.9" # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # OS/2's system install, which has a completely different semantic # ./install, which can be erroneously created by make from ./install.sh. +# Reject install programs that cannot install multiple files. { echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5 echo $ECHO_N "checking for a BSD-compatible install... $ECHO_C" >&6; } if test -z "$INSTALL"; then @@ -2148,8 +2149,18 @@ case $as_dir/ in # program-specific install script used by HP pwplus--don't use. : else - ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" - break 3 + rm -rf conftest.one conftest.two conftest.dir + echo one > conftest.one + echo two > conftest.two + mkdir conftest.dir + if "$as_dir/$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir" && + test -s conftest.one && test -s conftest.two && + test -s conftest.dir/conftest.one && + test -s conftest.dir/conftest.two + then + ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" + break 3 + fi fi fi done @@ -2159,6 +2170,7 @@ esac done IFS=$as_save_IFS +rm -rf conftest.one conftest.two conftest.dir fi if test "${ac_cv_path_install+set}" = set; then @@ -6492,13 +6504,13 @@ if test "${lt_cv_nm_interface+set}" = set; then else lt_cv_nm_interface="BSD nm" echo "int some_variable = 0;" > conftest.$ac_ext - (eval echo "\"\$as_me:6495: $ac_compile\"" >&5) + (eval echo "\"\$as_me:6507: $ac_compile\"" >&5) (eval "$ac_compile" 2>conftest.err) cat conftest.err >&5 - (eval echo "\"\$as_me:6498: $NM \\\"conftest.$ac_objext\\\"\"" >&5) + (eval echo "\"\$as_me:6510: $NM \\\"conftest.$ac_objext\\\"\"" >&5) (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out) cat conftest.err >&5 - (eval echo "\"\$as_me:6501: output\"" >&5) + (eval echo "\"\$as_me:6513: output\"" >&5) cat conftest.out >&5 if $GREP 'External.*some_variable' conftest.out > /dev/null; then lt_cv_nm_interface="MS dumpbin" @@ -7600,7 +7612,7 @@ ia64-*-hpux*) ;; *-*-irix6*) # Find out which ABI we are using. - echo '#line 7603 "configure"' > conftest.$ac_ext + echo '#line 7615 "configure"' > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? @@ -8221,11 +8233,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:8224: $lt_compile\"" >&5) + (eval echo "\"\$as_me:8236: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:8228: \$? = $ac_status" >&5 + echo "$as_me:8240: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -8543,11 +8555,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:8546: $lt_compile\"" >&5) + (eval echo "\"\$as_me:8558: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:8550: \$? = $ac_status" >&5 + echo "$as_me:8562: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -8648,11 +8660,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:8651: $lt_compile\"" >&5) + (eval echo "\"\$as_me:8663: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:8655: \$? = $ac_status" >&5 + echo "$as_me:8667: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -8703,11 +8715,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:8706: $lt_compile\"" >&5) + (eval echo "\"\$as_me:8718: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:8710: \$? = $ac_status" >&5 + echo "$as_me:8722: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -11459,7 +11471,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 11462 "configure" +#line 11474 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -11559,7 +11571,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 11562 "configure" +#line 11574 "configure" #include "confdefs.h" #if HAVE_DLFCN_H diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index f5900740560..0c6e5206916 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,156 @@ +2008-04-10 Benjamin Kosnik <bkoz@redhat.com> + + * doc/html/*: Regenerate. + +2008-04-10 Ralf Wildenhues <Ralf.Wildenhues@gmx.de> + + * doc/xml/manual/bitmap_allocator.xml: Improve wording a bit. + * doc/xml/authors.xml: Fix typos. + * doc/xml/faq.xml: Likewise. + * doc/xml/manual/abi.xml: Likewise. + * doc/xml/manual/allocator.xml: Likewise. + * doc/xml/manual/appendix_contributing.xml: Likewise. + * doc/xml/manual/backwards_compatibility.xml: Likewise. + * doc/xml/manual/build_hacking.xml: Likewise. + * doc/xml/manual/codecvt.xml: Likewise. + * doc/xml/manual/concurrency.xml: Likewise. + * doc/xml/manual/ctype.xml: Likewise. + * doc/xml/manual/debug_mode.xml: Likewise. + * doc/xml/manual/diagnostics.xml: Likewise. + * doc/xml/manual/evolution.xml: Likewise. + * doc/xml/manual/extensions.xml: Likewise. + * doc/xml/manual/locale.xml: Likewise. + * doc/xml/manual/messages.xml: Likewise. + * doc/xml/manual/parallel_mode.xml: Likewise. + * doc/xml/manual/status_cxx200x.xml: Likewise. + * doc/xml/manual/strings.xml: Likewise. + * doc/xml/manual/support.xml: Likewise. + * doc/xml/manual/test.xml: Likewise. + * doc/xml/manual/using.xml: Likewise. + +2008-04-10 Benjamin Kosnik <bkoz@redhat.com> + Johannes Singler <singler@ira.uka.de> + + * doc/xml/manual/parallel_mode.xml: Remove map/set bulk + insertors. Correct omp_set_num_threads example. + +2008-04-10 Benjamin Kosnik <bkoz@redhat.com> + + * include/c_global/cstdatomic: C++ types only, format, doxygen markup. + * include/c_compatibility/stdatomic.h: "C" only, format, doxygen markup. + * src/atomic.c: Format, doxygen markup, edits. + + * include/Makefile.am (cstdatomic, stdatomic.h): Add. + * src/Makefile.am (atomic.c): Add. + * acinclude.m4 (GLIBCXX_CHECK_STANDARD_LAYOUT): New. + * configure.ac: Call it. + * include/Makefile.in: Regenerate. + * src/Makefile.in: Same. + * Makefile.in: Same. + * doc/Makefile.in: Same. + * po/Makefile.in: Same. + * libmath/Makefile.in: Same. + * include/Makefile.in: Same. + * testsuite/Makefile.in: Same. + * libsupc++/Makefile.in: Same. + * config.h.in: Same. + * configure: Same. + + * config/abi/pre/gnu.ver: Add atomics exports. + + * include/ext/typelist.h (apply_generator): New. + * include/bits/c++config (_GLIBCXX_BEGIN_EXTERN_C): New. + (_GLIBCXX_END_EXTERN_C): New. + Deal with _GLIBCXX_BEGIN_NAMESPACE, _GLIBCXX_END_NAMESPACE when + compiling as C. + * testsuite/lib/libstdc++.exp (v3_target_compile_as_c): Add -L + flag for libstdc++. + * testsuite/util/testsuite_common_types.h (integral_types): New + typelist. + (atomics, atomics_tl): Same. + (assignable, default_constructible, copy_constructible, + explicit_value_constructible): New. + * testsuite/17_intro/headers/c++200x/all.cc: Test new headers. + * testsuite/29_atomics: New. + * testsuite/29_atomics/atomic_address: Same. + * testsuite/29_atomics/atomic_address/cons: Same. + * testsuite/29_atomics/atomic_address/cons/explicit_value.cc: Same. + * testsuite/29_atomics/atomic_address/cons/assign_neg.cc: Same. + * testsuite/29_atomics/atomic_address/cons/copy_neg.cc: Same. + * testsuite/29_atomics/atomic_address/cons/default.cc: Same. + * testsuite/29_atomics/atomic_address/cons/aggregate.cc: Same. + * testsuite/29_atomics/atomic_flag: Same. + * testsuite/29_atomics/atomic_flag/cons: Same. + * testsuite/29_atomics/atomic_flag/cons/assign_neg.cc: Same. + * testsuite/29_atomics/atomic_flag/cons/copy_neg.cc: Same. + * testsuite/29_atomics/atomic_flag/cons/default.cc: Same. + * testsuite/29_atomics/atomic_flag/cons/aggregate.cc: Same. + * testsuite/29_atomics/atomic_flag/requirements: Same. + * testsuite/29_atomics/atomic_flag/requirements/standard_layout.cc: + Same. + * testsuite/29_atomics/atomic_flag/ + atomic_global_fence_compatibility.cc: Same. + * testsuite/29_atomics/atomic_flag/test_and_set: Same. + * testsuite/29_atomics/atomic_flag/test_and_set/explicit.c: Same. + * testsuite/29_atomics/atomic_flag/test_and_set/explicit.cc: Same. + * testsuite/29_atomics/atomic_flag/test_and_set/implicit.c: Same. + * testsuite/29_atomics/atomic_flag/test_and_set/implicit.cc: Same. + * testsuite/29_atomics/headers: Same. + * testsuite/29_atomics/headers/cstdatomic: Same. + * testsuite/29_atomics/headers/cstdatomic/types_std_c++0x.cc: Same. + * testsuite/29_atomics/headers/cstdatomic/functions_std_c++0x.cc: Same. + * testsuite/29_atomics/headers/cstdatomic/std_c++0x_neg.cc: Same. + * testsuite/29_atomics/headers/cstdatomic/macros.cc: Same. + * testsuite/29_atomics/headers/stdatomic.h: Same. + * testsuite/29_atomics/headers/stdatomic.h/macros.c: Same. + * testsuite/29_atomics/headers/stdatomic.h/types.c: Same. + * testsuite/29_atomics/headers/stdatomic.h/functions.c: Same. + * testsuite/29_atomics/atomic: Same. + * testsuite/29_atomics/atomic/cons: Same. + * testsuite/29_atomics/atomic/cons/explicit_value.cc: Same. + * testsuite/29_atomics/atomic/cons/assign_neg.cc: Same. + * testsuite/29_atomics/atomic/cons/copy_neg.cc: Same. + * testsuite/29_atomics/atomic/cons/default.cc: Same. + * testsuite/29_atomics/atomic/requirements: Same. + * testsuite/29_atomics/atomic/requirements/explicit_instantiation: Same. + * testsuite/29_atomics/atomic/requirements/explicit_instantiation/ + 1.cc: Same. + +2008-04-10 Lawrence Crowl <crowl@google.com> + + * include/c_global/cstdatomic: New. + * include/c_compatibility/stdatomic.h: New. + * src/atomic.c: New. + +2008-04-10 Benjamin Kosnik <bkoz@redhat.com> + + * include/std/tuple: Consistency check for include guard, doxygen + file markup. + * include/std/date_time: Same. + * include/std/type_traits: Same. + * include/std/regex: Same. + * include/std/array: Same. + * include/std/system_error: Same, add error_code ctor. + +2008-04-07 Johannes Singler <singler@ira.uka.de> + + * include/parallel/multiway_merge.h: Moved decisions to + compile-time instead of run-time. + * include/parallel/losertree.h: Removed obsolete variants, added + variant that uses pointers in the loser tree. + * include/parallel/types.h: Remove obsolete settings options from enum. + * include/parallel/features.h: Remove obsolete compile-time switches. + * include/parallel/compiletime_settings.h: Remove obsolete variant + that copies back *after* sorting. + * include/parallel/tags.h: Add one new tag for compile-time switch. + * include/parallel/merge.h: Adapt to changes in multiway_merge.h. + * include/parallel/multiway_mergesort.h: Adapt to changes in + multiway_merge.h. Factor out splitting variants. Remove obsolete + variant that copies back *after* sorting. + * include/parallel/sort.h: Adapt to changes in multiway_mergesort.h. + * testsuite/25_algorithms/sort/35588.cc: Added test case from / + for PR 35588. + 2008-03-29 Paolo Carlini <pcarlini@suse.de> PR libstdc++/35725 diff --git a/libstdc++-v3/Makefile.in b/libstdc++-v3/Makefile.in index 76397b3b914..146704405ff 100644 --- a/libstdc++-v3/Makefile.in +++ b/libstdc++-v3/Makefile.in @@ -54,6 +54,7 @@ am__aclocal_m4_deps = $(top_srcdir)/../config/enable.m4 \ $(top_srcdir)/../config/lib-prefix.m4 \ $(top_srcdir)/../config/multi.m4 \ $(top_srcdir)/../config/no-executables.m4 \ + $(top_srcdir)/../config/proginstall.m4 \ $(top_srcdir)/../config/unwind_ipinfo.m4 \ $(top_srcdir)/../libtool.m4 $(top_srcdir)/../ltoptions.m4 \ $(top_srcdir)/../ltsugar.m4 $(top_srcdir)/../ltversion.m4 \ diff --git a/libstdc++-v3/acinclude.m4 b/libstdc++-v3/acinclude.m4 index 92c70b29079..e1712b77d80 100644 --- a/libstdc++-v3/acinclude.m4 +++ b/libstdc++-v3/acinclude.m4 @@ -1477,6 +1477,46 @@ AC_DEFUN([GLIBCXX_CHECK_SYSTEM_ERROR], [ ]) dnl +dnl Check whether C++200x's standard layout types are supported. +dnl +AC_DEFUN([GLIBCXX_CHECK_STANDARD_LAYOUT], [ + + AC_MSG_CHECKING([for ISO C++200x standard layout type support]) + AC_CACHE_VAL(ac_standard_layout, [ + AC_LANG_SAVE + AC_LANG_CPLUSPLUS + ac_test_CXXFLAGS="${CXXFLAGS+set}" + ac_save_CXXFLAGS="$CXXFLAGS" + CXXFLAGS='-std=gnu++0x' + + AC_TRY_COMPILE([struct b + { + bool t; + + // Need standard layout relaxation from POD + private: + b& operator=(const b&); + b(const b&); + }; + + int main() + { + b tst1 = { false }; + return 0; + }],, + [ac_standard_layout=yes], [ac_standard_layout=no]) + + CXXFLAGS="$ac_save_CXXFLAGS" + AC_LANG_RESTORE + ]) + AC_MSG_RESULT($ac_standard_layout) + if test x"$ac_standard_layout" = x"yes"; then + AC_DEFINE(_GLIBCXX_USE_STANDARD_LAYOUT, 1, + [Define if standard layout types are supported in C++200x.]) + fi +]) + +dnl dnl Check for what type of C headers to use. dnl dnl --enable-cheaders= [does stuff]. diff --git a/libstdc++-v3/config.h.in b/libstdc++-v3/config.h.in index 39ce4a9305c..52acd2c2f0d 100644 --- a/libstdc++-v3/config.h.in +++ b/libstdc++-v3/config.h.in @@ -815,6 +815,9 @@ TR1 (Chapter 5.1). */ #undef _GLIBCXX_USE_RANDOM_TR1 +/* Define if standard layout types are supported in C++200x. */ +#undef _GLIBCXX_USE_STANDARD_LAYOUT + /* Define if code specialized for wchar_t should be used. */ #undef _GLIBCXX_USE_WCHAR_T diff --git a/libstdc++-v3/config/abi/pre/gnu.ver b/libstdc++-v3/config/abi/pre/gnu.ver index 1d35bfbbd37..3e5a9240513 100644 --- a/libstdc++-v3/config/abi/pre/gnu.ver +++ b/libstdc++-v3/config/abi/pre/gnu.ver @@ -26,7 +26,11 @@ GLIBCXX_3.4 { # Names inside the 'extern' block are demangled names. extern "C++" { - std::[A-Za]*; + std::[A-Z]*; + std::a[a-c]*; + std::ad[a-n]*; + std::ad[p-z]*; + std::a[e-z]*; # std::ba[a-r]*; std::basic_[a-e]*; std::basic_f[a-r]*; @@ -61,7 +65,9 @@ GLIBCXX_3.4 { std::c[i-s]*; std::c[u-z]*; # std::[d-g]*; - std::[d-e]*; + std::d[a-d]*; + std::d[f-z]*; + std::e*; std::gslice*; std::h[^a]*; std::i[a-n]*; @@ -120,7 +126,6 @@ GLIBCXX_3.4 { std::_List_node_base::unhook*; std::_List_node_base::reverse*; std::_List_node_base::transfer*; - std::__throw_*; std::__timepunct*; std::__numeric_limits_base*; std::__num_base::_S_format_float*; @@ -135,23 +140,6 @@ GLIBCXX_3.4 { # Names not in an 'extern' block are mangled names. - # __gnu_debug::_Safe_sequence_base and _Safe_iterator_base - _ZN11__gnu_debug19_Safe_sequence_base13_M_detach_allEv; - _ZN11__gnu_debug19_Safe_sequence_base18_M_detach_singularEv; - _ZN11__gnu_debug19_Safe_sequence_base22_M_revalidate_singularEv; - _ZN11__gnu_debug19_Safe_sequence_base7_M_swapERS0_; - _ZN11__gnu_debug19_Safe_iterator_base9_M_attachEPNS_19_Safe_sequence_baseEb; - _ZN11__gnu_debug19_Safe_iterator_base9_M_detachEv; - _ZNK11__gnu_debug19_Safe_iterator_base11_M_singularEv; - _ZNK11__gnu_debug19_Safe_iterator_base14_M_can_compareERKS0_; - - # __gnu_debug::_Error_formatter - _ZNK11__gnu_debug16_Error_formatter10_M_message*; - _ZNK11__gnu_debug16_Error_formatter10_Parameter*; - _ZNK11__gnu_debug16_Error_formatter13_M_print_word*; - _ZNK11__gnu_debug16_Error_formatter15_M_print_string*; - _ZNK11__gnu_debug16_Error_formatter8_M_error*; - # std::string _ZNSsC*; _ZNSsD*; @@ -436,6 +424,39 @@ GLIBCXX_3.4 { _ZN10__gnu_norm15_List_node_base7reverseEv; _ZN10__gnu_norm15_List_node_base8transfer*; + # __gnu_debug::_Safe_sequence_base and _Safe_iterator_base + _ZN11__gnu_debug19_Safe_sequence_base13_M_detach_allEv; + _ZN11__gnu_debug19_Safe_sequence_base18_M_detach_singularEv; + _ZN11__gnu_debug19_Safe_sequence_base22_M_revalidate_singularEv; + _ZN11__gnu_debug19_Safe_sequence_base7_M_swapERS0_; + _ZN11__gnu_debug19_Safe_iterator_base9_M_attachEPNS_19_Safe_sequence_baseEb; + _ZN11__gnu_debug19_Safe_iterator_base9_M_detachEv; + _ZNK11__gnu_debug19_Safe_iterator_base11_M_singularEv; + _ZNK11__gnu_debug19_Safe_iterator_base14_M_can_compareERKS0_; + + # __gnu_debug::_Error_formatter + _ZNK11__gnu_debug16_Error_formatter10_M_message*; + _ZNK11__gnu_debug16_Error_formatter10_Parameter*; + _ZNK11__gnu_debug16_Error_formatter13_M_print_word*; + _ZNK11__gnu_debug16_Error_formatter15_M_print_string*; + _ZNK11__gnu_debug16_Error_formatter8_M_error*; + + # exceptions as functions + _ZSt16__throw_bad_castv; + _ZSt17__throw_bad_allocv; + _ZSt18__throw_bad_typeidv; + _ZSt19__throw_ios_failurePKc; + _ZSt19__throw_logic_errorPKc; + _ZSt19__throw_range_errorPKc; + _ZSt20__throw_domain_errorPKc; + _ZSt20__throw_length_errorPKc; + _ZSt20__throw_out_of_rangePKc; + _ZSt21__throw_bad_exceptionv; + _ZSt21__throw_runtime_errorPKc; + _ZSt22__throw_overflow_errorPKc; + _ZSt23__throw_underflow_errorPKc; + _ZSt24__throw_invalid_argumentPKc; + # operator new(size_t) _Znw[jm]; # operator new(size_t, std::nothrow_t const&) @@ -464,7 +485,10 @@ GLIBCXX_3.4 { # _ZTVSt[0-9][0-9][A-Za-z]*; _ZTVSt[0-9][0-9][A-Z]*; _ZTVSt[0-9][0-9][a-d]*; - _ZTVSt[0-9][0-9][f-r]*; + _ZTVSt[0-9][0-9][f-k]*; + _ZTVSt11logic_error; + _ZTVSt12length_error; + _ZTVSt[0-9][0-9][m-r]*; _ZTVSt[0-9][0-9][t-z]*; _ZTVSt[0-9][0-9]e[^r]*; _ZTVSt[0-9][0-9]s[^y]*; @@ -484,7 +508,10 @@ GLIBCXX_3.4 { # _ZTISt[0-9][0-9][A-Za-z]*; _ZTISt[0-9][0-9][A-Z]*; _ZTISt[0-9][0-9][a-d]*; - _ZTISt[0-9][0-9][f-r]*; + _ZTISt[0-9][0-9][f-k]*; + _ZTISt11logic_error; + _ZTISt12length_error; + _ZTISt[0-9][0-9][m-r]*; _ZTISt[0-9][0-9][t-z]*; _ZTISt[0-9][0-9]e[^r]*; _ZTISt[0-9][0-9]s[^y]*; @@ -508,7 +535,10 @@ GLIBCXX_3.4 { # _ZTSSt[0-9][0-9][A-Za-z]*; _ZTSSt[0-9][0-9][A-Z]*; _ZTSSt[0-9][0-9][a-d]*; - _ZTSSt[0-9][0-9][f-r]*; + _ZTSSt[0-9][0-9][f-k]*; + _ZTSSt11logic_error; + _ZTSSt12length_error; + _ZTSSt[0-9][0-9][m-r]*; _ZTSSt[0-9][0-9][t-z]*; _ZTSSt[0-9][0-9]e[^r]*; _ZTSSt[0-9][0-9]s[^y]*; @@ -785,13 +815,23 @@ GLIBCXX_3.4.10 { _ZNSt15basic_streambufI[cw]St11char_traitsI[cw]EE6stosscEv; - _ZN9__gnu_cxx18stdio_sync_filebufI[cw]St11char_traitsI[cw]EE4syncEv; _ZN9__gnu_cxx18stdio_sync_filebufI[cw]St11char_traitsI[cw]EE[5-9CD]*; } GLIBCXX_3.4.9; GLIBCXX_3.4.11 { + + # atomic + __atomic_flag_for_address; + __atomic_flag_wait_explicit; + atomic_flag_clear; + atomic_flag_clear_explicit; + atomic_flag_fence; + atomic_flag_test_and_set; + atomic_flag_test_and_set_explicit; + atomic_global_fence_compatibility; + # system_error _ZSt15system_category; diff --git a/libstdc++-v3/configure b/libstdc++-v3/configure index 78267040ae1..27fb6957ee4 100755 --- a/libstdc++-v3/configure +++ b/libstdc++-v3/configure @@ -17819,6 +17819,106 @@ _ACEOF fi + + echo "$as_me:$LINENO: checking for ISO C++200x standard layout type support" >&5 +echo $ECHO_N "checking for ISO C++200x standard layout type support... $ECHO_C" >&6 + if test "${ac_standard_layout+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + + + + ac_ext=cc +ac_cpp='$CXXCPP $CPPFLAGS' +ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_cxx_compiler_gnu + + ac_test_CXXFLAGS="${CXXFLAGS+set}" + ac_save_CXXFLAGS="$CXXFLAGS" + CXXFLAGS='-std=gnu++0x' + + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +struct b + { + bool t; + + // Need standard layout relaxation from POD + private: + b& operator=(const b&); + b(const b&); + }; + + int main() + { + b tst1 = { false }; + return 0; + } +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_cxx_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_standard_layout=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_standard_layout=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext + + CXXFLAGS="$ac_save_CXXFLAGS" + ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + +fi + + echo "$as_me:$LINENO: result: $ac_standard_layout" >&5 +echo "${ECHO_T}$ac_standard_layout" >&6 + if test x"$ac_standard_layout" = x"yes"; then + +cat >>confdefs.h <<\_ACEOF +#define _GLIBCXX_USE_STANDARD_LAYOUT 1 +_ACEOF + + fi + + # No surprises, no surprises... echo "$as_me:$LINENO: checking for thread model used by GCC" >&5 @@ -17860,7 +17960,7 @@ ac_compiler_gnu=$ac_cv_cxx_compiler_gnu # Fake what AC_TRY_COMPILE does. XXX Look at redoing this new-style. cat > conftest.$ac_ext << EOF -#line 17991 "configure" +#line 18091 "configure" int main() { // NB: _Atomic_word not necessarily int. diff --git a/libstdc++-v3/configure.ac b/libstdc++-v3/configure.ac index 1760aebdf0d..1930189ab5d 100644 --- a/libstdc++-v3/configure.ac +++ b/libstdc++-v3/configure.ac @@ -113,6 +113,7 @@ GLIBCXX_ENABLE_FULLY_DYNAMIC_STRING([no]) # Checks for operating systems support that don't require linking. GLIBCXX_CHECK_SYSTEM_ERROR +GLIBCXX_CHECK_STANDARD_LAYOUT # No surprises, no surprises... GLIBCXX_ENABLE_THREADS diff --git a/libstdc++-v3/doc/Makefile.in b/libstdc++-v3/doc/Makefile.in index b40e51059af..da58aa6abf0 100644 --- a/libstdc++-v3/doc/Makefile.in +++ b/libstdc++-v3/doc/Makefile.in @@ -49,6 +49,7 @@ am__aclocal_m4_deps = $(top_srcdir)/../config/enable.m4 \ $(top_srcdir)/../config/lib-prefix.m4 \ $(top_srcdir)/../config/multi.m4 \ $(top_srcdir)/../config/no-executables.m4 \ + $(top_srcdir)/../config/proginstall.m4 \ $(top_srcdir)/../config/unwind_ipinfo.m4 \ $(top_srcdir)/../libtool.m4 $(top_srcdir)/../ltoptions.m4 \ $(top_srcdir)/../ltsugar.m4 $(top_srcdir)/../ltversion.m4 \ diff --git a/libstdc++-v3/doc/html/api.html b/libstdc++-v3/doc/html/api.html index 6724b72ade2..0d07dc9aed1 100644 --- a/libstdc++-v3/doc/html/api.html +++ b/libstdc++-v3/doc/html/api.html @@ -5,7 +5,7 @@ <a class="ulink" href="http://www.fsf.org/" target="_top">FSF </a> - </p></div><div><div class="legalnotice"><a id="id478877"></a><p> + </p></div><div><div class="legalnotice"><a id="id364659"></a><p> <a class="ulink" href="17_intro/license.html" target="_top">License </a> </p></div></div></div><hr /></div><p> diff --git a/libstdc++-v3/doc/html/faq.html b/libstdc++-v3/doc/html/faq.html index b46c2b7ab5a..b4c548309fb 100644 --- a/libstdc++-v3/doc/html/faq.html +++ b/libstdc++-v3/doc/html/faq.html @@ -487,7 +487,7 @@ enough to detect when the minimal support to enable <span class="type">wchar_t</span> and C++ library structures like <code class="classname">wstring</code> were present. This impacted Solaris, - Darwin, and BSD varients, and is fixed in libstdc++ versions post 4.1.0. + Darwin, and BSD variants, and is fixed in libstdc++ versions post 4.1.0. </p><p> </p></td></tr><tr class="qandadiv"><td align="left" valign="top" colspan="2"><h3 class="title"><a id="faq.known_bugs"></a>5. Known Bugs</h3></td></tr><tr class="toc"><td align="left" valign="top" colspan="2"><dl><dt>5.1. <a href="faq.html#faq.what_works"> What works already? @@ -777,7 +777,7 @@ </p></td></tr><tr class="question"><td align="left" valign="top"><a id="faq.extensions_and_backwards_compat"></a><a id="q-extensions_and_backwards_compat"></a><p><b>7.4.</b></p></td><td align="left" valign="top"><p> Extensions and Backward Compatibility </p></td></tr><tr class="answer"><td align="left" valign="top"><a id="a-extensions_and_backwards_compat"></a></td><td align="left" valign="top"><p> - See the <a class="link" href="manual/backwards.html" title="Backwards Compatibility">link</a> on backwards compatiblity and <a class="link" href="manual/api.html" title="API Evolution and Deprecation History">link</a> on evolution. + See the <a class="link" href="manual/backwards.html" title="Backwards Compatibility">link</a> on backwards compatibility and <a class="link" href="manual/api.html" title="API Evolution and Deprecation History">link</a> on evolution. </p></td></tr><tr class="question"><td align="left" valign="top"><a id="faq.tr1_support"></a><a id="q-tr1_support"></a><p><b>7.5.</b></p></td><td align="left" valign="top"><p> Does libstdc++ support TR1? </p></td></tr><tr class="answer"><td align="left" valign="top"><a id="a-tr1_support"></a></td><td align="left" valign="top"><p> diff --git a/libstdc++-v3/doc/html/manual/abi.html b/libstdc++-v3/doc/html/manual/abi.html index d86bb47918b..1be31b3f575 100644 --- a/libstdc++-v3/doc/html/manual/abi.html +++ b/libstdc++-v3/doc/html/manual/abi.html @@ -54,7 +54,7 @@ given compiler ABI. In a nutshell: created with the same constraints. </p><p> To use a specific version of the C++ ABI, one must use a - corresponding GNU C++ toolchain (Ie, g++ and libstdc++) that + corresponding GNU C++ toolchain (i.e., g++ and libstdc++) that implements the C++ ABI in question. </p></div><div class="sect2" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 class="title"><a id="abi.versioning"></a>Versioning</h3></div></div></div><p> The C++ interface has evolved throughout the history of the GNU C++ toolchain. With each release, various details have been changed so @@ -84,7 +84,7 @@ release of the series to remain link compatible. others, this is libgcc_s.so.1. </p></li></ul></div></li><li><p>Symbol versioning on the libgcc_s.so binary.</p><p>It is versioned with the following labels and version definitions, where the version definition is the maximum for a particular release. Labels are cumulative. If a particular release - is not listed, it has the same version labels as the preceeding + is not listed, it has the same version labels as the preceding release.</p><p>This corresponds to the mapfile: gcc/libgcc-std.ver</p><div class="itemizedlist"><ul type="disc"><li><p>gcc-3.0.0: GCC_3.0</p></li><li><p>gcc-3.3.0: GCC_3.3</p></li><li><p>gcc-3.3.1: GCC_3.3.1</p></li><li><p>gcc-3.3.2: GCC_3.3.2</p></li><li><p>gcc-3.3.4: GCC_3.3.4</p></li><li><p>gcc-3.4.0: GCC_3.4</p></li><li><p>gcc-3.4.2: GCC_3.4.2</p></li><li><p>gcc-3.4.4: GCC_3.4.4</p></li><li><p>gcc-4.0.0: GCC_4.0.0</p></li><li><p>gcc-4.1.0: GCC_4.1.0</p></li><li><p>gcc-4.2.0: GCC_4.2.0</p></li></ul></div></li><li><p>Release versioning on the libstdc++.so binary, implemented in the same was as the libgcc_s.so binary, above.</p><p>It is versioned as follows: </p><div class="itemizedlist"><ul type="disc"><li><p>gcc-3.0.0: libstdc++.so.3.0.0</p></li><li><p>gcc-3.0.1: libstdc++.so.3.0.1</p></li><li><p>gcc-3.0.2: libstdc++.so.3.0.2</p></li><li><p>gcc-3.0.3: libstdc++.so.3.0.2 (Error should be libstdc++.so.3.0.3)</p></li><li><p>gcc-3.0.4: libstdc++.so.3.0.4</p></li><li><p>gcc-3.1.0: libstdc++.so.4.0.0</p></li><li><p>gcc-3.1.1: libstdc++.so.4.0.1</p></li><li><p>gcc-3.2.0: libstdc++.so.5.0.0</p></li><li><p>gcc-3.2.1: libstdc++.so.5.0.1</p></li><li><p>gcc-3.2.2: libstdc++.so.5.0.2</p></li><li><p>gcc-3.2.3: libstdc++.so.5.0.3 (Not strictly required)</p></li><li><p>gcc-3.3.0: libstdc++.so.5.0.4</p></li><li><p>gcc-3.3.1: libstdc++.so.5.0.5</p></li><li><p>gcc-3.3.2: libstdc++.so.5.0.5</p></li><li><p>gcc-3.3.3: libstdc++.so.5.0.5</p></li><li><p>gcc-3.4.0: libstdc++.so.6.0.0</p></li><li><p>gcc-3.4.1: libstdc++.so.6.0.1</p></li><li><p>gcc-3.4.2: libstdc++.so.6.0.2</p></li><li><p>gcc-3.4.3: libstdc++.so.6.0.3</p></li><li><p>gcc-3.4.4: libstdc++.so.6.0.3</p></li><li><p>gcc-3.4.5: libstdc++.so.6.0.3</p></li><li><p>gcc-3.4.6: libstdc++.so.6.0.3</p></li><li><p>gcc-4.0.0: libstdc++.so.6.0.4</p></li><li><p>gcc-4.0.1: libstdc++.so.6.0.5</p></li><li><p>gcc-4.0.2: libstdc++.so.6.0.6</p></li><li><p>gcc-4.0.3: libstdc++.so.6.0.7</p></li><li><p>gcc-4.1.0: libstdc++.so.6.0.7</p></li><li><p>gcc-4.1.1: libstdc++.so.6.0.8</p></li><li><p>gcc-4.1.2: libstdc++.so.6.0.8</p></li><li><p>gcc-4.2.0: libstdc++.so.6.0.9</p></li></ul></div></li><li><p>Symbol versioning on the libstdc++.so binary.</p><p>mapfile: libstdc++/config/linker-map.gnu</p><p>It is versioned with the following labels and version definitions, where the version definition is the maximum for a @@ -95,7 +95,7 @@ release of the series to remain link compatible. gcc-3.2.1 release, which has GLIBCPP_3.2.1 for new symbols and GLIBCPP_3.2 for symbols that were introduced in the gcc-3.2.0 release.) If a particular release is not listed, it has the same - version labels as the preceeding release. + version labels as the preceding release. </p><div class="itemizedlist"><ul type="disc"><li><p>gcc-3.0.0: (Error, not versioned)</p></li><li><p>gcc-3.0.1: (Error, not versioned)</p></li><li><p>gcc-3.0.2: (Error, not versioned)</p></li><li><p>gcc-3.0.3: (Error, not versioned)</p></li><li><p>gcc-3.0.4: (Error, not versioned)</p></li><li><p>gcc-3.1.0: GLIBCPP_3.1, CXXABI_1</p></li><li><p>gcc-3.1.1: GLIBCPP_3.1, CXXABI_1</p></li><li><p>gcc-3.2.0: GLIBCPP_3.2, CXXABI_1.2</p></li><li><p>gcc-3.2.1: GLIBCPP_3.2.1, CXXABI_1.2</p></li><li><p>gcc-3.2.2: GLIBCPP_3.2.2, CXXABI_1.2</p></li><li><p>gcc-3.2.3: GLIBCPP_3.2.2, CXXABI_1.2</p></li><li><p>gcc-3.3.0: GLIBCPP_3.2.2, CXXABI_1.2.1</p></li><li><p>gcc-3.3.1: GLIBCPP_3.2.3, CXXABI_1.2.1</p></li><li><p>gcc-3.3.2: GLIBCPP_3.2.3, CXXABI_1.2.1</p></li><li><p>gcc-3.3.3: GLIBCPP_3.2.3, CXXABI_1.2.1</p></li><li><p>gcc-3.4.0: GLIBCXX_3.4, CXXABI_1.3</p></li><li><p>gcc-3.4.1: GLIBCXX_3.4.1, CXXABI_1.3</p></li><li><p>gcc-3.4.2: GLIBCXX_3.4.2</p></li><li><p>gcc-3.4.3: GLIBCXX_3.4.3</p></li><li><p>gcc-4.0.0: GLIBCXX_3.4.4, CXXABI_1.3.1</p></li><li><p>gcc-4.0.1: GLIBCXX_3.4.5</p></li><li><p>gcc-4.0.2: GLIBCXX_3.4.6</p></li><li><p>gcc-4.0.3: GLIBCXX_3.4.7</p></li><li><p>gcc-4.1.1: GLIBCXX_3.4.8</p></li><li><p>gcc-4.2.0: GLIBCXX_3.4.9</p></li></ul></div></li><li><p>Incremental bumping of a compiler pre-defined macro, __GXX_ABI_VERSION. This macro is defined as the version of the compiler v3 ABI, with g++ 3.0.x being version 100. This macro will @@ -287,7 +287,7 @@ class in registers, the compiler will be forced to use memory. See <a class="uli addition, they have the possibility of changing without impacting ABI compatibility. </p><p>The following namespaces are transformed by the mapfile:</p><div class="variablelist"><dl><dt><span class="term"><code class="code">namespace std</code></span></dt><dd><p> Defaults to exporting all symbols in label -<code class="code">GLIBCXX</code> that do not begin with an underscore, ie +<code class="code">GLIBCXX</code> that do not begin with an underscore, i.e., <code class="code">__test_func</code> would not be exported by default. Select exceptional symbols are allowed to be visible.</p></dd><dt><span class="term"><code class="code">namespace __gnu_cxx</code></span></dt><dd><p> Defaults to not exporting any symbols in label <code class="code">GLIBCXX</code>, select items are allowed to be visible.</p></dd><dt><span class="term"><code class="code">namespace __gnu_internal</code></span></dt><dd><p> Defaults to not exported, no items are allowed to be visible.</p></dd><dt><span class="term"><code class="code">namespace __cxxabiv1</code>, aliased to <code class="code"> namespace abi</code></span></dt><dd><p> Defaults to not exporting any symbols in label @@ -428,7 +428,7 @@ gcc test.c -g -O2 -L. -lone -ltwo /usr/lib/libstdc++.so.5 /usr/lib/libstdc++.so. difficult. In particular, compiler generated constructs such as implicit instantiations for templates, typeinfo information, and virtual tables all may cause ABI leakage across shared library - boundaries. Because of this, mixing C++ ABI's is not recommended at + boundaries. Because of this, mixing C++ ABIs is not recommended at this time. </p><p> For more background on this issue, see these bugzilla entries: @@ -436,54 +436,54 @@ gcc test.c -g -O2 -L. -lone -ltwo /usr/lib/libstdc++.so.5 /usr/lib/libstdc++.so. <a class="ulink" href="http://gcc.gnu.org/PR24660" target="_top">24660: versioning weak symbols in libstdc++</a> </p><p> <a class="ulink" href="http://gcc.gnu.org/PR19664" target="_top">19664: libstdc++ headers should have pop/push of the visibility around the declarations</a> -</p></div><div class="bibliography"><div class="titlepage"><div><div><h3 class="title"><a id="abi.biblio"></a>Bibliography</h3></div></div></div><div class="biblioentry"><a id="id510592"></a><p><span class="title"><i> +</p></div><div class="bibliography"><div class="titlepage"><div><div><h3 class="title"><a id="abi.biblio"></a>Bibliography</h3></div></div></div><div class="biblioentry"><a id="id429530"></a><p><span class="title"><i> ABIcheck, a vague idea of checking ABI compatibility </i>. </span><span class="biblioid"> <a class="ulink" href="http://abicheck.sourceforge.net/" target="_top"> </a> - . </span></p></div><div class="biblioentry"><a id="id510609"></a><p><span class="title"><i> + . </span></p></div><div class="biblioentry"><a id="id429548"></a><p><span class="title"><i> C++ ABI Reference </i>. </span><span class="biblioid"> <a class="ulink" href="http://www.codesourcery.com/cxx-abi" target="_top"> </a> - . </span></p></div><div class="biblioentry"><a id="id510627"></a><p><span class="title"><i> + . </span></p></div><div class="biblioentry"><a id="id429565"></a><p><span class="title"><i> Intel® Compilers for Linux* -Compatibility with the GNU Compilers </i>. </span><span class="biblioid"> <a class="ulink" href="http://developer.intel.com/software/products/compilers/techtopics/LinuxCompilersCompatibility.htm" target="_top"> </a> - . </span></p></div><div class="biblioentry"><a id="id510644"></a><p><span class="title"><i> + . </span></p></div><div class="biblioentry"><a id="id429583"></a><p><span class="title"><i> Intel® Compilers for Linux* -Compatibility with the GNU Compilers </i>. </span><span class="biblioid"> <a class="ulink" href="http://developer.intel.com/software/products/compilers/techtopics/LinuxCompilersCompatibility.htm" target="_top"> </a> - . </span></p></div><div class="biblioentry"><a id="id510662"></a><p><span class="title"><i> + . </span></p></div><div class="biblioentry"><a id="id429600"></a><p><span class="title"><i> Sun Solaris 2.9 : Linker and Libraries Guide (document 816-1386) </i>. </span><span class="biblioid"> <a class="ulink" href="http://docs.sun.com/?p=/doc/816-1386&a=load" target="_top"> </a> - . </span></p></div><div class="biblioentry"><a id="id510679"></a><p><span class="title"><i> + . </span></p></div><div class="biblioentry"><a id="id429617"></a><p><span class="title"><i> Sun Solaris 2.9 : C++ Migration Guide (document 816-2459) </i>. </span><span class="biblioid"> <a class="ulink" href="http://docs.sun.com/db/prod/solaris.9" target="_top"> </a> - . </span></p></div><div class="biblioentry"><a id="id510696"></a><p><span class="title"><i> + . </span></p></div><div class="biblioentry"><a id="id429635"></a><p><span class="title"><i> ELF Symbol Versioning </i>. </span><span class="author"><span class="firstname">Ulrich</span> <span class="surname">Drepper</span>. </span><span class="biblioid"> <a class="ulink" href="http://people.redhat.com/drepper/symbol-versioning" target="_top"> </a> - . </span></p></div><div class="biblioentry"><a id="id510725"></a><p><span class="title"><i> + . </span></p></div><div class="biblioentry"><a id="id429663"></a><p><span class="title"><i> C++ ABI for the ARM Architecture </i>. </span><span class="biblioid"> <a class="ulink" href="http://www.arm.com/miscPDFs/8033.pdf" target="_top"> </a> - . </span></p></div><div class="biblioentry"><a id="id510742"></a><p><span class="title"><i> + . </span></p></div><div class="biblioentry"><a id="id429680"></a><p><span class="title"><i> Dynamic Shared Objects: Survey and Issues </i>. </span><span class="subtitle"> ISO C++ J16/06-0046 . </span><span class="author"><span class="firstname">Benjamin</span> <span class="surname">Kosnik</span>. </span><span class="biblioid"> <a class="ulink" href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2006/n1976.html" target="_top"> </a> - . </span></p></div><div class="biblioentry"><a id="id499374"></a><p><span class="title"><i> + . </span></p></div><div class="biblioentry"><a id="id497460"></a><p><span class="title"><i> Versioning With Namespaces </i>. </span><span class="subtitle"> ISO C++ J16/06-0083 diff --git a/libstdc++-v3/doc/html/manual/api.html b/libstdc++-v3/doc/html/manual/api.html index 6da7e73c058..c8c6d0e220c 100644 --- a/libstdc++-v3/doc/html/manual/api.html +++ b/libstdc++-v3/doc/html/manual/api.html @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="UTF-8" standalone="no"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>API Evolution and Deprecation History</title><meta name="generator" content="DocBook XSL Stylesheets V1.73.2" /><meta name="keywords" content="ISO C++, api, evolution, deprecation, history" /><meta name="keywords" content=" ISO C++ , library " /><link rel="start" href="../spine.html" title="The GNU C++ Library Documentation" /><link rel="up" href="appendix_porting.html" title="Appendix B. Porting and Maintenance" /><link rel="prev" href="abi.html" title="ABI Policy and Guidelines" /><link rel="next" href="backwards.html" title="Backwards Compatibility" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">API Evolution and Deprecation History</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="abi.html">Prev</a> </td><th width="60%" align="center">Appendix B. Porting and Maintenance</th><td width="20%" align="right"> <a accesskey="n" href="backwards.html">Next</a></td></tr></table><hr /></div><div class="sect1" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="appendix.porting.api"></a>API Evolution and Deprecation History</h2></div></div></div><p> -A list of user-visible changes, in cronological order +A list of user-visible changes, in chronological order </p><div class="sect2" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 class="title"><a id="api.rel_300"></a><code class="constant">3.0</code></h3></div></div></div><p> Extensions moved to <code class="filename">include/ext</code>. </p><p> @@ -52,7 +52,7 @@ _Alloc_traits</code> have been removed. </p><p>Default behavior of <code class="code">std::allocator</code> has changed.</p><p> Previous versions prior to 3.4 cache allocations in a memory pool, instead of passing through to call the global allocation - operators (ie, <code class="classname">__gnu_cxx::pool_allocator</code>). More + operators (i.e., <code class="classname">__gnu_cxx::pool_allocator</code>). More recent versions default to the simpler <code class="classname">__gnu_cxx::new_allocator</code>. </p><p> Previously, all allocators were written to the SGI @@ -72,11 +72,11 @@ _Alloc_traits</code> have been removed. <span class="type">__alloc</span> to select an underlying allocator that satisfied memory allocation requests. The selection of this underlying allocator was not user-configurable. - </p><div class="table"><a id="id456920"></a><p class="title"><b>Table B.1. Extension Allocators</b></p><div class="table-contents"><table summary="Extension Allocators" border="1"><colgroup><col align="left" /><col align="left" /><col align="left" /><col align="left" /></colgroup><thead><tr><th align="left">Allocator (3.4)</th><th align="left">Header (3.4)</th><th align="left">Allocator (3.[0-3])</th><th align="left">Header (3.[0-3])</th></tr></thead><tbody><tr><td align="left"><code class="classname">__gnu_cxx::new_allocator<T></code></td><td align="left"><code class="filename">ext/new_allocator.h</code></td><td align="left"><code class="classname">std::__new_alloc</code></td><td align="left"><code class="filename">memory</code></td></tr><tr><td align="left"><code class="classname">__gnu_cxx::malloc_allocator<T></code></td><td align="left"><code class="filename">ext/malloc_allocator.h</code></td><td align="left"><code class="classname">std::__malloc_alloc_template<int></code></td><td align="left"><code class="filename">memory</code></td></tr><tr><td align="left"><code class="classname">__gnu_cxx::debug_allocator<T></code></td><td align="left"><code class="filename">ext/debug_allocator.h</code></td><td align="left"><code class="classname">std::debug_alloc<T></code></td><td align="left"><code class="filename">memory</code></td></tr><tr><td align="left"><code class="classname">__gnu_cxx::__pool_alloc<T></code></td><td align="left"><code class="filename">ext/pool_allocator.h</code></td><td align="left"><code class="classname">std::__default_alloc_template<bool,int></code></td><td align="left"><code class="filename">memory</code></td></tr><tr><td align="left"><code class="classname">__gnu_cxx::__mt_alloc<T></code></td><td align="left"><code class="filename">ext/mt_allocator.h</code></td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left"><code class="classname">__gnu_cxx::bitmap_allocator<T></code></td><td align="left"><code class="filename">ext/bitmap_allocator.h</code></td><td align="left"> </td><td align="left"> </td></tr></tbody></table></div></div><br class="table-break" /><p> Releases after gcc-3.4 have continued to add to the collection + </p><div class="table"><a id="id521812"></a><p class="title"><b>Table B.1. Extension Allocators</b></p><div class="table-contents"><table summary="Extension Allocators" border="1"><colgroup><col align="left" /><col align="left" /><col align="left" /><col align="left" /></colgroup><thead><tr><th align="left">Allocator (3.4)</th><th align="left">Header (3.4)</th><th align="left">Allocator (3.[0-3])</th><th align="left">Header (3.[0-3])</th></tr></thead><tbody><tr><td align="left"><code class="classname">__gnu_cxx::new_allocator<T></code></td><td align="left"><code class="filename">ext/new_allocator.h</code></td><td align="left"><code class="classname">std::__new_alloc</code></td><td align="left"><code class="filename">memory</code></td></tr><tr><td align="left"><code class="classname">__gnu_cxx::malloc_allocator<T></code></td><td align="left"><code class="filename">ext/malloc_allocator.h</code></td><td align="left"><code class="classname">std::__malloc_alloc_template<int></code></td><td align="left"><code class="filename">memory</code></td></tr><tr><td align="left"><code class="classname">__gnu_cxx::debug_allocator<T></code></td><td align="left"><code class="filename">ext/debug_allocator.h</code></td><td align="left"><code class="classname">std::debug_alloc<T></code></td><td align="left"><code class="filename">memory</code></td></tr><tr><td align="left"><code class="classname">__gnu_cxx::__pool_alloc<T></code></td><td align="left"><code class="filename">ext/pool_allocator.h</code></td><td align="left"><code class="classname">std::__default_alloc_template<bool,int></code></td><td align="left"><code class="filename">memory</code></td></tr><tr><td align="left"><code class="classname">__gnu_cxx::__mt_alloc<T></code></td><td align="left"><code class="filename">ext/mt_allocator.h</code></td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left"><code class="classname">__gnu_cxx::bitmap_allocator<T></code></td><td align="left"><code class="filename">ext/bitmap_allocator.h</code></td><td align="left"> </td><td align="left"> </td></tr></tbody></table></div></div><br class="table-break" /><p> Releases after gcc-3.4 have continued to add to the collection of available allocators. All of these new allocators are standard-style. The following table includes details, along with the first released version of GCC that included the extension allocator. - </p><div class="table"><a id="id408028"></a><p class="title"><b>Table B.2. Extension Allocators Continued</b></p><div class="table-contents"><table summary="Extension Allocators Continued" border="1"><colgroup><col align="left" /><col align="left" /><col align="left" /></colgroup><thead><tr><th align="left">Allocator</th><th align="left">Include</th><th align="left">Version</th></tr></thead><tbody><tr><td align="left"><code class="classname">__gnu_cxx::array_allocator<T></code></td><td align="left"><code class="filename">ext/array_allocator.h</code></td><td align="left">4.0.0</td></tr><tr><td align="left"><code class="classname">__gnu_cxx::throw_allocator<T></code></td><td align="left"><code class="filename">ext/throw_allocator.h</code></td><td align="left">4.2.0</td></tr></tbody></table></div></div><br class="table-break" /><p> + </p><div class="table"><a id="id422487"></a><p class="title"><b>Table B.2. Extension Allocators Continued</b></p><div class="table-contents"><table summary="Extension Allocators Continued" border="1"><colgroup><col align="left" /><col align="left" /><col align="left" /></colgroup><thead><tr><th align="left">Allocator</th><th align="left">Include</th><th align="left">Version</th></tr></thead><tbody><tr><td align="left"><code class="classname">__gnu_cxx::array_allocator<T></code></td><td align="left"><code class="filename">ext/array_allocator.h</code></td><td align="left">4.0.0</td></tr><tr><td align="left"><code class="classname">__gnu_cxx::throw_allocator<T></code></td><td align="left"><code class="filename">ext/throw_allocator.h</code></td><td align="left">4.2.0</td></tr></tbody></table></div></div><br class="table-break" /><p> Debug mode first appears. </p><p> Precompiled header support <acronym class="acronym">PCH</acronym> support. diff --git a/libstdc++-v3/doc/html/manual/appendix_contributing.html b/libstdc++-v3/doc/html/manual/appendix_contributing.html index 007c7fe52a6..08032d04056 100644 --- a/libstdc++-v3/doc/html/manual/appendix_contributing.html +++ b/libstdc++-v3/doc/html/manual/appendix_contributing.html @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8" standalone="no"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> -<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Appendix A. Contributing</title><meta name="generator" content="DocBook XSL Stylesheets V1.73.2" /><meta name="keywords" content=" ISO C++ , library " /><link rel="start" href="../spine.html" title="The GNU C++ Library Documentation" /><link rel="up" href="spine.html" title="The GNU C++ Library" /><link rel="prev" href="bk01pt12ch40s03.html" title="Use" /><link rel="next" href="bk01apas02.html" title="Directory Layout and Source Conventions" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Appendix A. Contributing</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="bk01pt12ch40s03.html">Prev</a> </td><th width="60%" align="center">The GNU C++ Library</th><td width="20%" align="right"> <a accesskey="n" href="bk01apas02.html">Next</a></td></tr></table><hr /></div><div class="appendix" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title"><a id="appendix.contrib"></a>Appendix A. Contributing</h2></div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="sect1"><a href="appendix_contributing.html#contrib.list">Contributor Checklist</a></span></dt><dd><dl><dt><span class="sect2"><a href="appendix_contributing.html#list.reading">Reading</a></span></dt><dt><span class="sect2"><a href="appendix_contributing.html#list.copyright">Assignment</a></span></dt><dt><span class="sect2"><a href="appendix_contributing.html#list.getting">Getting Sources</a></span></dt><dt><span class="sect2"><a href="appendix_contributing.html#list.patches">Submitting Patches</a></span></dt></dl></dd><dt><span class="sect1"><a href="bk01apas02.html">Directory Layout and Source Conventions</a></span></dt><dt><span class="sect1"><a href="bk01apas03.html">Coding Style</a></span></dt><dd><dl><dt><span class="sect2"><a href="bk01apas03.html#coding_style.bad_identifiers">Bad Itentifiers</a></span></dt><dt><span class="sect2"><a href="bk01apas03.html#coding_style.example">By Example</a></span></dt></dl></dd><dt><span class="sect1"><a href="bk01apas04.html">Documentation Style</a></span></dt><dd><dl><dt><span class="sect2"><a href="bk01apas04.html#doc_style.doxygen">Doxygen</a></span></dt><dt><span class="sect2"><a href="bk01apas04.html#doc_style.docbook">Docbook</a></span></dt></dl></dd><dt><span class="sect1"><a href="bk01apas05.html">Design Notes</a></span></dt></dl></div><p> +<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Appendix A. Contributing</title><meta name="generator" content="DocBook XSL Stylesheets V1.73.2" /><meta name="keywords" content=" ISO C++ , library " /><link rel="start" href="../spine.html" title="The GNU C++ Library Documentation" /><link rel="up" href="spine.html" title="The GNU C++ Library" /><link rel="prev" href="bk01pt12ch40s03.html" title="Use" /><link rel="next" href="bk01apas02.html" title="Directory Layout and Source Conventions" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Appendix A. Contributing</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="bk01pt12ch40s03.html">Prev</a> </td><th width="60%" align="center">The GNU C++ Library</th><td width="20%" align="right"> <a accesskey="n" href="bk01apas02.html">Next</a></td></tr></table><hr /></div><div class="appendix" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title"><a id="appendix.contrib"></a>Appendix A. Contributing</h2></div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="sect1"><a href="appendix_contributing.html#contrib.list">Contributor Checklist</a></span></dt><dd><dl><dt><span class="sect2"><a href="appendix_contributing.html#list.reading">Reading</a></span></dt><dt><span class="sect2"><a href="appendix_contributing.html#list.copyright">Assignment</a></span></dt><dt><span class="sect2"><a href="appendix_contributing.html#list.getting">Getting Sources</a></span></dt><dt><span class="sect2"><a href="appendix_contributing.html#list.patches">Submitting Patches</a></span></dt></dl></dd><dt><span class="sect1"><a href="bk01apas02.html">Directory Layout and Source Conventions</a></span></dt><dt><span class="sect1"><a href="bk01apas03.html">Coding Style</a></span></dt><dd><dl><dt><span class="sect2"><a href="bk01apas03.html#coding_style.bad_identifiers">Bad Identifiers</a></span></dt><dt><span class="sect2"><a href="bk01apas03.html#coding_style.example">By Example</a></span></dt></dl></dd><dt><span class="sect1"><a href="bk01apas04.html">Documentation Style</a></span></dt><dd><dl><dt><span class="sect2"><a href="bk01apas04.html#doc_style.doxygen">Doxygen</a></span></dt><dt><span class="sect2"><a href="bk01apas04.html#doc_style.docbook">Docbook</a></span></dt></dl></dd><dt><span class="sect1"><a href="bk01apas05.html">Design Notes</a></span></dt></dl></div><p> The GNU C++ Library follows an open development model. Active contributors are assigned maintainer-ship responsibility, and given write access to the source repository. First time contributors diff --git a/libstdc++-v3/doc/html/manual/appendix_porting.html b/libstdc++-v3/doc/html/manual/appendix_porting.html index 001943516a3..9cd2ebf224e 100644 --- a/libstdc++-v3/doc/html/manual/appendix_porting.html +++ b/libstdc++-v3/doc/html/manual/appendix_porting.html @@ -47,7 +47,7 @@ discourage that. </p></div><div class="sect2" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 class="title"><a id="build_hacking.conventions"></a>Coding and Commenting Conventions</h3></div></div></div><p> Most comments should use {octothorpes, shibboleths, hash marks, - pound signs, whatevers} rather than "dnl". Nearly all comments in + pound signs, whatever} rather than "dnl". Nearly all comments in configure.ac should. Comments inside macros written in ancilliary .m4 files should. About the only comments which should <span class="emphasis"><em>not</em></span> use #, but use dnl instead, are comments diff --git a/libstdc++-v3/doc/html/manual/backwards.html b/libstdc++-v3/doc/html/manual/backwards.html index 3bdf1937aad..6475a7e8a25 100644 --- a/libstdc++-v3/doc/html/manual/backwards.html +++ b/libstdc++-v3/doc/html/manual/backwards.html @@ -14,8 +14,8 @@ ISO Standard (e.g., statistical analysis). While there are a lot of really useful things that are used by a lot of people, the Standards Committee couldn't include everything, and so a lot of those “<span class="quote">obvious</span>” classes didn't get included. -</p><p>Known Issues include many of the limitations of its immediate ancestor.</p><p>Portability notes and known implementation limitations are as follows.</p><div class="sect3" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="id390292"></a>No <code class="code">ios_base</code></h4></div></div></div><p> At least some older implementations don't have <code class="code">std::ios_base</code>, so you should use <code class="code">std::ios::badbit</code>, <code class="code">std::ios::failbit</code> and <code class="code">std::ios::eofbit</code> and <code class="code">std::ios::goodbit</code>. -</p></div><div class="sect3" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="id390324"></a>No <code class="code">cout</code> in <code class="code">ostream.h</code>, no <code class="code">cin</code> in <code class="code">istream.h</code></h4></div></div></div><p> +</p><p>Known Issues include many of the limitations of its immediate ancestor.</p><p>Portability notes and known implementation limitations are as follows.</p><div class="sect3" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="id493961"></a>No <code class="code">ios_base</code></h4></div></div></div><p> At least some older implementations don't have <code class="code">std::ios_base</code>, so you should use <code class="code">std::ios::badbit</code>, <code class="code">std::ios::failbit</code> and <code class="code">std::ios::eofbit</code> and <code class="code">std::ios::goodbit</code>. +</p></div><div class="sect3" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="id493993"></a>No <code class="code">cout</code> in <code class="code">ostream.h</code>, no <code class="code">cin</code> in <code class="code">istream.h</code></h4></div></div></div><p> In earlier versions of the standard, <code class="filename">fstream.h</code>, <code class="filename">ostream.h</code> @@ -41,7 +41,7 @@ considered replaced and rewritten. archived. The code is considered replaced and rewritten. </p><p> Portability notes and known implementation limitations are as follows. -</p><div class="sect3" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="id390424"></a>Namespace <code class="code">std::</code> not supported</h4></div></div></div><p> +</p><div class="sect3" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="id494094"></a>Namespace <code class="code">std::</code> not supported</h4></div></div></div><p> Some care is required to support C++ compiler and or library implementation that do not have the standard library in <code class="code">namespace std</code>. @@ -77,7 +77,7 @@ considered replaced and rewritten. then using that to set a value for the <code class="code">NAMESPACE_STD</code> macro. At that point, one is able to use <code class="code">NAMESPACE_STD::string</code>, which will evaluate to - <code class="code">std::string</code> or <code class="code">::string</code> (ie, in the + <code class="code">std::string</code> or <code class="code">::string</code> (i.e., in the global namespace on systems that do not put <code class="code">string</code> in <code class="code">std::</code>). </p><pre class="programlisting"> @@ -105,7 +105,7 @@ AC_DEFUN([AC_CXX_NAMESPACE_STD], [ AC_DEFINE(HAVE_NAMESPACE_STD,,[Define if g++ supports namespace std. ]) fi ]) -</pre></div><div class="sect3" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="id393816"></a>Illegal iterator usage</h4></div></div></div><p> +</pre></div><div class="sect3" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="id509052"></a>Illegal iterator usage</h4></div></div></div><p> The following illustrate implementation-allowed illegal iterator use, and then correct use. </p><div class="itemizedlist"><ul type="disc"><li><p> @@ -118,7 +118,7 @@ AC_DEFUN([AC_CXX_NAMESPACE_STD], [ </p></li><li><p> <code class="code">if (iterator)</code> won't work any more => use <code class="code">if (iterator != iterator_type())</code> - </p></li></ul></div></div><div class="sect3" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="id393877"></a><code class="code">isspace</code> from <code class="filename">cctype</code> is a macro + </p></li></ul></div></div><div class="sect3" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="id509113"></a><code class="code">isspace</code> from <code class="filename">cctype</code> is a macro </h4></div></div></div><p> Glibc 2.0.x and 2.1.x define <code class="filename">ctype.h</code> functionality as macros (isspace, isalpha etc.). @@ -151,7 +151,7 @@ std:: (__ctype_b[(int) ( ( 'X' ) )] & (unsigned short int) _ISspace ) ; (<code class="filename">ctype.h</code>) and the definitions in namespace <code class="code">std::</code> (<code class="code"><cctype></code>). -</p></div><div class="sect3" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="id450846"></a>No <code class="code">vector::at</code>, <code class="code">deque::at</code>, <code class="code">string::at</code></h4></div></div></div><p> +</p></div><div class="sect3" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="id509207"></a>No <code class="code">vector::at</code>, <code class="code">deque::at</code>, <code class="code">string::at</code></h4></div></div></div><p> One solution is to add an autoconf-test for this: </p><pre class="programlisting"> AC_MSG_CHECKING(for container::at) @@ -177,7 +177,7 @@ AC_DEFINE(HAVE_CONTAINER_AT)], </pre><p> If you are using other (non-GNU) compilers it might be a good idea to check for <code class="code">string::at</code> separately. -</p></div><div class="sect3" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="id450884"></a>No <code class="code">std::char_traits<char>::eof</code></h4></div></div></div><p> +</p></div><div class="sect3" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="id509245"></a>No <code class="code">std::char_traits<char>::eof</code></h4></div></div></div><p> Use some kind of autoconf test, plus this: </p><pre class="programlisting"> #ifdef HAVE_CHAR_TRAITS @@ -185,7 +185,7 @@ AC_DEFINE(HAVE_CONTAINER_AT)], #else #define CPP_EOF EOF #endif -</pre></div><div class="sect3" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="id450902"></a>No <code class="code">string::clear</code></h4></div></div></div><p> +</pre></div><div class="sect3" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="id509263"></a>No <code class="code">string::clear</code></h4></div></div></div><p> There are two functions for deleting the contents of a string: <code class="code">clear</code> and <code class="code">erase</code> (the latter returns the string). @@ -200,15 +200,15 @@ erase(size_type __pos = 0, size_type __n = npos) _M_data(), _M_data()); } </pre><p> - Unfortunately, ut <code class="code">clear</code> is not implemented in this + Unfortunately, <code class="code">clear</code> is not implemented in this version, so you should use <code class="code">erase</code> (which is probably faster than <code class="code">operator=(charT*)</code>). -</p></div><div class="sect3" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="id450947"></a> +</p></div><div class="sect3" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="id509309"></a> Removal of <code class="code">ostream::form</code> and <code class="code">istream::scan</code> extensions </h4></div></div></div><p> These are no longer supported. Please use stringstreams instead. -</p></div><div class="sect3" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="id450966"></a>No <code class="code">basic_stringbuf</code>, <code class="code">basic_stringstream</code></h4></div></div></div><p> +</p></div><div class="sect3" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="id509328"></a>No <code class="code">basic_stringbuf</code>, <code class="code">basic_stringstream</code></h4></div></div></div><p> Although the ISO standard <code class="code">i/ostringstream</code>-classes are provided, (<code class="filename">sstream</code>), for compatibility with older implementations the pre-ISO @@ -296,14 +296,14 @@ any = temp; Another example of using stringstreams is in <a class="link" href="bk01pt05ch13s05.html" title="Shrink to Fit">this howto</a>. </p><p> There is additional information in the libstdc++-v2 info files, in particular “<span class="quote">info iostream</span>”. -</p></div><div class="sect3" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="id451118"></a>Little or no wide character support</h4></div></div></div><p> +</p></div><div class="sect3" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="id466068"></a>Little or no wide character support</h4></div></div></div><p> Classes <code class="classname">wstring</code> and <code class="classname">char_traits<wchar_t></code> are not supported. - </p></div><div class="sect3" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="id451137"></a>No templatized iostreams</h4></div></div></div><p> + </p></div><div class="sect3" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="id466087"></a>No templatized iostreams</h4></div></div></div><p> Classes <code class="classname">wfilebuf</code> and <code class="classname">wstringstream</code> are not supported. - </p></div><div class="sect3" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="id451156"></a>Thread safety issues</h4></div></div></div><p> + </p></div><div class="sect3" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="id466106"></a>Thread safety issues</h4></div></div></div><p> Earlier GCC releases had a somewhat different approach to threading configuration and proper compilation. Before GCC 3.0, configuration of the threading model was dictated by compiler @@ -361,7 +361,7 @@ libstdc++-v3. of the SGI STL (version 3.3), with extensive changes. </p><p>A more formal description of the V3 goals can be found in the official <a class="ulink" href="../17_intro/DESIGN" target="_top">design document</a>. - </p><p>Portability notes and known implementation limitations are as follows.</p><div class="sect3" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="id516132"></a>Pre-ISO headers moved to backwards or removed</h4></div></div></div><p> The pre-ISO C++ headers + </p><p>Portability notes and known implementation limitations are as follows.</p><div class="sect3" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="id466225"></a>Pre-ISO headers moved to backwards or removed</h4></div></div></div><p> The pre-ISO C++ headers (<code class="code">iostream.h</code>, <code class="code">defalloc.h</code> etc.) are available, unlike previous libstdc++ versions, but inclusion generates a warning that you are using deprecated headers. @@ -433,7 +433,7 @@ like <code class="filename">vector.h</code> can be replaced with <code class="fi directive <code class="code">using namespace std;</code> can be put at the global scope. This should be enough to get this code compiling, assuming the other usage is correct. -</p></div><div class="sect3" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="id516213"></a>Extension headers hash_map, hash_set moved to ext or backwards</h4></div></div></div><p>At this time most of the features of the SGI STL extension have been +</p></div><div class="sect3" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="id466308"></a>Extension headers hash_map, hash_set moved to ext or backwards</h4></div></div></div><p>At this time most of the features of the SGI STL extension have been replaced by standardized libraries. In particular, the unordered_map and unordered_set containers of TR1 are suitable replacement for the non-standard hash_map and hash_set @@ -505,7 +505,7 @@ AC_DEFUN([AC_HEADER_EXT_HASH_SET], [ AC_DEFINE(HAVE_EXT_HASH_SET,,[Define if ext/hash_set is present. ]) fi ]) -</pre></div><div class="sect3" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="id516316"></a>No <code class="code">ios::nocreate/ios::noreplace</code>. +</pre></div><div class="sect3" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="id466429"></a>No <code class="code">ios::nocreate/ios::noreplace</code>. </h4></div></div></div><p> The existence of <code class="code">ios::nocreate</code> being used for input-streams has been confirmed, most probably because the author thought it would be more correct to specify nocreate explicitly. So @@ -516,7 +516,7 @@ open the file for reading, check if it has been opened, and then decide whether you want to create/replace or not. To my knowledge, even older implementations support <code class="code">app</code>, <code class="code">ate</code> and <code class="code">trunc</code> (except for <code class="code">app</code> ?). -</p></div><div class="sect3" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="id516364"></a> +</p></div><div class="sect3" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="id466476"></a> No <code class="code">stream::attach(int fd)</code> </h4></div></div></div><p> Phil Edwards writes: It was considered and rejected for the ISO @@ -524,7 +524,7 @@ No <code class="code">stream::attach(int fd)</code> that do, not all of them use integers to represent them. </p><p> For a portable solution (among systems which use - filedescriptors), you need to implement a subclass of + file descriptors), you need to implement a subclass of <code class="code">std::streambuf</code> (or <code class="code">std::basic_streambuf<..></code>) which opens a file given a descriptor, and then pass an instance of this to the @@ -539,7 +539,7 @@ No <code class="code">stream::attach(int fd)</code> For another example of this, refer to <a class="ulink" href="http://www.josuttis.com/cppcode/fdstream.html" target="_top">fdstream example</a> by Nicolai Josuttis. -</p></div><div class="sect3" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="id516428"></a> +</p></div><div class="sect3" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="id466540"></a> Support for C++98 dialect. </h4></div></div></div><p>Check for complete library coverage of the C++1998/2003 standard. </p><pre class="programlisting"> @@ -607,7 +607,7 @@ AC_DEFUN([AC_HEADER_STDCXX_98], [ AC_DEFINE(STDCXX_98_HEADERS,,[Define if ISO C++ 1998 header files are present. ]) fi ]) -</pre></div><div class="sect3" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="id516455"></a> +</pre></div><div class="sect3" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="id466568"></a> Support for C++TR1 dialect. </h4></div></div></div><p>Check for library coverage of the TR1 standard. </p><pre class="programlisting"> @@ -684,7 +684,7 @@ AC_DEFUN([AC_HEADER_TR1_UNORDERED_SET], [ AC_DEFINE(HAVE_TR1_UNORDERED_SET,,[Define if tr1/unordered_set is present. ]) fi ]) -</pre></div><div class="sect3" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="id516499"></a> +</pre></div><div class="sect3" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="id466612"></a> Support for C++0x dialect. </h4></div></div></div><p>Check for baseline language coverage in the compiler for the C++0xstandard. </p><pre class="programlisting"> @@ -896,27 +896,27 @@ AC_DEFUN([AC_HEADER_UNORDERED_SET], [ AC_DEFINE(HAVE_UNORDERED_SET,,[Define if unordered_set is present. ]) fi ]) -</pre></div><div class="sect3" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="id437068"></a> +</pre></div><div class="sect3" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="id466689"></a> Container::iterator_type is not necessarily Container::value_type* </h4></div></div></div><p> This is a change in behavior from the previous version. Now, most <span class="type">iterator_type</span> typedefs in container classes are POD objects, not <span class="type">value_type</span> pointers. -</p></div></div><div class="bibliography"><div class="titlepage"><div><div><h3 class="title"><a id="backwards.biblio"></a>Bibliography</h3></div></div></div><div class="biblioentry"><a id="id437100"></a><p>[<abbr class="abbrev"> +</p></div></div><div class="bibliography"><div class="titlepage"><div><div><h3 class="title"><a id="backwards.biblio"></a>Bibliography</h3></div></div></div><div class="biblioentry"><a id="id466721"></a><p>[<abbr class="abbrev"> kegel41 </abbr>] <span class="title"><i> Migrating to GCC 4.1 </i>. </span><span class="author"><span class="firstname">Dan</span> <span class="surname">Kegel</span>. </span><span class="biblioid"> <a class="ulink" href="http://www.kegel.com/gcc/gcc4.html" target="_top"> </a> - . </span></p></div><div class="biblioentry"><a id="id437132"></a><p>[<abbr class="abbrev"> + . </span></p></div><div class="biblioentry"><a id="id466753"></a><p>[<abbr class="abbrev"> kegel41 </abbr>] <span class="title"><i> Building the Whole Debian Archive with GCC 4.1: A Summary </i>. </span><span class="author"><span class="firstname">Martin</span> <span class="surname">Michlmayr</span>. </span><span class="biblioid"> <a class="ulink" href="http://lists.debian.org/debian-gcc/2006/03/msg00405.html" target="_top"> </a> - . </span></p></div><div class="biblioentry"><a id="id437165"></a><p>[<abbr class="abbrev"> + . </span></p></div><div class="biblioentry"><a id="id448867"></a><p>[<abbr class="abbrev"> lbl32 </abbr>] <span class="title"><i> Migration guide for GCC-3.2 diff --git a/libstdc++-v3/doc/html/manual/bitmap_allocator.html b/libstdc++-v3/doc/html/manual/bitmap_allocator.html index 88b44157bd7..3aa04e1ed8e 100644 --- a/libstdc++-v3/doc/html/manual/bitmap_allocator.html +++ b/libstdc++-v3/doc/html/manual/bitmap_allocator.html @@ -103,7 +103,7 @@ else return false.</p></li></ol></div><p> </p><p> Consider a block of size 64 ints. In memory, it would look like this: (assume a 32-bit system where, size_t is a 32-bit entity). - </p><div class="table"><a id="id510462"></a><p class="title"><b>Table 32.1. Bitmap Allocator Memory Map</b></p><div class="table-contents"><table summary="Bitmap Allocator Memory Map" border="1"><colgroup><col align="left" /><col align="left" /><col align="left" /><col align="left" /><col align="left" /></colgroup><tbody><tr><td align="left">268</td><td align="left">0</td><td align="left">4294967295</td><td align="left">4294967295</td><td align="left">Data -> Space for 64 ints</td></tr></tbody></table></div></div><br class="table-break" /><p> + </p><div class="table"><a id="id362834"></a><p class="title"><b>Table 32.1. Bitmap Allocator Memory Map</b></p><div class="table-contents"><table summary="Bitmap Allocator Memory Map" border="1"><colgroup><col align="left" /><col align="left" /><col align="left" /><col align="left" /><col align="left" /></colgroup><tbody><tr><td align="left">268</td><td align="left">0</td><td align="left">4294967295</td><td align="left">4294967295</td><td align="left">Data -> Space for 64 ints</td></tr></tbody></table></div></div><br class="table-break" /><p> The first Column(268) represents the size of the Block in bytes as seen by the Bitmap Allocator. Internally, a global free list is used to keep track of the free blocks used and given back by the @@ -141,8 +141,8 @@ else return false.</p></li></ol></div><p> </p><p> (32 x k + 1) / (2 x (32 x k + 1 + 32 x c)) x 100. </p><p> - Where, k => The constant overhead per node. eg. for list, it is - 8 bytes, and for map it is 12 bytes. c => The size of the + where k is the constant overhead per node (e.g., for list, it is + 8 bytes, and for map it is 12 bytes) and c is the size of the base type on which the map/list is instantiated. Thus, suppose the type1 is int and type2 is double, they are related by the relation sizeof(double) == 2*sizeof(int). Thus, all types must have this diff --git a/libstdc++-v3/doc/html/manual/bk01apas03.html b/libstdc++-v3/doc/html/manual/bk01apas03.html index 620968d2750..1f5e5f7b3c3 100644 --- a/libstdc++-v3/doc/html/manual/bk01apas03.html +++ b/libstdc++-v3/doc/html/manual/bk01apas03.html @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="UTF-8" standalone="no"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Coding Style</title><meta name="generator" content="DocBook XSL Stylesheets V1.73.2" /><meta name="keywords" content=" ISO C++ , library " /><link rel="start" href="../spine.html" title="The GNU C++ Library Documentation" /><link rel="up" href="appendix_contributing.html" title="Appendix A. Contributing" /><link rel="prev" href="bk01apas02.html" title="Directory Layout and Source Conventions" /><link rel="next" href="bk01apas04.html" title="Documentation Style" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Coding Style</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="bk01apas02.html">Prev</a> </td><th width="60%" align="center">Appendix A. Contributing</th><td width="20%" align="right"> <a accesskey="n" href="bk01apas04.html">Next</a></td></tr></table><hr /></div><div class="sect1" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="contrib.coding_style"></a>Coding Style</h2></div></div></div><p> - </p><div class="sect2" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 class="title"><a id="coding_style.bad_identifiers"></a>Bad Itentifiers</h3></div></div></div><p> + </p><div class="sect2" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 class="title"><a id="coding_style.bad_identifiers"></a>Bad Identifiers</h3></div></div></div><p> Identifiers that conflict and should be avoided. </p><div class="literallayout"><p><br /> This is the list of names “<span class="quote">reserved to the<br /> @@ -330,7 +330,7 @@ for definitions. For C++, where we have member functions that can<br /> be either inline definitions or declarations, keeping to this<br /> standard allows all member function names for a given class to be<br /> - aligned to the same margin, increasing readibility.<br /> + aligned to the same margin, increasing readability.<br /> <br /> <br /> 10. Invocation of member functions with "this->"<br /> @@ -356,7 +356,7 @@ <br /> 12. Spacing under protected and private in class declarations:<br /> space above, none below<br /> - ie<br /> + i.e.<br /> <br /> public:<br /> int foo;<br /> @@ -368,7 +368,7 @@ <br /> 13. Spacing WRT return statements.<br /> no extra spacing before returns, no parenthesis<br /> - ie<br /> + i.e.<br /> <br /> }<br /> return __ret;<br /> @@ -385,7 +385,7 @@ <br /> <br /> 14. Location of global variables.<br /> - All global variables of class type, whether in the "user visable"<br /> + All global variables of class type, whether in the "user visible"<br /> space (e.g., cin) or the implementation namespace, must be defined<br /> as a character array with the appropriate alignment and then later<br /> re-initialized to the correct value.<br /> diff --git a/libstdc++-v3/doc/html/manual/bk01apas04.html b/libstdc++-v3/doc/html/manual/bk01apas04.html index ceb73d88346..1ca6ed93900 100644 --- a/libstdc++-v3/doc/html/manual/bk01apas04.html +++ b/libstdc++-v3/doc/html/manual/bk01apas04.html @@ -83,7 +83,7 @@ (Examples of all these abound in the present code.) </p></div></div><div class="sect2" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 class="title"><a id="doc_style.docbook"></a>Docbook</h3></div></div></div><div class="sect3" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="docbook.prereq"></a>Prerequisites</h4></div></div></div><p> Editing the DocBook sources requires an XML editor. Many - exist: some noteable options + exist: some notable options include <span class="command"><strong>emacs</strong></span>, <span class="application">Kate</span>, or <span class="application">Conglomerate</span>. </p><p> @@ -103,7 +103,7 @@ in <code class="filename">doc/Makefile.am</code> and defaults to <code class="filename">/usr/share/sgml/docbook/xsl-stylesheets</code>. </p><p> - For procesessing XML, an XML processor and some style + For processing XML, an XML processor and some style sheets are necessary. Defaults are <span class="command"><strong>xsltproc</strong></span> provided by <code class="filename">libxslt</code>. </p><p> @@ -153,10 +153,10 @@ xmllint --noout --valid <code class="filename">xml/index.xml</code> faq.xml - index to FAQ<br /> api.xml - index to source level / API <br /> <br /> - All *.txml files are template xml files, ie otherwise empty files with<br /> + All *.txml files are template xml files, i.e., otherwise empty files with<br /> the correct structure, suitable for filling in with new information.<br /> <br /> - <span class="emphasis"><em>Cannonical Writing Style</em></span><br /> + <span class="emphasis"><em>Canonical Writing Style</em></span><br /> <br /> class template<br /> function template<br /> diff --git a/libstdc++-v3/doc/html/manual/bk01apas05.html b/libstdc++-v3/doc/html/manual/bk01apas05.html index 27baae87413..79d6f217bc0 100644 --- a/libstdc++-v3/doc/html/manual/bk01apas05.html +++ b/libstdc++-v3/doc/html/manual/bk01apas05.html @@ -210,7 +210,7 @@ "export") is badly needed.<br /> <br /> When building a shared library, the current compiler/linker cannot<br /> - automatically generate the instantiatiations needed. This creates a<br /> + automatically generate the instantiations needed. This creates a<br /> miserable situation; it means any time something is changed in the<br /> library, before a shared library can be built someone must manually<br /> copy the declarations of all templates that are needed by other parts<br /> @@ -814,7 +814,7 @@ by filebuf. These wrappings have not been completed, though there<br /> is scaffolding in place.<br /> <br /> - The encapulation of certain C header <cstdio> names presents an<br /> + The encapsulation of certain C header <cstdio> names presents an<br /> interesting problem. It is possible to define an inline std::fprintf()<br /> implemented in terms of the 'extern "C"' vfprintf(), but there is no<br /> standard vfscanf() to use to implement std::fscanf(). It appears that<br /> diff --git a/libstdc++-v3/doc/html/manual/bk01pt01ch01.html b/libstdc++-v3/doc/html/manual/bk01pt01ch01.html index ab5c04569e7..cf60565fdd9 100644 --- a/libstdc++-v3/doc/html/manual/bk01pt01ch01.html +++ b/libstdc++-v3/doc/html/manual/bk01pt01ch01.html @@ -6101,7 +6101,7 @@ In this implementation the header names are prefixed by </p><p> This page describes the TR1 support in mainline GCC SVN, not in any particular release. -</p><div class="table"><a id="id395297"></a><p class="title"><b>Table 1.1. C++ TR1 Implementation Status</b></p><div class="table-contents"><table summary="C++ TR1 Implementation Status" border="1"><colgroup><col align="left" /><col align="left" /><col align="left" /><col align="left" /><col align="left" /><col align="left" /></colgroup><thead><tr><th align="left">Section</th><th align="left">Description</th><th align="left">Done</th><th align="left">Broken</th><th align="left">Missing</th><th align="left">Comments</th></tr></thead><tbody><tr><td align="left"><span class="emphasis"><em>2</em></span></td><td colspan="5" align="left"><span class="emphasis"><em>General Utilities</em></span></td></tr><tr><td align="left">2.1</td><td align="left">Reference wrappers</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">2.1.1</td><td align="left">Additions to header <code class="code"><functional></code> synopsis</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">2.1.2</td><td align="left">Class template <code class="code">reference_wrapper</code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">2.1.2.1</td><td align="left"><code class="code">reference_wrapper</code> construct/copy/destroy</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">2.1.2.2</td><td align="left"><code class="code">reference_wrapper</code> assignment</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">2.1.2.3</td><td align="left"><code class="code">reference_wrapper</code> access</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">2.1.2.4</td><td align="left"><code class="code">reference_wrapper</code> invocation</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">2.1.2.5</td><td align="left"><code class="code">reference_wrapper</code> helper functions</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">2.2</td><td align="left">Smart pointers</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">2.2.1</td><td align="left">Additions to header <code class="code"><memory></code> synopsis</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">2.2.2</td><td align="left">Class <code class="code">bad_weak_ptr</code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">2.2.3</td><td align="left">Class template <code class="code">shared_ptr</code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left">See Footnotes</td></tr><tr><td align="left">2.2.3.1</td><td align="left"><code class="code">shared_ptr</code> constructors</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">2.2.3.2</td><td align="left"><code class="code">shared_ptr</code> destructor</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">2.2.3.3</td><td align="left"><code class="code">shared_ptr</code> assignment</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">2.2.3.4</td><td align="left"><code class="code">shared_ptr</code> modifiers</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">2.2.3.5</td><td align="left"><code class="code">shared_ptr</code> observers</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">2.2.3.6</td><td align="left"><code class="code">shared_ptr</code> comparison</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">2.2.3.7</td><td align="left"><code class="code">shared_ptr</code> I/O</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">2.2.3.8</td><td align="left"><code class="code">shared_ptr</code> specialized algorithms</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">2.2.3.9</td><td align="left"><code class="code">shared_ptr</code> casts</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">2.2.3.10</td><td align="left"><code class="code">get_deleter</code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">2.2.4</td><td align="left">Class template <code class="code">weak_ptr</code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">2.2.4.1</td><td align="left"><code class="code">weak_ptr</code> constructors</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">2.2.4.2</td><td align="left"><code class="code">weak_ptr</code> destructor</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">2.2.4.3</td><td align="left"><code class="code">weak_ptr</code> assignment</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">2.2.4.4</td><td align="left"><code class="code">weak_ptr</code> modifiers</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">2.2.4.5</td><td align="left"><code class="code">weak_ptr</code> observers</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">2.2.4.6</td><td align="left"><code class="code">weak_ptr</code> comparison</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">2.2.4.7</td><td align="left"><code class="code">weak_ptr</code> specialized algorithms</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">2.2.5</td><td align="left">Class template <code class="code">enable_shared_from_this</code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left"><span class="emphasis"><em>3</em></span></td><td colspan="5" align="left"><span class="emphasis"><em>Function Objects</em></span></td></tr><tr><td align="left">3.1</td><td align="left">Definitions</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">3.2</td><td align="left">Additions to <code class="code"><functional> synopsis</code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">3.3</td><td align="left">Requirements</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">3.4</td><td align="left">Function return types</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">3.5</td><td align="left">Function template <code class="code">mem_fn</code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">3.6</td><td align="left">Function object binders</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">3.6.1</td><td align="left">Class template <code class="code">is_bind_expression</code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">3.6.2</td><td align="left">Class template <code class="code">is_placeholder</code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">3.6.3</td><td align="left">Function template <code class="code">bind</code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">3.6.4</td><td align="left">Placeholders</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">3.7</td><td align="left">Polymorphic function wrappers</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">3.7.1</td><td align="left">Class <code class="code">bad_function_call<code class="code"></code></code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">3.7.1.1</td><td align="left"><code class="code">bad_function_call</code> constructor</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">3.7.2</td><td align="left">Class template <code class="code">function</code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">3.7.2.1</td><td align="left"><code class="code">function</code> construct/copy/destroy</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">3.7.2.2</td><td align="left"><code class="code">function</code> modifiers</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">3.7.2.3</td><td align="left"><code class="code">function</code> capacity</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">3.7.2.4</td><td align="left"><code class="code">function</code> invocation</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">3.7.2.5</td><td align="left"><code class="code">function</code> target access</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">3.7.2.6</td><td align="left">undefined operators</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">3.7.2.7</td><td align="left">null pointer comparison operators</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">3.7.2.8</td><td align="left">specialized algorithms</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left"><span class="emphasis"><em>4</em></span></td><td colspan="5" align="left"><span class="emphasis"><em>Metaprogramming and type traits</em></span></td></tr><tr><td align="left">4.1</td><td align="left">Requirements</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">4.2</td><td align="left">Header <code class="code"><type_traits></code> synopsis</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">4.3</td><td align="left">Helper classes</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">4.4</td><td align="left">General Requirements</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">4.5</td><td align="left">Unary Type Traits</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">4.5.1</td><td align="left">Primary Type Categories</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">4.5.2</td><td align="left">Composite type traits</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">4.5.3</td><td align="left">Type properties</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">4.6</td><td align="left">Relationships between types</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">4.7</td><td align="left">Transformations between types</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">4.7.1</td><td align="left">Const-volatile modifications</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">4.7.2</td><td align="left">Reference modifications</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">4.7.3</td><td align="left">Array modifications</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">4.7.4</td><td align="left">Pointer modifications</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">4.8</td><td align="left">Other transformations</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">4.9</td><td align="left">Implementation requirements</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left"><span class="emphasis"><em>5</em></span></td><td colspan="5" align="left"><span class="emphasis"><em>Numerical Facilities</em></span></td></tr><tr><td align="left">5.1</td><td align="left">Random number generation</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">5.1.1</td><td align="left">Requirements</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">5.1.2</td><td align="left">Header <code class="code"><random></code> synopsis</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">5.1.3</td><td align="left">Class template <code class="code">variate_generator</code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">5.1.4</td><td align="left">Random number engine class templates</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">5.1.4.1</td><td align="left">Class template <code class="code">linear_congruential</code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">5.1.4.2</td><td align="left">Class template <code class="code">mersenne_twister</code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">5.1.4.3</td><td align="left">Class template <code class="code">subtract_with_carry</code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">5.1.4.4</td><td align="left">Class template <code class="code">subtract_with_carry_01</code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">5.1.4.5</td><td align="left">Class template <code class="code">discard_block</code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">5.1.4.6</td><td align="left">Class template <code class="code">xor_combine</code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left">operator()() per N2079</td></tr><tr><td align="left">5.1.5</td><td align="left">Engines with predefined parameters</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">5.1.6</td><td align="left">Class <code class="code">random_device</code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">5.1.7</td><td align="left">Random distribution class templates</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">5.1.7.1</td><td align="left">Class template <code class="code">uniform_int</code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">5.1.7.2</td><td align="left">Class <code class="code">bernoulli_distribution</code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">5.1.7.3</td><td align="left">Class template <code class="code">geometric_distribution</code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">5.1.7.4</td><td align="left">Class template <code class="code">poisson_distribution</code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">5.1.7.5</td><td align="left">Class template <code class="code">binomial_distribution</code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">5.1.7.6</td><td align="left">Class template <code class="code">uniform_real</code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">5.1.7.7</td><td align="left">Class template <code class="code">exponential_distribution</code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">5.1.7.8</td><td align="left">Class template <code class="code">normal_distribution</code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">5.1.7.9</td><td align="left">Class template <code class="code">gamma_distribution</code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">5.2</td><td align="left">Mathematical special functions</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">5.2.1</td><td align="left">Additions to header <code class="code"><cmath></code> synopsis</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">5.2.1.1</td><td align="left">associated Laguerre polynomials</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">5.2.1.2</td><td align="left">associated Legendre functions</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">5.2.1.3</td><td align="left">beta function</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">5.2.1.4</td><td align="left">(complete) elliptic integral of the first kind</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">5.2.1.5</td><td align="left">(complete) elliptic integral of the second kind</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">5.2.1.6</td><td align="left">(complete) elliptic integral of the third kind</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">5.2.1.7</td><td align="left">confluent hypergeometric functions</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">5.2.1.8</td><td align="left">regular modified cylindrical Bessel functions</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">5.2.1.9</td><td align="left">cylindrical Bessel functions (of the first kind)</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">5.2.1.10</td><td align="left">irregular modified cylindrical Bessel functions</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">5.2.1.11</td><td align="left">cylindrical Neumann functions</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">5.2.1.12</td><td align="left">(incomplete) elliptic integral of the first kind</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">5.2.1.13</td><td align="left">(incomplete) elliptic integral of the second kind</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">5.2.1.14</td><td align="left">(incomplete) elliptic integral of the third kind</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">5.2.1.15</td><td align="left">exponential integral</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">5.2.1.16</td><td align="left">Hermite polynomials</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">5.2.1.17</td><td align="left">hypergeometric functions</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">5.2.1.18</td><td align="left">Laguerre polynomials</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">5.2.1.19</td><td align="left">Legendre polynomials</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">5.2.1.20</td><td align="left">Riemann zeta function</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">5.2.1.21</td><td align="left">spherical Bessel functions (of the first kind)</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">5.2.1.22</td><td align="left">spherical associated Legendre functions</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">5.2.1.23</td><td align="left">spherical Neumann functions</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">5.2.2</td><td align="left">Additions to header <code class="code"><math.h></code> synopsis</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left"><span class="emphasis"><em>6</em></span></td><td colspan="5" align="left"><span class="emphasis"><em>Containers</em></span></td></tr><tr><td align="left">6.1</td><td align="left">Tuple types</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">6.1.1</td><td align="left">Header <code class="code"><tuple></code> synopsis</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">6.1.2</td><td align="left">Additions to header <code class="code"><utility></code> synopsis</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">6.1.3</td><td align="left">Class template <code class="code">tuple</code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">6.1.3.1</td><td align="left">Construction</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">6.1.3.2</td><td align="left">Tuple creation functions</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">6.1.3.3</td><td align="left">Tuple helper classes</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">6.1.3.4</td><td align="left">Element access</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">6.1.3.5</td><td align="left">Relational operators</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">6.1.4</td><td align="left">Pairs</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">6.2</td><td align="left">Fixed size array</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">6.2.1</td><td align="left">Header <code class="code"><array></code> synopsis</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">6.2.2</td><td align="left">Class template <code class="code">array</code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">6.2.2.1</td><td align="left"><code class="code">array</code> constructors, copy, and assignment</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">6.2.2.2</td><td align="left"><code class="code">array</code> specialized algorithms</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">6.2.2.3</td><td align="left"><code class="code">array</code> size</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">6.2.2.4</td><td align="left">Zero sized <code class="code">array</code>s</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">6.2.2.5</td><td align="left">Tuple interface to class template <code class="code">array</code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">6.3</td><td align="left">Unordered associative containers</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">6.3.1</td><td align="left">Unordered associative container requirements</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">6.3.1.1</td><td align="left">Exception safety guarantees</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">6.3.2</td><td align="left">Additions to header <code class="code"><functional></code> synopsis</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">6.3.3</td><td align="left">Class template <code class="code">hash</code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">6.3.4</td><td align="left">Unordered associative container classes</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">6.3.4.1</td><td align="left">Header <code class="code"><unordered_set></code> synopsis</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">6.3.4.2</td><td align="left">Header <code class="code"><unordered_map></code> synopsis</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">6.3.4.3</td><td align="left">Class template <code class="code">unordered_set</code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">6.3.4.3.1</td><td align="left"><code class="code">unordered_set</code> constructors</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">6.3.4.3.2</td><td align="left"><code class="code">unordered_set</code> swap</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">6.3.4.4</td><td align="left">Class template <code class="code">unordered_map</code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">6.3.4.4.1</td><td align="left"><code class="code">unordered_map</code> constructors</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">6.3.4.4.2</td><td align="left"><code class="code">unordered_map</code> element access</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">6.3.4.4.3</td><td align="left"><code class="code">unordered_map</code> swap</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">6.3.4.5</td><td align="left">Class template <code class="code">unordered_multiset<code class="code"></code></code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">6.3.4.5.1</td><td align="left"><code class="code">unordered_multiset</code> constructors</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">6.3.4.5.2</td><td align="left"><code class="code">unordered_multiset</code> swap</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">6.3.4.6</td><td align="left">Class template <code class="code">unordered_multimap</code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">6.3.4.6.1</td><td align="left"><code class="code">unordered_multimap</code> constructors</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">6.3.4.6.2</td><td align="left"><code class="code">unordered_multimap</code> swap</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left"><span class="emphasis"><em>7</em></span></td><td colspan="5" align="left"><span class="emphasis"><em>Regular Expressions</em></span></td></tr><tr><td align="left">7.1</td><td align="left">Definitions</td><td align="left"> </td><td align="left"> </td><td align="left">missing</td><td align="left"> </td></tr><tr><td align="left">7.2</td><td align="left">Requirements</td><td align="left"> </td><td align="left"> </td><td align="left">missing</td><td align="left"> </td></tr><tr><td align="left">7.3</td><td align="left">Regular expressions summary</td><td align="left"> </td><td align="left"> </td><td align="left">missing</td><td align="left"> </td></tr><tr><td align="left">7.4</td><td align="left">Header <code class="code"><regex></code> synopsis</td><td align="left"> </td><td align="left"> </td><td align="left">missing</td><td align="left"> </td></tr><tr><td align="left">7.5</td><td align="left">Namespace <code class="code">tr1::regex_constants</code></td><td align="left"> </td><td align="left"> </td><td align="left">missing</td><td align="left"> </td></tr><tr><td align="left">7.5.1</td><td align="left">Bitmask Type <code class="code">syntax_option_type</code></td><td align="left"> </td><td align="left"> </td><td align="left">missing</td><td align="left"> </td></tr><tr><td align="left">7.5.2</td><td align="left">Bitmask Type <code class="code">regex_constants::match_flag_type</code></td><td align="left"> </td><td align="left"> </td><td align="left">missing</td><td align="left"> </td></tr><tr><td align="left">7.5.3</td><td align="left">Implementation defined <code class="code">error_type</code></td><td align="left"> </td><td align="left"> </td><td align="left">missing</td><td align="left"> </td></tr><tr><td align="left">7.6</td><td align="left">Class <code class="code">regex_error</code></td><td align="left"> </td><td align="left"> </td><td align="left">missing</td><td align="left"> </td></tr><tr><td align="left">7.7</td><td align="left">Class template <code class="code">regex_traits</code></td><td align="left"> </td><td align="left"> </td><td align="left">missing</td><td align="left"> </td></tr><tr><td align="left">7.8</td><td align="left">Class template <code class="code">basic_regex</code></td><td align="left"> </td><td align="left"> </td><td align="left">missing</td><td align="left"> </td></tr><tr><td align="left">7.8.1</td><td align="left"><code class="code">basic_regex</code> constants</td><td align="left"> </td><td align="left"> </td><td align="left">missing</td><td align="left"> </td></tr><tr><td align="left">7.8.2</td><td align="left"><code class="code">basic_regex</code> constructors</td><td align="left"> </td><td align="left"> </td><td align="left">missing</td><td align="left"> </td></tr><tr><td align="left">7.8.3</td><td align="left"><code class="code">basic_regex</code> assign</td><td align="left"> </td><td align="left"> </td><td align="left">missing</td><td align="left"> </td></tr><tr><td align="left">7.8.4</td><td align="left"><code class="code">basic_regex</code> constant operations</td><td align="left"> </td><td align="left"> </td><td align="left">missing</td><td align="left"> </td></tr><tr><td align="left">7.8.5</td><td align="left"><code class="code">basic_regex</code> locale</td><td align="left"> </td><td align="left"> </td><td align="left">missing</td><td align="left"> </td></tr><tr><td align="left">7.8.6</td><td align="left"><code class="code">basic_regex</code> swap</td><td align="left"> </td><td align="left"> </td><td align="left">missing</td><td align="left"> </td></tr><tr><td align="left">7.8.7</td><td align="left"><code class="code">basic_regex</code> non-member functions</td><td align="left"> </td><td align="left"> </td><td align="left">missing</td><td align="left"> </td></tr><tr><td align="left">7.8.7.1</td><td align="left"><code class="code">basic_regex</code> non-member swap</td><td align="left"> </td><td align="left"> </td><td align="left">missing</td><td align="left"> </td></tr><tr><td align="left">7.9</td><td align="left">Class template <code class="code">sub_match</code></td><td align="left"> </td><td align="left"> </td><td align="left">missing</td><td align="left"> </td></tr><tr><td align="left">7.9.1</td><td align="left"><code class="code">sub_match</code> members</td><td align="left"> </td><td align="left"> </td><td align="left">missing</td><td align="left"> </td></tr><tr><td align="left">7.9.2</td><td align="left"><code class="code">sub_match</code> non-member operators</td><td align="left"> </td><td align="left"> </td><td align="left">missing</td><td align="left"> </td></tr><tr><td align="left">7.10</td><td align="left">Class template <code class="code">match_results</code></td><td align="left"> </td><td align="left"> </td><td align="left">missing</td><td align="left"> </td></tr><tr><td align="left">7.10.1</td><td align="left"><code class="code">match_results</code> constructors</td><td align="left"> </td><td align="left"> </td><td align="left">missing</td><td align="left"> </td></tr><tr><td align="left">7.10.2</td><td align="left"><code class="code">match_results</code> size</td><td align="left"> </td><td align="left"> </td><td align="left">missing</td><td align="left"> </td></tr><tr><td align="left">7.10.3</td><td align="left"><code class="code">match_results</code> element access</td><td align="left"> </td><td align="left"> </td><td align="left">missing</td><td align="left"> </td></tr><tr><td align="left">7.10.4</td><td align="left"><code class="code">match_results</code> formatting</td><td align="left"> </td><td align="left"> </td><td align="left">missing</td><td align="left"> </td></tr><tr><td align="left">7.10.5</td><td align="left"><code class="code">match_results</code> allocator</td><td align="left"> </td><td align="left"> </td><td align="left">missing</td><td align="left"> </td></tr><tr><td align="left">7.10.6</td><td align="left"><code class="code">match_results</code> swap</td><td align="left"> </td><td align="left"> </td><td align="left">missing</td><td align="left"> </td></tr><tr><td align="left">7.11</td><td align="left">Regular expression algorithms</td><td align="left"> </td><td align="left"> </td><td align="left">missing</td><td align="left"> </td></tr><tr><td align="left">7.11.1</td><td align="left">exceptions</td><td align="left"> </td><td align="left"> </td><td align="left">missing</td><td align="left"> </td></tr><tr><td align="left">7.11.2</td><td align="left"><code class="code">regex_match</code></td><td align="left"> </td><td align="left"> </td><td align="left">missing</td><td align="left"> </td></tr><tr><td align="left">7.11.3</td><td align="left"><code class="code">regex_search</code></td><td align="left"> </td><td align="left"> </td><td align="left">missing</td><td align="left"> </td></tr><tr><td align="left">7.11.4</td><td align="left"><code class="code">regex_replace</code></td><td align="left"> </td><td align="left"> </td><td align="left">missing</td><td align="left"> </td></tr><tr><td align="left">7.12</td><td align="left">Regular expression Iterators</td><td align="left"> </td><td align="left"> </td><td align="left">missing</td><td align="left"> </td></tr><tr><td align="left">7.12.1</td><td align="left">Class template <code class="code">regex_iterator</code></td><td align="left"> </td><td align="left"> </td><td align="left">missing</td><td align="left"> </td></tr><tr><td align="left">7.12.1.1</td><td align="left"><code class="code">regex_iterator</code> constructors</td><td align="left"> </td><td align="left"> </td><td align="left">missing</td><td align="left"> </td></tr><tr><td align="left">7.12.1.2</td><td align="left"><code class="code">regex_iterator</code> comparisons</td><td align="left"> </td><td align="left"> </td><td align="left">missing</td><td align="left"> </td></tr><tr><td align="left">7.12.1.3</td><td align="left"><code class="code">regex_iterator</code> dereference</td><td align="left"> </td><td align="left"> </td><td align="left">missing</td><td align="left"> </td></tr><tr><td align="left">7.12.1.4</td><td align="left"><code class="code">regex_iterator</code> increment</td><td align="left"> </td><td align="left"> </td><td align="left">missing</td><td align="left"> </td></tr><tr><td align="left">7.12.2</td><td align="left">Class template <code class="code">regex_token_iterator</code></td><td align="left"> </td><td align="left"> </td><td align="left">missing</td><td align="left"> </td></tr><tr><td align="left">7.12.2.1</td><td align="left"><code class="code">regex_token_iterator</code> constructors</td><td align="left"> </td><td align="left"> </td><td align="left">missing</td><td align="left"> </td></tr><tr><td align="left">7.12.2.2</td><td align="left"><code class="code">regex_token_iterator</code> comparisons</td><td align="left"> </td><td align="left"> </td><td align="left">missing</td><td align="left"> </td></tr><tr><td align="left">7.12.2.3</td><td align="left"><code class="code">regex_token_iterator</code> dereference</td><td align="left"> </td><td align="left"> </td><td align="left">missing</td><td align="left"> </td></tr><tr><td align="left">7.12.2.4</td><td align="left"><code class="code">regex_token_iterator</code> increment</td><td align="left"> </td><td align="left"> </td><td align="left">missing</td><td align="left"> </td></tr><tr><td align="left">7.13</td><td align="left">Modified ECMAScript regular expression grammar</td><td align="left"> </td><td align="left"> </td><td align="left">missing</td><td align="left"> </td></tr><tr><td align="left"><span class="emphasis"><em>8</em></span></td><td colspan="5" align="left"><span class="emphasis"><em>C Compatibility</em></span></td></tr><tr><td align="left">8.1</td><td align="left">Additions to header <code class="code"><complex></code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">8.1.1</td><td align="left">Synopsis</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">8.1.2</td><td align="left">Function <code class="code">acos</code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">8.1.3</td><td align="left">Function <code class="code">asin</code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">8.1.4</td><td align="left">Function <code class="code">atan</code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">8.1.5</td><td align="left">Function <code class="code">acosh</code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">8.1.6</td><td align="left">Function <code class="code">asinh</code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">8.1.7</td><td align="left">Function <code class="code">atanh</code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">8.1.8</td><td align="left">Function <code class="code">fabs</code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">8.1.9</td><td align="left">Additional Overloads</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">8.2</td><td align="left">Header <code class="code"><ccomplex></code></td><td align="left"> </td><td align="left"> </td><td align="left">missing</td><td align="left">DR 551</td></tr><tr><td align="left">8.3</td><td align="left">Header <code class="code"><complex.h></code></td><td align="left"> </td><td align="left"> </td><td align="left">missing</td><td align="left">DR 551</td></tr><tr><td align="left">8.4</td><td align="left">Additions to header <code class="code"><cctype></code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">8.4.1</td><td align="left">Synopsis</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">8.4.2</td><td align="left">Function <code class="code">isblank</code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">8.5</td><td align="left">Additions to header <code class="code"><ctype.h></code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">8.6</td><td align="left">Header <code class="code"><cfenv></code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">8.6.1</td><td align="left">Synopsis</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">8.6.2</td><td align="left">Definitions</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">8.7</td><td align="left">Header <code class="code"><fenv.h></code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">8.8</td><td align="left">Additions to header <code class="code"><cfloat></code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">8.9</td><td align="left">Additions to header <code class="code"><float.h></code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">8.10</td><td align="left">Additions to header <code class="code"><ios></code></td><td align="left"> </td><td align="left"> </td><td align="left">missing</td><td align="left"> </td></tr><tr><td align="left">8.10.1</td><td align="left">Synopsis</td><td align="left"> </td><td align="left"> </td><td align="left">missing</td><td align="left"> </td></tr><tr><td align="left">8.10.2</td><td align="left">Function <code class="code">hexfloat</code></td><td align="left"> </td><td align="left"> </td><td align="left">missing</td><td align="left"> </td></tr><tr><td align="left">8.11</td><td align="left">Header <code class="code"><cinttypes></code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">8.11.1</td><td align="left">Synopsis</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left">DR 557</td></tr><tr><td align="left">8.11.2</td><td align="left">Definitions</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">8.12</td><td align="left">Header <code class="code"><inttypes.h></code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">8.13</td><td align="left">Additions to header <code class="code"><climits></code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">8.14</td><td align="left">Additions to header <code class="code"><limits.h></code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">8.15</td><td align="left">Additions to header <code class="code"><locale></code></td><td align="left"> </td><td align="left"> </td><td align="left">missing</td><td align="left"> </td></tr><tr><td align="left">8.16</td><td align="left">Additions to header <code class="code"><cmath></code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">8.16.1</td><td align="left">Synopsis</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">8.16.2</td><td align="left">Definitions</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">8.16.3</td><td align="left">Function template definitions</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">8.16.4</td><td align="left">Additional overloads</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left">DR 568; DR 550</td></tr><tr><td align="left">8.17</td><td align="left">Additions to header <code class="code"><math.h></code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">8.18</td><td align="left">Additions to header <code class="code"><cstdarg></code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">8.19</td><td align="left">Additions to header <code class="code"><stdarg.h></code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">8.20</td><td align="left">The header <code class="code"><cstdbool></code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">8.21</td><td align="left">The header <code class="code"><stdbool.h></code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">8.22</td><td align="left">The header <code class="code"><cstdint></code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">8.22.1</td><td align="left">Synopsis</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">8.22.2</td><td align="left">Definitions</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">8.23</td><td align="left">The header <code class="code"><stdint.h></code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">8.24</td><td align="left">Additions to header <code class="code"><cstdio></code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">8.24.1</td><td align="left">Synopsis</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">8.24.2</td><td align="left">Definitions</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">8.24.3</td><td align="left">Additional format specifiers</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left">C library responsibility</td></tr><tr><td align="left">8.24.4</td><td align="left">Additions to header <code class="code"><stdio.h></code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">8.25</td><td align="left">Additions to header <code class="code"><cstdlib></code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">8.25.1</td><td align="left">Synopsis</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">8.25.2</td><td align="left">Definitions</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">8.25.3</td><td align="left">Function <code class="code">abs</code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">8.25.4</td><td align="left">Function <code class="code">div</code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">8.26</td><td align="left">Additions to header <code class="code"><stdlib.h></code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">8.27</td><td align="left">Header <code class="code"><ctgmath></code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left">DR 551</td></tr><tr><td align="left">8.28</td><td align="left">Header <code class="code"><tgmath.h></code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left">DR 551</td></tr><tr><td align="left">8.29</td><td align="left">Additions to header <code class="code"><ctime></code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left">C library responsibility</td></tr><tr><td align="left">8.30</td><td align="left">Additions to header <code class="code"><cwchar></code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">8.30.1</td><td align="left">Synopsis</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">8.30.2</td><td align="left">Definitions</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">8.30.3</td><td align="left">Additional wide format specifiers</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left">C library responsibility</td></tr><tr><td align="left">8.31</td><td align="left">Additions to header <code class="code"><wchar.h></code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">8.32</td><td align="left">Additions to header <code class="code"><cwctype></code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">8.32.1</td><td align="left">Synopsis</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">8.32.2</td><td align="left">Function <code class="code">iswblank</code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">8.33</td><td align="left">Additions to header <code class="code"><wctype.h></code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr></tbody></table></div></div><br class="table-break" /><p> +</p><div class="table"><a id="id405938"></a><p class="title"><b>Table 1.1. C++ TR1 Implementation Status</b></p><div class="table-contents"><table summary="C++ TR1 Implementation Status" border="1"><colgroup><col align="left" /><col align="left" /><col align="left" /><col align="left" /><col align="left" /><col align="left" /></colgroup><thead><tr><th align="left">Section</th><th align="left">Description</th><th align="left">Done</th><th align="left">Broken</th><th align="left">Missing</th><th align="left">Comments</th></tr></thead><tbody><tr><td align="left"><span class="emphasis"><em>2</em></span></td><td colspan="5" align="left"><span class="emphasis"><em>General Utilities</em></span></td></tr><tr><td align="left">2.1</td><td align="left">Reference wrappers</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">2.1.1</td><td align="left">Additions to header <code class="code"><functional></code> synopsis</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">2.1.2</td><td align="left">Class template <code class="code">reference_wrapper</code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">2.1.2.1</td><td align="left"><code class="code">reference_wrapper</code> construct/copy/destroy</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">2.1.2.2</td><td align="left"><code class="code">reference_wrapper</code> assignment</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">2.1.2.3</td><td align="left"><code class="code">reference_wrapper</code> access</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">2.1.2.4</td><td align="left"><code class="code">reference_wrapper</code> invocation</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">2.1.2.5</td><td align="left"><code class="code">reference_wrapper</code> helper functions</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">2.2</td><td align="left">Smart pointers</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">2.2.1</td><td align="left">Additions to header <code class="code"><memory></code> synopsis</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">2.2.2</td><td align="left">Class <code class="code">bad_weak_ptr</code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">2.2.3</td><td align="left">Class template <code class="code">shared_ptr</code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left">See Footnotes</td></tr><tr><td align="left">2.2.3.1</td><td align="left"><code class="code">shared_ptr</code> constructors</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">2.2.3.2</td><td align="left"><code class="code">shared_ptr</code> destructor</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">2.2.3.3</td><td align="left"><code class="code">shared_ptr</code> assignment</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">2.2.3.4</td><td align="left"><code class="code">shared_ptr</code> modifiers</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">2.2.3.5</td><td align="left"><code class="code">shared_ptr</code> observers</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">2.2.3.6</td><td align="left"><code class="code">shared_ptr</code> comparison</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">2.2.3.7</td><td align="left"><code class="code">shared_ptr</code> I/O</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">2.2.3.8</td><td align="left"><code class="code">shared_ptr</code> specialized algorithms</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">2.2.3.9</td><td align="left"><code class="code">shared_ptr</code> casts</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">2.2.3.10</td><td align="left"><code class="code">get_deleter</code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">2.2.4</td><td align="left">Class template <code class="code">weak_ptr</code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">2.2.4.1</td><td align="left"><code class="code">weak_ptr</code> constructors</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">2.2.4.2</td><td align="left"><code class="code">weak_ptr</code> destructor</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">2.2.4.3</td><td align="left"><code class="code">weak_ptr</code> assignment</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">2.2.4.4</td><td align="left"><code class="code">weak_ptr</code> modifiers</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">2.2.4.5</td><td align="left"><code class="code">weak_ptr</code> observers</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">2.2.4.6</td><td align="left"><code class="code">weak_ptr</code> comparison</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">2.2.4.7</td><td align="left"><code class="code">weak_ptr</code> specialized algorithms</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">2.2.5</td><td align="left">Class template <code class="code">enable_shared_from_this</code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left"><span class="emphasis"><em>3</em></span></td><td colspan="5" align="left"><span class="emphasis"><em>Function Objects</em></span></td></tr><tr><td align="left">3.1</td><td align="left">Definitions</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">3.2</td><td align="left">Additions to <code class="code"><functional> synopsis</code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">3.3</td><td align="left">Requirements</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">3.4</td><td align="left">Function return types</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">3.5</td><td align="left">Function template <code class="code">mem_fn</code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">3.6</td><td align="left">Function object binders</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">3.6.1</td><td align="left">Class template <code class="code">is_bind_expression</code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">3.6.2</td><td align="left">Class template <code class="code">is_placeholder</code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">3.6.3</td><td align="left">Function template <code class="code">bind</code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">3.6.4</td><td align="left">Placeholders</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">3.7</td><td align="left">Polymorphic function wrappers</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">3.7.1</td><td align="left">Class <code class="code">bad_function_call<code class="code"></code></code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">3.7.1.1</td><td align="left"><code class="code">bad_function_call</code> constructor</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">3.7.2</td><td align="left">Class template <code class="code">function</code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">3.7.2.1</td><td align="left"><code class="code">function</code> construct/copy/destroy</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">3.7.2.2</td><td align="left"><code class="code">function</code> modifiers</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">3.7.2.3</td><td align="left"><code class="code">function</code> capacity</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">3.7.2.4</td><td align="left"><code class="code">function</code> invocation</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">3.7.2.5</td><td align="left"><code class="code">function</code> target access</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">3.7.2.6</td><td align="left">undefined operators</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">3.7.2.7</td><td align="left">null pointer comparison operators</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">3.7.2.8</td><td align="left">specialized algorithms</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left"><span class="emphasis"><em>4</em></span></td><td colspan="5" align="left"><span class="emphasis"><em>Metaprogramming and type traits</em></span></td></tr><tr><td align="left">4.1</td><td align="left">Requirements</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">4.2</td><td align="left">Header <code class="code"><type_traits></code> synopsis</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">4.3</td><td align="left">Helper classes</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">4.4</td><td align="left">General Requirements</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">4.5</td><td align="left">Unary Type Traits</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">4.5.1</td><td align="left">Primary Type Categories</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">4.5.2</td><td align="left">Composite type traits</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">4.5.3</td><td align="left">Type properties</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">4.6</td><td align="left">Relationships between types</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">4.7</td><td align="left">Transformations between types</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">4.7.1</td><td align="left">Const-volatile modifications</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">4.7.2</td><td align="left">Reference modifications</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">4.7.3</td><td align="left">Array modifications</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">4.7.4</td><td align="left">Pointer modifications</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">4.8</td><td align="left">Other transformations</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">4.9</td><td align="left">Implementation requirements</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left"><span class="emphasis"><em>5</em></span></td><td colspan="5" align="left"><span class="emphasis"><em>Numerical Facilities</em></span></td></tr><tr><td align="left">5.1</td><td align="left">Random number generation</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">5.1.1</td><td align="left">Requirements</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">5.1.2</td><td align="left">Header <code class="code"><random></code> synopsis</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">5.1.3</td><td align="left">Class template <code class="code">variate_generator</code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">5.1.4</td><td align="left">Random number engine class templates</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">5.1.4.1</td><td align="left">Class template <code class="code">linear_congruential</code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">5.1.4.2</td><td align="left">Class template <code class="code">mersenne_twister</code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">5.1.4.3</td><td align="left">Class template <code class="code">subtract_with_carry</code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">5.1.4.4</td><td align="left">Class template <code class="code">subtract_with_carry_01</code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">5.1.4.5</td><td align="left">Class template <code class="code">discard_block</code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">5.1.4.6</td><td align="left">Class template <code class="code">xor_combine</code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left">operator()() per N2079</td></tr><tr><td align="left">5.1.5</td><td align="left">Engines with predefined parameters</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">5.1.6</td><td align="left">Class <code class="code">random_device</code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">5.1.7</td><td align="left">Random distribution class templates</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">5.1.7.1</td><td align="left">Class template <code class="code">uniform_int</code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">5.1.7.2</td><td align="left">Class <code class="code">bernoulli_distribution</code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">5.1.7.3</td><td align="left">Class template <code class="code">geometric_distribution</code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">5.1.7.4</td><td align="left">Class template <code class="code">poisson_distribution</code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">5.1.7.5</td><td align="left">Class template <code class="code">binomial_distribution</code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">5.1.7.6</td><td align="left">Class template <code class="code">uniform_real</code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">5.1.7.7</td><td align="left">Class template <code class="code">exponential_distribution</code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">5.1.7.8</td><td align="left">Class template <code class="code">normal_distribution</code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">5.1.7.9</td><td align="left">Class template <code class="code">gamma_distribution</code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">5.2</td><td align="left">Mathematical special functions</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">5.2.1</td><td align="left">Additions to header <code class="code"><cmath></code> synopsis</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">5.2.1.1</td><td align="left">associated Laguerre polynomials</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">5.2.1.2</td><td align="left">associated Legendre functions</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">5.2.1.3</td><td align="left">beta function</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">5.2.1.4</td><td align="left">(complete) elliptic integral of the first kind</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">5.2.1.5</td><td align="left">(complete) elliptic integral of the second kind</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">5.2.1.6</td><td align="left">(complete) elliptic integral of the third kind</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">5.2.1.7</td><td align="left">confluent hypergeometric functions</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">5.2.1.8</td><td align="left">regular modified cylindrical Bessel functions</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">5.2.1.9</td><td align="left">cylindrical Bessel functions (of the first kind)</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">5.2.1.10</td><td align="left">irregular modified cylindrical Bessel functions</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">5.2.1.11</td><td align="left">cylindrical Neumann functions</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">5.2.1.12</td><td align="left">(incomplete) elliptic integral of the first kind</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">5.2.1.13</td><td align="left">(incomplete) elliptic integral of the second kind</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">5.2.1.14</td><td align="left">(incomplete) elliptic integral of the third kind</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">5.2.1.15</td><td align="left">exponential integral</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">5.2.1.16</td><td align="left">Hermite polynomials</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">5.2.1.17</td><td align="left">hypergeometric functions</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">5.2.1.18</td><td align="left">Laguerre polynomials</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">5.2.1.19</td><td align="left">Legendre polynomials</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">5.2.1.20</td><td align="left">Riemann zeta function</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">5.2.1.21</td><td align="left">spherical Bessel functions (of the first kind)</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">5.2.1.22</td><td align="left">spherical associated Legendre functions</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">5.2.1.23</td><td align="left">spherical Neumann functions</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">5.2.2</td><td align="left">Additions to header <code class="code"><math.h></code> synopsis</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left"><span class="emphasis"><em>6</em></span></td><td colspan="5" align="left"><span class="emphasis"><em>Containers</em></span></td></tr><tr><td align="left">6.1</td><td align="left">Tuple types</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">6.1.1</td><td align="left">Header <code class="code"><tuple></code> synopsis</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">6.1.2</td><td align="left">Additions to header <code class="code"><utility></code> synopsis</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">6.1.3</td><td align="left">Class template <code class="code">tuple</code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">6.1.3.1</td><td align="left">Construction</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">6.1.3.2</td><td align="left">Tuple creation functions</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">6.1.3.3</td><td align="left">Tuple helper classes</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">6.1.3.4</td><td align="left">Element access</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">6.1.3.5</td><td align="left">Relational operators</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">6.1.4</td><td align="left">Pairs</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">6.2</td><td align="left">Fixed size array</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">6.2.1</td><td align="left">Header <code class="code"><array></code> synopsis</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">6.2.2</td><td align="left">Class template <code class="code">array</code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">6.2.2.1</td><td align="left"><code class="code">array</code> constructors, copy, and assignment</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">6.2.2.2</td><td align="left"><code class="code">array</code> specialized algorithms</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">6.2.2.3</td><td align="left"><code class="code">array</code> size</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">6.2.2.4</td><td align="left">Zero sized <code class="code">array</code>s</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">6.2.2.5</td><td align="left">Tuple interface to class template <code class="code">array</code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">6.3</td><td align="left">Unordered associative containers</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">6.3.1</td><td align="left">Unordered associative container requirements</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">6.3.1.1</td><td align="left">Exception safety guarantees</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">6.3.2</td><td align="left">Additions to header <code class="code"><functional></code> synopsis</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">6.3.3</td><td align="left">Class template <code class="code">hash</code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">6.3.4</td><td align="left">Unordered associative container classes</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">6.3.4.1</td><td align="left">Header <code class="code"><unordered_set></code> synopsis</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">6.3.4.2</td><td align="left">Header <code class="code"><unordered_map></code> synopsis</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">6.3.4.3</td><td align="left">Class template <code class="code">unordered_set</code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">6.3.4.3.1</td><td align="left"><code class="code">unordered_set</code> constructors</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">6.3.4.3.2</td><td align="left"><code class="code">unordered_set</code> swap</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">6.3.4.4</td><td align="left">Class template <code class="code">unordered_map</code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">6.3.4.4.1</td><td align="left"><code class="code">unordered_map</code> constructors</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">6.3.4.4.2</td><td align="left"><code class="code">unordered_map</code> element access</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">6.3.4.4.3</td><td align="left"><code class="code">unordered_map</code> swap</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">6.3.4.5</td><td align="left">Class template <code class="code">unordered_multiset<code class="code"></code></code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">6.3.4.5.1</td><td align="left"><code class="code">unordered_multiset</code> constructors</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">6.3.4.5.2</td><td align="left"><code class="code">unordered_multiset</code> swap</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">6.3.4.6</td><td align="left">Class template <code class="code">unordered_multimap</code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">6.3.4.6.1</td><td align="left"><code class="code">unordered_multimap</code> constructors</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">6.3.4.6.2</td><td align="left"><code class="code">unordered_multimap</code> swap</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left"><span class="emphasis"><em>7</em></span></td><td colspan="5" align="left"><span class="emphasis"><em>Regular Expressions</em></span></td></tr><tr><td align="left">7.1</td><td align="left">Definitions</td><td align="left"> </td><td align="left"> </td><td align="left">missing</td><td align="left"> </td></tr><tr><td align="left">7.2</td><td align="left">Requirements</td><td align="left"> </td><td align="left"> </td><td align="left">missing</td><td align="left"> </td></tr><tr><td align="left">7.3</td><td align="left">Regular expressions summary</td><td align="left"> </td><td align="left"> </td><td align="left">missing</td><td align="left"> </td></tr><tr><td align="left">7.4</td><td align="left">Header <code class="code"><regex></code> synopsis</td><td align="left"> </td><td align="left"> </td><td align="left">missing</td><td align="left"> </td></tr><tr><td align="left">7.5</td><td align="left">Namespace <code class="code">tr1::regex_constants</code></td><td align="left"> </td><td align="left"> </td><td align="left">missing</td><td align="left"> </td></tr><tr><td align="left">7.5.1</td><td align="left">Bitmask Type <code class="code">syntax_option_type</code></td><td align="left"> </td><td align="left"> </td><td align="left">missing</td><td align="left"> </td></tr><tr><td align="left">7.5.2</td><td align="left">Bitmask Type <code class="code">regex_constants::match_flag_type</code></td><td align="left"> </td><td align="left"> </td><td align="left">missing</td><td align="left"> </td></tr><tr><td align="left">7.5.3</td><td align="left">Implementation defined <code class="code">error_type</code></td><td align="left"> </td><td align="left"> </td><td align="left">missing</td><td align="left"> </td></tr><tr><td align="left">7.6</td><td align="left">Class <code class="code">regex_error</code></td><td align="left"> </td><td align="left"> </td><td align="left">missing</td><td align="left"> </td></tr><tr><td align="left">7.7</td><td align="left">Class template <code class="code">regex_traits</code></td><td align="left"> </td><td align="left"> </td><td align="left">missing</td><td align="left"> </td></tr><tr><td align="left">7.8</td><td align="left">Class template <code class="code">basic_regex</code></td><td align="left"> </td><td align="left"> </td><td align="left">missing</td><td align="left"> </td></tr><tr><td align="left">7.8.1</td><td align="left"><code class="code">basic_regex</code> constants</td><td align="left"> </td><td align="left"> </td><td align="left">missing</td><td align="left"> </td></tr><tr><td align="left">7.8.2</td><td align="left"><code class="code">basic_regex</code> constructors</td><td align="left"> </td><td align="left"> </td><td align="left">missing</td><td align="left"> </td></tr><tr><td align="left">7.8.3</td><td align="left"><code class="code">basic_regex</code> assign</td><td align="left"> </td><td align="left"> </td><td align="left">missing</td><td align="left"> </td></tr><tr><td align="left">7.8.4</td><td align="left"><code class="code">basic_regex</code> constant operations</td><td align="left"> </td><td align="left"> </td><td align="left">missing</td><td align="left"> </td></tr><tr><td align="left">7.8.5</td><td align="left"><code class="code">basic_regex</code> locale</td><td align="left"> </td><td align="left"> </td><td align="left">missing</td><td align="left"> </td></tr><tr><td align="left">7.8.6</td><td align="left"><code class="code">basic_regex</code> swap</td><td align="left"> </td><td align="left"> </td><td align="left">missing</td><td align="left"> </td></tr><tr><td align="left">7.8.7</td><td align="left"><code class="code">basic_regex</code> non-member functions</td><td align="left"> </td><td align="left"> </td><td align="left">missing</td><td align="left"> </td></tr><tr><td align="left">7.8.7.1</td><td align="left"><code class="code">basic_regex</code> non-member swap</td><td align="left"> </td><td align="left"> </td><td align="left">missing</td><td align="left"> </td></tr><tr><td align="left">7.9</td><td align="left">Class template <code class="code">sub_match</code></td><td align="left"> </td><td align="left"> </td><td align="left">missing</td><td align="left"> </td></tr><tr><td align="left">7.9.1</td><td align="left"><code class="code">sub_match</code> members</td><td align="left"> </td><td align="left"> </td><td align="left">missing</td><td align="left"> </td></tr><tr><td align="left">7.9.2</td><td align="left"><code class="code">sub_match</code> non-member operators</td><td align="left"> </td><td align="left"> </td><td align="left">missing</td><td align="left"> </td></tr><tr><td align="left">7.10</td><td align="left">Class template <code class="code">match_results</code></td><td align="left"> </td><td align="left"> </td><td align="left">missing</td><td align="left"> </td></tr><tr><td align="left">7.10.1</td><td align="left"><code class="code">match_results</code> constructors</td><td align="left"> </td><td align="left"> </td><td align="left">missing</td><td align="left"> </td></tr><tr><td align="left">7.10.2</td><td align="left"><code class="code">match_results</code> size</td><td align="left"> </td><td align="left"> </td><td align="left">missing</td><td align="left"> </td></tr><tr><td align="left">7.10.3</td><td align="left"><code class="code">match_results</code> element access</td><td align="left"> </td><td align="left"> </td><td align="left">missing</td><td align="left"> </td></tr><tr><td align="left">7.10.4</td><td align="left"><code class="code">match_results</code> formatting</td><td align="left"> </td><td align="left"> </td><td align="left">missing</td><td align="left"> </td></tr><tr><td align="left">7.10.5</td><td align="left"><code class="code">match_results</code> allocator</td><td align="left"> </td><td align="left"> </td><td align="left">missing</td><td align="left"> </td></tr><tr><td align="left">7.10.6</td><td align="left"><code class="code">match_results</code> swap</td><td align="left"> </td><td align="left"> </td><td align="left">missing</td><td align="left"> </td></tr><tr><td align="left">7.11</td><td align="left">Regular expression algorithms</td><td align="left"> </td><td align="left"> </td><td align="left">missing</td><td align="left"> </td></tr><tr><td align="left">7.11.1</td><td align="left">exceptions</td><td align="left"> </td><td align="left"> </td><td align="left">missing</td><td align="left"> </td></tr><tr><td align="left">7.11.2</td><td align="left"><code class="code">regex_match</code></td><td align="left"> </td><td align="left"> </td><td align="left">missing</td><td align="left"> </td></tr><tr><td align="left">7.11.3</td><td align="left"><code class="code">regex_search</code></td><td align="left"> </td><td align="left"> </td><td align="left">missing</td><td align="left"> </td></tr><tr><td align="left">7.11.4</td><td align="left"><code class="code">regex_replace</code></td><td align="left"> </td><td align="left"> </td><td align="left">missing</td><td align="left"> </td></tr><tr><td align="left">7.12</td><td align="left">Regular expression Iterators</td><td align="left"> </td><td align="left"> </td><td align="left">missing</td><td align="left"> </td></tr><tr><td align="left">7.12.1</td><td align="left">Class template <code class="code">regex_iterator</code></td><td align="left"> </td><td align="left"> </td><td align="left">missing</td><td align="left"> </td></tr><tr><td align="left">7.12.1.1</td><td align="left"><code class="code">regex_iterator</code> constructors</td><td align="left"> </td><td align="left"> </td><td align="left">missing</td><td align="left"> </td></tr><tr><td align="left">7.12.1.2</td><td align="left"><code class="code">regex_iterator</code> comparisons</td><td align="left"> </td><td align="left"> </td><td align="left">missing</td><td align="left"> </td></tr><tr><td align="left">7.12.1.3</td><td align="left"><code class="code">regex_iterator</code> dereference</td><td align="left"> </td><td align="left"> </td><td align="left">missing</td><td align="left"> </td></tr><tr><td align="left">7.12.1.4</td><td align="left"><code class="code">regex_iterator</code> increment</td><td align="left"> </td><td align="left"> </td><td align="left">missing</td><td align="left"> </td></tr><tr><td align="left">7.12.2</td><td align="left">Class template <code class="code">regex_token_iterator</code></td><td align="left"> </td><td align="left"> </td><td align="left">missing</td><td align="left"> </td></tr><tr><td align="left">7.12.2.1</td><td align="left"><code class="code">regex_token_iterator</code> constructors</td><td align="left"> </td><td align="left"> </td><td align="left">missing</td><td align="left"> </td></tr><tr><td align="left">7.12.2.2</td><td align="left"><code class="code">regex_token_iterator</code> comparisons</td><td align="left"> </td><td align="left"> </td><td align="left">missing</td><td align="left"> </td></tr><tr><td align="left">7.12.2.3</td><td align="left"><code class="code">regex_token_iterator</code> dereference</td><td align="left"> </td><td align="left"> </td><td align="left">missing</td><td align="left"> </td></tr><tr><td align="left">7.12.2.4</td><td align="left"><code class="code">regex_token_iterator</code> increment</td><td align="left"> </td><td align="left"> </td><td align="left">missing</td><td align="left"> </td></tr><tr><td align="left">7.13</td><td align="left">Modified ECMAScript regular expression grammar</td><td align="left"> </td><td align="left"> </td><td align="left">missing</td><td align="left"> </td></tr><tr><td align="left"><span class="emphasis"><em>8</em></span></td><td colspan="5" align="left"><span class="emphasis"><em>C Compatibility</em></span></td></tr><tr><td align="left">8.1</td><td align="left">Additions to header <code class="code"><complex></code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">8.1.1</td><td align="left">Synopsis</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">8.1.2</td><td align="left">Function <code class="code">acos</code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">8.1.3</td><td align="left">Function <code class="code">asin</code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">8.1.4</td><td align="left">Function <code class="code">atan</code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">8.1.5</td><td align="left">Function <code class="code">acosh</code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">8.1.6</td><td align="left">Function <code class="code">asinh</code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">8.1.7</td><td align="left">Function <code class="code">atanh</code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">8.1.8</td><td align="left">Function <code class="code">fabs</code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">8.1.9</td><td align="left">Additional Overloads</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">8.2</td><td align="left">Header <code class="code"><ccomplex></code></td><td align="left"> </td><td align="left"> </td><td align="left">missing</td><td align="left">DR 551</td></tr><tr><td align="left">8.3</td><td align="left">Header <code class="code"><complex.h></code></td><td align="left"> </td><td align="left"> </td><td align="left">missing</td><td align="left">DR 551</td></tr><tr><td align="left">8.4</td><td align="left">Additions to header <code class="code"><cctype></code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">8.4.1</td><td align="left">Synopsis</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">8.4.2</td><td align="left">Function <code class="code">isblank</code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">8.5</td><td align="left">Additions to header <code class="code"><ctype.h></code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">8.6</td><td align="left">Header <code class="code"><cfenv></code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">8.6.1</td><td align="left">Synopsis</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">8.6.2</td><td align="left">Definitions</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">8.7</td><td align="left">Header <code class="code"><fenv.h></code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">8.8</td><td align="left">Additions to header <code class="code"><cfloat></code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">8.9</td><td align="left">Additions to header <code class="code"><float.h></code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">8.10</td><td align="left">Additions to header <code class="code"><ios></code></td><td align="left"> </td><td align="left"> </td><td align="left">missing</td><td align="left"> </td></tr><tr><td align="left">8.10.1</td><td align="left">Synopsis</td><td align="left"> </td><td align="left"> </td><td align="left">missing</td><td align="left"> </td></tr><tr><td align="left">8.10.2</td><td align="left">Function <code class="code">hexfloat</code></td><td align="left"> </td><td align="left"> </td><td align="left">missing</td><td align="left"> </td></tr><tr><td align="left">8.11</td><td align="left">Header <code class="code"><cinttypes></code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">8.11.1</td><td align="left">Synopsis</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left">DR 557</td></tr><tr><td align="left">8.11.2</td><td align="left">Definitions</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">8.12</td><td align="left">Header <code class="code"><inttypes.h></code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">8.13</td><td align="left">Additions to header <code class="code"><climits></code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">8.14</td><td align="left">Additions to header <code class="code"><limits.h></code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">8.15</td><td align="left">Additions to header <code class="code"><locale></code></td><td align="left"> </td><td align="left"> </td><td align="left">missing</td><td align="left"> </td></tr><tr><td align="left">8.16</td><td align="left">Additions to header <code class="code"><cmath></code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">8.16.1</td><td align="left">Synopsis</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">8.16.2</td><td align="left">Definitions</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">8.16.3</td><td align="left">Function template definitions</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">8.16.4</td><td align="left">Additional overloads</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left">DR 568; DR 550</td></tr><tr><td align="left">8.17</td><td align="left">Additions to header <code class="code"><math.h></code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">8.18</td><td align="left">Additions to header <code class="code"><cstdarg></code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">8.19</td><td align="left">Additions to header <code class="code"><stdarg.h></code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">8.20</td><td align="left">The header <code class="code"><cstdbool></code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">8.21</td><td align="left">The header <code class="code"><stdbool.h></code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">8.22</td><td align="left">The header <code class="code"><cstdint></code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">8.22.1</td><td align="left">Synopsis</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">8.22.2</td><td align="left">Definitions</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">8.23</td><td align="left">The header <code class="code"><stdint.h></code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">8.24</td><td align="left">Additions to header <code class="code"><cstdio></code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">8.24.1</td><td align="left">Synopsis</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">8.24.2</td><td align="left">Definitions</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">8.24.3</td><td align="left">Additional format specifiers</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left">C library responsibility</td></tr><tr><td align="left">8.24.4</td><td align="left">Additions to header <code class="code"><stdio.h></code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">8.25</td><td align="left">Additions to header <code class="code"><cstdlib></code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">8.25.1</td><td align="left">Synopsis</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">8.25.2</td><td align="left">Definitions</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">8.25.3</td><td align="left">Function <code class="code">abs</code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">8.25.4</td><td align="left">Function <code class="code">div</code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">8.26</td><td align="left">Additions to header <code class="code"><stdlib.h></code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">8.27</td><td align="left">Header <code class="code"><ctgmath></code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left">DR 551</td></tr><tr><td align="left">8.28</td><td align="left">Header <code class="code"><tgmath.h></code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left">DR 551</td></tr><tr><td align="left">8.29</td><td align="left">Additions to header <code class="code"><ctime></code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left">C library responsibility</td></tr><tr><td align="left">8.30</td><td align="left">Additions to header <code class="code"><cwchar></code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">8.30.1</td><td align="left">Synopsis</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">8.30.2</td><td align="left">Definitions</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">8.30.3</td><td align="left">Additional wide format specifiers</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left">C library responsibility</td></tr><tr><td align="left">8.31</td><td align="left">Additions to header <code class="code"><wchar.h></code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">8.32</td><td align="left">Additions to header <code class="code"><cwctype></code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">8.32.1</td><td align="left">Synopsis</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">8.32.2</td><td align="left">Function <code class="code">iswblank</code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">8.33</td><td align="left">Additions to header <code class="code"><wctype.h></code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr></tbody></table></div></div><br class="table-break" /><p> Footnotes </p><p> The shared_ptr implementation uses some code from the @@ -6120,9 +6120,9 @@ presence of the required flag. </p><p> This page describes the C++0x support in mainline GCC SVN, not in any particular release. -</p><div class="table"><a id="id472768"></a><p class="title"><b>Table 1.2. C++ 200x Implementation Status</b></p><div class="table-contents"><table summary="C++ 200x Implementation Status" border="1"><colgroup><col align="left" /><col align="left" /><col align="left" /><col align="left" /><col align="left" /><col align="left" /></colgroup><thead><tr><th align="left">Section</th><th align="left">Description</th><th align="left">Done</th><th align="left">Broken</th><th align="left">Missing</th><th align="left">Comments</th></tr></thead><tbody><tr><td align="left"><span class="emphasis"><em>20</em></span></td><td colspan="5" align="left"><span class="emphasis"><em>General Utilities</em></span></td></tr><tr><td align="left">20.2</td><td align="left">Utility Components</td><td align="left"> </td><td align="left"> </td><td align="left">incomplete</td><td align="left"> </td></tr><tr><td align="left">20.2.1</td><td align="left">Operators</td><td align="left"> </td><td align="left"> </td><td align="left">partial</td><td align="left"> </td></tr><tr><td align="left">20.2.2</td><td align="left">forward/move helpers</td><td align="left"> </td><td align="left"> </td><td align="left">partial</td><td align="left"> </td></tr><tr><td align="left">20.2.3</td><td align="left">Pairs</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">20.3</td><td align="left">Header <code class="code"><tuple></code> synopsis</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">20.3.1</td><td align="left">Class template <code class="code">tuple</code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">20.3.1.1</td><td align="left">Construction</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">20.3.1.2</td><td align="left">Tuple creation functions</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">20.3.1.3</td><td align="left">Tuple helper classes</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">20.3.1.4</td><td align="left">Element access</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">20.3.1.5</td><td align="left">Relational operators</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">20.4</td><td colspan="5" align="left"><span class="emphasis"><em>Metaprogramming and type traits</em></span></td></tr><tr><td align="left">20.4.1</td><td align="left">Requirements</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">20.4.2</td><td align="left">Header <code class="code"><type_traits></code> synopsis</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">20.4.3</td><td align="left">Helper classes</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">20.4.4</td><td align="left">General Requirements</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">20.4.5</td><td align="left">Unary Type Traits</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">20.4.5.1</td><td align="left">Primary Type Categories</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">20.4.5.2</td><td align="left">Composite type traits</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">20.4.5.3</td><td align="left">Type properties</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">20.4.6</td><td align="left">Relationships between types</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">20.4.7</td><td align="left">Transformations between types</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">20.4.7.1</td><td align="left">Const-volatile modifications</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">20.4.7.2</td><td align="left">Reference modifications</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">20.4.7.3</td><td align="left">Array modifications</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">20.4.7.4</td><td align="left">Pointer modifications</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">20.4.8</td><td align="left">Other transformations</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">20.4.9</td><td align="left">Implementation requirements</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">20.5 </td><td align="left">Function Objects</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">20.5</td><td align="left">Additions to header <code class="code"><functional></code> synopsis</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">20.5.1</td><td align="left">Definitions</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">20.5.2</td><td align="left">Requirements</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">20.5.3</td><td align="left">Base</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">20.5.4</td><td align="left">Function return types</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">20.5.5</td><td align="left">Class template <code class="code">reference_wrapper</code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">20.5.5.1</td><td align="left"><code class="code">reference_wrapper</code> construct/copy/destroy</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">20.5.5.2</td><td align="left"><code class="code">reference_wrapper</code> assignment</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">20.5.5.3</td><td align="left"><code class="code">reference_wrapper</code> access</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">20.5.5.4</td><td align="left"><code class="code">reference_wrapper</code> invocation</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">20.5.5.5</td><td align="left"><code class="code">reference_wrapper</code> helper functions</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">20.5.14</td><td align="left">Function template <code class="code">mem_fn</code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">20.5.11</td><td align="left">Template function bind</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">20.5.11.1</td><td align="left">Function object binders</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">20.5.11.1.1</td><td align="left">Class template <code class="code">is_bind_expression</code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">20.5.11.1.2</td><td align="left">Class template <code class="code">is_placeholder</code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">20.5.11.1.3</td><td align="left">Function template <code class="code">bind</code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">20.5.11.1.4</td><td align="left">Placeholders</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">20.5.15</td><td align="left">Polymorphic function wrappers</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">20.5.15.1</td><td align="left">Class <code class="code">bad_function_call<code class="code"></code></code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">20.5.15.1.1</td><td align="left"><code class="code">bad_function_call</code> constructor</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">20.5.15.2</td><td align="left">Class template <code class="code">function</code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">20.5.15.2.1</td><td align="left"><code class="code">function</code> construct/copy/destroy</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">20.5.15.2.2</td><td align="left"><code class="code">function</code> modifiers</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">20.5.15.2.3</td><td align="left"><code class="code">function</code> capacity</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">20.5.15.2.4</td><td align="left"><code class="code">function</code> invocation</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">20.5.15.2.5</td><td align="left"><code class="code">function</code> target access</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">20.5.15.2.7</td><td align="left">null pointer comparison operators</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">20.5.15.2.8</td><td align="left">specialized algorithms</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">20.5.16</td><td align="left">Class template <code class="code">hash</code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">20.6</td><td align="left">Additions to header <code class="code"><memory></code> synopsis</td><td align="left"> </td><td align="left"> </td><td align="left">partial</td><td align="left">missing <code class="code">unique_ptr</code></td></tr><tr><td align="left">20.6.5</td><td align="left">Class template <code class="code">unique_ptr</code></td><td align="left"> </td><td align="left"> </td><td align="left">missing</td><td align="left"> </td></tr><tr><td align="left">20.6.6</td><td align="left">Smart pointers</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">20.6.6.1</td><td align="left">Class <code class="code">bad_weak_ptr</code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">20.6.6.2</td><td align="left">Class template <code class="code">shared_ptr</code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left">See Footnotes.</td></tr><tr><td align="left">20.6.6.2.1</td><td align="left"><code class="code">shared_ptr</code> constructors</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">20.6.6.2.2</td><td align="left"><code class="code">shared_ptr</code> destructor</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">20.6.6.2.3</td><td align="left"><code class="code">shared_ptr</code> assignment</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">20.6.6.2.4</td><td align="left"><code class="code">shared_ptr</code> modifiers</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">20.6.6.2.5</td><td align="left"><code class="code">shared_ptr</code> observers</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">20.6.6.2.6</td><td align="left"><code class="code">shared_ptr</code> creation</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> +</p><div class="table"><a id="id428196"></a><p class="title"><b>Table 1.2. C++ 200x Implementation Status</b></p><div class="table-contents"><table summary="C++ 200x Implementation Status" border="1"><colgroup><col align="left" /><col align="left" /><col align="left" /><col align="left" /><col align="left" /><col align="left" /></colgroup><thead><tr><th align="left">Section</th><th align="left">Description</th><th align="left">Done</th><th align="left">Broken</th><th align="left">Missing</th><th align="left">Comments</th></tr></thead><tbody><tr><td align="left"><span class="emphasis"><em>20</em></span></td><td colspan="5" align="left"><span class="emphasis"><em>General Utilities</em></span></td></tr><tr><td align="left">20.2</td><td align="left">Utility Components</td><td align="left"> </td><td align="left"> </td><td align="left">incomplete</td><td align="left"> </td></tr><tr><td align="left">20.2.1</td><td align="left">Operators</td><td align="left"> </td><td align="left"> </td><td align="left">partial</td><td align="left"> </td></tr><tr><td align="left">20.2.2</td><td align="left">forward/move helpers</td><td align="left"> </td><td align="left"> </td><td align="left">partial</td><td align="left"> </td></tr><tr><td align="left">20.2.3</td><td align="left">Pairs</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">20.3</td><td align="left">Header <code class="code"><tuple></code> synopsis</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">20.3.1</td><td align="left">Class template <code class="code">tuple</code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">20.3.1.1</td><td align="left">Construction</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">20.3.1.2</td><td align="left">Tuple creation functions</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">20.3.1.3</td><td align="left">Tuple helper classes</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">20.3.1.4</td><td align="left">Element access</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">20.3.1.5</td><td align="left">Relational operators</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">20.4</td><td colspan="5" align="left"><span class="emphasis"><em>Metaprogramming and type traits</em></span></td></tr><tr><td align="left">20.4.1</td><td align="left">Requirements</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">20.4.2</td><td align="left">Header <code class="code"><type_traits></code> synopsis</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">20.4.3</td><td align="left">Helper classes</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">20.4.4</td><td align="left">General Requirements</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">20.4.5</td><td align="left">Unary Type Traits</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">20.4.5.1</td><td align="left">Primary Type Categories</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">20.4.5.2</td><td align="left">Composite type traits</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">20.4.5.3</td><td align="left">Type properties</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">20.4.6</td><td align="left">Relationships between types</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">20.4.7</td><td align="left">Transformations between types</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">20.4.7.1</td><td align="left">Const-volatile modifications</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">20.4.7.2</td><td align="left">Reference modifications</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">20.4.7.3</td><td align="left">Array modifications</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">20.4.7.4</td><td align="left">Pointer modifications</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">20.4.8</td><td align="left">Other transformations</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">20.4.9</td><td align="left">Implementation requirements</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">20.5 </td><td align="left">Function Objects</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">20.5</td><td align="left">Additions to header <code class="code"><functional></code> synopsis</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">20.5.1</td><td align="left">Definitions</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">20.5.2</td><td align="left">Requirements</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">20.5.3</td><td align="left">Base</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">20.5.4</td><td align="left">Function return types</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">20.5.5</td><td align="left">Class template <code class="code">reference_wrapper</code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">20.5.5.1</td><td align="left"><code class="code">reference_wrapper</code> construct/copy/destroy</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">20.5.5.2</td><td align="left"><code class="code">reference_wrapper</code> assignment</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">20.5.5.3</td><td align="left"><code class="code">reference_wrapper</code> access</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">20.5.5.4</td><td align="left"><code class="code">reference_wrapper</code> invocation</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">20.5.5.5</td><td align="left"><code class="code">reference_wrapper</code> helper functions</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">20.5.14</td><td align="left">Function template <code class="code">mem_fn</code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">20.5.11</td><td align="left">Template function bind</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">20.5.11.1</td><td align="left">Function object binders</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">20.5.11.1.1</td><td align="left">Class template <code class="code">is_bind_expression</code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">20.5.11.1.2</td><td align="left">Class template <code class="code">is_placeholder</code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">20.5.11.1.3</td><td align="left">Function template <code class="code">bind</code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">20.5.11.1.4</td><td align="left">Placeholders</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">20.5.15</td><td align="left">Polymorphic function wrappers</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">20.5.15.1</td><td align="left">Class <code class="code">bad_function_call<code class="code"></code></code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">20.5.15.1.1</td><td align="left"><code class="code">bad_function_call</code> constructor</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">20.5.15.2</td><td align="left">Class template <code class="code">function</code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">20.5.15.2.1</td><td align="left"><code class="code">function</code> construct/copy/destroy</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">20.5.15.2.2</td><td align="left"><code class="code">function</code> modifiers</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">20.5.15.2.3</td><td align="left"><code class="code">function</code> capacity</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">20.5.15.2.4</td><td align="left"><code class="code">function</code> invocation</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">20.5.15.2.5</td><td align="left"><code class="code">function</code> target access</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">20.5.15.2.7</td><td align="left">null pointer comparison operators</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">20.5.15.2.8</td><td align="left">specialized algorithms</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">20.5.16</td><td align="left">Class template <code class="code">hash</code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">20.6</td><td align="left">Additions to header <code class="code"><memory></code> synopsis</td><td align="left"> </td><td align="left"> </td><td align="left">partial</td><td align="left">missing <code class="code">unique_ptr</code></td></tr><tr><td align="left">20.6.5</td><td align="left">Class template <code class="code">unique_ptr</code></td><td align="left"> </td><td align="left"> </td><td align="left">missing</td><td align="left"> </td></tr><tr><td align="left">20.6.6</td><td align="left">Smart pointers</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">20.6.6.1</td><td align="left">Class <code class="code">bad_weak_ptr</code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">20.6.6.2</td><td align="left">Class template <code class="code">shared_ptr</code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left">See Footnotes.</td></tr><tr><td align="left">20.6.6.2.1</td><td align="left"><code class="code">shared_ptr</code> constructors</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">20.6.6.2.2</td><td align="left"><code class="code">shared_ptr</code> destructor</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">20.6.6.2.3</td><td align="left"><code class="code">shared_ptr</code> assignment</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">20.6.6.2.4</td><td align="left"><code class="code">shared_ptr</code> modifiers</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">20.6.6.2.5</td><td align="left"><code class="code">shared_ptr</code> observers</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">20.6.6.2.6</td><td align="left"><code class="code">shared_ptr</code> creation</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> <a class="ulink" href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2351.htm" target="_top">N2351</a> - </td></tr><tr><td align="left">20.6.6.2.7</td><td align="left"><code class="code">shared_ptr</code> comparison</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">20.6.6.2.8</td><td align="left"><code class="code">shared_ptr</code> I/O</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">20.6.6.2.9</td><td align="left"><code class="code">shared_ptr</code> specialized algorithms</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">20.6.6.2.10</td><td align="left"><code class="code">shared_ptr</code> casts</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">20.6.6.2.11</td><td align="left"><code class="code">get_deleter</code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">20.6.6.3</td><td align="left">Class template <code class="code">weak_ptr</code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">20.6.6.3.1</td><td align="left"><code class="code">weak_ptr</code> constructors</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">20.6.6.3.2</td><td align="left"><code class="code">weak_ptr</code> destructor</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">20.6.6.3.3</td><td align="left"><code class="code">weak_ptr</code> assignment</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">20.6.6.3.4</td><td align="left"><code class="code">weak_ptr</code> modifiers</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">20.6.6.3.5</td><td align="left"><code class="code">weak_ptr</code> observers</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">20.6.6.3.6</td><td align="left"><code class="code">weak_ptr</code> comparison</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">20.6.6.3.7</td><td align="left"><code class="code">weak_ptr</code> specialized algorithms</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">20.6.6.4</td><td align="left">Class template <code class="code">enable_shared_from_this</code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left"><span class="emphasis"><em>23</em></span></td><td colspan="5" align="left"><span class="emphasis"><em>Containers</em></span></td></tr><tr><td align="left">23.2.1</td><td align="left">Header <code class="code"><array></code> synopsis</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">23.2.1</td><td align="left">Class template array</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">23.2.1.1</td><td align="left"><code class="code">array</code> constructors, copy, and assignment</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">23.2.1.2</td><td align="left"><code class="code">array</code> specialized algorithms</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">23.2.1.3</td><td align="left"><code class="code">array </code>size</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">23.2.1.4</td><td align="left"><code class="code">array </code>data</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">23.2.1.5</td><td align="left">Zero sized <code class="code">array</code>s</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">23.2.1.6</td><td align="left">Tuple interface to class template <code class="code">array</code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">23.4</td><td align="left">Unordered associative containers</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">23.4.1</td><td align="left">Class template <code class="code">unordered_map</code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">23.4.1.1</td><td align="left"><code class="code">unordered_map</code> constructors</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">23.4.1.2</td><td align="left"><code class="code">unordered_map</code> element access</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">23.4.1.3</td><td align="left"><code class="code">unordered_map</code> swap</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">23.4.2</td><td align="left">Class template <code class="code">unordered_multimap</code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">23.4.2.1</td><td align="left"><code class="code">unordered_multimap</code> constructors</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">23.4.2.2</td><td align="left"><code class="code">unordered_multimap</code> swap</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">23.4.3</td><td align="left">Class template <code class="code">unordered_set</code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">23.4.3.1</td><td align="left"><code class="code">unordered_set</code> constructors</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">23.4.3.2</td><td align="left"><code class="code">unordered_set</code> swap</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">23.4.4</td><td align="left">Class template <code class="code">unordered_multiset<code class="code"></code></code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">23.4.4.1</td><td align="left"><code class="code">unordered_multiset</code> constructors</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">23.4.4.2</td><td align="left"><code class="code">unordered_multiset</code> swap</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left"><span class="emphasis"><em>26</em></span></td><td colspan="5" align="left"><span class="emphasis"><em>Numerics</em></span></td></tr><tr><td align="left">26.4</td><td align="left">Random number generation</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">26.4.1</td><td align="left">Requirements</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">26.4.2</td><td align="left">Header <code class="code"><random></code> synopsis</td><td align="left"> </td><td align="left"> </td><td align="left">partial</td><td align="left"> </td></tr><tr><td align="left">26.4.3</td><td align="left">Random number engine class templates</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">26.4.3.1</td><td align="left">Class template <code class="code">linear_congruential_engine</code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">26.4.3.2</td><td align="left">Class template <code class="code">mersenne_twister_engine</code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">26.4.3.3</td><td align="left">Class template <code class="code">subtract_with_carry_engine</code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">26.4.4</td><td align="left">Random number engine adaptor class templates</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">26.4.4.1</td><td align="left">Class template <code class="code">discard_block_engine</code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">26.4.4.2</td><td align="left">Class template <code class="code">independent_bits_engine</code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">26.4.4.3</td><td align="left">Class template <code class="code">shuffle_order_engine</code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">26.4.4.4</td><td align="left">Class template <code class="code">xor_combine_engine</code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left">operator()() per N2079</td></tr><tr><td align="left">26.4.5</td><td align="left">Engines and engine adaptors with predefined parameters</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">26.4.6</td><td align="left">Class <code class="code">random_device</code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">26.4.7</td><td align="left">Utilities</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">26.4.7.1</td><td align="left">Class <code class="code">seed_seq</code></td><td align="left"> </td><td align="left"> </td><td align="left">missing</td><td align="left"> </td></tr><tr><td align="left">26.4.7.2</td><td align="left">Function template <code class="code">generate_cannonical</code></td><td align="left"> </td><td align="left"> </td><td align="left">missing</td><td align="left"> </td></tr><tr><td align="left">26.4.8</td><td align="left">Random number generation class templates</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">26.4.8.1</td><td align="left">Uniform distributions</td><td align="left"> </td><td align="left"> </td><td align="left">partial</td><td align="left"> </td></tr><tr><td align="left">26.4.8.1</td><td align="left">Class template <code class="code">uniform_int_distribution</code></td><td align="left"> </td><td align="left"> </td><td align="left">missing</td><td align="left"> </td></tr><tr><td align="left">26.4.8.1</td><td align="left">Class template <code class="code">uniform_real_distribution</code></td><td align="left"> </td><td align="left"> </td><td align="left">missing</td><td align="left"> </td></tr><tr><td align="left">26.4.8.2</td><td align="left">Bernoulli distributions</td><td align="left"> </td><td align="left"> </td><td align="left">partial</td><td align="left"> </td></tr><tr><td align="left">26.4.8.2.1</td><td align="left">Class <code class="code">bernoulli_distribution</code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">26.4.8.2.2</td><td align="left">Class template <code class="code">binomial_distribution</code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">26.4.8.2.3</td><td align="left">Class template <code class="code">geometric_distribution</code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">26.4.8.2.4</td><td align="left">Class template <code class="code">negative_binomial_distribution</code></td><td align="left"> </td><td align="left"> </td><td align="left">missing</td><td align="left"> </td></tr><tr><td align="left">26.4.8.3</td><td align="left">Poisson distributions</td><td align="left"> </td><td align="left"> </td><td align="left">partial</td><td align="left"> </td></tr><tr><td align="left">26.4.8.3.1</td><td align="left">Class template <code class="code">poisson_distribution</code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">26.4.8.3.2</td><td align="left">Class template <code class="code">exponential_distribution</code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">26.4.8.3.3</td><td align="left">Class template <code class="code">gamma_distribution</code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">26.4.8.3.4</td><td align="left">Class template <code class="code">weibull_distribution</code></td><td align="left"> </td><td align="left"> </td><td align="left">missing</td><td align="left"> </td></tr><tr><td align="left">26.4.8.3.5</td><td align="left">Class template <code class="code">extreme_value_distribution</code></td><td align="left"> </td><td align="left"> </td><td align="left">missing</td><td align="left"> </td></tr><tr><td align="left">26.4.8.4</td><td align="left">Normal distributions</td><td align="left"> </td><td align="left"> </td><td align="left">partial</td><td align="left"> </td></tr><tr><td align="left">26.4.8.4.1</td><td align="left">Class template <code class="code">normal_distribution</code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">26.4.8.4.2</td><td align="left">Class template <code class="code">lognormal_distribution</code></td><td align="left"> </td><td align="left"> </td><td align="left">missing</td><td align="left"> </td></tr><tr><td align="left">26.4.8.4.3</td><td align="left">Class template <code class="code">chi_squared_distribution</code></td><td align="left"> </td><td align="left"> </td><td align="left">missing</td><td align="left"> </td></tr><tr><td align="left">26.4.8.4.4</td><td align="left">Class template <code class="code">cauchy_distribution</code></td><td align="left"> </td><td align="left"> </td><td align="left">missing</td><td align="left"> </td></tr><tr><td align="left">26.4.8.4.5</td><td align="left">Class template <code class="code">fisher_f_distribution</code></td><td align="left"> </td><td align="left"> </td><td align="left">missing</td><td align="left"> </td></tr><tr><td align="left">26.4.8.4.6</td><td align="left">Class template <code class="code">student_t_distribution</code></td><td align="left"> </td><td align="left"> </td><td align="left">missing</td><td align="left"> </td></tr><tr><td align="left">26.4.8.5</td><td align="left">Sampling distributions</td><td align="left"> </td><td align="left"> </td><td align="left">missing</td><td align="left"> </td></tr><tr><td align="left">26.4.8.5.1</td><td align="left">Class template <code class="code">discrete_distribution</code></td><td align="left"> </td><td align="left"> </td><td align="left">missing</td><td align="left"> </td></tr><tr><td align="left">26.4.8.5.1</td><td align="left">Class template <code class="code">piecewise_constant_distribution</code></td><td align="left"> </td><td align="left"> </td><td align="left">missing</td><td align="left"> </td></tr><tr><td align="left">26.4.8.5.1</td><td align="left">Class template <code class="code">general_pdf_distribution</code></td><td align="left"> </td><td align="left"> </td><td align="left">missing</td><td align="left"> </td></tr><tr><td align="left"><span class="emphasis"><em>28</em></span></td><td colspan="5" align="left"><span class="emphasis"><em>Regular Expressions</em></span></td></tr><tr><td align="left">28.1</td><td align="left">Definitions</td><td align="left"> </td><td align="left"> </td><td align="left">missing</td><td align="left"> </td></tr><tr><td align="left">28.2</td><td align="left">Requirements</td><td align="left"> </td><td align="left"> </td><td align="left">missing</td><td align="left"> </td></tr><tr><td align="left">28.3</td><td align="left">Regular expressions summary</td><td align="left"> </td><td align="left"> </td><td align="left">missing</td><td align="left"> </td></tr><tr><td align="left">28.4</td><td align="left">Header <code class="code"><regex></code> synopsis</td><td align="left"> </td><td align="left"> </td><td align="left">missing</td><td align="left"> </td></tr><tr><td align="left">28.5</td><td align="left">Namespace <code class="code">tr1::regex_constants</code></td><td align="left"> </td><td align="left"> </td><td align="left">missing</td><td align="left"> </td></tr><tr><td align="left">28.5.1</td><td align="left">Bitmask Type <code class="code">syntax_option_type</code></td><td align="left"> </td><td align="left"> </td><td align="left">missing</td><td align="left"> </td></tr><tr><td align="left">28.5.2</td><td align="left">Bitmask Type <code class="code">regex_constants::match_flag_type</code></td><td align="left"> </td><td align="left"> </td><td align="left">missing</td><td align="left"> </td></tr><tr><td align="left">28.5.3</td><td align="left">Implementation defined <code class="code">error_type</code></td><td align="left"> </td><td align="left"> </td><td align="left">missing</td><td align="left"> </td></tr><tr><td align="left">28.6</td><td align="left">Class <code class="code">regex_error</code></td><td align="left"> </td><td align="left"> </td><td align="left">missing</td><td align="left"> </td></tr><tr><td align="left">28.7</td><td align="left">Class template <code class="code">regex_traits</code></td><td align="left"> </td><td align="left"> </td><td align="left">missing</td><td align="left"> </td></tr><tr><td align="left">28.8</td><td align="left">Class template <code class="code">basic_regex</code></td><td align="left"> </td><td align="left"> </td><td align="left">missing</td><td align="left"> </td></tr><tr><td align="left">28.8.1</td><td align="left"><code class="code">basic_regex</code> constants</td><td align="left"> </td><td align="left"> </td><td align="left">missing</td><td align="left"> </td></tr><tr><td align="left">28.8.2</td><td align="left"><code class="code">basic_regex</code> constructors</td><td align="left"> </td><td align="left"> </td><td align="left">missing</td><td align="left"> </td></tr><tr><td align="left">28.8.3</td><td align="left"><code class="code">basic_regex</code> assign</td><td align="left"> </td><td align="left"> </td><td align="left">missing</td><td align="left"> </td></tr><tr><td align="left">28.8.4</td><td align="left"><code class="code">basic_regex</code> constant operations</td><td align="left"> </td><td align="left"> </td><td align="left">missing</td><td align="left"> </td></tr><tr><td align="left">28.8.5</td><td align="left"><code class="code">basic_regex</code> locale</td><td align="left"> </td><td align="left"> </td><td align="left">missing</td><td align="left"> </td></tr><tr><td align="left">28.8.6</td><td align="left"><code class="code">basic_regex</code> swap</td><td align="left"> </td><td align="left"> </td><td align="left">missing</td><td align="left"> </td></tr><tr><td align="left">28.8.7</td><td align="left"><code class="code">basic_regex</code> non-member functions</td><td align="left"> </td><td align="left"> </td><td align="left">missing</td><td align="left"> </td></tr><tr><td align="left">28.8.7.1</td><td align="left"><code class="code">basic_regex</code> non-member swap</td><td align="left"> </td><td align="left"> </td><td align="left">missing</td><td align="left"> </td></tr><tr><td align="left">28.9</td><td align="left">Class template <code class="code">sub_match</code></td><td align="left"> </td><td align="left"> </td><td align="left">missing</td><td align="left"> </td></tr><tr><td align="left">28.9.1</td><td align="left"><code class="code">sub_match</code> members</td><td align="left"> </td><td align="left"> </td><td align="left">missing</td><td align="left"> </td></tr><tr><td align="left">28.9.2</td><td align="left"><code class="code">sub_match</code> non-member operators</td><td align="left"> </td><td align="left"> </td><td align="left">missing</td><td align="left"> </td></tr><tr><td align="left">28.10</td><td align="left">Class template <code class="code">match_results</code></td><td align="left"> </td><td align="left"> </td><td align="left">missing</td><td align="left"> </td></tr><tr><td align="left">28.10.1</td><td align="left"><code class="code">match_results</code> constructors</td><td align="left"> </td><td align="left"> </td><td align="left">missing</td><td align="left"> </td></tr><tr><td align="left">28.10.2</td><td align="left"><code class="code">match_results</code> size</td><td align="left"> </td><td align="left"> </td><td align="left">missing</td><td align="left"> </td></tr><tr><td align="left">28.10.3</td><td align="left"><code class="code">match_results</code> element access</td><td align="left"> </td><td align="left"> </td><td align="left">missing</td><td align="left"> </td></tr><tr><td align="left">28.10.4</td><td align="left"><code class="code">match_results</code> formatting</td><td align="left"> </td><td align="left"> </td><td align="left">missing</td><td align="left"> </td></tr><tr><td align="left">28.10.5</td><td align="left"><code class="code">match_results</code> allocator</td><td align="left"> </td><td align="left"> </td><td align="left">missing</td><td align="left"> </td></tr><tr><td align="left">28.10.6</td><td align="left"><code class="code">match_results</code> swap</td><td align="left"> </td><td align="left"> </td><td align="left">missing</td><td align="left"> </td></tr><tr><td align="left">28.11</td><td align="left">Regular expression algorithms</td><td align="left"> </td><td align="left"> </td><td align="left">missing</td><td align="left"> </td></tr><tr><td align="left">28.11.1</td><td align="left">exceptions</td><td align="left"> </td><td align="left"> </td><td align="left">missing</td><td align="left"> </td></tr><tr><td align="left">28.11.2</td><td align="left"><code class="code">regex_match</code></td><td align="left"> </td><td align="left"> </td><td align="left">missing</td><td align="left"> </td></tr><tr><td align="left">28.11.3</td><td align="left"><code class="code">regex_search</code></td><td align="left"> </td><td align="left"> </td><td align="left">missing</td><td align="left"> </td></tr><tr><td align="left">28.11.4</td><td align="left"><code class="code">regex_replace</code></td><td align="left"> </td><td align="left"> </td><td align="left">missing</td><td align="left"> </td></tr><tr><td align="left">28.12</td><td align="left">Regular expression Iterators</td><td align="left"> </td><td align="left"> </td><td align="left">missing</td><td align="left"> </td></tr><tr><td align="left">28.12.1</td><td align="left">Class template <code class="code">regex_iterator</code></td><td align="left"> </td><td align="left"> </td><td align="left">missing</td><td align="left"> </td></tr><tr><td align="left">28.12.1.1</td><td align="left"><code class="code">regex_iterator</code> constructors</td><td align="left"> </td><td align="left"> </td><td align="left">missing</td><td align="left"> </td></tr><tr><td align="left">28.12.1.2</td><td align="left"><code class="code">regex_iterator</code> comparisons</td><td align="left"> </td><td align="left"> </td><td align="left">missing</td><td align="left"> </td></tr><tr><td align="left">28.12.1.3</td><td align="left"><code class="code">regex_iterator</code> dereference</td><td align="left"> </td><td align="left"> </td><td align="left">missing</td><td align="left"> </td></tr><tr><td align="left">28.12.1.4</td><td align="left"><code class="code">regex_iterator</code> increment</td><td align="left"> </td><td align="left"> </td><td align="left">missing</td><td align="left"> </td></tr><tr><td align="left">28.12.2</td><td align="left">Class template <code class="code">regex_token_iterator</code></td><td align="left"> </td><td align="left"> </td><td align="left">missing</td><td align="left"> </td></tr><tr><td align="left">28.12.2.1</td><td align="left"><code class="code">regex_token_iterator</code> constructors</td><td align="left"> </td><td align="left"> </td><td align="left">missing</td><td align="left"> </td></tr><tr><td align="left">28.12.2.2</td><td align="left"><code class="code">regex_token_iterator</code> comparisons</td><td align="left"> </td><td align="left"> </td><td align="left">missing</td><td align="left"> </td></tr><tr><td align="left">28.12.2.3</td><td align="left"><code class="code">regex_token_iterator</code> dereference</td><td align="left"> </td><td align="left"> </td><td align="left">missing</td><td align="left"> </td></tr><tr><td align="left">28.12.2.4</td><td align="left"><code class="code">regex_token_iterator</code> increment</td><td align="left"> </td><td align="left"> </td><td align="left">missing</td><td align="left"> </td></tr><tr><td align="left">28.13</td><td align="left">Modified ECMAScript regular expression grammar</td><td align="left"> </td><td align="left"> </td><td align="left">missing</td><td align="left"> </td></tr><tr><td align="left"><span class="emphasis"><em>C</em></span></td><td colspan="5" align="left"><span class="emphasis"><em>C Compatibility</em></span></td></tr><tr><td align="left">C2.1</td><td align="left">Additions to header <code class="code"><complex></code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">C2.1.1</td><td align="left">Synopsis</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">C2.1.2</td><td align="left">Function <code class="code">acos</code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">C2.1.3</td><td align="left">Function <code class="code">asin</code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">C2.1.4</td><td align="left">Function <code class="code">atan</code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">C2.1.5</td><td align="left">Function <code class="code">acosh</code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">C2.1.6</td><td align="left">Function <code class="code">asinh</code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">C2.1.7</td><td align="left">Function <code class="code">atanh</code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">C2.1.8</td><td align="left">Function <code class="code">fabs</code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">C2.1.9</td><td align="left">Additional Overloads</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">C2.2</td><td align="left">Header <code class="code"><ccomplex></code></td><td align="left"> </td><td align="left"> </td><td align="left">missing</td><td align="left">DR 551</td></tr><tr><td align="left">C2.3</td><td align="left">Header <code class="code"><complex.h></code></td><td align="left"> </td><td align="left"> </td><td align="left">missing</td><td align="left">DR 551</td></tr><tr><td align="left">C2.4</td><td align="left">Additions to header <code class="code"><cctype></code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">C2.4.1</td><td align="left">Synopsis</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">C2.4.2</td><td align="left">Function <code class="code">isblank</code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">C2.5</td><td align="left">Additions to header <code class="code"><ctype.h></code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">C2.6</td><td align="left">Header <code class="code"><cfenv></code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">C2.6.1</td><td align="left">Synopsis</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">C2.6.2</td><td align="left">Definitions</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">C2.7</td><td align="left">Header <code class="code"><fenv.h></code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">C2.8</td><td align="left">Additions to header <code class="code"><cfloat></code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">C2.9</td><td align="left">Additions to header <code class="code"><float.h></code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">C2.10</td><td align="left">Additions to header <code class="code"><ios></code></td><td align="left"> </td><td align="left"> </td><td align="left">missing</td><td align="left"> </td></tr><tr><td align="left">C2.10.1</td><td align="left">Synopsis</td><td align="left"> </td><td align="left"> </td><td align="left">missing</td><td align="left"> </td></tr><tr><td align="left">C2.10.2</td><td align="left">Function <code class="code">hexfloat</code></td><td align="left"> </td><td align="left"> </td><td align="left">missing</td><td align="left"> </td></tr><tr><td align="left">C2.11</td><td align="left">Header <code class="code"><cinttypes></code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">C2.11.1</td><td align="left">Synopsis</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left">DR 557</td></tr><tr><td align="left">C2.11.2</td><td align="left">Definitions</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">C2.12</td><td align="left">Header <code class="code"><inttypes.h></code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">C2.13</td><td align="left">Additions to header <code class="code"><climits></code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">C2.14</td><td align="left">Additions to header <code class="code"><limits.h></code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">C2.15</td><td align="left">Additions to header <code class="code"><locale></code></td><td align="left"> </td><td align="left"> </td><td align="left">missing</td><td align="left"> </td></tr><tr><td align="left">C2.16</td><td align="left">Additions to header <code class="code"><cmath></code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">C2.16.1</td><td align="left">Synopsis</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">C2.16.2</td><td align="left">Definitions</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">C2.16.3</td><td align="left">Function template definitions</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">C2.16.4</td><td align="left">Additional overloads</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left">DR 568; DR 550</td></tr><tr><td align="left">C2.17</td><td align="left">Additions to header <code class="code"><math.h></code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">C2.18</td><td align="left">Additions to header <code class="code"><cstdarg></code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">C2.19</td><td align="left">Additions to header <code class="code"><stdarg.h></code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">C2.20</td><td align="left">The header <code class="code"><cstdbool></code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">C2.21</td><td align="left">The header <code class="code"><stdbool.h></code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">C2.22</td><td align="left">The header <code class="code"><cstdint></code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">C2.22.1</td><td align="left">Synopsis</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">C2.22.2</td><td align="left">Definitions</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">C2.23</td><td align="left">The header <code class="code"><stdint.h></code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">C2.24</td><td align="left">Additions to header <code class="code"><cstdio></code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">C2.24.1</td><td align="left">Synopsis</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">C2.24.2</td><td align="left">Definitions</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">C2.24.3</td><td align="left">Additional format specifiers</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left">C library responsibility</td></tr><tr><td align="left">C2.24.4</td><td align="left">Additions to header <code class="code"><stdio.h></code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">C2.25</td><td align="left">Additions to header <code class="code"><cstdlib></code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">C2.25.1</td><td align="left">Synopsis</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">C2.25.2</td><td align="left">Definitions</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">C2.25.3</td><td align="left">Function <code class="code">abs</code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">C2.25.4</td><td align="left">Function <code class="code">div</code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">C2.26</td><td align="left">Additions to header <code class="code"><stdlib.h></code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">C2.27</td><td align="left">Header <code class="code"><ctgmath></code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left">DR 551</td></tr><tr><td align="left">C2.28</td><td align="left">Header <code class="code"><tgmath.h></code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left">DR 551</td></tr><tr><td align="left">C2.29</td><td align="left">Additions to header <code class="code"><ctime></code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left">C library responsibility</td></tr><tr><td align="left">C2.30</td><td align="left">Additions to header <code class="code"><cwchar></code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">C2.30.1</td><td align="left">Synopsis</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">C2.30.2</td><td align="left">Definitions</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">C2.30.3</td><td align="left">Additional wide format specifiers</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left">C library responsibility</td></tr><tr><td align="left">C2.31</td><td align="left">Additions to header <code class="code"><wchar.h></code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">C2.32</td><td align="left">Additions to header <code class="code"><cwctype></code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">C2.32.1</td><td align="left">Synopsis</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">C2.32.2</td><td align="left">Function <code class="code">iswblank</code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">C2.33</td><td align="left">Additions to header <code class="code"><wctype.h></code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left"><span class="emphasis"><em>D</em></span></td><td colspan="5" align="left"><span class="emphasis"><em>Compatibility Features</em></span></td></tr><tr><td align="left">D.6</td><td align="left">Old iostream members</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">D.8</td><td align="left">Binders</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"><a class="ulink" href="http://gcc.gnu.org/PR33911" target="_top">33911</a></td></tr><tr><td align="left">D.9</td><td align="left">Class template <code class="code">auto_ptr</code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"><a class="ulink" href="http://gcc.gnu.org/PR33911" target="_top">33911</a></td></tr></tbody></table></div></div><br class="table-break" /><p> + </td></tr><tr><td align="left">20.6.6.2.7</td><td align="left"><code class="code">shared_ptr</code> comparison</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">20.6.6.2.8</td><td align="left"><code class="code">shared_ptr</code> I/O</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">20.6.6.2.9</td><td align="left"><code class="code">shared_ptr</code> specialized algorithms</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">20.6.6.2.10</td><td align="left"><code class="code">shared_ptr</code> casts</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">20.6.6.2.11</td><td align="left"><code class="code">get_deleter</code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">20.6.6.3</td><td align="left">Class template <code class="code">weak_ptr</code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">20.6.6.3.1</td><td align="left"><code class="code">weak_ptr</code> constructors</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">20.6.6.3.2</td><td align="left"><code class="code">weak_ptr</code> destructor</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">20.6.6.3.3</td><td align="left"><code class="code">weak_ptr</code> assignment</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">20.6.6.3.4</td><td align="left"><code class="code">weak_ptr</code> modifiers</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">20.6.6.3.5</td><td align="left"><code class="code">weak_ptr</code> observers</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">20.6.6.3.6</td><td align="left"><code class="code">weak_ptr</code> comparison</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">20.6.6.3.7</td><td align="left"><code class="code">weak_ptr</code> specialized algorithms</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">20.6.6.4</td><td align="left">Class template <code class="code">enable_shared_from_this</code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left"><span class="emphasis"><em>23</em></span></td><td colspan="5" align="left"><span class="emphasis"><em>Containers</em></span></td></tr><tr><td align="left">23.2.1</td><td align="left">Header <code class="code"><array></code> synopsis</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">23.2.1</td><td align="left">Class template array</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">23.2.1.1</td><td align="left"><code class="code">array</code> constructors, copy, and assignment</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">23.2.1.2</td><td align="left"><code class="code">array</code> specialized algorithms</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">23.2.1.3</td><td align="left"><code class="code">array </code>size</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">23.2.1.4</td><td align="left"><code class="code">array </code>data</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">23.2.1.5</td><td align="left">Zero sized <code class="code">array</code>s</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">23.2.1.6</td><td align="left">Tuple interface to class template <code class="code">array</code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">23.4</td><td align="left">Unordered associative containers</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">23.4.1</td><td align="left">Class template <code class="code">unordered_map</code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">23.4.1.1</td><td align="left"><code class="code">unordered_map</code> constructors</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">23.4.1.2</td><td align="left"><code class="code">unordered_map</code> element access</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">23.4.1.3</td><td align="left"><code class="code">unordered_map</code> swap</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">23.4.2</td><td align="left">Class template <code class="code">unordered_multimap</code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">23.4.2.1</td><td align="left"><code class="code">unordered_multimap</code> constructors</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">23.4.2.2</td><td align="left"><code class="code">unordered_multimap</code> swap</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">23.4.3</td><td align="left">Class template <code class="code">unordered_set</code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">23.4.3.1</td><td align="left"><code class="code">unordered_set</code> constructors</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">23.4.3.2</td><td align="left"><code class="code">unordered_set</code> swap</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">23.4.4</td><td align="left">Class template <code class="code">unordered_multiset<code class="code"></code></code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">23.4.4.1</td><td align="left"><code class="code">unordered_multiset</code> constructors</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">23.4.4.2</td><td align="left"><code class="code">unordered_multiset</code> swap</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left"><span class="emphasis"><em>26</em></span></td><td colspan="5" align="left"><span class="emphasis"><em>Numerics</em></span></td></tr><tr><td align="left">26.4</td><td align="left">Random number generation</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">26.4.1</td><td align="left">Requirements</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">26.4.2</td><td align="left">Header <code class="code"><random></code> synopsis</td><td align="left"> </td><td align="left"> </td><td align="left">partial</td><td align="left"> </td></tr><tr><td align="left">26.4.3</td><td align="left">Random number engine class templates</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">26.4.3.1</td><td align="left">Class template <code class="code">linear_congruential_engine</code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">26.4.3.2</td><td align="left">Class template <code class="code">mersenne_twister_engine</code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">26.4.3.3</td><td align="left">Class template <code class="code">subtract_with_carry_engine</code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">26.4.4</td><td align="left">Random number engine adaptor class templates</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">26.4.4.1</td><td align="left">Class template <code class="code">discard_block_engine</code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">26.4.4.2</td><td align="left">Class template <code class="code">independent_bits_engine</code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">26.4.4.3</td><td align="left">Class template <code class="code">shuffle_order_engine</code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">26.4.4.4</td><td align="left">Class template <code class="code">xor_combine_engine</code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left">operator()() per N2079</td></tr><tr><td align="left">26.4.5</td><td align="left">Engines and engine adaptors with predefined parameters</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">26.4.6</td><td align="left">Class <code class="code">random_device</code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">26.4.7</td><td align="left">Utilities</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">26.4.7.1</td><td align="left">Class <code class="code">seed_seq</code></td><td align="left"> </td><td align="left"> </td><td align="left">missing</td><td align="left"> </td></tr><tr><td align="left">26.4.7.2</td><td align="left">Function template <code class="code">generate_canonical</code></td><td align="left"> </td><td align="left"> </td><td align="left">missing</td><td align="left"> </td></tr><tr><td align="left">26.4.8</td><td align="left">Random number generation class templates</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">26.4.8.1</td><td align="left">Uniform distributions</td><td align="left"> </td><td align="left"> </td><td align="left">partial</td><td align="left"> </td></tr><tr><td align="left">26.4.8.1</td><td align="left">Class template <code class="code">uniform_int_distribution</code></td><td align="left"> </td><td align="left"> </td><td align="left">missing</td><td align="left"> </td></tr><tr><td align="left">26.4.8.1</td><td align="left">Class template <code class="code">uniform_real_distribution</code></td><td align="left"> </td><td align="left"> </td><td align="left">missing</td><td align="left"> </td></tr><tr><td align="left">26.4.8.2</td><td align="left">Bernoulli distributions</td><td align="left"> </td><td align="left"> </td><td align="left">partial</td><td align="left"> </td></tr><tr><td align="left">26.4.8.2.1</td><td align="left">Class <code class="code">bernoulli_distribution</code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">26.4.8.2.2</td><td align="left">Class template <code class="code">binomial_distribution</code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">26.4.8.2.3</td><td align="left">Class template <code class="code">geometric_distribution</code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">26.4.8.2.4</td><td align="left">Class template <code class="code">negative_binomial_distribution</code></td><td align="left"> </td><td align="left"> </td><td align="left">missing</td><td align="left"> </td></tr><tr><td align="left">26.4.8.3</td><td align="left">Poisson distributions</td><td align="left"> </td><td align="left"> </td><td align="left">partial</td><td align="left"> </td></tr><tr><td align="left">26.4.8.3.1</td><td align="left">Class template <code class="code">poisson_distribution</code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">26.4.8.3.2</td><td align="left">Class template <code class="code">exponential_distribution</code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">26.4.8.3.3</td><td align="left">Class template <code class="code">gamma_distribution</code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">26.4.8.3.4</td><td align="left">Class template <code class="code">weibull_distribution</code></td><td align="left"> </td><td align="left"> </td><td align="left">missing</td><td align="left"> </td></tr><tr><td align="left">26.4.8.3.5</td><td align="left">Class template <code class="code">extreme_value_distribution</code></td><td align="left"> </td><td align="left"> </td><td align="left">missing</td><td align="left"> </td></tr><tr><td align="left">26.4.8.4</td><td align="left">Normal distributions</td><td align="left"> </td><td align="left"> </td><td align="left">partial</td><td align="left"> </td></tr><tr><td align="left">26.4.8.4.1</td><td align="left">Class template <code class="code">normal_distribution</code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">26.4.8.4.2</td><td align="left">Class template <code class="code">lognormal_distribution</code></td><td align="left"> </td><td align="left"> </td><td align="left">missing</td><td align="left"> </td></tr><tr><td align="left">26.4.8.4.3</td><td align="left">Class template <code class="code">chi_squared_distribution</code></td><td align="left"> </td><td align="left"> </td><td align="left">missing</td><td align="left"> </td></tr><tr><td align="left">26.4.8.4.4</td><td align="left">Class template <code class="code">cauchy_distribution</code></td><td align="left"> </td><td align="left"> </td><td align="left">missing</td><td align="left"> </td></tr><tr><td align="left">26.4.8.4.5</td><td align="left">Class template <code class="code">fisher_f_distribution</code></td><td align="left"> </td><td align="left"> </td><td align="left">missing</td><td align="left"> </td></tr><tr><td align="left">26.4.8.4.6</td><td align="left">Class template <code class="code">student_t_distribution</code></td><td align="left"> </td><td align="left"> </td><td align="left">missing</td><td align="left"> </td></tr><tr><td align="left">26.4.8.5</td><td align="left">Sampling distributions</td><td align="left"> </td><td align="left"> </td><td align="left">missing</td><td align="left"> </td></tr><tr><td align="left">26.4.8.5.1</td><td align="left">Class template <code class="code">discrete_distribution</code></td><td align="left"> </td><td align="left"> </td><td align="left">missing</td><td align="left"> </td></tr><tr><td align="left">26.4.8.5.1</td><td align="left">Class template <code class="code">piecewise_constant_distribution</code></td><td align="left"> </td><td align="left"> </td><td align="left">missing</td><td align="left"> </td></tr><tr><td align="left">26.4.8.5.1</td><td align="left">Class template <code class="code">general_pdf_distribution</code></td><td align="left"> </td><td align="left"> </td><td align="left">missing</td><td align="left"> </td></tr><tr><td align="left"><span class="emphasis"><em>28</em></span></td><td colspan="5" align="left"><span class="emphasis"><em>Regular Expressions</em></span></td></tr><tr><td align="left">28.1</td><td align="left">Definitions</td><td align="left"> </td><td align="left"> </td><td align="left">missing</td><td align="left"> </td></tr><tr><td align="left">28.2</td><td align="left">Requirements</td><td align="left"> </td><td align="left"> </td><td align="left">missing</td><td align="left"> </td></tr><tr><td align="left">28.3</td><td align="left">Regular expressions summary</td><td align="left"> </td><td align="left"> </td><td align="left">missing</td><td align="left"> </td></tr><tr><td align="left">28.4</td><td align="left">Header <code class="code"><regex></code> synopsis</td><td align="left"> </td><td align="left"> </td><td align="left">missing</td><td align="left"> </td></tr><tr><td align="left">28.5</td><td align="left">Namespace <code class="code">tr1::regex_constants</code></td><td align="left"> </td><td align="left"> </td><td align="left">missing</td><td align="left"> </td></tr><tr><td align="left">28.5.1</td><td align="left">Bitmask Type <code class="code">syntax_option_type</code></td><td align="left"> </td><td align="left"> </td><td align="left">missing</td><td align="left"> </td></tr><tr><td align="left">28.5.2</td><td align="left">Bitmask Type <code class="code">regex_constants::match_flag_type</code></td><td align="left"> </td><td align="left"> </td><td align="left">missing</td><td align="left"> </td></tr><tr><td align="left">28.5.3</td><td align="left">Implementation defined <code class="code">error_type</code></td><td align="left"> </td><td align="left"> </td><td align="left">missing</td><td align="left"> </td></tr><tr><td align="left">28.6</td><td align="left">Class <code class="code">regex_error</code></td><td align="left"> </td><td align="left"> </td><td align="left">missing</td><td align="left"> </td></tr><tr><td align="left">28.7</td><td align="left">Class template <code class="code">regex_traits</code></td><td align="left"> </td><td align="left"> </td><td align="left">missing</td><td align="left"> </td></tr><tr><td align="left">28.8</td><td align="left">Class template <code class="code">basic_regex</code></td><td align="left"> </td><td align="left"> </td><td align="left">missing</td><td align="left"> </td></tr><tr><td align="left">28.8.1</td><td align="left"><code class="code">basic_regex</code> constants</td><td align="left"> </td><td align="left"> </td><td align="left">missing</td><td align="left"> </td></tr><tr><td align="left">28.8.2</td><td align="left"><code class="code">basic_regex</code> constructors</td><td align="left"> </td><td align="left"> </td><td align="left">missing</td><td align="left"> </td></tr><tr><td align="left">28.8.3</td><td align="left"><code class="code">basic_regex</code> assign</td><td align="left"> </td><td align="left"> </td><td align="left">missing</td><td align="left"> </td></tr><tr><td align="left">28.8.4</td><td align="left"><code class="code">basic_regex</code> constant operations</td><td align="left"> </td><td align="left"> </td><td align="left">missing</td><td align="left"> </td></tr><tr><td align="left">28.8.5</td><td align="left"><code class="code">basic_regex</code> locale</td><td align="left"> </td><td align="left"> </td><td align="left">missing</td><td align="left"> </td></tr><tr><td align="left">28.8.6</td><td align="left"><code class="code">basic_regex</code> swap</td><td align="left"> </td><td align="left"> </td><td align="left">missing</td><td align="left"> </td></tr><tr><td align="left">28.8.7</td><td align="left"><code class="code">basic_regex</code> non-member functions</td><td align="left"> </td><td align="left"> </td><td align="left">missing</td><td align="left"> </td></tr><tr><td align="left">28.8.7.1</td><td align="left"><code class="code">basic_regex</code> non-member swap</td><td align="left"> </td><td align="left"> </td><td align="left">missing</td><td align="left"> </td></tr><tr><td align="left">28.9</td><td align="left">Class template <code class="code">sub_match</code></td><td align="left"> </td><td align="left"> </td><td align="left">missing</td><td align="left"> </td></tr><tr><td align="left">28.9.1</td><td align="left"><code class="code">sub_match</code> members</td><td align="left"> </td><td align="left"> </td><td align="left">missing</td><td align="left"> </td></tr><tr><td align="left">28.9.2</td><td align="left"><code class="code">sub_match</code> non-member operators</td><td align="left"> </td><td align="left"> </td><td align="left">missing</td><td align="left"> </td></tr><tr><td align="left">28.10</td><td align="left">Class template <code class="code">match_results</code></td><td align="left"> </td><td align="left"> </td><td align="left">missing</td><td align="left"> </td></tr><tr><td align="left">28.10.1</td><td align="left"><code class="code">match_results</code> constructors</td><td align="left"> </td><td align="left"> </td><td align="left">missing</td><td align="left"> </td></tr><tr><td align="left">28.10.2</td><td align="left"><code class="code">match_results</code> size</td><td align="left"> </td><td align="left"> </td><td align="left">missing</td><td align="left"> </td></tr><tr><td align="left">28.10.3</td><td align="left"><code class="code">match_results</code> element access</td><td align="left"> </td><td align="left"> </td><td align="left">missing</td><td align="left"> </td></tr><tr><td align="left">28.10.4</td><td align="left"><code class="code">match_results</code> formatting</td><td align="left"> </td><td align="left"> </td><td align="left">missing</td><td align="left"> </td></tr><tr><td align="left">28.10.5</td><td align="left"><code class="code">match_results</code> allocator</td><td align="left"> </td><td align="left"> </td><td align="left">missing</td><td align="left"> </td></tr><tr><td align="left">28.10.6</td><td align="left"><code class="code">match_results</code> swap</td><td align="left"> </td><td align="left"> </td><td align="left">missing</td><td align="left"> </td></tr><tr><td align="left">28.11</td><td align="left">Regular expression algorithms</td><td align="left"> </td><td align="left"> </td><td align="left">missing</td><td align="left"> </td></tr><tr><td align="left">28.11.1</td><td align="left">exceptions</td><td align="left"> </td><td align="left"> </td><td align="left">missing</td><td align="left"> </td></tr><tr><td align="left">28.11.2</td><td align="left"><code class="code">regex_match</code></td><td align="left"> </td><td align="left"> </td><td align="left">missing</td><td align="left"> </td></tr><tr><td align="left">28.11.3</td><td align="left"><code class="code">regex_search</code></td><td align="left"> </td><td align="left"> </td><td align="left">missing</td><td align="left"> </td></tr><tr><td align="left">28.11.4</td><td align="left"><code class="code">regex_replace</code></td><td align="left"> </td><td align="left"> </td><td align="left">missing</td><td align="left"> </td></tr><tr><td align="left">28.12</td><td align="left">Regular expression Iterators</td><td align="left"> </td><td align="left"> </td><td align="left">missing</td><td align="left"> </td></tr><tr><td align="left">28.12.1</td><td align="left">Class template <code class="code">regex_iterator</code></td><td align="left"> </td><td align="left"> </td><td align="left">missing</td><td align="left"> </td></tr><tr><td align="left">28.12.1.1</td><td align="left"><code class="code">regex_iterator</code> constructors</td><td align="left"> </td><td align="left"> </td><td align="left">missing</td><td align="left"> </td></tr><tr><td align="left">28.12.1.2</td><td align="left"><code class="code">regex_iterator</code> comparisons</td><td align="left"> </td><td align="left"> </td><td align="left">missing</td><td align="left"> </td></tr><tr><td align="left">28.12.1.3</td><td align="left"><code class="code">regex_iterator</code> dereference</td><td align="left"> </td><td align="left"> </td><td align="left">missing</td><td align="left"> </td></tr><tr><td align="left">28.12.1.4</td><td align="left"><code class="code">regex_iterator</code> increment</td><td align="left"> </td><td align="left"> </td><td align="left">missing</td><td align="left"> </td></tr><tr><td align="left">28.12.2</td><td align="left">Class template <code class="code">regex_token_iterator</code></td><td align="left"> </td><td align="left"> </td><td align="left">missing</td><td align="left"> </td></tr><tr><td align="left">28.12.2.1</td><td align="left"><code class="code">regex_token_iterator</code> constructors</td><td align="left"> </td><td align="left"> </td><td align="left">missing</td><td align="left"> </td></tr><tr><td align="left">28.12.2.2</td><td align="left"><code class="code">regex_token_iterator</code> comparisons</td><td align="left"> </td><td align="left"> </td><td align="left">missing</td><td align="left"> </td></tr><tr><td align="left">28.12.2.3</td><td align="left"><code class="code">regex_token_iterator</code> dereference</td><td align="left"> </td><td align="left"> </td><td align="left">missing</td><td align="left"> </td></tr><tr><td align="left">28.12.2.4</td><td align="left"><code class="code">regex_token_iterator</code> increment</td><td align="left"> </td><td align="left"> </td><td align="left">missing</td><td align="left"> </td></tr><tr><td align="left">28.13</td><td align="left">Modified ECMAScript regular expression grammar</td><td align="left"> </td><td align="left"> </td><td align="left">missing</td><td align="left"> </td></tr><tr><td align="left"><span class="emphasis"><em>C</em></span></td><td colspan="5" align="left"><span class="emphasis"><em>C Compatibility</em></span></td></tr><tr><td align="left">C2.1</td><td align="left">Additions to header <code class="code"><complex></code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">C2.1.1</td><td align="left">Synopsis</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">C2.1.2</td><td align="left">Function <code class="code">acos</code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">C2.1.3</td><td align="left">Function <code class="code">asin</code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">C2.1.4</td><td align="left">Function <code class="code">atan</code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">C2.1.5</td><td align="left">Function <code class="code">acosh</code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">C2.1.6</td><td align="left">Function <code class="code">asinh</code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">C2.1.7</td><td align="left">Function <code class="code">atanh</code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">C2.1.8</td><td align="left">Function <code class="code">fabs</code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">C2.1.9</td><td align="left">Additional Overloads</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">C2.2</td><td align="left">Header <code class="code"><ccomplex></code></td><td align="left"> </td><td align="left"> </td><td align="left">missing</td><td align="left">DR 551</td></tr><tr><td align="left">C2.3</td><td align="left">Header <code class="code"><complex.h></code></td><td align="left"> </td><td align="left"> </td><td align="left">missing</td><td align="left">DR 551</td></tr><tr><td align="left">C2.4</td><td align="left">Additions to header <code class="code"><cctype></code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">C2.4.1</td><td align="left">Synopsis</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">C2.4.2</td><td align="left">Function <code class="code">isblank</code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">C2.5</td><td align="left">Additions to header <code class="code"><ctype.h></code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">C2.6</td><td align="left">Header <code class="code"><cfenv></code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">C2.6.1</td><td align="left">Synopsis</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">C2.6.2</td><td align="left">Definitions</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">C2.7</td><td align="left">Header <code class="code"><fenv.h></code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">C2.8</td><td align="left">Additions to header <code class="code"><cfloat></code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">C2.9</td><td align="left">Additions to header <code class="code"><float.h></code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">C2.10</td><td align="left">Additions to header <code class="code"><ios></code></td><td align="left"> </td><td align="left"> </td><td align="left">missing</td><td align="left"> </td></tr><tr><td align="left">C2.10.1</td><td align="left">Synopsis</td><td align="left"> </td><td align="left"> </td><td align="left">missing</td><td align="left"> </td></tr><tr><td align="left">C2.10.2</td><td align="left">Function <code class="code">hexfloat</code></td><td align="left"> </td><td align="left"> </td><td align="left">missing</td><td align="left"> </td></tr><tr><td align="left">C2.11</td><td align="left">Header <code class="code"><cinttypes></code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">C2.11.1</td><td align="left">Synopsis</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left">DR 557</td></tr><tr><td align="left">C2.11.2</td><td align="left">Definitions</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">C2.12</td><td align="left">Header <code class="code"><inttypes.h></code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">C2.13</td><td align="left">Additions to header <code class="code"><climits></code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">C2.14</td><td align="left">Additions to header <code class="code"><limits.h></code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">C2.15</td><td align="left">Additions to header <code class="code"><locale></code></td><td align="left"> </td><td align="left"> </td><td align="left">missing</td><td align="left"> </td></tr><tr><td align="left">C2.16</td><td align="left">Additions to header <code class="code"><cmath></code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">C2.16.1</td><td align="left">Synopsis</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">C2.16.2</td><td align="left">Definitions</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">C2.16.3</td><td align="left">Function template definitions</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">C2.16.4</td><td align="left">Additional overloads</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left">DR 568; DR 550</td></tr><tr><td align="left">C2.17</td><td align="left">Additions to header <code class="code"><math.h></code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">C2.18</td><td align="left">Additions to header <code class="code"><cstdarg></code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">C2.19</td><td align="left">Additions to header <code class="code"><stdarg.h></code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">C2.20</td><td align="left">The header <code class="code"><cstdbool></code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">C2.21</td><td align="left">The header <code class="code"><stdbool.h></code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">C2.22</td><td align="left">The header <code class="code"><cstdint></code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">C2.22.1</td><td align="left">Synopsis</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">C2.22.2</td><td align="left">Definitions</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">C2.23</td><td align="left">The header <code class="code"><stdint.h></code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">C2.24</td><td align="left">Additions to header <code class="code"><cstdio></code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">C2.24.1</td><td align="left">Synopsis</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">C2.24.2</td><td align="left">Definitions</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">C2.24.3</td><td align="left">Additional format specifiers</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left">C library responsibility</td></tr><tr><td align="left">C2.24.4</td><td align="left">Additions to header <code class="code"><stdio.h></code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">C2.25</td><td align="left">Additions to header <code class="code"><cstdlib></code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">C2.25.1</td><td align="left">Synopsis</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">C2.25.2</td><td align="left">Definitions</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">C2.25.3</td><td align="left">Function <code class="code">abs</code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">C2.25.4</td><td align="left">Function <code class="code">div</code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">C2.26</td><td align="left">Additions to header <code class="code"><stdlib.h></code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">C2.27</td><td align="left">Header <code class="code"><ctgmath></code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left">DR 551</td></tr><tr><td align="left">C2.28</td><td align="left">Header <code class="code"><tgmath.h></code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left">DR 551</td></tr><tr><td align="left">C2.29</td><td align="left">Additions to header <code class="code"><ctime></code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left">C library responsibility</td></tr><tr><td align="left">C2.30</td><td align="left">Additions to header <code class="code"><cwchar></code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">C2.30.1</td><td align="left">Synopsis</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">C2.30.2</td><td align="left">Definitions</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">C2.30.3</td><td align="left">Additional wide format specifiers</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left">C library responsibility</td></tr><tr><td align="left">C2.31</td><td align="left">Additions to header <code class="code"><wchar.h></code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">C2.32</td><td align="left">Additions to header <code class="code"><cwctype></code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">C2.32.1</td><td align="left">Synopsis</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">C2.32.2</td><td align="left">Function <code class="code">iswblank</code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">C2.33</td><td align="left">Additions to header <code class="code"><wctype.h></code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left"><span class="emphasis"><em>D</em></span></td><td colspan="5" align="left"><span class="emphasis"><em>Compatibility Features</em></span></td></tr><tr><td align="left">D.6</td><td align="left">Old iostream members</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">D.8</td><td align="left">Binders</td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"><a class="ulink" href="http://gcc.gnu.org/PR33911" target="_top">33911</a></td></tr><tr><td align="left">D.9</td><td align="left">Class template <code class="code">auto_ptr</code></td><td align="left">done</td><td align="left"> </td><td align="left"> </td><td align="left"><a class="ulink" href="http://gcc.gnu.org/PR33911" target="_top">33911</a></td></tr></tbody></table></div></div><br class="table-break" /><p> Footnotes </p><p> The shared_ptr implementation uses some code from the diff --git a/libstdc++-v3/doc/html/manual/bk01pt01ch03s02.html b/libstdc++-v3/doc/html/manual/bk01pt01ch03s02.html index 6bdc0333a32..6daf4365f73 100644 --- a/libstdc++-v3/doc/html/manual/bk01pt01ch03s02.html +++ b/libstdc++-v3/doc/html/manual/bk01pt01ch03s02.html @@ -19,15 +19,15 @@ the 1998 standard as updated for 2003, and the draft of the upcoming 200x standard. </p><p> - C++98/03 include files. These are available in the default compilation mode, ie <code class="code">-std=c++98</code> or <code class="code">-std=gnu++98</code>. - </p><div class="table"><a id="id398035"></a><p class="title"><b>Table 3.1. C++ 1998 Library Headers</b></p><div class="table-contents"><table summary="C++ 1998 Library Headers" border="1"><colgroup><col align="left" /><col align="left" /><col align="left" /><col align="left" /><col /></colgroup><tbody><tr><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="filename">iomanip</code></td><td align="left"><code class="filename">list</code></td><td align="left"><code class="filename">ostream</code></td><td align="left"><code class="filename">streambuf</code></td></tr><tr><td align="left"><code class="filename">bitset</code></td><td align="left"><code class="filename">ios</code></td><td align="left"><code class="filename">locale</code></td><td align="left"><code class="filename">queue</code></td><td align="left"><code class="filename">string</code></td></tr><tr><td align="left"><code class="filename">complex</code></td><td align="left"><code class="filename">iosfwd</code></td><td align="left"><code class="filename">map</code></td><td align="left"><code class="filename">set</code></td><td align="left"><code class="filename">typeinfo</code></td></tr><tr><td align="left"><code class="filename">deque</code></td><td align="left"><code class="filename">iostream</code></td><td align="left"><code class="filename">memory</code></td><td align="left"><code class="filename">sstream</code></td><td align="left"><code class="filename">utility</code></td></tr><tr><td align="left"><code class="filename">exception</code></td><td align="left"><code class="filename">istream</code></td><td align="left"><code class="filename">new</code></td><td align="left"><code class="filename">stack</code></td><td align="left"><code class="filename">valarray</code></td></tr><tr><td align="left"><code class="filename">fstream</code></td><td align="left"><code class="filename">iterator</code></td><td align="left"><code class="filename">numeric</code></td><td align="left"><code class="filename">stdexcept</code></td><td align="left"><code class="filename">vector</code></td></tr><tr><td align="left"><code class="filename">functional</code></td><td align="left"><code class="filename">limits</code></td><td class="auto-generated"> </td><td class="auto-generated"> </td><td class="auto-generated"> </td></tr></tbody></table></div></div><br class="table-break" /><p></p><div class="table"><a id="id397982"></a><p class="title"><b>Table 3.2. C++ 1998 Library Headers for C Library Facilities</b></p><div class="table-contents"><table summary="C++ 1998 Library Headers for C Library Facilities" border="1"><colgroup><col align="left" /><col align="left" /><col align="left" /><col align="left" /><col /></colgroup><tbody><tr><td align="left"><code class="filename">cassert</code></td><td align="left"><code class="filename">ciso646</code></td><td align="left"><code class="filename">csetjmp</code></td><td align="left"><code class="filename">cstdio</code></td><td align="left"><code class="filename">ctime</code></td></tr><tr><td align="left"><code class="filename">cctype</code></td><td align="left"><code class="filename">climits</code></td><td align="left"><code class="filename">csignal</code></td><td align="left"><code class="filename">cstdlib</code></td><td align="left"><code class="filename">cwchar</code></td></tr><tr><td align="left"><code class="filename">cerrno</code></td><td align="left"><code class="filename">clocale</code></td><td align="left"><code class="filename">cstdarg</code></td><td align="left"><code class="filename">cstring</code></td><td align="left"><code class="filename">cwctype</code></td></tr><tr><td align="left"><code class="filename">cfloat</code></td><td align="left"><code class="filename">cmath</code></td><td align="left"><code class="filename">cstddef</code></td><td class="auto-generated"> </td><td class="auto-generated"> </td></tr></tbody></table></div></div><br class="table-break" /><p>C++0x include files. These are only available in C++0x compilation mode, ie <code class="code">-std=c++0x</code> or <code class="code">-std=gnu++0x</code>. -</p><p></p><div class="table"><a id="id399447"></a><p class="title"><b>Table 3.3. C++ 200x Library Headers</b></p><div class="table-contents"><table summary="C++ 200x Library Headers" border="1"><colgroup><col align="left" /><col align="left" /><col align="left" /><col align="left" /><col /></colgroup><tbody><tr><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="filename">iomanip</code></td><td align="left"><code class="filename">locale</code></td><td align="left"><code class="filename">regex</code></td><td align="left"><code class="filename">tuple</code></td></tr><tr><td align="left"><code class="filename">array</code></td><td align="left"><code class="filename">ios</code></td><td align="left"><code class="filename">map</code></td><td align="left"><code class="filename">set</code></td><td align="left"><code class="filename">typeinfo</code></td></tr><tr><td align="left"><code class="filename">bitset</code></td><td align="left"><code class="filename">iosfwd</code></td><td align="left"><code class="filename">memory</code></td><td align="left"><code class="filename">sstream</code></td><td align="left"><code class="filename">type_traits</code></td></tr><tr><td align="left"><code class="filename">complex</code></td><td align="left"><code class="filename">iostream</code></td><td align="left"><code class="filename">new</code></td><td align="left"><code class="filename">stack</code></td><td align="left"><code class="filename">unordered_map</code></td></tr><tr><td align="left"><code class="filename">deque</code></td><td align="left"><code class="filename">istream</code></td><td align="left"><code class="filename">numeric</code></td><td align="left"><code class="filename">stdexcept</code></td><td align="left"><code class="filename">unordered_set</code></td></tr><tr><td align="left"><code class="filename">exception</code></td><td align="left"><code class="filename">iterator</code></td><td align="left"><code class="filename">ostream</code></td><td align="left"><code class="filename">streambuf</code></td><td align="left"><code class="filename">utility</code></td></tr><tr><td align="left"><code class="filename">fstream</code></td><td align="left"><code class="filename">limits</code></td><td align="left"><code class="filename">queue</code></td><td align="left"><code class="filename">string</code></td><td align="left"><code class="filename">valarray</code></td></tr><tr><td align="left"><code class="filename">functional</code></td><td align="left"><code class="filename">list</code></td><td align="left"><code class="filename">random</code></td><td align="left"><code class="filename">system_error</code></td><td align="left"><code class="filename">vector</code></td></tr></tbody></table></div></div><br class="table-break" /><p></p><div class="table"><a id="id394222"></a><p class="title"><b>Table 3.4. C++ 200x Library Headers for C Library Facilities</b></p><div class="table-contents"><table summary="C++ 200x Library Headers for C Library Facilities" border="1"><colgroup><col align="left" /><col align="left" /><col align="left" /><col align="left" /><col align="left" /></colgroup><tbody><tr><td align="left"><code class="filename">cassert</code></td><td align="left"><code class="filename">cfloat</code></td><td align="left"><code class="filename">cmath</code></td><td align="left"><code class="filename">cstddef</code></td><td align="left"><code class="filename">ctgmath</code></td></tr><tr><td align="left"><code class="filename">ccomplex</code></td><td align="left"><code class="filename">cinttypes</code></td><td align="left"><code class="filename">csetjmp</code></td><td align="left"><code class="filename">cstdint</code></td><td align="left"><code class="filename">ctime</code></td></tr><tr><td align="left"><code class="filename">cctype</code></td><td align="left"><code class="filename">ciso646</code></td><td align="left"><code class="filename">csignal</code></td><td align="left"><code class="filename">cstdio</code></td><td align="left"><code class="filename">cuchar</code></td></tr><tr><td align="left"><code class="filename">cerrno</code></td><td align="left"><code class="filename">climits</code></td><td align="left"><code class="filename">cstdarg</code></td><td align="left"><code class="filename">cstdlib</code></td><td align="left"><code class="filename">cwchar</code></td></tr><tr><td align="left"><code class="filename">cfenv</code></td><td align="left"><code class="filename">clocale</code></td><td align="left"><code class="filename">cstdbool</code></td><td align="left"><code class="filename">cstring</code></td><td align="left"><code class="filename">cwctype</code></td></tr></tbody></table></div></div><br class="table-break" /><p> + C++98/03 include files. These are available in the default compilation mode, i.e. <code class="code">-std=c++98</code> or <code class="code">-std=gnu++98</code>. + </p><div class="table"><a id="id424211"></a><p class="title"><b>Table 3.1. C++ 1998 Library Headers</b></p><div class="table-contents"><table summary="C++ 1998 Library Headers" border="1"><colgroup><col align="left" /><col align="left" /><col align="left" /><col align="left" /><col /></colgroup><tbody><tr><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="filename">iomanip</code></td><td align="left"><code class="filename">list</code></td><td align="left"><code class="filename">ostream</code></td><td align="left"><code class="filename">streambuf</code></td></tr><tr><td align="left"><code class="filename">bitset</code></td><td align="left"><code class="filename">ios</code></td><td align="left"><code class="filename">locale</code></td><td align="left"><code class="filename">queue</code></td><td align="left"><code class="filename">string</code></td></tr><tr><td align="left"><code class="filename">complex</code></td><td align="left"><code class="filename">iosfwd</code></td><td align="left"><code class="filename">map</code></td><td align="left"><code class="filename">set</code></td><td align="left"><code class="filename">typeinfo</code></td></tr><tr><td align="left"><code class="filename">deque</code></td><td align="left"><code class="filename">iostream</code></td><td align="left"><code class="filename">memory</code></td><td align="left"><code class="filename">sstream</code></td><td align="left"><code class="filename">utility</code></td></tr><tr><td align="left"><code class="filename">exception</code></td><td align="left"><code class="filename">istream</code></td><td align="left"><code class="filename">new</code></td><td align="left"><code class="filename">stack</code></td><td align="left"><code class="filename">valarray</code></td></tr><tr><td align="left"><code class="filename">fstream</code></td><td align="left"><code class="filename">iterator</code></td><td align="left"><code class="filename">numeric</code></td><td align="left"><code class="filename">stdexcept</code></td><td align="left"><code class="filename">vector</code></td></tr><tr><td align="left"><code class="filename">functional</code></td><td align="left"><code class="filename">limits</code></td><td class="auto-generated"> </td><td class="auto-generated"> </td><td class="auto-generated"> </td></tr></tbody></table></div></div><br class="table-break" /><p></p><div class="table"><a id="id410652"></a><p class="title"><b>Table 3.2. C++ 1998 Library Headers for C Library Facilities</b></p><div class="table-contents"><table summary="C++ 1998 Library Headers for C Library Facilities" border="1"><colgroup><col align="left" /><col align="left" /><col align="left" /><col align="left" /><col /></colgroup><tbody><tr><td align="left"><code class="filename">cassert</code></td><td align="left"><code class="filename">ciso646</code></td><td align="left"><code class="filename">csetjmp</code></td><td align="left"><code class="filename">cstdio</code></td><td align="left"><code class="filename">ctime</code></td></tr><tr><td align="left"><code class="filename">cctype</code></td><td align="left"><code class="filename">climits</code></td><td align="left"><code class="filename">csignal</code></td><td align="left"><code class="filename">cstdlib</code></td><td align="left"><code class="filename">cwchar</code></td></tr><tr><td align="left"><code class="filename">cerrno</code></td><td align="left"><code class="filename">clocale</code></td><td align="left"><code class="filename">cstdarg</code></td><td align="left"><code class="filename">cstring</code></td><td align="left"><code class="filename">cwctype</code></td></tr><tr><td align="left"><code class="filename">cfloat</code></td><td align="left"><code class="filename">cmath</code></td><td align="left"><code class="filename">cstddef</code></td><td class="auto-generated"> </td><td class="auto-generated"> </td></tr></tbody></table></div></div><br class="table-break" /><p>C++0x include files. These are only available in C++0x compilation mode, i.e. <code class="code">-std=c++0x</code> or <code class="code">-std=gnu++0x</code>. +</p><p></p><div class="table"><a id="id411001"></a><p class="title"><b>Table 3.3. C++ 200x Library Headers</b></p><div class="table-contents"><table summary="C++ 200x Library Headers" border="1"><colgroup><col align="left" /><col align="left" /><col align="left" /><col align="left" /><col /></colgroup><tbody><tr><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="filename">iomanip</code></td><td align="left"><code class="filename">locale</code></td><td align="left"><code class="filename">regex</code></td><td align="left"><code class="filename">tuple</code></td></tr><tr><td align="left"><code class="filename">array</code></td><td align="left"><code class="filename">ios</code></td><td align="left"><code class="filename">map</code></td><td align="left"><code class="filename">set</code></td><td align="left"><code class="filename">typeinfo</code></td></tr><tr><td align="left"><code class="filename">bitset</code></td><td align="left"><code class="filename">iosfwd</code></td><td align="left"><code class="filename">memory</code></td><td align="left"><code class="filename">sstream</code></td><td align="left"><code class="filename">type_traits</code></td></tr><tr><td align="left"><code class="filename">complex</code></td><td align="left"><code class="filename">iostream</code></td><td align="left"><code class="filename">new</code></td><td align="left"><code class="filename">stack</code></td><td align="left"><code class="filename">unordered_map</code></td></tr><tr><td align="left"><code class="filename">deque</code></td><td align="left"><code class="filename">istream</code></td><td align="left"><code class="filename">numeric</code></td><td align="left"><code class="filename">stdexcept</code></td><td align="left"><code class="filename">unordered_set</code></td></tr><tr><td align="left"><code class="filename">exception</code></td><td align="left"><code class="filename">iterator</code></td><td align="left"><code class="filename">ostream</code></td><td align="left"><code class="filename">streambuf</code></td><td align="left"><code class="filename">utility</code></td></tr><tr><td align="left"><code class="filename">fstream</code></td><td align="left"><code class="filename">limits</code></td><td align="left"><code class="filename">queue</code></td><td align="left"><code class="filename">string</code></td><td align="left"><code class="filename">valarray</code></td></tr><tr><td align="left"><code class="filename">functional</code></td><td align="left"><code class="filename">list</code></td><td align="left"><code class="filename">random</code></td><td align="left"><code class="filename">system_error</code></td><td align="left"><code class="filename">vector</code></td></tr></tbody></table></div></div><br class="table-break" /><p></p><div class="table"><a id="id456739"></a><p class="title"><b>Table 3.4. C++ 200x Library Headers for C Library Facilities</b></p><div class="table-contents"><table summary="C++ 200x Library Headers for C Library Facilities" border="1"><colgroup><col align="left" /><col align="left" /><col align="left" /><col align="left" /><col align="left" /></colgroup><tbody><tr><td align="left"><code class="filename">cassert</code></td><td align="left"><code class="filename">cfloat</code></td><td align="left"><code class="filename">cmath</code></td><td align="left"><code class="filename">cstddef</code></td><td align="left"><code class="filename">ctgmath</code></td></tr><tr><td align="left"><code class="filename">ccomplex</code></td><td align="left"><code class="filename">cinttypes</code></td><td align="left"><code class="filename">csetjmp</code></td><td align="left"><code class="filename">cstdint</code></td><td align="left"><code class="filename">ctime</code></td></tr><tr><td align="left"><code class="filename">cctype</code></td><td align="left"><code class="filename">ciso646</code></td><td align="left"><code class="filename">csignal</code></td><td align="left"><code class="filename">cstdio</code></td><td align="left"><code class="filename">cuchar</code></td></tr><tr><td align="left"><code class="filename">cerrno</code></td><td align="left"><code class="filename">climits</code></td><td align="left"><code class="filename">cstdarg</code></td><td align="left"><code class="filename">cstdlib</code></td><td align="left"><code class="filename">cwchar</code></td></tr><tr><td align="left"><code class="filename">cfenv</code></td><td align="left"><code class="filename">clocale</code></td><td align="left"><code class="filename">cstdbool</code></td><td align="left"><code class="filename">cstring</code></td><td align="left"><code class="filename">cwctype</code></td></tr></tbody></table></div></div><br class="table-break" /><p> In addition, TR1 includes as: -</p><div class="table"><a id="id485624"></a><p class="title"><b>Table 3.5. C++ TR1 Library Headers</b></p><div class="table-contents"><table summary="C++ TR1 Library Headers" border="1"><colgroup><col align="left" /><col align="left" /><col align="left" /><col align="left" /><col align="left" /></colgroup><tbody><tr><td align="left"><code class="filename">tr1/array</code></td><td align="left"><code class="filename">tr1/memory</code></td><td align="left"><code class="filename">tr1/regex</code></td><td align="left"><code class="filename">tr1/type_traits</code></td><td align="left"><code class="filename">tr1/unordered_set</code></td></tr><tr><td align="left"><code class="filename">tr1/complex</code></td><td align="left"><code class="filename">tr1/random</code></td><td align="left"><code class="filename">tr1/tuple</code></td><td align="left"><code class="filename">tr1/unordered_map</code></td><td align="left"><code class="filename">tr1/utility</code></td></tr><tr><td align="left"><code class="filename">tr1/functional</code></td><td class="auto-generated"> </td><td class="auto-generated"> </td><td class="auto-generated"> </td><td class="auto-generated"> </td></tr></tbody></table></div></div><br class="table-break" /><p></p><div class="table"><a id="id407403"></a><p class="title"><b>Table 3.6. C++ TR1 Library Headers for C Library Facilities</b></p><div class="table-contents"><table summary="C++ TR1 Library Headers for C Library Facilities" border="1"><colgroup><col align="left" /><col align="left" /><col align="left" /><col align="left" /><col align="left" /></colgroup><tbody><tr><td align="left"><code class="filename">tr1/cmath</code></td><td align="left"><code class="filename">tr1/cfloat</code></td><td align="left"><code class="filename">tr1/cstdarg</code></td><td align="left"><code class="filename">tr1/cstdio</code></td><td align="left"><code class="filename">tr1/ctime</code></td></tr><tr><td align="left"><code class="filename">tr1/ccomplex</code></td><td align="left"><code class="filename">tr1/cinttypes</code></td><td align="left"><code class="filename">tr1/cstdbool</code></td><td align="left"><code class="filename">tr1/cstdlib</code></td><td align="left"><code class="filename">tr1/cwchar</code></td></tr><tr><td align="left"><code class="filename">tr1/cfenv</code></td><td align="left"><code class="filename">tr1/climits</code></td><td align="left"><code class="filename">tr1/cstdint</code></td><td align="left"><code class="filename">tr1/ctgmath</code></td><td align="left"><code class="filename">tr1/cwctype</code></td></tr></tbody></table></div></div><br class="table-break" /><p> +</p><div class="table"><a id="id420313"></a><p class="title"><b>Table 3.5. C++ TR1 Library Headers</b></p><div class="table-contents"><table summary="C++ TR1 Library Headers" border="1"><colgroup><col align="left" /><col align="left" /><col align="left" /><col align="left" /><col align="left" /></colgroup><tbody><tr><td align="left"><code class="filename">tr1/array</code></td><td align="left"><code class="filename">tr1/memory</code></td><td align="left"><code class="filename">tr1/regex</code></td><td align="left"><code class="filename">tr1/type_traits</code></td><td align="left"><code class="filename">tr1/unordered_set</code></td></tr><tr><td align="left"><code class="filename">tr1/complex</code></td><td align="left"><code class="filename">tr1/random</code></td><td align="left"><code class="filename">tr1/tuple</code></td><td align="left"><code class="filename">tr1/unordered_map</code></td><td align="left"><code class="filename">tr1/utility</code></td></tr><tr><td align="left"><code class="filename">tr1/functional</code></td><td class="auto-generated"> </td><td class="auto-generated"> </td><td class="auto-generated"> </td><td class="auto-generated"> </td></tr></tbody></table></div></div><br class="table-break" /><p></p><div class="table"><a id="id362939"></a><p class="title"><b>Table 3.6. C++ TR1 Library Headers for C Library Facilities</b></p><div class="table-contents"><table summary="C++ TR1 Library Headers for C Library Facilities" border="1"><colgroup><col align="left" /><col align="left" /><col align="left" /><col align="left" /><col align="left" /></colgroup><tbody><tr><td align="left"><code class="filename">tr1/cmath</code></td><td align="left"><code class="filename">tr1/cfloat</code></td><td align="left"><code class="filename">tr1/cstdarg</code></td><td align="left"><code class="filename">tr1/cstdio</code></td><td align="left"><code class="filename">tr1/ctime</code></td></tr><tr><td align="left"><code class="filename">tr1/ccomplex</code></td><td align="left"><code class="filename">tr1/cinttypes</code></td><td align="left"><code class="filename">tr1/cstdbool</code></td><td align="left"><code class="filename">tr1/cstdlib</code></td><td align="left"><code class="filename">tr1/cwchar</code></td></tr><tr><td align="left"><code class="filename">tr1/cfenv</code></td><td align="left"><code class="filename">tr1/climits</code></td><td align="left"><code class="filename">tr1/cstdint</code></td><td align="left"><code class="filename">tr1/ctgmath</code></td><td align="left"><code class="filename">tr1/cwctype</code></td></tr></tbody></table></div></div><br class="table-break" /><p> Also included are files for the C++ ABI interface: -</p><div class="table"><a id="id420398"></a><p class="title"><b>Table 3.7. C++ ABI Headers</b></p><div class="table-contents"><table summary="C++ ABI Headers" border="1"><colgroup><col align="left" /><col align="left" /></colgroup><tbody><tr><td align="left"><code class="filename">cxxabi.h</code></td><td align="left"><code class="filename">cxxabi_forced.h</code></td></tr></tbody></table></div></div><br class="table-break" /><p> +</p><div class="table"><a id="id429435"></a><p class="title"><b>Table 3.7. C++ ABI Headers</b></p><div class="table-contents"><table summary="C++ ABI Headers" border="1"><colgroup><col align="left" /><col align="left" /></colgroup><tbody><tr><td align="left"><code class="filename">cxxabi.h</code></td><td align="left"><code class="filename">cxxabi_forced.h</code></td></tr></tbody></table></div></div><br class="table-break" /><p> And a large variety of extensions. -</p><div class="table"><a id="id414207"></a><p class="title"><b>Table 3.8. Extension Headers</b></p><div class="table-contents"><table summary="Extension Headers" border="1"><colgroup><col align="left" /><col align="left" /><col align="left" /><col align="left" /><col align="left" /></colgroup><tbody><tr><td align="left"><code class="filename">ext/algorithm</code></td><td align="left"><code class="filename">ext/debug_allocator.h</code></td><td align="left"><code class="filename">ext/mt_allocator.h</code></td><td align="left"><code class="filename">ext/pod_char_traits.h</code></td><td align="left"><code class="filename">ext/stdio_sync_filebuf.h</code></td></tr><tr><td align="left"><code class="filename">ext/array_allocator.h</code></td><td align="left"><code class="filename">ext/enc_filebuf.h</code></td><td align="left"><code class="filename">ext/new_allocator.h</code></td><td align="left"><code class="filename">ext/pool_allocator.h</code></td><td align="left"><code class="filename">ext/throw_allocator.h</code></td></tr><tr><td align="left"><code class="filename">ext/atomicity.h</code></td><td align="left"><code class="filename">ext/functional</code></td><td align="left"><code class="filename">ext/numeric</code></td><td align="left"><code class="filename">ext/rb_tree</code></td><td align="left"><code class="filename">ext/typelist.h</code></td></tr><tr><td align="left"><code class="filename">ext/bitmap_allocator.h</code></td><td align="left"><code class="filename">ext/iterator</code></td><td align="left"><code class="filename">ext/numeric_traits.h</code></td><td align="left"><code class="filename">ext/rope</code></td><td align="left"><code class="filename">ext/type_traits.h</code></td></tr><tr><td align="left"><code class="filename">ext/codecvt_specializations.h</code></td><td align="left"><code class="filename">ext/malloc_allocator.h</code></td><td align="left"><code class="filename">ext/pb_ds/assoc_container.h</code></td><td align="left"><code class="filename">ext/slist</code></td><td align="left"><code class="filename">ext/vstring.h</code></td></tr><tr><td align="left"><code class="filename">ext/concurrence.h</code></td><td align="left"><code class="filename">ext/memory</code></td><td align="left"><code class="filename">ext/pb_ds/priority_queue.h</code></td><td align="left"><code class="filename">ext/stdio_filebuf.h</code></td><td class="auto-generated"> </td></tr></tbody></table></div></div><br class="table-break" /><p></p><div class="table"><a id="id458275"></a><p class="title"><b>Table 3.9. Extension Debug Headers</b></p><div class="table-contents"><table summary="Extension Debug Headers" border="1"><colgroup><col align="left" /><col align="left" /><col align="left" /><col align="left" /><col align="left" /></colgroup><tbody><tr><td align="left"><code class="filename">debug/bitset</code></td><td align="left"><code class="filename">debug/list</code></td><td align="left"><code class="filename">debug/set</code></td><td align="left"><code class="filename">debug/unordered_map</code></td><td align="left"><code class="filename">debug/vector</code></td></tr><tr><td align="left"><code class="filename">debug/deque</code></td><td align="left"><code class="filename">debug/map</code></td><td align="left"><code class="filename">debug/string</code></td><td align="left"><code class="filename">debug/unordered_set</code></td><td class="auto-generated"> </td></tr></tbody></table></div></div><br class="table-break" /><p></p><div class="table"><a id="id428288"></a><p class="title"><b>Table 3.10. Extension Parallel Headers</b></p><div class="table-contents"><table summary="Extension Parallel Headers" border="1"><colgroup><col align="left" /><col align="left" /></colgroup><tbody><tr><td align="left"><code class="filename">parallel/algorithm</code></td><td align="left"><code class="filename">parallel/numeric</code></td></tr></tbody></table></div></div><br class="table-break" /></div><div class="sect2" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 class="title"><a id="manual.intro.using.headers.mixing"></a>Mixing Headers</h3></div></div></div><p> A few simple rules. +</p><div class="table"><a id="id490019"></a><p class="title"><b>Table 3.8. Extension Headers</b></p><div class="table-contents"><table summary="Extension Headers" border="1"><colgroup><col align="left" /><col align="left" /><col align="left" /><col align="left" /><col align="left" /></colgroup><tbody><tr><td align="left"><code class="filename">ext/algorithm</code></td><td align="left"><code class="filename">ext/debug_allocator.h</code></td><td align="left"><code class="filename">ext/mt_allocator.h</code></td><td align="left"><code class="filename">ext/pod_char_traits.h</code></td><td align="left"><code class="filename">ext/stdio_sync_filebuf.h</code></td></tr><tr><td align="left"><code class="filename">ext/array_allocator.h</code></td><td align="left"><code class="filename">ext/enc_filebuf.h</code></td><td align="left"><code class="filename">ext/new_allocator.h</code></td><td align="left"><code class="filename">ext/pool_allocator.h</code></td><td align="left"><code class="filename">ext/throw_allocator.h</code></td></tr><tr><td align="left"><code class="filename">ext/atomicity.h</code></td><td align="left"><code class="filename">ext/functional</code></td><td align="left"><code class="filename">ext/numeric</code></td><td align="left"><code class="filename">ext/rb_tree</code></td><td align="left"><code class="filename">ext/typelist.h</code></td></tr><tr><td align="left"><code class="filename">ext/bitmap_allocator.h</code></td><td align="left"><code class="filename">ext/iterator</code></td><td align="left"><code class="filename">ext/numeric_traits.h</code></td><td align="left"><code class="filename">ext/rope</code></td><td align="left"><code class="filename">ext/type_traits.h</code></td></tr><tr><td align="left"><code class="filename">ext/codecvt_specializations.h</code></td><td align="left"><code class="filename">ext/malloc_allocator.h</code></td><td align="left"><code class="filename">ext/pb_ds/assoc_container.h</code></td><td align="left"><code class="filename">ext/slist</code></td><td align="left"><code class="filename">ext/vstring.h</code></td></tr><tr><td align="left"><code class="filename">ext/concurrence.h</code></td><td align="left"><code class="filename">ext/memory</code></td><td align="left"><code class="filename">ext/pb_ds/priority_queue.h</code></td><td align="left"><code class="filename">ext/stdio_filebuf.h</code></td><td class="auto-generated"> </td></tr></tbody></table></div></div><br class="table-break" /><p></p><div class="table"><a id="id421980"></a><p class="title"><b>Table 3.9. Extension Debug Headers</b></p><div class="table-contents"><table summary="Extension Debug Headers" border="1"><colgroup><col align="left" /><col align="left" /><col align="left" /><col align="left" /><col align="left" /></colgroup><tbody><tr><td align="left"><code class="filename">debug/bitset</code></td><td align="left"><code class="filename">debug/list</code></td><td align="left"><code class="filename">debug/set</code></td><td align="left"><code class="filename">debug/unordered_map</code></td><td align="left"><code class="filename">debug/vector</code></td></tr><tr><td align="left"><code class="filename">debug/deque</code></td><td align="left"><code class="filename">debug/map</code></td><td align="left"><code class="filename">debug/string</code></td><td align="left"><code class="filename">debug/unordered_set</code></td><td class="auto-generated"> </td></tr></tbody></table></div></div><br class="table-break" /><p></p><div class="table"><a id="id362228"></a><p class="title"><b>Table 3.10. Extension Parallel Headers</b></p><div class="table-contents"><table summary="Extension Parallel Headers" border="1"><colgroup><col align="left" /><col align="left" /></colgroup><tbody><tr><td align="left"><code class="filename">parallel/algorithm</code></td><td align="left"><code class="filename">parallel/numeric</code></td></tr></tbody></table></div></div><br class="table-break" /></div><div class="sect2" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 class="title"><a id="manual.intro.using.headers.mixing"></a>Mixing Headers</h3></div></div></div><p> A few simple rules. </p><p>First, mixing different dialects of the standard headers is not possible. It's an all-or-nothing affair. Thus, code like </p><pre class="programlisting"> diff --git a/libstdc++-v3/doc/html/manual/bk01pt01ch03s03.html b/libstdc++-v3/doc/html/manual/bk01pt01ch03s03.html index 50ea8771de3..bb6e28196fd 100644 --- a/libstdc++-v3/doc/html/manual/bk01pt01ch03s03.html +++ b/libstdc++-v3/doc/html/manual/bk01pt01ch03s03.html @@ -2,7 +2,7 @@ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Namespaces</title><meta name="generator" content="DocBook XSL Stylesheets V1.73.2" /><meta name="keywords" content=" ISO C++ , library " /><link rel="start" href="../spine.html" title="The GNU C++ Library Documentation" /><link rel="up" href="using.html" title="Chapter 3. Using" /><link rel="prev" href="bk01pt01ch03s02.html" title="Headers" /><link rel="next" href="bk01pt01ch03s04.html" title="Macros" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Namespaces</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="bk01pt01ch03s02.html">Prev</a> </td><th width="60%" align="center">Chapter 3. Using</th><td width="20%" align="right"> <a accesskey="n" href="bk01pt01ch03s04.html">Next</a></td></tr></table><hr /></div><div class="sect1" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="manual.intro.using.namespaces"></a>Namespaces</h2></div></div></div><div class="sect2" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 class="title"><a id="manual.intro.using.namespaces.all"></a>Available Namespaces</h3></div></div></div><p> There are three main namespaces. </p><div class="itemizedlist"><ul type="disc"><li><p>std</p><p>The ISO C++ standards specify that "all library entities are defined -within namespace std." This includes namepaces nested +within namespace std." This includes namespaces nested within <code class="code">namespace std</code>, such as <code class="code">namespace std::tr1</code>. </p></li><li><p>abi</p><p>Specified by the C++ ABI. This ABI specifies a number of type and diff --git a/libstdc++-v3/doc/html/manual/bk01pt02pr01.html b/libstdc++-v3/doc/html/manual/bk01pt02pr01.html index 46dbe2ab865..811d492188b 100644 --- a/libstdc++-v3/doc/html/manual/bk01pt02pr01.html +++ b/libstdc++-v3/doc/html/manual/bk01pt02pr01.html @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8" standalone="no"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> -<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title></title><meta name="generator" content="DocBook XSL Stylesheets V1.73.2" /><meta name="keywords" content=" ISO C++ , library " /><link rel="start" href="../spine.html" title="The GNU C++ Library Documentation" /><link rel="up" href="support.html" title="Part II. Support" /><link rel="prev" href="support.html" title="Part II. Support" /><link rel="next" href="bk01pt02ch04.html" title="Chapter 4. Types" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center"></th></tr><tr><td width="20%" align="left"><a accesskey="p" href="support.html">Prev</a> </td><th width="60%" align="center">Part II. Support</th><td width="20%" align="right"> <a accesskey="n" href="bk01pt02ch04.html">Next</a></td></tr></table><hr /></div><div class="preface" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title"><a id="id394397"></a></h2></div></div></div><p> +<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title></title><meta name="generator" content="DocBook XSL Stylesheets V1.73.2" /><meta name="keywords" content=" ISO C++ , library " /><link rel="start" href="../spine.html" title="The GNU C++ Library Documentation" /><link rel="up" href="support.html" title="Part II. Support" /><link rel="prev" href="support.html" title="Part II. Support" /><link rel="next" href="bk01pt02ch04.html" title="Chapter 4. Types" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center"></th></tr><tr><td width="20%" align="left"><a accesskey="p" href="support.html">Prev</a> </td><th width="60%" align="center">Part II. Support</th><td width="20%" align="right"> <a accesskey="n" href="bk01pt02ch04.html">Next</a></td></tr></table><hr /></div><div class="preface" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title"><a id="id490700"></a></h2></div></div></div><p> This part deals with the functions called and objects created automatically during the course of a program's existence. </p><p> diff --git a/libstdc++-v3/doc/html/manual/bk01pt03ch07.html b/libstdc++-v3/doc/html/manual/bk01pt03ch07.html index a258631cb16..e29d2bf2d49 100644 --- a/libstdc++-v3/doc/html/manual/bk01pt03ch07.html +++ b/libstdc++-v3/doc/html/manual/bk01pt03ch07.html @@ -11,6 +11,6 @@ <code class="classname">string</code> member. </p><p> Derived from this are several classes that may have a - <code class="classname">string</code> member: a full heirarchy can be + <code class="classname">string</code> member: a full hierarchy can be found in the <a class="ulink" href="http://gcc.gnu.org/onlinedocs/libstdc++/latest-doxygen/a00233.html" target="_top">source documentation</a>. </p></div></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="diagnostics.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="diagnostics.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="bk01pt03ch07s02.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Part III. Diagnostics </td><td width="20%" align="center"><a accesskey="h" href="../spine.html">Home</a></td><td width="40%" align="right" valign="top"> Adding Data to Exceptions</td></tr></table></div></body></html> diff --git a/libstdc++-v3/doc/html/manual/bk01pt04ch11.html b/libstdc++-v3/doc/html/manual/bk01pt04ch11.html index d1f0024810f..4682fe3e46e 100644 --- a/libstdc++-v3/doc/html/manual/bk01pt04ch11.html +++ b/libstdc++-v3/doc/html/manual/bk01pt04ch11.html @@ -11,7 +11,7 @@ class template called <code class="classname">allocator</code>. The <code class="classname">allocator</code> abstraction is used throughout the library in <code class="classname">string</code>, container classes, - algorithnms, and parts of iostreams. This class, and base classes of + algorithms, and parts of iostreams. This class, and base classes of it, are the superset of available free store (“<span class="quote">heap</span>”) management classes. </p><div class="sect2" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 class="title"><a id="allocator.req"></a>Requirements</h3></div></div></div><p> @@ -90,7 +90,7 @@ or loading and unloading shared objects in memory. As such, using caching allocators on systems that do not support <code class="function">abi::__cxa_atexit</code> is not recommended. - </p></div><div class="sect2" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 class="title"><a id="allocator.impl"></a>Implementation</h3></div></div></div><div class="sect3" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="id419220"></a>Interface Design</h4></div></div></div><p> + </p></div><div class="sect2" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 class="title"><a id="allocator.impl"></a>Implementation</h3></div></div></div><div class="sect3" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="id425964"></a>Interface Design</h4></div></div></div><p> The only allocator interface that is support is the standard C++ interface. As such, all STL containers have been adjusted, and all external allocators have @@ -103,7 +103,7 @@ </p><p> The base class that <code class="classname">allocator</code> is derived from may not be user-configurable. -</p></div><div class="sect3" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="id480984"></a>Selecting Default Allocation Policy</h4></div></div></div><p> +</p></div><div class="sect3" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="id424963"></a>Selecting Default Allocation Policy</h4></div></div></div><p> It's difficult to pick an allocation strategy that will provide maximum utility, without excessively penalizing some behavior. In fact, it's difficult just deciding which typical actions to measure @@ -140,7 +140,7 @@ The current default choice for <code class="classname">allocator</code> is <code class="classname">__gnu_cxx::new_allocator</code>. - </p></div><div class="sect3" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="id411194"></a>Disabling Memory Caching</h4></div></div></div><p> + </p></div><div class="sect3" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="id458581"></a>Disabling Memory Caching</h4></div></div></div><p> In use, <code class="classname">allocator</code> may allocate and deallocate using implementation-specified strategies and heuristics. Because of this, every call to an allocator object's @@ -161,7 +161,7 @@ directly, for every allocation. (See <code class="filename">include/ext/new_allocator.h</code>, for instance.) However, that option would involve changing source code to use - the a non-default allocator. Another option is to force the + a non-default allocator. Another option is to force the default allocator to remove caching and pools, and to directly allocate with every call of <code class="function">allocate</code> and directly deallocate with every call of @@ -245,7 +245,7 @@ <code class="classname">throw_allocator</code> </p><p> Includes memory tracking and marking abilities as well as hooks for - throwing exceptinos at configurable intervals (including random, + throwing exceptions at configurable intervals (including random, all, none). </p></li><li><p> <code class="classname">__pool_alloc</code> @@ -282,13 +282,13 @@ </p><p>The <code class="varname">thr</code> boolean determines whether the pool should be manipulated atomically or not. When <code class="varname">thr</code> = <code class="constant">true</code>, the allocator - is is threadsafe, while <code class="varname">thr</code> = + is is thread-safe, while <code class="varname">thr</code> = <code class="constant">false</code>, and is slightly faster but unsafe for multiple threads. </p><p> For thread-enabled configurations, the pool is locked with a single big lock. In some situations, this implementation detail - may result in severe performance degredation. + may result in severe performance degradation. </p><p> (Note that the GCC thread abstraction layer allows us to provide safe zero-overhead stubs for the threading routines, if threads @@ -305,11 +305,11 @@ A high-performance allocator that uses a bit-map to keep track of the used and unused memory locations. It has its own documentation, found <a class="ulink" href="../ext/ballocator_doc.html" target="_top">here</a>. - </p></li></ol></div></div><div class="bibliography"><div class="titlepage"><div><div><h3 class="title"><a id="allocator.biblio"></a>Bibliography</h3></div></div></div><div class="biblioentry"><a id="id413478"></a><p><span class="title"><i> + </p></li></ol></div></div><div class="bibliography"><div class="titlepage"><div><div><h3 class="title"><a id="allocator.biblio"></a>Bibliography</h3></div></div></div><div class="biblioentry"><a id="id457599"></a><p><span class="title"><i> ISO/IEC 14882:1998 Programming languages - C++ </i>. </span> isoc++_1998 - <span class="pagenums">20.4 Memory. </span></p></div><div class="biblioentry"><a id="id415484"></a><p><span class="title"><i>The Standard Librarian: What Are Allocators Good + <span class="pagenums">20.4 Memory. </span></p></div><div class="biblioentry"><a id="id457613"></a><p><span class="title"><i>The Standard Librarian: What Are Allocators Good </i>. </span> austernm <span class="author"><span class="firstname">Matt</span> <span class="surname">Austern</span>. </span><span class="publisher"><span class="publishername"> @@ -317,28 +317,28 @@ . </span></span><span class="biblioid"> <a class="ulink" href="http://www.cuj.com/documents/s=8000/cujcexp1812austern/" target="_top"> </a> - . </span></p></div><div class="biblioentry"><a id="id398891"></a><p><span class="title"><i>The Hoard Memory Allocator</i>. </span> + . </span></p></div><div class="biblioentry"><a id="id458630"></a><p><span class="title"><i>The Hoard Memory Allocator</i>. </span> emeryb <span class="author"><span class="firstname">Emery</span> <span class="surname">Berger</span>. </span><span class="biblioid"> <a class="ulink" href="http://www.cs.umass.edu/~emery/hoard/" target="_top"> </a> - . </span></p></div><div class="biblioentry"><a id="id413375"></a><p><span class="title"><i>Reconsidering Custom Memory Allocation</i>. </span> + . </span></p></div><div class="biblioentry"><a id="id459380"></a><p><span class="title"><i>Reconsidering Custom Memory Allocation</i>. </span> bergerzorn <span class="author"><span class="firstname">Emery</span> <span class="surname">Berger</span>. </span><span class="author"><span class="firstname">Ben</span> <span class="surname">Zorn</span>. </span><span class="author"><span class="firstname">Kathryn</span> <span class="surname">McKinley</span>. </span><span class="copyright">Copyright © 2002 OOPSLA. </span><span class="biblioid"> <a class="ulink" href="http://www.cs.umass.edu/~emery/pubs/berger-oopsla2002.pdf" target="_top"> </a> - . </span></p></div><div class="biblioentry"><a id="id425682"></a><p><span class="title"><i>Allocator Types</i>. </span> + . </span></p></div><div class="biblioentry"><a id="id470488"></a><p><span class="title"><i>Allocator Types</i>. </span> kreftlanger <span class="author"><span class="firstname">Klaus</span> <span class="surname">Kreft</span>. </span><span class="author"><span class="firstname">Angelika</span> <span class="surname">Langer</span>. </span><span class="publisher"><span class="publishername"> C/C++ Users Journal . </span></span><span class="biblioid"> <a class="ulink" href="http://www.langer.camelot.de/Articles/C++Report/Allocators/Allocators.html" target="_top"> </a> - . </span></p></div><div class="biblioentry"><a id="id420837"></a><p><span class="title"><i>The C++ Programming Language</i>. </span> + . </span></p></div><div class="biblioentry"><a id="id454967"></a><p><span class="title"><i>The C++ Programming Language</i>. </span> tcpl <span class="author"><span class="firstname">Bjarne</span> <span class="surname">Stroustrup</span>. </span><span class="copyright">Copyright © 2000 . </span><span class="pagenums">19.4 Allocators. </span><span class="publisher"><span class="publishername"> Addison Wesley - . </span></span></p></div><div class="biblioentry"><a id="id423539"></a><p><span class="title"><i>Yalloc: A Recycling C++ Allocator</i>. </span> + . </span></span></p></div><div class="biblioentry"><a id="id453321"></a><p><span class="title"><i>Yalloc: A Recycling C++ Allocator</i>. </span> yenf <span class="author"><span class="firstname">Felix</span> <span class="surname">Yen</span>. </span><span class="copyright">Copyright © . </span><span class="biblioid"> <a class="ulink" href="http://home.earthlink.net/~brimar/yalloc/" target="_top"> diff --git a/libstdc++-v3/doc/html/manual/bk01pt05ch13.html b/libstdc++-v3/doc/html/manual/bk01pt05ch13.html index bc03ae817d9..e50eb1fe71c 100644 --- a/libstdc++-v3/doc/html/manual/bk01pt05ch13.html +++ b/libstdc++-v3/doc/html/manual/bk01pt05ch13.html @@ -1,13 +1,13 @@ <?xml version="1.0" encoding="UTF-8" standalone="no"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> -<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Chapter 13. String Classes</title><meta name="generator" content="DocBook XSL Stylesheets V1.73.2" /><meta name="keywords" content=" ISO C++ , library " /><link rel="start" href="../spine.html" title="The GNU C++ Library Documentation" /><link rel="up" href="strings.html" title="Part V. Strings" /><link rel="prev" href="strings.html" title="Part V. Strings" /><link rel="next" href="bk01pt05ch13s02.html" title="Case Sensivitity" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Chapter 13. String Classes</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="strings.html">Prev</a> </td><th width="60%" align="center">Part V. Strings</th><td width="20%" align="right"> <a accesskey="n" href="bk01pt05ch13s02.html">Next</a></td></tr></table><hr /></div><div class="chapter" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title"><a id="manual.strings.string"></a>Chapter 13. String Classes</h2></div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="sect1"><a href="bk01pt05ch13.html#strings.string.simple">Simple Transformations</a></span></dt><dt><span class="sect1"><a href="bk01pt05ch13s02.html">Case Sensivitity</a></span></dt><dt><span class="sect1"><a href="bk01pt05ch13s03.html">Arbitrary Character Types</a></span></dt><dt><span class="sect1"><a href="bk01pt05ch13s04.html">Tokenizing</a></span></dt><dt><span class="sect1"><a href="bk01pt05ch13s05.html">Shrink to Fit</a></span></dt><dt><span class="sect1"><a href="bk01pt05ch13s06.html">CString (MFC)</a></span></dt></dl></div><div class="sect1" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="strings.string.simple"></a>Simple Transformations</h2></div></div></div><p> +<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Chapter 13. String Classes</title><meta name="generator" content="DocBook XSL Stylesheets V1.73.2" /><meta name="keywords" content=" ISO C++ , library " /><link rel="start" href="../spine.html" title="The GNU C++ Library Documentation" /><link rel="up" href="strings.html" title="Part V. Strings" /><link rel="prev" href="strings.html" title="Part V. Strings" /><link rel="next" href="bk01pt05ch13s02.html" title="Case Sensitivity" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Chapter 13. String Classes</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="strings.html">Prev</a> </td><th width="60%" align="center">Part V. Strings</th><td width="20%" align="right"> <a accesskey="n" href="bk01pt05ch13s02.html">Next</a></td></tr></table><hr /></div><div class="chapter" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title"><a id="manual.strings.string"></a>Chapter 13. String Classes</h2></div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="sect1"><a href="bk01pt05ch13.html#strings.string.simple">Simple Transformations</a></span></dt><dt><span class="sect1"><a href="bk01pt05ch13s02.html">Case Sensitivity</a></span></dt><dt><span class="sect1"><a href="bk01pt05ch13s03.html">Arbitrary Character Types</a></span></dt><dt><span class="sect1"><a href="bk01pt05ch13s04.html">Tokenizing</a></span></dt><dt><span class="sect1"><a href="bk01pt05ch13s05.html">Shrink to Fit</a></span></dt><dt><span class="sect1"><a href="bk01pt05ch13s06.html">CString (MFC)</a></span></dt></dl></div><div class="sect1" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="strings.string.simple"></a>Simple Transformations</h2></div></div></div><p> Here are Standard, simple, and portable ways to perform common transformations on a <code class="code">string</code> instance, such as "convert to all upper case." The word transformations is especially apt, because the standard template function <code class="code">transform<></code> is used. </p><p> - This code will go through some iterations. Here's a simiple + This code will go through some iterations. Here's a simple version: </p><pre class="programlisting"> #include <string> @@ -86,4 +86,4 @@ str.erase(notwhite+1); </pre><p>Obviously, the calls to <code class="code">find</code> could be inserted directly into the calls to <code class="code">erase</code>, in case your compiler does not optimize named temporaries out of existence. - </p></div></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="strings.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="strings.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="bk01pt05ch13s02.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Part V. Strings </td><td width="20%" align="center"><a accesskey="h" href="../spine.html">Home</a></td><td width="40%" align="right" valign="top"> Case Sensivitity</td></tr></table></div></body></html> + </p></div></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="strings.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="strings.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="bk01pt05ch13s02.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Part V. Strings </td><td width="20%" align="center"><a accesskey="h" href="../spine.html">Home</a></td><td width="40%" align="right" valign="top"> Case Sensitivity</td></tr></table></div></body></html> diff --git a/libstdc++-v3/doc/html/manual/bk01pt05ch13s02.html b/libstdc++-v3/doc/html/manual/bk01pt05ch13s02.html index 603721cd88d..2db68f6d814 100644 --- a/libstdc++-v3/doc/html/manual/bk01pt05ch13s02.html +++ b/libstdc++-v3/doc/html/manual/bk01pt05ch13s02.html @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8" standalone="no"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> -<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Case Sensivitity</title><meta name="generator" content="DocBook XSL Stylesheets V1.73.2" /><meta name="keywords" content=" ISO C++ , library " /><link rel="start" href="../spine.html" title="The GNU C++ Library Documentation" /><link rel="up" href="bk01pt05ch13.html" title="Chapter 13. String Classes" /><link rel="prev" href="bk01pt05ch13.html" title="Chapter 13. String Classes" /><link rel="next" href="bk01pt05ch13s03.html" title="Arbitrary Character Types" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Case Sensivitity</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="bk01pt05ch13.html">Prev</a> </td><th width="60%" align="center">Chapter 13. String Classes</th><td width="20%" align="right"> <a accesskey="n" href="bk01pt05ch13s03.html">Next</a></td></tr></table><hr /></div><div class="sect1" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="strings.string.case"></a>Case Sensivitity</h2></div></div></div><p> +<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Case Sensitivity</title><meta name="generator" content="DocBook XSL Stylesheets V1.73.2" /><meta name="keywords" content=" ISO C++ , library " /><link rel="start" href="../spine.html" title="The GNU C++ Library Documentation" /><link rel="up" href="bk01pt05ch13.html" title="Chapter 13. String Classes" /><link rel="prev" href="bk01pt05ch13.html" title="Chapter 13. String Classes" /><link rel="next" href="bk01pt05ch13s03.html" title="Arbitrary Character Types" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Case Sensitivity</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="bk01pt05ch13.html">Prev</a> </td><th width="60%" align="center">Chapter 13. String Classes</th><td width="20%" align="right"> <a accesskey="n" href="bk01pt05ch13s03.html">Next</a></td></tr></table><hr /></div><div class="sect1" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="strings.string.case"></a>Case Sensitivity</h2></div></div></div><p> </p><p>The well-known-and-if-it-isn't-well-known-it-ought-to-be <a class="ulink" href="http://www.gotw.ca/gotw/" target="_top">Guru of the Week</a> discussions held on Usenet covered this topic in January of 1998. diff --git a/libstdc++-v3/doc/html/manual/bk01pt05ch13s03.html b/libstdc++-v3/doc/html/manual/bk01pt05ch13s03.html index c321667a729..49f416a170c 100644 --- a/libstdc++-v3/doc/html/manual/bk01pt05ch13s03.html +++ b/libstdc++-v3/doc/html/manual/bk01pt05ch13s03.html @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8" standalone="no"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> -<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Arbitrary Character Types</title><meta name="generator" content="DocBook XSL Stylesheets V1.73.2" /><meta name="keywords" content=" ISO C++ , library " /><link rel="start" href="../spine.html" title="The GNU C++ Library Documentation" /><link rel="up" href="bk01pt05ch13.html" title="Chapter 13. String Classes" /><link rel="prev" href="bk01pt05ch13s02.html" title="Case Sensivitity" /><link rel="next" href="bk01pt05ch13s04.html" title="Tokenizing" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Arbitrary Character Types</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="bk01pt05ch13s02.html">Prev</a> </td><th width="60%" align="center">Chapter 13. String Classes</th><td width="20%" align="right"> <a accesskey="n" href="bk01pt05ch13s04.html">Next</a></td></tr></table><hr /></div><div class="sect1" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="strings.string.character_types"></a>Arbitrary Character Types</h2></div></div></div><p> +<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Arbitrary Character Types</title><meta name="generator" content="DocBook XSL Stylesheets V1.73.2" /><meta name="keywords" content=" ISO C++ , library " /><link rel="start" href="../spine.html" title="The GNU C++ Library Documentation" /><link rel="up" href="bk01pt05ch13.html" title="Chapter 13. String Classes" /><link rel="prev" href="bk01pt05ch13s02.html" title="Case Sensitivity" /><link rel="next" href="bk01pt05ch13s04.html" title="Tokenizing" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Arbitrary Character Types</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="bk01pt05ch13s02.html">Prev</a> </td><th width="60%" align="center">Chapter 13. String Classes</th><td width="20%" align="right"> <a accesskey="n" href="bk01pt05ch13s04.html">Next</a></td></tr></table><hr /></div><div class="sect1" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="strings.string.character_types"></a>Arbitrary Character Types</h2></div></div></div><p> </p><p>The <code class="code">std::basic_string</code> is tantalizingly general, in that it is parameterized on the type of the characters which it holds. In theory, you could whip up a Unicode character class and instantiate @@ -54,4 +54,4 @@ nice-looking first attempt</a> turned out to <a class="ulink" href="http://gcc.gnu.org/ml/libstdc++/2002-08/msg00242.html" target="_top">not be conforming C++</a>, due to the rule that CharT must be a POD. (See how tricky this is?) - </p></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="bk01pt05ch13s02.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="bk01pt05ch13.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="bk01pt05ch13s04.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Case Sensivitity </td><td width="20%" align="center"><a accesskey="h" href="../spine.html">Home</a></td><td width="40%" align="right" valign="top"> Tokenizing</td></tr></table></div></body></html> + </p></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="bk01pt05ch13s02.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="bk01pt05ch13.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="bk01pt05ch13s04.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Case Sensitivity </td><td width="20%" align="center"><a accesskey="h" href="../spine.html">Home</a></td><td width="40%" align="right" valign="top"> Tokenizing</td></tr></table></div></body></html> diff --git a/libstdc++-v3/doc/html/manual/bk01pt06ch14.html b/libstdc++-v3/doc/html/manual/bk01pt06ch14.html index 7b98960a0a0..e1d2aa0a438 100644 --- a/libstdc++-v3/doc/html/manual/bk01pt06ch14.html +++ b/libstdc++-v3/doc/html/manual/bk01pt06ch14.html @@ -19,7 +19,7 @@ thousands separator is in the German locale. </p><p> Literally, a facet is strictly defined: </p><div class="itemizedlist"><ul type="disc"><li><p> - Dontaining the following public data member: + Containing the following public data member: </p><p> <code class="code">static locale::id id;</code> </p></li><li><p> @@ -42,11 +42,11 @@ class id Provides an index for looking up specific facets. </p></div><div class="sect2" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 class="title"><a id="locales.locale.design"></a>Design</h3></div></div></div><p> The major design challenge is fitting an object-orientated and -non-global locale design ontop of POSIX and other relevant stanards, +non-global locale design on top of POSIX and other relevant standards, which include the Single Unix (nee X/Open.) </p><p> Because C and earlier versions of POSIX falls down so completely, -portibility is an issue. +portability is an issue. </p></div><div class="sect2" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 class="title"><a id="locales.locale.impl"></a>Implementation</h3></div></div></div><div class="sect3" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="locale.impl.c"></a>Interacting with "C" locales</h4></div></div></div><div class="itemizedlist"><ul type="disc"><li><p> <code class="code">`locale -a`</code> displays available locales. </p><div class="blockquote"><blockquote class="blockquote"><pre class="programlisting"> @@ -372,7 +372,7 @@ relation (of the C++ locale mechanism) to the C locale mechanism: the global C locale is modified if a named C++ locale object is set as the global locale" (emphasis Paolo), that is: </p><pre class="programlisting">std::locale::global(std::locale(""));</pre><p>affects the C functions as if the following call was made:</p><pre class="programlisting">std::setlocale(LC_ALL, "");</pre><p> - On the other hand, there is *no* viceversa, that is, calling + On the other hand, there is *no* vice versa, that is, calling setlocale has *no* whatsoever on the C++ locale mechanism, in particular on the working of locale(""), which constructs the locale object from the environment of the running program, that is, in @@ -383,7 +383,7 @@ global locale" (emphasis Paolo), that is: has already taken place? </p></li><li><p> Document how named locales error check when filling data - members. Ie, a fr_FR locale that doesn't have + members. I.e., a fr_FR locale that doesn't have numpunct::truename(): does it use "true"? Or is it a blank string? What's the convention? </p></li><li><p> @@ -393,27 +393,27 @@ global locale" (emphasis Paolo), that is: language code and ISO country code (say, "de_DE"). </p></li><li><p> What should non-required facet instantiations do? If the - generic implemenation is provided, then how to end-users + generic implementation is provided, then how to end-users provide specializations? - </p></li></ul></div></div><div class="bibliography"><div class="titlepage"><div><div><h3 class="title"><a id="locales.locale.biblio"></a>Bibliography</h3></div></div></div><div class="biblioentry"><a id="id389722"></a><p><span class="title"><i> + </p></li></ul></div></div><div class="bibliography"><div class="titlepage"><div><div><h3 class="title"><a id="locales.locale.biblio"></a>Bibliography</h3></div></div></div><div class="biblioentry"><a id="id412273"></a><p><span class="title"><i> The GNU C Library - </i>. </span><span class="author"><span class="firstname">Roland</span> <span class="surname">McGrath</span>. </span><span class="author"><span class="firstname">Ulrich</span> <span class="surname">Drepper</span>. </span><span class="copyright">Copyright © 2007 FSF. </span><span class="pagenums">Chapters 6 Character Set Handling and 7 Locales and Internationalization. </span></p></div><div class="biblioentry"><a id="id418042"></a><p><span class="title"><i> + </i>. </span><span class="author"><span class="firstname">Roland</span> <span class="surname">McGrath</span>. </span><span class="author"><span class="firstname">Ulrich</span> <span class="surname">Drepper</span>. </span><span class="copyright">Copyright © 2007 FSF. </span><span class="pagenums">Chapters 6 Character Set Handling and 7 Locales and Internationalization. </span></p></div><div class="biblioentry"><a id="id398173"></a><p><span class="title"><i> Correspondence - </i>. </span><span class="author"><span class="firstname">Ulrich</span> <span class="surname">Drepper</span>. </span><span class="copyright">Copyright © 2002 . </span></p></div><div class="biblioentry"><a id="id495535"></a><p><span class="title"><i> + </i>. </span><span class="author"><span class="firstname">Ulrich</span> <span class="surname">Drepper</span>. </span><span class="copyright">Copyright © 2002 . </span></p></div><div class="biblioentry"><a id="id427688"></a><p><span class="title"><i> ISO/IEC 14882:1998 Programming languages - C++ - </i>. </span><span class="copyright">Copyright © 1998 ISO. </span></p></div><div class="biblioentry"><a id="id434429"></a><p><span class="title"><i> + </i>. </span><span class="copyright">Copyright © 1998 ISO. </span></p></div><div class="biblioentry"><a id="id427707"></a><p><span class="title"><i> ISO/IEC 9899:1999 Programming languages - C - </i>. </span><span class="copyright">Copyright © 1999 ISO. </span></p></div><div class="biblioentry"><a id="id434447"></a><p><span class="title"><i> + </i>. </span><span class="copyright">Copyright © 1999 ISO. </span></p></div><div class="biblioentry"><a id="id406617"></a><p><span class="title"><i> System Interface Definitions, Issue 6 (IEEE Std. 1003.1-200x) </i>. </span><span class="copyright">Copyright © 1999 The Open Group/The Institute of Electrical and Electronics Engineers, Inc.. </span><span class="biblioid"> <a class="ulink" href="http://www.opennc.org/austin/docreg.html" target="_top"> </a> - . </span></p></div><div class="biblioentry"><a id="id415318"></a><p><span class="title"><i> + . </span></p></div><div class="biblioentry"><a id="id471678"></a><p><span class="title"><i> The C++ Programming Language, Special Edition </i>. </span><span class="author"><span class="firstname">Bjarne</span> <span class="surname">Stroustrup</span>. </span><span class="copyright">Copyright © 2000 Addison Wesley, Inc.. </span><span class="pagenums">Appendix D. </span><span class="publisher"><span class="publishername"> Addison Wesley - . </span></span></p></div><div class="biblioentry"><a id="id424745"></a><p><span class="title"><i> + . </span></span></p></div><div class="biblioentry"><a id="id414572"></a><p><span class="title"><i> Standard C++ IOStreams and Locales </i>. </span><span class="subtitle"> Advanced Programmer's Guide and Reference diff --git a/libstdc++-v3/doc/html/manual/bk01pt06ch15.html b/libstdc++-v3/doc/html/manual/bk01pt06ch15.html index 2a3811806a7..7bad31da01b 100644 --- a/libstdc++-v3/doc/html/manual/bk01pt06ch15.html +++ b/libstdc++-v3/doc/html/manual/bk01pt06ch15.html @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8" standalone="no"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> -<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Chapter 15. Facets aka Categories</title><meta name="generator" content="DocBook XSL Stylesheets V1.73.2" /><meta name="keywords" content=" ISO C++ , library " /><link rel="start" href="../spine.html" title="The GNU C++ Library Documentation" /><link rel="up" href="localization.html" title="Part VI. Localization" /><link rel="prev" href="bk01pt06ch14.html" title="Chapter 14. Locales" /><link rel="next" href="codecvt.html" title="codecvt" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Chapter 15. Facets aka Categories</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="bk01pt06ch14.html">Prev</a> </td><th width="60%" align="center">Part VI. Localization</th><td width="20%" align="right"> <a accesskey="n" href="codecvt.html">Next</a></td></tr></table><hr /></div><div class="chapter" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title"><a id="manual.localization.facet"></a>Chapter 15. Facets aka Categories</h2></div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="sect1"><a href="bk01pt06ch15.html#manual.localization.facet.ctype">ctype</a></span></dt><dd><dl><dt><span class="sect2"><a href="bk01pt06ch15.html#facet.ctype.impl">Implementation</a></span></dt><dt><span class="sect2"><a href="bk01pt06ch15.html#facet.ctype.future">Future</a></span></dt></dl></dd><dt><span class="sect1"><a href="codecvt.html">codecvt</a></span></dt><dd><dl><dt><span class="sect2"><a href="codecvt.html#facet.codecvt.req">Requirements</a></span></dt><dt><span class="sect2"><a href="codecvt.html#facet.codecvt.design">Design</a></span></dt><dt><span class="sect2"><a href="codecvt.html#facet.codecvt.impl">Implementation</a></span></dt><dt><span class="sect2"><a href="codecvt.html#facet.codecvt.use">Use</a></span></dt><dt><span class="sect2"><a href="codecvt.html#facet.codecvt.future">Future</a></span></dt></dl></dd><dt><span class="sect1"><a href="messages.html">messages</a></span></dt><dd><dl><dt><span class="sect2"><a href="messages.html#facet.messages.req">Requirements</a></span></dt><dt><span class="sect2"><a href="messages.html#facet.messages.design">Design</a></span></dt><dt><span class="sect2"><a href="messages.html#facet.messages.impl">Implementation</a></span></dt><dt><span class="sect2"><a href="messages.html#facet.messages.use">Use</a></span></dt><dt><span class="sect2"><a href="messages.html#facet.messages.future">Future</a></span></dt></dl></dd></dl></div><div class="sect1" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="manual.localization.facet.ctype"></a>ctype</h2></div></div></div><div class="sect2" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 class="title"><a id="facet.ctype.impl"></a>Implementation</h3></div></div></div><div class="sect3" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="id424267"></a>Specializations</h4></div></div></div><p> +<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Chapter 15. Facets aka Categories</title><meta name="generator" content="DocBook XSL Stylesheets V1.73.2" /><meta name="keywords" content=" ISO C++ , library " /><link rel="start" href="../spine.html" title="The GNU C++ Library Documentation" /><link rel="up" href="localization.html" title="Part VI. Localization" /><link rel="prev" href="bk01pt06ch14.html" title="Chapter 14. Locales" /><link rel="next" href="codecvt.html" title="codecvt" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Chapter 15. Facets aka Categories</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="bk01pt06ch14.html">Prev</a> </td><th width="60%" align="center">Part VI. Localization</th><td width="20%" align="right"> <a accesskey="n" href="codecvt.html">Next</a></td></tr></table><hr /></div><div class="chapter" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title"><a id="manual.localization.facet"></a>Chapter 15. Facets aka Categories</h2></div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="sect1"><a href="bk01pt06ch15.html#manual.localization.facet.ctype">ctype</a></span></dt><dd><dl><dt><span class="sect2"><a href="bk01pt06ch15.html#facet.ctype.impl">Implementation</a></span></dt><dt><span class="sect2"><a href="bk01pt06ch15.html#facet.ctype.future">Future</a></span></dt></dl></dd><dt><span class="sect1"><a href="codecvt.html">codecvt</a></span></dt><dd><dl><dt><span class="sect2"><a href="codecvt.html#facet.codecvt.req">Requirements</a></span></dt><dt><span class="sect2"><a href="codecvt.html#facet.codecvt.design">Design</a></span></dt><dt><span class="sect2"><a href="codecvt.html#facet.codecvt.impl">Implementation</a></span></dt><dt><span class="sect2"><a href="codecvt.html#facet.codecvt.use">Use</a></span></dt><dt><span class="sect2"><a href="codecvt.html#facet.codecvt.future">Future</a></span></dt></dl></dd><dt><span class="sect1"><a href="messages.html">messages</a></span></dt><dd><dl><dt><span class="sect2"><a href="messages.html#facet.messages.req">Requirements</a></span></dt><dt><span class="sect2"><a href="messages.html#facet.messages.design">Design</a></span></dt><dt><span class="sect2"><a href="messages.html#facet.messages.impl">Implementation</a></span></dt><dt><span class="sect2"><a href="messages.html#facet.messages.use">Use</a></span></dt><dt><span class="sect2"><a href="messages.html#facet.messages.future">Future</a></span></dt></dl></dd></dl></div><div class="sect1" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="manual.localization.facet.ctype"></a>ctype</h2></div></div></div><div class="sect2" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 class="title"><a id="facet.ctype.impl"></a>Implementation</h3></div></div></div><div class="sect3" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="id423514"></a>Specializations</h4></div></div></div><p> For the required specialization codecvt<wchar_t, char, mbstate_t> , conversions are made between the internal character set (always UCS4 on GNU/Linux) and whatever the currently selected locale for the @@ -41,31 +41,31 @@ characters. this class? </p></li><li><p> Get the ctype<wchar_t>::mask stuff under control. Need to - make some kind of static table, and not do lookup evertime + make some kind of static table, and not do lookup every time somebody hits the do_is... functions. Too bad we can't just redefine mask for ctype<wchar_t> </p></li><li><p> Rename abstract base class. See if just smash-overriding is a better approach. Clarify, add sanity to naming. - </p></li></ul></div></div><div class="bibliography"><div class="titlepage"><div><div><h3 class="title"><a id="facet.ctype.biblio"></a>Bibliography</h3></div></div></div><div class="biblioentry"><a id="id428438"></a><p><span class="title"><i> + </p></li></ul></div></div><div class="bibliography"><div class="titlepage"><div><div><h3 class="title"><a id="facet.ctype.biblio"></a>Bibliography</h3></div></div></div><div class="biblioentry"><a id="id397038"></a><p><span class="title"><i> The GNU C Library - </i>. </span><span class="author"><span class="firstname">Roland</span> <span class="surname">McGrath</span>. </span><span class="author"><span class="firstname">Ulrich</span> <span class="surname">Drepper</span>. </span><span class="copyright">Copyright © 2007 FSF. </span><span class="pagenums">Chapters 6 Character Set Handling and 7 Locales and Internationalization. </span></p></div><div class="biblioentry"><a id="id406217"></a><p><span class="title"><i> + </i>. </span><span class="author"><span class="firstname">Roland</span> <span class="surname">McGrath</span>. </span><span class="author"><span class="firstname">Ulrich</span> <span class="surname">Drepper</span>. </span><span class="copyright">Copyright © 2007 FSF. </span><span class="pagenums">Chapters 6 Character Set Handling and 7 Locales and Internationalization. </span></p></div><div class="biblioentry"><a id="id399816"></a><p><span class="title"><i> Correspondence - </i>. </span><span class="author"><span class="firstname">Ulrich</span> <span class="surname">Drepper</span>. </span><span class="copyright">Copyright © 2002 . </span></p></div><div class="biblioentry"><a id="id406246"></a><p><span class="title"><i> + </i>. </span><span class="author"><span class="firstname">Ulrich</span> <span class="surname">Drepper</span>. </span><span class="copyright">Copyright © 2002 . </span></p></div><div class="biblioentry"><a id="id419755"></a><p><span class="title"><i> ISO/IEC 14882:1998 Programming languages - C++ - </i>. </span><span class="copyright">Copyright © 1998 ISO. </span></p></div><div class="biblioentry"><a id="id424106"></a><p><span class="title"><i> + </i>. </span><span class="copyright">Copyright © 1998 ISO. </span></p></div><div class="biblioentry"><a id="id419773"></a><p><span class="title"><i> ISO/IEC 9899:1999 Programming languages - C - </i>. </span><span class="copyright">Copyright © 1999 ISO. </span></p></div><div class="biblioentry"><a id="id424124"></a><p><span class="title"><i> + </i>. </span><span class="copyright">Copyright © 1999 ISO. </span></p></div><div class="biblioentry"><a id="id397810"></a><p><span class="title"><i> System Interface Definitions, Issue 6 (IEEE Std. 1003.1-200x) </i>. </span><span class="copyright">Copyright © 1999 The Open Group/The Institute of Electrical and Electronics Engineers, Inc.. </span><span class="biblioid"> <a class="ulink" href="http://www.opennc.org/austin/docreg.html" target="_top"> </a> - . </span></p></div><div class="biblioentry"><a id="id483804"></a><p><span class="title"><i> + . </span></p></div><div class="biblioentry"><a id="id397838"></a><p><span class="title"><i> The C++ Programming Language, Special Edition </i>. </span><span class="author"><span class="firstname">Bjarne</span> <span class="surname">Stroustrup</span>. </span><span class="copyright">Copyright © 2000 Addison Wesley, Inc.. </span><span class="pagenums">Appendix D. </span><span class="publisher"><span class="publishername"> Addison Wesley - . </span></span></p></div><div class="biblioentry"><a id="id428016"></a><p><span class="title"><i> + . </span></span></p></div><div class="biblioentry"><a id="id362481"></a><p><span class="title"><i> Standard C++ IOStreams and Locales </i>. </span><span class="subtitle"> Advanced Programmer's Guide and Reference diff --git a/libstdc++-v3/doc/html/manual/bk01pt09pr02.html b/libstdc++-v3/doc/html/manual/bk01pt09pr02.html index d5cedbdfd3f..365ae11cb8d 100644 --- a/libstdc++-v3/doc/html/manual/bk01pt09pr02.html +++ b/libstdc++-v3/doc/html/manual/bk01pt09pr02.html @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8" standalone="no"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> -<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title></title><meta name="generator" content="DocBook XSL Stylesheets V1.73.2" /><meta name="keywords" content=" ISO C++ , library , algorithm " /><link rel="start" href="../spine.html" title="The GNU C++ Library Documentation" /><link rel="up" href="algorithms.html" title="Part IX. Algorithms" /><link rel="prev" href="algorithms.html" title="Part IX. Algorithms" /><link rel="next" href="bk01pt09ch20.html" title="Chapter 20. Mutating" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center"></th></tr><tr><td width="20%" align="left"><a accesskey="p" href="algorithms.html">Prev</a> </td><th width="60%" align="center">Part IX. Algorithms</th><td width="20%" align="right"> <a accesskey="n" href="bk01pt09ch20.html">Next</a></td></tr></table><hr /></div><div class="preface" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title"><a id="id405802"></a></h2></div></div></div><p> +<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title></title><meta name="generator" content="DocBook XSL Stylesheets V1.73.2" /><meta name="keywords" content=" ISO C++ , library , algorithm " /><link rel="start" href="../spine.html" title="The GNU C++ Library Documentation" /><link rel="up" href="algorithms.html" title="Part IX. Algorithms" /><link rel="prev" href="algorithms.html" title="Part IX. Algorithms" /><link rel="next" href="bk01pt09ch20.html" title="Chapter 20. Mutating" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center"></th></tr><tr><td width="20%" align="left"><a accesskey="p" href="algorithms.html">Prev</a> </td><th width="60%" align="center">Part IX. Algorithms</th><td width="20%" align="right"> <a accesskey="n" href="bk01pt09ch20.html">Next</a></td></tr></table><hr /></div><div class="preface" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title"><a id="id411081"></a></h2></div></div></div><p> The neatest accomplishment of the algorithms chapter is that all the work is done via iterators, not containers directly. This means two important things: diff --git a/libstdc++-v3/doc/html/manual/bk01pt12ch30s03.html b/libstdc++-v3/doc/html/manual/bk01pt12ch30s03.html index d52674bbb3d..e293caa2668 100644 --- a/libstdc++-v3/doc/html/manual/bk01pt12ch30s03.html +++ b/libstdc++-v3/doc/html/manual/bk01pt12ch30s03.html @@ -19,6 +19,6 @@ mode or with debug mode. The following table provides the names and headers of the debugging containers: -</p><div class="table"><a id="id400605"></a><p class="title"><b>Table 30.1. Debugging Containers</b></p><div class="table-contents"><table summary="Debugging Containers" border="1"><colgroup><col align="left" /><col align="left" /><col align="left" /><col align="left" /><col /><col /></colgroup><thead><tr><th align="left">Container</th><th align="left">Header</th><th align="left">Debug container</th><th align="left">Debug header</th><td class="auto-generated"> </td><td class="auto-generated"> </td></tr></thead><tbody><tr><td align="left"><code class="classname">std::bitset</code></td><td align="left"><code class="filename">bitset</code></td><td align="left"><code class="classname">__gnu_debug::bitset</code></td><td align="left"><code class="filename">bitset</code></td><td class="auto-generated"> </td><td class="auto-generated"> </td></tr><tr><td align="left"><code class="classname">std::deque</code></td><td align="left"><code class="filename">deque</code></td><td align="left"><code class="classname">__gnu_debug::deque</code></td><td align="left"><code class="filename">deque</code></td><td class="auto-generated"> </td><td class="auto-generated"> </td></tr><tr><td align="left"><code class="classname">std::list</code></td><td align="left"><code class="filename">list</code></td><td align="left"><code class="classname">__gnu_debug::list</code></td><td align="left"><code class="filename">list</code></td><td class="auto-generated"> </td><td class="auto-generated"> </td></tr><tr><td align="left"><code class="classname">std::map</code></td><td align="left"><code class="filename">map</code></td><td align="left"><code class="classname">__gnu_debug::map</code></td><td align="left"><code class="filename">map</code></td><td class="auto-generated"> </td><td class="auto-generated"> </td></tr><tr><td align="left"><code class="classname">std::multimap</code></td><td align="left"><code class="filename">map</code></td><td align="left"><code class="classname">__gnu_debug::multimap</code></td><td align="left"><code class="filename">map</code></td><td class="auto-generated"> </td><td class="auto-generated"> </td></tr><tr><td align="left"><code class="classname">std::multiset</code></td><td align="left"><code class="filename">set</code></td><td align="left"><code class="classname">__gnu_debug::multiset</code></td><td align="left"><code class="filename">set</code></td><td class="auto-generated"> </td><td class="auto-generated"> </td></tr><tr><td align="left"><code class="classname">std::set</code></td><td align="left"><code class="filename">set</code></td><td align="left"><code class="classname">__gnu_debug::set</code></td><td align="left"><code class="filename">set</code></td><td class="auto-generated"> </td><td class="auto-generated"> </td></tr><tr><td align="left"><code class="classname">std::string</code></td><td align="left"><code class="filename">string</code></td><td align="left"><code class="classname">__gnu_debug::string</code></td><td align="left"><code class="filename">string</code></td><td class="auto-generated"> </td><td class="auto-generated"> </td></tr><tr><td align="left"><code class="classname">std::wstring</code></td><td align="left"><code class="filename">string</code></td><td align="left"><code class="classname">__gnu_debug::wstring</code></td><td align="left"><code class="filename">string</code></td><td class="auto-generated"> </td><td class="auto-generated"> </td></tr><tr><td align="left"><code class="classname">std::basic_string</code></td><td align="left"><code class="filename">string</code></td><td align="left"><code class="classname">__gnu_debug::basic_string</code></td><td align="left"><code class="filename">string</code></td><td class="auto-generated"> </td><td class="auto-generated"> </td></tr><tr><td align="left"><code class="classname">std::vector</code></td><td align="left"><code class="filename">vector</code></td><td align="left"><code class="classname">__gnu_debug::vector</code></td><td align="left"><code class="filename">vector</code></td><td class="auto-generated"> </td><td class="auto-generated"> </td></tr></tbody></table></div></div><br class="table-break" /><p>In addition, when compiling in C++0x mode, these additional +</p><div class="table"><a id="id391620"></a><p class="title"><b>Table 30.1. Debugging Containers</b></p><div class="table-contents"><table summary="Debugging Containers" border="1"><colgroup><col align="left" /><col align="left" /><col align="left" /><col align="left" /><col /><col /></colgroup><thead><tr><th align="left">Container</th><th align="left">Header</th><th align="left">Debug container</th><th align="left">Debug header</th><td class="auto-generated"> </td><td class="auto-generated"> </td></tr></thead><tbody><tr><td align="left"><code class="classname">std::bitset</code></td><td align="left"><code class="filename">bitset</code></td><td align="left"><code class="classname">__gnu_debug::bitset</code></td><td align="left"><code class="filename">bitset</code></td><td class="auto-generated"> </td><td class="auto-generated"> </td></tr><tr><td align="left"><code class="classname">std::deque</code></td><td align="left"><code class="filename">deque</code></td><td align="left"><code class="classname">__gnu_debug::deque</code></td><td align="left"><code class="filename">deque</code></td><td class="auto-generated"> </td><td class="auto-generated"> </td></tr><tr><td align="left"><code class="classname">std::list</code></td><td align="left"><code class="filename">list</code></td><td align="left"><code class="classname">__gnu_debug::list</code></td><td align="left"><code class="filename">list</code></td><td class="auto-generated"> </td><td class="auto-generated"> </td></tr><tr><td align="left"><code class="classname">std::map</code></td><td align="left"><code class="filename">map</code></td><td align="left"><code class="classname">__gnu_debug::map</code></td><td align="left"><code class="filename">map</code></td><td class="auto-generated"> </td><td class="auto-generated"> </td></tr><tr><td align="left"><code class="classname">std::multimap</code></td><td align="left"><code class="filename">map</code></td><td align="left"><code class="classname">__gnu_debug::multimap</code></td><td align="left"><code class="filename">map</code></td><td class="auto-generated"> </td><td class="auto-generated"> </td></tr><tr><td align="left"><code class="classname">std::multiset</code></td><td align="left"><code class="filename">set</code></td><td align="left"><code class="classname">__gnu_debug::multiset</code></td><td align="left"><code class="filename">set</code></td><td class="auto-generated"> </td><td class="auto-generated"> </td></tr><tr><td align="left"><code class="classname">std::set</code></td><td align="left"><code class="filename">set</code></td><td align="left"><code class="classname">__gnu_debug::set</code></td><td align="left"><code class="filename">set</code></td><td class="auto-generated"> </td><td class="auto-generated"> </td></tr><tr><td align="left"><code class="classname">std::string</code></td><td align="left"><code class="filename">string</code></td><td align="left"><code class="classname">__gnu_debug::string</code></td><td align="left"><code class="filename">string</code></td><td class="auto-generated"> </td><td class="auto-generated"> </td></tr><tr><td align="left"><code class="classname">std::wstring</code></td><td align="left"><code class="filename">string</code></td><td align="left"><code class="classname">__gnu_debug::wstring</code></td><td align="left"><code class="filename">string</code></td><td class="auto-generated"> </td><td class="auto-generated"> </td></tr><tr><td align="left"><code class="classname">std::basic_string</code></td><td align="left"><code class="filename">string</code></td><td align="left"><code class="classname">__gnu_debug::basic_string</code></td><td align="left"><code class="filename">string</code></td><td class="auto-generated"> </td><td class="auto-generated"> </td></tr><tr><td align="left"><code class="classname">std::vector</code></td><td align="left"><code class="filename">vector</code></td><td align="left"><code class="classname">__gnu_debug::vector</code></td><td align="left"><code class="filename">vector</code></td><td class="auto-generated"> </td><td class="auto-generated"> </td></tr></tbody></table></div></div><br class="table-break" /><p>In addition, when compiling in C++0x mode, these additional containers have additional debug capability. -</p><div class="table"><a id="id452759"></a><p class="title"><b>Table 30.2. Debugging Containers C++0x</b></p><div class="table-contents"><table summary="Debugging Containers C++0x" border="1"><colgroup><col align="left" /><col align="left" /><col align="left" /><col align="left" /><col /><col /></colgroup><thead><tr><th align="left">Container</th><th align="left">Header</th><th align="left">Debug container</th><th align="left">Debug header</th><td class="auto-generated"> </td><td class="auto-generated"> </td></tr></thead><tbody><tr><td align="left"><code class="classname">std::unordered_map</code></td><td align="left"><code class="filename">unordered_map</code></td><td align="left"><code class="classname">__gnu_debug::unordered_map</code></td><td align="left"><code class="filename">unordered_map</code></td><td class="auto-generated"> </td><td class="auto-generated"> </td></tr><tr><td align="left"><code class="classname">std::unordered_multimap</code></td><td align="left"><code class="filename">unordered_map</code></td><td align="left"><code class="classname">__gnu_debug::unordered_multimap</code></td><td align="left"><code class="filename">unordered_map</code></td><td class="auto-generated"> </td><td class="auto-generated"> </td></tr><tr><td align="left"><code class="classname">std::unordered_set</code></td><td align="left"><code class="filename">unordered_set</code></td><td align="left"><code class="classname">__gnu_debug::unordered_set</code></td><td align="left"><code class="filename">unordered_set</code></td><td class="auto-generated"> </td><td class="auto-generated"> </td></tr><tr><td align="left"><code class="classname">std::unordered_multiset</code></td><td align="left"><code class="filename">unordered_set</code></td><td align="left"><code class="classname">__gnu_debug::unordered_multiset</code></td><td align="left"><code class="filename">unordered_set</code></td><td class="auto-generated"> </td><td class="auto-generated"> </td></tr></tbody></table></div></div><br class="table-break" /></div></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="bk01pt12ch30s02.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="debug_mode.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="bk01pt12ch30s04.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Semantics </td><td width="20%" align="center"><a accesskey="h" href="../spine.html">Home</a></td><td width="40%" align="right" valign="top"> Design</td></tr></table></div></body></html> +</p><div class="table"><a id="id417569"></a><p class="title"><b>Table 30.2. Debugging Containers C++0x</b></p><div class="table-contents"><table summary="Debugging Containers C++0x" border="1"><colgroup><col align="left" /><col align="left" /><col align="left" /><col align="left" /><col /><col /></colgroup><thead><tr><th align="left">Container</th><th align="left">Header</th><th align="left">Debug container</th><th align="left">Debug header</th><td class="auto-generated"> </td><td class="auto-generated"> </td></tr></thead><tbody><tr><td align="left"><code class="classname">std::unordered_map</code></td><td align="left"><code class="filename">unordered_map</code></td><td align="left"><code class="classname">__gnu_debug::unordered_map</code></td><td align="left"><code class="filename">unordered_map</code></td><td class="auto-generated"> </td><td class="auto-generated"> </td></tr><tr><td align="left"><code class="classname">std::unordered_multimap</code></td><td align="left"><code class="filename">unordered_map</code></td><td align="left"><code class="classname">__gnu_debug::unordered_multimap</code></td><td align="left"><code class="filename">unordered_map</code></td><td class="auto-generated"> </td><td class="auto-generated"> </td></tr><tr><td align="left"><code class="classname">std::unordered_set</code></td><td align="left"><code class="filename">unordered_set</code></td><td align="left"><code class="classname">__gnu_debug::unordered_set</code></td><td align="left"><code class="filename">unordered_set</code></td><td class="auto-generated"> </td><td class="auto-generated"> </td></tr><tr><td align="left"><code class="classname">std::unordered_multiset</code></td><td align="left"><code class="filename">unordered_set</code></td><td align="left"><code class="classname">__gnu_debug::unordered_multiset</code></td><td align="left"><code class="filename">unordered_set</code></td><td class="auto-generated"> </td><td class="auto-generated"> </td></tr></tbody></table></div></div><br class="table-break" /></div></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="bk01pt12ch30s02.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="debug_mode.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="bk01pt12ch30s04.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Semantics </td><td width="20%" align="center"><a accesskey="h" href="../spine.html">Home</a></td><td width="40%" align="right" valign="top"> Design</td></tr></table></div></body></html> diff --git a/libstdc++-v3/doc/html/manual/bk01pt12ch30s04.html b/libstdc++-v3/doc/html/manual/bk01pt12ch30s04.html index 53b2d4c3825..141978a48c7 100644 --- a/libstdc++-v3/doc/html/manual/bk01pt12ch30s04.html +++ b/libstdc++-v3/doc/html/manual/bk01pt12ch30s04.html @@ -187,7 +187,7 @@ template<typename _Tp, typename _Allocator = allocator<_Tp> allows release-compiled and debug-compiled code to be linked and executed together without causing unpredictable behavior. This guarantee minimizes the recompilation that users are required to - perform, shortening the detect-compile-debug bughunting cycle + perform, shortening the detect-compile-debug bug hunting cycle and making the debug mode easier to incorporate into development environments by minimizing dependencies.</p><p>Achieving link- and run-time coexistence is not a trivial implementation task. To achieve this goal we required a small diff --git a/libstdc++-v3/doc/html/manual/bk01pt12ch31s02.html b/libstdc++-v3/doc/html/manual/bk01pt12ch31s02.html index e06362edd9f..a22fd095932 100644 --- a/libstdc++-v3/doc/html/manual/bk01pt12ch31s02.html +++ b/libstdc++-v3/doc/html/manual/bk01pt12ch31s02.html @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="UTF-8" standalone="no"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Semantics</title><meta name="generator" content="DocBook XSL Stylesheets V1.73.2" /><meta name="keywords" content=" C++ , library , parallel " /><meta name="keywords" content=" ISO C++ , library " /><link rel="start" href="../spine.html" title="The GNU C++ Library Documentation" /><link rel="up" href="parallel_mode.html" title="Chapter 31. Parallel Mode" /><link rel="prev" href="parallel_mode.html" title="Chapter 31. Parallel Mode" /><link rel="next" href="bk01pt12ch31s03.html" title="Using" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Semantics</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="parallel_mode.html">Prev</a> </td><th width="60%" align="center">Chapter 31. Parallel Mode</th><td width="20%" align="right"> <a accesskey="n" href="bk01pt12ch31s03.html">Next</a></td></tr></table><hr /></div><div class="sect1" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="manual.ext.parallel_mode.semantics"></a>Semantics</h2></div></div></div><p> The parallel mode STL algorithms are currently not exception-safe, -i. e. user-defined functors must not throw exceptions. +i.e. user-defined functors must not throw exceptions. </p><p> Since the current GCC OpenMP implementation does not support OpenMP parallel regions in concurrent threads, it is not possible to call parallel STL algorithm in diff --git a/libstdc++-v3/doc/html/manual/bk01pt12ch31s03.html b/libstdc++-v3/doc/html/manual/bk01pt12ch31s03.html index 97fdb5ba1b5..2e03e0e9943 100644 --- a/libstdc++-v3/doc/html/manual/bk01pt12ch31s03.html +++ b/libstdc++-v3/doc/html/manual/bk01pt12ch31s03.html @@ -1,20 +1,22 @@ <?xml version="1.0" encoding="UTF-8" standalone="no"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> -<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Using</title><meta name="generator" content="DocBook XSL Stylesheets V1.73.2" /><meta name="keywords" content=" C++ , library , parallel " /><meta name="keywords" content=" ISO C++ , library " /><link rel="start" href="../spine.html" title="The GNU C++ Library Documentation" /><link rel="up" href="parallel_mode.html" title="Chapter 31. Parallel Mode" /><link rel="prev" href="bk01pt12ch31s02.html" title="Semantics" /><link rel="next" href="bk01pt12ch31s04.html" title="Design" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Using</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="bk01pt12ch31s02.html">Prev</a> </td><th width="60%" align="center">Chapter 31. Parallel Mode</th><td width="20%" align="right"> <a accesskey="n" href="bk01pt12ch31s04.html">Next</a></td></tr></table><hr /></div><div class="sect1" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="manual.ext.parallel_mode.using"></a>Using</h2></div></div></div><div class="sect2" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 class="title"><a id="parallel_mode.using.parallel_mode"></a>Using Parallel Mode</h3></div></div></div><p>To use the libstdc++ parallel mode, compile your application with - the compiler flag <code class="code">-D_GLIBCXX_PARALLEL -fopenmp</code>. This +<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Using</title><meta name="generator" content="DocBook XSL Stylesheets V1.73.2" /><meta name="keywords" content=" C++ , library , parallel " /><meta name="keywords" content=" ISO C++ , library " /><link rel="start" href="../spine.html" title="The GNU C++ Library Documentation" /><link rel="up" href="parallel_mode.html" title="Chapter 31. Parallel Mode" /><link rel="prev" href="bk01pt12ch31s02.html" title="Semantics" /><link rel="next" href="bk01pt12ch31s04.html" title="Design" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Using</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="bk01pt12ch31s02.html">Prev</a> </td><th width="60%" align="center">Chapter 31. Parallel Mode</th><td width="20%" align="right"> <a accesskey="n" href="bk01pt12ch31s04.html">Next</a></td></tr></table><hr /></div><div class="sect1" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="manual.ext.parallel_mode.using"></a>Using</h2></div></div></div><div class="sect2" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 class="title"><a id="parallel_mode.using.parallel_mode"></a>Using Parallel Mode</h3></div></div></div><p> + To use the libstdc++ parallel mode, compile your application with + the compiler flag <code class="constant">-D_GLIBCXX_PARALLEL -fopenmp</code>. This will link in <code class="code">libgomp</code>, the GNU OpenMP <a class="ulink" href="http://gcc.gnu.org/onlinedocs/libgomp/" target="_top">implementation</a>, whose presence is mandatory. In addition, hardware capable of atomic operations is mandatory. Actually activating these atomic operations may require explicit compiler flags on some targets - (like sparc and x86), such as <code class="code">-march=i686</code>, - <code class="code">-march=native</code> or <code class="code">-mcpu=v9</code>. -</p><p>Note that the <code class="code">_GLIBCXX_PARALLEL</code> define may change the + (like sparc and x86), such as <code class="literal">-march=i686</code>, + <code class="literal">-march=native</code> or <code class="literal">-mcpu=v9</code>. +</p><p>Note that the <code class="constant">_GLIBCXX_PARALLEL</code> define may change the sizes and behavior of standard class templates such as - <code class="code">std::search</code>, and therefore one can only link code + <code class="function">std::search</code>, and therefore one can only link code compiled with parallel mode and code compiled without parallel mode if no instantiation of a container is passed between the two translation units. Parallel mode functionality has distinct linkage, - and cannot be confused with normal mode symbols.</p></div><div class="sect2" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 class="title"><a id="manual.ext.parallel_mode.usings"></a>Using Specific Parallel Components</h3></div></div></div><p>When it is not feasible to recompile your entire application, or + and cannot be confused with normal mode symbols. +</p></div><div class="sect2" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 class="title"><a id="manual.ext.parallel_mode.usings"></a>Using Specific Parallel Components</h3></div></div></div><p>When it is not feasible to recompile your entire application, or only specific algorithms need to be parallel-aware, individual parallel algorithms can be made available explicitly. These parallel algorithms are functionally equivalent to the standard @@ -23,4 +25,4 @@ compiled with either release mode or with parallel mode. The following table provides the names and headers of the parallel algorithms: -</p><div class="table"><a id="id419374"></a><p class="title"><b>Table 31.1. Parallel Algorithms</b></p><div class="table-contents"><table summary="Parallel Algorithms" border="1"><colgroup><col align="left" /><col align="left" /><col align="left" /><col align="left" /></colgroup><thead><tr><th align="left">Algorithm</th><th align="left">Header</th><th align="left">Parallel algorithm</th><th align="left">Parallel header</th></tr></thead><tbody><tr><td align="left"><code class="function">std::accumulate</code></td><td align="left"><code class="filename">numeric</code></td><td align="left"><code class="function">__gnu_parallel::accumulate</code></td><td align="left"><code class="filename">parallel/numeric</code></td></tr><tr><td align="left"><code class="function">std::adjacent_difference</code></td><td align="left"><code class="filename">numeric</code></td><td align="left"><code class="function">__gnu_parallel::adjacent_difference</code></td><td align="left"><code class="filename">parallel/numeric</code></td></tr><tr><td align="left"><code class="function">std::inner_product</code></td><td align="left"><code class="filename">numeric</code></td><td align="left"><code class="function">__gnu_parallel::inner_product</code></td><td align="left"><code class="filename">parallel/numeric</code></td></tr><tr><td align="left"><code class="function">std::partial_sum</code></td><td align="left"><code class="filename">numeric</code></td><td align="left"><code class="function">__gnu_parallel::partial_sum</code></td><td align="left"><code class="filename">parallel/numeric</code></td></tr><tr><td align="left"><code class="function">std::adjacent_find</code></td><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="function">__gnu_parallel::adjacent_find</code></td><td align="left"><code class="filename">parallel/algorithm</code></td></tr><tr><td align="left"><code class="function">std::count</code></td><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="function">__gnu_parallel::count</code></td><td align="left"><code class="filename">parallel/algorithm</code></td></tr><tr><td align="left"><code class="function">std::count_if</code></td><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="function">__gnu_parallel::count_if</code></td><td align="left"><code class="filename">parallel/algorithm</code></td></tr><tr><td align="left"><code class="function">std::equal</code></td><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="function">__gnu_parallel::equal</code></td><td align="left"><code class="filename">parallel/algorithm</code></td></tr><tr><td align="left"><code class="function">std::find</code></td><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="function">__gnu_parallel::find</code></td><td align="left"><code class="filename">parallel/algorithm</code></td></tr><tr><td align="left"><code class="function">std::find_if</code></td><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="function">__gnu_parallel::find_if</code></td><td align="left"><code class="filename">parallel/algorithm</code></td></tr><tr><td align="left"><code class="function">std::find_first_of</code></td><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="function">__gnu_parallel::find_first_of</code></td><td align="left"><code class="filename">parallel/algorithm</code></td></tr><tr><td align="left"><code class="function">std::for_each</code></td><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="function">__gnu_parallel::for_each</code></td><td align="left"><code class="filename">parallel/algorithm</code></td></tr><tr><td align="left"><code class="function">std::generate</code></td><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="function">__gnu_parallel::generate</code></td><td align="left"><code class="filename">parallel/algorithm</code></td></tr><tr><td align="left"><code class="function">std::generate_n</code></td><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="function">__gnu_parallel::generate_n</code></td><td align="left"><code class="filename">parallel/algorithm</code></td></tr><tr><td align="left"><code class="function">std::lexicographical_compare</code></td><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="function">__gnu_parallel::lexicographical_compare</code></td><td align="left"><code class="filename">parallel/algorithm</code></td></tr><tr><td align="left"><code class="function">std::mismatch</code></td><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="function">__gnu_parallel::mismatch</code></td><td align="left"><code class="filename">parallel/algorithm</code></td></tr><tr><td align="left"><code class="function">std::search</code></td><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="function">__gnu_parallel::search</code></td><td align="left"><code class="filename">parallel/algorithm</code></td></tr><tr><td align="left"><code class="function">std::search_n</code></td><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="function">__gnu_parallel::search_n</code></td><td align="left"><code class="filename">parallel/algorithm</code></td></tr><tr><td align="left"><code class="function">std::transform</code></td><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="function">__gnu_parallel::transform</code></td><td align="left"><code class="filename">parallel/algorithm</code></td></tr><tr><td align="left"><code class="function">std::replace</code></td><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="function">__gnu_parallel::replace</code></td><td align="left"><code class="filename">parallel/algorithm</code></td></tr><tr><td align="left"><code class="function">std::replace_if</code></td><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="function">__gnu_parallel::replace_if</code></td><td align="left"><code class="filename">parallel/algorithm</code></td></tr><tr><td align="left"><code class="function">std::max_element</code></td><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="function">__gnu_parallel::max_element</code></td><td align="left"><code class="filename">parallel/algorithm</code></td></tr><tr><td align="left"><code class="function">std::merge</code></td><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="function">__gnu_parallel::merge</code></td><td align="left"><code class="filename">parallel/algorithm</code></td></tr><tr><td align="left"><code class="function">std::min_element</code></td><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="function">__gnu_parallel::min_element</code></td><td align="left"><code class="filename">parallel/algorithm</code></td></tr><tr><td align="left"><code class="function">std::nth_element</code></td><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="function">__gnu_parallel::nth_element</code></td><td align="left"><code class="filename">parallel/algorithm</code></td></tr><tr><td align="left"><code class="function">std::partial_sort</code></td><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="function">__gnu_parallel::partial_sort</code></td><td align="left"><code class="filename">parallel/algorithm</code></td></tr><tr><td align="left"><code class="function">std::partition</code></td><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="function">__gnu_parallel::partition</code></td><td align="left"><code class="filename">parallel/algorithm</code></td></tr><tr><td align="left"><code class="function">std::random_shuffle</code></td><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="function">__gnu_parallel::random_shuffle</code></td><td align="left"><code class="filename">parallel/algorithm</code></td></tr><tr><td align="left"><code class="function">std::set_union</code></td><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="function">__gnu_parallel::set_union</code></td><td align="left"><code class="filename">parallel/algorithm</code></td></tr><tr><td align="left"><code class="function">std::set_intersection</code></td><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="function">__gnu_parallel::set_intersection</code></td><td align="left"><code class="filename">parallel/algorithm</code></td></tr><tr><td align="left"><code class="function">std::set_symmetric_difference</code></td><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="function">__gnu_parallel::set_symmetric_difference</code></td><td align="left"><code class="filename">parallel/algorithm</code></td></tr><tr><td align="left"><code class="function">std::set_difference</code></td><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="function">__gnu_parallel::set_difference</code></td><td align="left"><code class="filename">parallel/algorithm</code></td></tr><tr><td align="left"><code class="function">std::sort</code></td><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="function">__gnu_parallel::sort</code></td><td align="left"><code class="filename">parallel/algorithm</code></td></tr><tr><td align="left"><code class="function">std::stable_sort</code></td><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="function">__gnu_parallel::stable_sort</code></td><td align="left"><code class="filename">parallel/algorithm</code></td></tr><tr><td align="left"><code class="function">std::unique_copy</code></td><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="function">__gnu_parallel::unique_copy</code></td><td align="left"><code class="filename">parallel/algorithm</code></td></tr></tbody></table></div></div><br class="table-break" /></div></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="bk01pt12ch31s02.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="parallel_mode.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="bk01pt12ch31s04.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Semantics </td><td width="20%" align="center"><a accesskey="h" href="../spine.html">Home</a></td><td width="40%" align="right" valign="top"> Design</td></tr></table></div></body></html> +</p><div class="table"><a id="id407416"></a><p class="title"><b>Table 31.1. Parallel Algorithms</b></p><div class="table-contents"><table summary="Parallel Algorithms" border="1"><colgroup><col align="left" /><col align="left" /><col align="left" /><col align="left" /></colgroup><thead><tr><th align="left">Algorithm</th><th align="left">Header</th><th align="left">Parallel algorithm</th><th align="left">Parallel header</th></tr></thead><tbody><tr><td align="left"><code class="function">std::accumulate</code></td><td align="left"><code class="filename">numeric</code></td><td align="left"><code class="function">__gnu_parallel::accumulate</code></td><td align="left"><code class="filename">parallel/numeric</code></td></tr><tr><td align="left"><code class="function">std::adjacent_difference</code></td><td align="left"><code class="filename">numeric</code></td><td align="left"><code class="function">__gnu_parallel::adjacent_difference</code></td><td align="left"><code class="filename">parallel/numeric</code></td></tr><tr><td align="left"><code class="function">std::inner_product</code></td><td align="left"><code class="filename">numeric</code></td><td align="left"><code class="function">__gnu_parallel::inner_product</code></td><td align="left"><code class="filename">parallel/numeric</code></td></tr><tr><td align="left"><code class="function">std::partial_sum</code></td><td align="left"><code class="filename">numeric</code></td><td align="left"><code class="function">__gnu_parallel::partial_sum</code></td><td align="left"><code class="filename">parallel/numeric</code></td></tr><tr><td align="left"><code class="function">std::adjacent_find</code></td><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="function">__gnu_parallel::adjacent_find</code></td><td align="left"><code class="filename">parallel/algorithm</code></td></tr><tr><td align="left"><code class="function">std::count</code></td><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="function">__gnu_parallel::count</code></td><td align="left"><code class="filename">parallel/algorithm</code></td></tr><tr><td align="left"><code class="function">std::count_if</code></td><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="function">__gnu_parallel::count_if</code></td><td align="left"><code class="filename">parallel/algorithm</code></td></tr><tr><td align="left"><code class="function">std::equal</code></td><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="function">__gnu_parallel::equal</code></td><td align="left"><code class="filename">parallel/algorithm</code></td></tr><tr><td align="left"><code class="function">std::find</code></td><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="function">__gnu_parallel::find</code></td><td align="left"><code class="filename">parallel/algorithm</code></td></tr><tr><td align="left"><code class="function">std::find_if</code></td><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="function">__gnu_parallel::find_if</code></td><td align="left"><code class="filename">parallel/algorithm</code></td></tr><tr><td align="left"><code class="function">std::find_first_of</code></td><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="function">__gnu_parallel::find_first_of</code></td><td align="left"><code class="filename">parallel/algorithm</code></td></tr><tr><td align="left"><code class="function">std::for_each</code></td><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="function">__gnu_parallel::for_each</code></td><td align="left"><code class="filename">parallel/algorithm</code></td></tr><tr><td align="left"><code class="function">std::generate</code></td><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="function">__gnu_parallel::generate</code></td><td align="left"><code class="filename">parallel/algorithm</code></td></tr><tr><td align="left"><code class="function">std::generate_n</code></td><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="function">__gnu_parallel::generate_n</code></td><td align="left"><code class="filename">parallel/algorithm</code></td></tr><tr><td align="left"><code class="function">std::lexicographical_compare</code></td><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="function">__gnu_parallel::lexicographical_compare</code></td><td align="left"><code class="filename">parallel/algorithm</code></td></tr><tr><td align="left"><code class="function">std::mismatch</code></td><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="function">__gnu_parallel::mismatch</code></td><td align="left"><code class="filename">parallel/algorithm</code></td></tr><tr><td align="left"><code class="function">std::search</code></td><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="function">__gnu_parallel::search</code></td><td align="left"><code class="filename">parallel/algorithm</code></td></tr><tr><td align="left"><code class="function">std::search_n</code></td><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="function">__gnu_parallel::search_n</code></td><td align="left"><code class="filename">parallel/algorithm</code></td></tr><tr><td align="left"><code class="function">std::transform</code></td><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="function">__gnu_parallel::transform</code></td><td align="left"><code class="filename">parallel/algorithm</code></td></tr><tr><td align="left"><code class="function">std::replace</code></td><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="function">__gnu_parallel::replace</code></td><td align="left"><code class="filename">parallel/algorithm</code></td></tr><tr><td align="left"><code class="function">std::replace_if</code></td><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="function">__gnu_parallel::replace_if</code></td><td align="left"><code class="filename">parallel/algorithm</code></td></tr><tr><td align="left"><code class="function">std::max_element</code></td><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="function">__gnu_parallel::max_element</code></td><td align="left"><code class="filename">parallel/algorithm</code></td></tr><tr><td align="left"><code class="function">std::merge</code></td><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="function">__gnu_parallel::merge</code></td><td align="left"><code class="filename">parallel/algorithm</code></td></tr><tr><td align="left"><code class="function">std::min_element</code></td><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="function">__gnu_parallel::min_element</code></td><td align="left"><code class="filename">parallel/algorithm</code></td></tr><tr><td align="left"><code class="function">std::nth_element</code></td><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="function">__gnu_parallel::nth_element</code></td><td align="left"><code class="filename">parallel/algorithm</code></td></tr><tr><td align="left"><code class="function">std::partial_sort</code></td><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="function">__gnu_parallel::partial_sort</code></td><td align="left"><code class="filename">parallel/algorithm</code></td></tr><tr><td align="left"><code class="function">std::partition</code></td><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="function">__gnu_parallel::partition</code></td><td align="left"><code class="filename">parallel/algorithm</code></td></tr><tr><td align="left"><code class="function">std::random_shuffle</code></td><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="function">__gnu_parallel::random_shuffle</code></td><td align="left"><code class="filename">parallel/algorithm</code></td></tr><tr><td align="left"><code class="function">std::set_union</code></td><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="function">__gnu_parallel::set_union</code></td><td align="left"><code class="filename">parallel/algorithm</code></td></tr><tr><td align="left"><code class="function">std::set_intersection</code></td><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="function">__gnu_parallel::set_intersection</code></td><td align="left"><code class="filename">parallel/algorithm</code></td></tr><tr><td align="left"><code class="function">std::set_symmetric_difference</code></td><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="function">__gnu_parallel::set_symmetric_difference</code></td><td align="left"><code class="filename">parallel/algorithm</code></td></tr><tr><td align="left"><code class="function">std::set_difference</code></td><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="function">__gnu_parallel::set_difference</code></td><td align="left"><code class="filename">parallel/algorithm</code></td></tr><tr><td align="left"><code class="function">std::sort</code></td><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="function">__gnu_parallel::sort</code></td><td align="left"><code class="filename">parallel/algorithm</code></td></tr><tr><td align="left"><code class="function">std::stable_sort</code></td><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="function">__gnu_parallel::stable_sort</code></td><td align="left"><code class="filename">parallel/algorithm</code></td></tr><tr><td align="left"><code class="function">std::unique_copy</code></td><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="function">__gnu_parallel::unique_copy</code></td><td align="left"><code class="filename">parallel/algorithm</code></td></tr></tbody></table></div></div><br class="table-break" /></div></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="bk01pt12ch31s02.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="parallel_mode.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="bk01pt12ch31s04.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Semantics </td><td width="20%" align="center"><a accesskey="h" href="../spine.html">Home</a></td><td width="40%" align="right" valign="top"> Design</td></tr></table></div></body></html> diff --git a/libstdc++-v3/doc/html/manual/bk01pt12ch31s04.html b/libstdc++-v3/doc/html/manual/bk01pt12ch31s04.html index 3db7d912e63..49db41c141d 100644 --- a/libstdc++-v3/doc/html/manual/bk01pt12ch31s04.html +++ b/libstdc++-v3/doc/html/manual/bk01pt12ch31s04.html @@ -27,15 +27,15 @@ namespace std ... } } -</pre><p>But.... why the elipses? -</p><p> The elipses in the example above represent additional overloads +</pre><p>But.... why the ellipses? +</p><p> The ellipses in the example above represent additional overloads required for the parallel version of the function. These additional overloads are used to dispatch calls from the ISO C++ function signature to the appropriate parallel function (or sequential function, if no parallel functions are deemed worthy), based on either compile-time or run-time conditions. </p><p> Compile-time conditions are referred to as "embarrassingly -parallel," and are denoted with the appropriate dispatch object, ie +parallel," and are denoted with the appropriate dispatch object, i.e., one of <code class="code">__gnu_parallel::sequential_tag</code>, <code class="code">__gnu_parallel::parallel_tag</code>, <code class="code">__gnu_parallel::balanced_tag</code>, @@ -74,8 +74,6 @@ int main() const int threads_wanted = 20; omp_set_dynamic(false); omp_set_num_threads(threads_wanted); - if (omp_get_num_threads() != threads_wanted) - abort(); // Do work. @@ -107,7 +105,7 @@ at compile-time. See <a class="ulink" href="http://gcc.gnu.org/onlinedocs/libstdc++/latest-doxygen/a00446.html" target="_top"><code class="filename">compiletime_settings.h</code></a> and See <a class="ulink" href="http://gcc.gnu.org/onlinedocs/libstdc++/latest-doxygen/a00505.html" target="_top"><code class="filename">features.h</code></a> for details. </p></div><div class="sect3" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="parallel_mode.design.tuning.settings"></a>Run Time Settings and Defaults</h4></div></div></div><p> -The default parallization strategy, the choice of specific algorithm +The default parallelization strategy, the choice of specific algorithm strategy, the minimum threshold limits for individual parallel algorithms, and aspects of the underlying hardware can be specified as desired via manipulation @@ -120,7 +118,7 @@ value of enum <span class="type">__gnu_parallel::_AlgorithmStrategy</span> type. Choices include: <span class="type">heuristic</span>, <span class="type">force_sequential</span>, and <span class="type">force_parallel</span>. The default is -implementation-deduced, ie <span class="type">heuristic</span>. +implementation-deduced, i.e. <span class="type">heuristic</span>. </p><p> Next, the sub-choices for algorithm implementation. Specific algorithms like <code class="function">find</code> or <code class="function">sort</code> @@ -133,7 +131,7 @@ enum <span class="type">__gnu_parallel::_SortAlgorithm</span>: <span class="type or <span class="type">QS_BALANCED</span>. </p><p> Likewise for setting the minimal threshold for algorithm -paralleization. Parallelism always incurs some overhead. Thus, it is +parallelization. Parallelism always incurs some overhead. Thus, it is not helpful to parallelize operations on very small sets of data. Because of this, measures are taken to avoid parallelizing below a certain, pre-determined threshold. For each algorithm, a minimum diff --git a/libstdc++-v3/doc/html/manual/bk01pt12ch31s05.html b/libstdc++-v3/doc/html/manual/bk01pt12ch31s05.html index 698ba3906de..ff3ea023344 100644 --- a/libstdc++-v3/doc/html/manual/bk01pt12ch31s05.html +++ b/libstdc++-v3/doc/html/manual/bk01pt12ch31s05.html @@ -10,15 +10,15 @@ <strong class="userinput"><code>make check-parallel</code></strong> </pre><p> The log and summary files for conformance testing are in the - <code class="code">testsuite/parallel</code> directory. + <code class="filename">testsuite/parallel</code> directory. </p><p> To run the performance tests with the parallel mode active, </p><pre class="screen"> - <strong class="userinput"><code>check-performance-parallel</code></strong> + <strong class="userinput"><code>make check-performance-parallel</code></strong> </pre><p> The result file for performance testing are in the - <code class="code">testsuite</code> directory, in the file - <code class="code">libstdc++_performance.sum</code>. In addition, the + <code class="filename">testsuite</code> directory, in the file + <code class="filename">libstdc++_performance.sum</code>. In addition, the policy-based containers have their own visualizations, which have additional software dependencies than the usual bare-boned text file, and can be generated by using the <code class="code">make diff --git a/libstdc++-v3/doc/html/manual/bk01pt12ch35.html b/libstdc++-v3/doc/html/manual/bk01pt12ch35.html index 1ab65c963a7..ac3e3955327 100644 --- a/libstdc++-v3/doc/html/manual/bk01pt12ch35.html +++ b/libstdc++-v3/doc/html/manual/bk01pt12ch35.html @@ -13,7 +13,7 @@ </p><p>25.3 (sorting 'n' heaps 'n' stuff) is extended with some helper predicates. Look in the doxygen-generated pages for notes on these. </p><div class="itemizedlist"><ul type="disc"><li><p><code class="code">is_heap</code> tests whether or not a range is a heap.</p></li><li><p><code class="code">is_sorted</code> tests whether or not a range is sorted in - nondescending order.</p></li></ul></div><p>25.3.8 (lexigraphical_compare) is extended with + nondescending order.</p></li></ul></div><p>25.3.8 (lexicographical_compare) is extended with </p><pre class="programlisting"> lexicographical_compare_3way(_InputIter1 first1, _InputIter1 last1, _InputIter2 first2, _InputIter2 last2)</pre><p>which does... what? diff --git a/libstdc++-v3/doc/html/manual/bk01pt12ch39.html b/libstdc++-v3/doc/html/manual/bk01pt12ch39.html index 666a384f507..15ba1ca3d2d 100644 --- a/libstdc++-v3/doc/html/manual/bk01pt12ch39.html +++ b/libstdc++-v3/doc/html/manual/bk01pt12ch39.html @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="UTF-8" standalone="no"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Chapter 39. Demangling</title><meta name="generator" content="DocBook XSL Stylesheets V1.73.2" /><meta name="keywords" content=" ISO C++ , library " /><link rel="start" href="../spine.html" title="The GNU C++ Library Documentation" /><link rel="up" href="extensions.html" title="Part XII. Extensions" /><link rel="prev" href="bk01pt12ch38.html" title="Chapter 38. Input and Output" /><link rel="next" href="concurrency.html" title="Chapter 40. Concurrency" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Chapter 39. Demangling</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="bk01pt12ch38.html">Prev</a> </td><th width="60%" align="center">Part XII. Extensions</th><td width="20%" align="right"> <a accesskey="n" href="concurrency.html">Next</a></td></tr></table><hr /></div><div class="chapter" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title"><a id="manual.ext.demangle"></a>Chapter 39. Demangling</h2></div></div></div><p> - Transforming C++ ABI itentifiers (like RTTI symbols) into the + Transforming C++ ABI identifiers (like RTTI symbols) into the original C++ source identifiers is called “<span class="quote">demangling.</span>” </p><p> diff --git a/libstdc++-v3/doc/html/manual/bk01pt12ch40s02.html b/libstdc++-v3/doc/html/manual/bk01pt12ch40s02.html index 6f1f5df4b23..2e4aee7aa08 100644 --- a/libstdc++-v3/doc/html/manual/bk01pt12ch40s02.html +++ b/libstdc++-v3/doc/html/manual/bk01pt12ch40s02.html @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8" standalone="no"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> -<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Implementation</title><meta name="generator" content="DocBook XSL Stylesheets V1.73.2" /><meta name="keywords" content=" ISO C++ , library " /><meta name="keywords" content=" ISO C++ , library " /><link rel="start" href="../spine.html" title="The GNU C++ Library Documentation" /><link rel="up" href="concurrency.html" title="Chapter 40. Concurrency" /><link rel="prev" href="concurrency.html" title="Chapter 40. Concurrency" /><link rel="next" href="bk01pt12ch40s03.html" title="Use" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Implementation</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="concurrency.html">Prev</a> </td><th width="60%" align="center">Chapter 40. Concurrency</th><td width="20%" align="right"> <a accesskey="n" href="bk01pt12ch40s03.html">Next</a></td></tr></table><hr /></div><div class="sect1" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="manual.ext.concurrency.impl"></a>Implementation</h2></div></div></div><div class="sect2" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 class="title"><a id="manual.ext.concurrency.impl.atomic_fallbacks"></a>Using Builitin Atomic Functions</h3></div></div></div><p>The functions for atomic operations described above are either +<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Implementation</title><meta name="generator" content="DocBook XSL Stylesheets V1.73.2" /><meta name="keywords" content=" ISO C++ , library " /><meta name="keywords" content=" ISO C++ , library " /><link rel="start" href="../spine.html" title="The GNU C++ Library Documentation" /><link rel="up" href="concurrency.html" title="Chapter 40. Concurrency" /><link rel="prev" href="concurrency.html" title="Chapter 40. Concurrency" /><link rel="next" href="bk01pt12ch40s03.html" title="Use" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Implementation</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="concurrency.html">Prev</a> </td><th width="60%" align="center">Chapter 40. Concurrency</th><td width="20%" align="right"> <a accesskey="n" href="bk01pt12ch40s03.html">Next</a></td></tr></table><hr /></div><div class="sect1" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="manual.ext.concurrency.impl"></a>Implementation</h2></div></div></div><div class="sect2" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 class="title"><a id="manual.ext.concurrency.impl.atomic_fallbacks"></a>Using Builtin Atomic Functions</h3></div></div></div><p>The functions for atomic operations described above are either implemented via compiler intrinsics (if the underlying host is capable) or by library fallbacks.</p><p>Compiler intrinsics (builtins) are always preferred. However, as the compiler builtins for atomics are not universally implemented, @@ -22,7 +22,7 @@ hardware, hand-crafted assembly is selected. This is the case for the following </p><div class="itemizedlist"><ul type="disc"><li><p>cris</p></li><li><p>hppa</p></li><li><p>i386</p></li><li><p>i486</p></li><li><p>m48k</p></li><li><p>mips</p></li><li><p>sparc</p></li></ul></div><p>And for the rest, a simulated atomic lock via pthreads. </p><p> Detailed information about compiler intrinsics for atomic operations can be found in the GCC <a class="ulink" href="http://gcc.gnu.org/onlinedocs/gcc/Atomic-Builtins.html" target="_top"> documentation</a>. </p><p> More details on the library fallbacks from the porting <a class="ulink" href="http://gcc.gnu.org/onlinedocs/libstdc++/17_intro/porting.html#Thread%20safety" target="_top">section</a>. -</p></div><div class="sect2" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 class="title"><a id="manual.ext.concurrency.impl.thread"></a>Thread Abstraction</h3></div></div></div><p>A thin layer above IEEE 1003.1 (ie pthreads) is used to abstract +</p></div><div class="sect2" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 class="title"><a id="manual.ext.concurrency.impl.thread"></a>Thread Abstraction</h3></div></div></div><p>A thin layer above IEEE 1003.1 (i.e. pthreads) is used to abstract the thread interface for GCC. This layer is called "gthread," and is comprised of one header file that wraps the host's default thread layer with a POSIX-like interface. diff --git a/libstdc++-v3/doc/html/manual/bk01pt12pr03.html b/libstdc++-v3/doc/html/manual/bk01pt12pr03.html index 79d6d356f2c..589c107502b 100644 --- a/libstdc++-v3/doc/html/manual/bk01pt12pr03.html +++ b/libstdc++-v3/doc/html/manual/bk01pt12pr03.html @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8" standalone="no"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> -<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title></title><meta name="generator" content="DocBook XSL Stylesheets V1.73.2" /><meta name="keywords" content=" ISO C++ , library " /><link rel="start" href="../spine.html" title="The GNU C++ Library Documentation" /><link rel="up" href="extensions.html" title="Part XII. Extensions" /><link rel="prev" href="extensions.html" title="Part XII. Extensions" /><link rel="next" href="bk01pt12ch29.html" title="Chapter 29. Compile Time Checks" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center"></th></tr><tr><td width="20%" align="left"><a accesskey="p" href="extensions.html">Prev</a> </td><th width="60%" align="center">Part XII. Extensions</th><td width="20%" align="right"> <a accesskey="n" href="bk01pt12ch29.html">Next</a></td></tr></table><hr /></div><div class="preface" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title"><a id="id516952"></a></h2></div></div></div><p> +<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title></title><meta name="generator" content="DocBook XSL Stylesheets V1.73.2" /><meta name="keywords" content=" ISO C++ , library " /><link rel="start" href="../spine.html" title="The GNU C++ Library Documentation" /><link rel="up" href="extensions.html" title="Part XII. Extensions" /><link rel="prev" href="extensions.html" title="Part XII. Extensions" /><link rel="next" href="bk01pt12ch29.html" title="Chapter 29. Compile Time Checks" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center"></th></tr><tr><td width="20%" align="left"><a accesskey="p" href="extensions.html">Prev</a> </td><th width="60%" align="center">Part XII. Extensions</th><td width="20%" align="right"> <a accesskey="n" href="bk01pt12ch29.html">Next</a></td></tr></table><hr /></div><div class="preface" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title"><a id="id418164"></a></h2></div></div></div><p> Here we will make an attempt at describing the non-Standard extensions to the library. Some of these are from SGI's STL, some of these are GNU's, and some just seemed to appear on the doorstep. diff --git a/libstdc++-v3/doc/html/manual/codecvt.html b/libstdc++-v3/doc/html/manual/codecvt.html index 17230b9b3c1..3af9d23abba 100644 --- a/libstdc++-v3/doc/html/manual/codecvt.html +++ b/libstdc++-v3/doc/html/manual/codecvt.html @@ -111,7 +111,7 @@ UCS2, UCS4, UNICODE, UNICODEBIG, UNICODELIcodeLE, US-ASCII, US, UTF-8, UTF-16, UTF8, UTF16). </pre></blockquote></div><p> For iconv-based implementations, string literals for each of the -encodings (ie. "UCS-2" and "UTF-8") are necessary, +encodings (i.e. "UCS-2" and "UTF-8") are necessary, although for other, non-iconv implementations a table of enumerated values or some other mechanism may be required. @@ -130,7 +130,7 @@ mechanism may be required. conversion descriptor encodes more information than a simple encoding state type. </p></li><li><p> - Conversion descriptors for both directions of encoding. (ie, both + Conversion descriptors for both directions of encoding. (i.e., both UCS-2 to UTF-8 and UTF-8 to UCS-2.) </p></li><li><p> Something to indicate if the conversion requested if valid. @@ -179,7 +179,7 @@ The two required specializations are implemented as follows: codecvt<char, char, mbstate_t> </code> </p><p> -This is a degenerate (ie, does nothing) specialization. Implementing +This is a degenerate (i.e., does nothing) specialization. Implementing this was a piece of cake. </p><p> <code class="code"> @@ -337,41 +337,41 @@ codecvt usage. </p></li><li><p> wchar_t/char internal buffers and conversions between internal/external buffers? - </p></li></ul></div></li></ul></div></div><div class="bibliography"><div class="titlepage"><div><div><h3 class="title"><a id="facet.codecvt.biblio"></a>Bibliography</h3></div></div></div><div class="biblioentry"><a id="id400718"></a><p><span class="title"><i> + </p></li></ul></div></li></ul></div></div><div class="bibliography"><div class="titlepage"><div><div><h3 class="title"><a id="facet.codecvt.biblio"></a>Bibliography</h3></div></div></div><div class="biblioentry"><a id="id394270"></a><p><span class="title"><i> The GNU C Library - </i>. </span><span class="author"><span class="firstname">Roland</span> <span class="surname">McGrath</span>. </span><span class="author"><span class="firstname">Ulrich</span> <span class="surname">Drepper</span>. </span><span class="copyright">Copyright © 2007 FSF. </span><span class="pagenums">Chapters 6 Character Set Handling and 7 Locales and Internationalization. </span></p></div><div class="biblioentry"><a id="id487971"></a><p><span class="title"><i> + </i>. </span><span class="author"><span class="firstname">Roland</span> <span class="surname">McGrath</span>. </span><span class="author"><span class="firstname">Ulrich</span> <span class="surname">Drepper</span>. </span><span class="copyright">Copyright © 2007 FSF. </span><span class="pagenums">Chapters 6 Character Set Handling and 7 Locales and Internationalization. </span></p></div><div class="biblioentry"><a id="id464999"></a><p><span class="title"><i> Correspondence - </i>. </span><span class="author"><span class="firstname">Ulrich</span> <span class="surname">Drepper</span>. </span><span class="copyright">Copyright © 2002 . </span></p></div><div class="biblioentry"><a id="id452178"></a><p><span class="title"><i> + </i>. </span><span class="author"><span class="firstname">Ulrich</span> <span class="surname">Drepper</span>. </span><span class="copyright">Copyright © 2002 . </span></p></div><div class="biblioentry"><a id="id465028"></a><p><span class="title"><i> ISO/IEC 14882:1998 Programming languages - C++ - </i>. </span><span class="copyright">Copyright © 1998 ISO. </span></p></div><div class="biblioentry"><a id="id452196"></a><p><span class="title"><i> + </i>. </span><span class="copyright">Copyright © 1998 ISO. </span></p></div><div class="biblioentry"><a id="id426183"></a><p><span class="title"><i> ISO/IEC 9899:1999 Programming languages - C - </i>. </span><span class="copyright">Copyright © 1999 ISO. </span></p></div><div class="biblioentry"><a id="id461282"></a><p><span class="title"><i> + </i>. </span><span class="copyright">Copyright © 1999 ISO. </span></p></div><div class="biblioentry"><a id="id426202"></a><p><span class="title"><i> System Interface Definitions, Issue 6 (IEEE Std. 1003.1-200x) </i>. </span><span class="copyright">Copyright © 1999 The Open Group/The Institute of Electrical and Electronics Engineers, Inc.. </span><span class="biblioid"> <a class="ulink" href="http://www.opennc.org/austin/docreg.html" target="_top"> </a> - . </span></p></div><div class="biblioentry"><a id="id461308"></a><p><span class="title"><i> + . </span></p></div><div class="biblioentry"><a id="id402703"></a><p><span class="title"><i> The C++ Programming Language, Special Edition </i>. </span><span class="author"><span class="firstname">Bjarne</span> <span class="surname">Stroustrup</span>. </span><span class="copyright">Copyright © 2000 Addison Wesley, Inc.. </span><span class="pagenums">Appendix D. </span><span class="publisher"><span class="publishername"> Addison Wesley - . </span></span></p></div><div class="biblioentry"><a id="id494830"></a><p><span class="title"><i> + . </span></span></p></div><div class="biblioentry"><a id="id413189"></a><p><span class="title"><i> Standard C++ IOStreams and Locales </i>. </span><span class="subtitle"> Advanced Programmer's Guide and Reference . </span><span class="author"><span class="firstname">Angelika</span> <span class="surname">Langer</span>. </span><span class="author"><span class="firstname">Klaus</span> <span class="surname">Kreft</span>. </span><span class="copyright">Copyright © 2000 Addison Wesley Longman, Inc.. </span><span class="publisher"><span class="publishername"> Addison Wesley Longman - . </span></span></p></div><div class="biblioentry"><a id="id417572"></a><p><span class="title"><i> + . </span></span></p></div><div class="biblioentry"><a id="id427920"></a><p><span class="title"><i> A brief description of Normative Addendum 1 </i>. </span><span class="author"><span class="firstname">Clive</span> <span class="surname">Feather</span>. </span><span class="pagenums">Extended Character Sets. </span><span class="biblioid"> <a class="ulink" href="http://www.lysator.liu.se/c/na1.html" target="_top"> </a> - . </span></p></div><div class="biblioentry"><a id="id417604"></a><p><span class="title"><i> + . </span></p></div><div class="biblioentry"><a id="id458138"></a><p><span class="title"><i> The Unicode HOWTO </i>. </span><span class="author"><span class="firstname">Bruno</span> <span class="surname">Haible</span>. </span><span class="biblioid"> <a class="ulink" href="ftp://ftp.ilog.fr/pub/Users/haible/utf8/Unicode-HOWTO.html" target="_top"> </a> - . </span></p></div><div class="biblioentry"><a id="id427552"></a><p><span class="title"><i> + . </span></p></div><div class="biblioentry"><a id="id458167"></a><p><span class="title"><i> UTF-8 and Unicode FAQ for Unix/Linux </i>. </span><span class="author"><span class="firstname">Markus</span> <span class="surname">Khun</span>. </span><span class="biblioid"> <a class="ulink" href="http://www.cl.cam.ac.uk/~mgk25/unicode.html" target="_top"> diff --git a/libstdc++-v3/doc/html/manual/concurrency.html b/libstdc++-v3/doc/html/manual/concurrency.html index 6b3705aabc2..561c2cf288d 100644 --- a/libstdc++-v3/doc/html/manual/concurrency.html +++ b/libstdc++-v3/doc/html/manual/concurrency.html @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8" standalone="no"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> -<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Chapter 40. Concurrency</title><meta name="generator" content="DocBook XSL Stylesheets V1.73.2" /><meta name="keywords" content=" ISO C++ , library " /><meta name="keywords" content=" ISO C++ , library " /><link rel="start" href="../spine.html" title="The GNU C++ Library Documentation" /><link rel="up" href="extensions.html" title="Part XII. Extensions" /><link rel="prev" href="bk01pt12ch39.html" title="Chapter 39. Demangling" /><link rel="next" href="bk01pt12ch40s02.html" title="Implementation" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Chapter 40. Concurrency</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="bk01pt12ch39.html">Prev</a> </td><th width="60%" align="center">Part XII. Extensions</th><td width="20%" align="right"> <a accesskey="n" href="bk01pt12ch40s02.html">Next</a></td></tr></table><hr /></div><div class="chapter" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title"><a id="manual.ext.concurrency"></a>Chapter 40. Concurrency</h2></div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="sect1"><a href="concurrency.html#manual.ext.concurrency.design">Design</a></span></dt><dd><dl><dt><span class="sect2"><a href="concurrency.html#manual.ext.concurrency.design.threads">Interface to Locks and Mutexes</a></span></dt><dt><span class="sect2"><a href="concurrency.html#manual.ext.concurrency.design.atomics">Interface to Atomic Functions</a></span></dt></dl></dd><dt><span class="sect1"><a href="bk01pt12ch40s02.html">Implementation</a></span></dt><dd><dl><dt><span class="sect2"><a href="bk01pt12ch40s02.html#manual.ext.concurrency.impl.atomic_fallbacks">Using Builitin Atomic Functions</a></span></dt><dt><span class="sect2"><a href="bk01pt12ch40s02.html#manual.ext.concurrency.impl.thread">Thread Abstraction</a></span></dt></dl></dd><dt><span class="sect1"><a href="bk01pt12ch40s03.html">Use</a></span></dt></dl></div><div class="sect1" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="manual.ext.concurrency.design"></a>Design</h2></div></div></div><div class="sect2" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 class="title"><a id="manual.ext.concurrency.design.threads"></a>Interface to Locks and Mutexes</h3></div></div></div><p>The file <ext/concurrence.h> contains all the higher-level +<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Chapter 40. Concurrency</title><meta name="generator" content="DocBook XSL Stylesheets V1.73.2" /><meta name="keywords" content=" ISO C++ , library " /><meta name="keywords" content=" ISO C++ , library " /><link rel="start" href="../spine.html" title="The GNU C++ Library Documentation" /><link rel="up" href="extensions.html" title="Part XII. Extensions" /><link rel="prev" href="bk01pt12ch39.html" title="Chapter 39. Demangling" /><link rel="next" href="bk01pt12ch40s02.html" title="Implementation" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Chapter 40. Concurrency</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="bk01pt12ch39.html">Prev</a> </td><th width="60%" align="center">Part XII. Extensions</th><td width="20%" align="right"> <a accesskey="n" href="bk01pt12ch40s02.html">Next</a></td></tr></table><hr /></div><div class="chapter" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title"><a id="manual.ext.concurrency"></a>Chapter 40. Concurrency</h2></div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="sect1"><a href="concurrency.html#manual.ext.concurrency.design">Design</a></span></dt><dd><dl><dt><span class="sect2"><a href="concurrency.html#manual.ext.concurrency.design.threads">Interface to Locks and Mutexes</a></span></dt><dt><span class="sect2"><a href="concurrency.html#manual.ext.concurrency.design.atomics">Interface to Atomic Functions</a></span></dt></dl></dd><dt><span class="sect1"><a href="bk01pt12ch40s02.html">Implementation</a></span></dt><dd><dl><dt><span class="sect2"><a href="bk01pt12ch40s02.html#manual.ext.concurrency.impl.atomic_fallbacks">Using Builtin Atomic Functions</a></span></dt><dt><span class="sect2"><a href="bk01pt12ch40s02.html#manual.ext.concurrency.impl.thread">Thread Abstraction</a></span></dt></dl></dd><dt><span class="sect1"><a href="bk01pt12ch40s03.html">Use</a></span></dt></dl></div><div class="sect1" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="manual.ext.concurrency.design"></a>Design</h2></div></div></div><div class="sect2" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 class="title"><a id="manual.ext.concurrency.design.threads"></a>Interface to Locks and Mutexes</h3></div></div></div><p>The file <ext/concurrence.h> contains all the higher-level constructs for playing with threads. In contrast to the atomics layer, the concurrence layer consists largely of types. All types are defined within <code class="code">namespace __gnu_cxx</code>. </p><p> diff --git a/libstdc++-v3/doc/html/manual/extensions.html b/libstdc++-v3/doc/html/manual/extensions.html index bbd57bafde9..c4f6ac8bac0 100644 --- a/libstdc++-v3/doc/html/manual/extensions.html +++ b/libstdc++-v3/doc/html/manual/extensions.html @@ -1,3 +1,3 @@ <?xml version="1.0" encoding="UTF-8" standalone="no"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> -<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Part XII. Extensions</title><meta name="generator" content="DocBook XSL Stylesheets V1.73.2" /><meta name="keywords" content=" ISO C++ , library " /><link rel="start" href="../spine.html" title="The GNU C++ Library Documentation" /><link rel="up" href="spine.html" title="The GNU C++ Library" /><link rel="prev" href="bk01pt11ch28s02.html" title="Performance" /><link rel="next" href="bk01pt12pr03.html" title="" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Part XII. Extensions</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="bk01pt11ch28s02.html">Prev</a> </td><th width="60%" align="center">The GNU C++ Library</th><td width="20%" align="right"> <a accesskey="n" href="bk01pt12pr03.html">Next</a></td></tr></table><hr /></div><div class="part" lang="en" xml:lang="en"><div class="titlepage"><div><div><h1 class="title"><a id="manual.ext"></a>Part XII. Extensions</h1></div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="preface"><a href="bk01pt12pr03.html"></a></span></dt><dt><span class="chapter"><a href="bk01pt12ch29.html">29. Compile Time Checks</a></span></dt><dt><span class="chapter"><a href="debug_mode.html">30. Debug Mode</a></span></dt><dd><dl><dt><span class="sect1"><a href="debug_mode.html#manual.ext.debug_mode.intro">Intro</a></span></dt><dt><span class="sect1"><a href="bk01pt12ch30s02.html">Semantics</a></span></dt><dt><span class="sect1"><a href="bk01pt12ch30s03.html">Using</a></span></dt><dd><dl><dt><span class="sect2"><a href="bk01pt12ch30s03.html#debug_mode.using.mode">Using the Debug Mode</a></span></dt><dt><span class="sect2"><a href="bk01pt12ch30s03.html#debug_mode.using.specific">Using a Specific Debug Container</a></span></dt></dl></dd><dt><span class="sect1"><a href="bk01pt12ch30s04.html">Design</a></span></dt><dd><dl><dt><span class="sect2"><a href="bk01pt12ch30s04.html#manual.ext.debug_mode.design.goals">Goals</a></span></dt><dt><span class="sect2"><a href="bk01pt12ch30s04.html#manual.ext.debug_mode.design.methods">Methods</a></span></dt><dt><span class="sect2"><a href="bk01pt12ch30s04.html#manual.ext.debug_mode.design.other">Other Implementations</a></span></dt></dl></dd></dl></dd><dt><span class="chapter"><a href="parallel_mode.html">31. Parallel Mode</a></span></dt><dd><dl><dt><span class="sect1"><a href="parallel_mode.html#manual.ext.parallel_mode.intro">Intro</a></span></dt><dt><span class="sect1"><a href="bk01pt12ch31s02.html">Semantics</a></span></dt><dt><span class="sect1"><a href="bk01pt12ch31s03.html">Using</a></span></dt><dd><dl><dt><span class="sect2"><a href="bk01pt12ch31s03.html#parallel_mode.using.parallel_mode">Using Parallel Mode</a></span></dt><dt><span class="sect2"><a href="bk01pt12ch31s03.html#manual.ext.parallel_mode.usings">Using Specific Parallel Components</a></span></dt></dl></dd><dt><span class="sect1"><a href="bk01pt12ch31s04.html">Design</a></span></dt><dd><dl><dt><span class="sect2"><a href="bk01pt12ch31s04.html#manual.ext.parallel_mode.design.intro">Interface Basics</a></span></dt><dt><span class="sect2"><a href="bk01pt12ch31s04.html#manual.ext.parallel_mode.design.tuning">Configuration and Tuning</a></span></dt><dt><span class="sect2"><a href="bk01pt12ch31s04.html#manual.ext.parallel_mode.design.impl">Implementation Namespaces</a></span></dt></dl></dd><dt><span class="sect1"><a href="bk01pt12ch31s05.html">Testing</a></span></dt><dt><span class="bibliography"><a href="parallel_mode.html#parallel_mode.biblio">Bibliography</a></span></dt></dl></dd><dt><span class="chapter"><a href="bk01pt12ch32.html">32. Allocators</a></span></dt><dd><dl><dt><span class="sect1"><a href="bk01pt12ch32.html#manual.ext.allocator.mt">mt_allocator</a></span></dt><dd><dl><dt><span class="sect2"><a href="bk01pt12ch32.html#allocator.mt.intro">Intro</a></span></dt><dt><span class="sect2"><a href="bk01pt12ch32.html#allocator.mt.design_issues">Design Issues</a></span></dt><dt><span class="sect2"><a href="bk01pt12ch32.html#allocator.mt.impl">Implementation</a></span></dt><dt><span class="sect2"><a href="bk01pt12ch32.html#allocator.mt.example_single">Single Thread Example</a></span></dt><dt><span class="sect2"><a href="bk01pt12ch32.html#allocator.mt.example_multi">Multiple Thread Example</a></span></dt></dl></dd><dt><span class="sect1"><a href="bitmap_allocator.html">bitmap_allocator</a></span></dt><dd><dl><dt><span class="sect2"><a href="bitmap_allocator.html#allocator.bitmap.design">Design</a></span></dt><dt><span class="sect2"><a href="bitmap_allocator.html#allocator.bitmap.impl">Implementation</a></span></dt></dl></dd></dl></dd><dt><span class="chapter"><a href="bk01pt12ch33.html">33. Containers</a></span></dt><dd><dl><dt><span class="sect1"><a href="bk01pt12ch33.html#manual.ext.containers.pbds">Policy Based Data Structures</a></span></dt><dt><span class="sect1"><a href="bk01pt12ch33s02.html">HP/SGI</a></span></dt><dt><span class="sect1"><a href="bk01pt12ch33s03.html">Deprecated HP/SGI</a></span></dt></dl></dd><dt><span class="chapter"><a href="bk01pt12ch34.html">34. Utilities</a></span></dt><dt><span class="chapter"><a href="bk01pt12ch35.html">35. Algorithms</a></span></dt><dt><span class="chapter"><a href="bk01pt12ch36.html">36. Numerics</a></span></dt><dt><span class="chapter"><a href="bk01pt12ch37.html">37. Iterators</a></span></dt><dt><span class="chapter"><a href="bk01pt12ch38.html">38. Input and Output</a></span></dt><dd><dl><dt><span class="sect1"><a href="bk01pt12ch38.html#manual.ext.io.filebuf_derived">Derived filebufs</a></span></dt></dl></dd><dt><span class="chapter"><a href="bk01pt12ch39.html">39. Demangling</a></span></dt><dt><span class="chapter"><a href="concurrency.html">40. Concurrency</a></span></dt><dd><dl><dt><span class="sect1"><a href="concurrency.html#manual.ext.concurrency.design">Design</a></span></dt><dd><dl><dt><span class="sect2"><a href="concurrency.html#manual.ext.concurrency.design.threads">Interface to Locks and Mutexes</a></span></dt><dt><span class="sect2"><a href="concurrency.html#manual.ext.concurrency.design.atomics">Interface to Atomic Functions</a></span></dt></dl></dd><dt><span class="sect1"><a href="bk01pt12ch40s02.html">Implementation</a></span></dt><dd><dl><dt><span class="sect2"><a href="bk01pt12ch40s02.html#manual.ext.concurrency.impl.atomic_fallbacks">Using Builitin Atomic Functions</a></span></dt><dt><span class="sect2"><a href="bk01pt12ch40s02.html#manual.ext.concurrency.impl.thread">Thread Abstraction</a></span></dt></dl></dd><dt><span class="sect1"><a href="bk01pt12ch40s03.html">Use</a></span></dt></dl></dd></dl></div></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="bk01pt11ch28s02.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="spine.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="bk01pt12pr03.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Performance </td><td width="20%" align="center"><a accesskey="h" href="../spine.html">Home</a></td><td width="40%" align="right" valign="top"> </td></tr></table></div></body></html> +<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Part XII. Extensions</title><meta name="generator" content="DocBook XSL Stylesheets V1.73.2" /><meta name="keywords" content=" ISO C++ , library " /><link rel="start" href="../spine.html" title="The GNU C++ Library Documentation" /><link rel="up" href="spine.html" title="The GNU C++ Library" /><link rel="prev" href="bk01pt11ch28s02.html" title="Performance" /><link rel="next" href="bk01pt12pr03.html" title="" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Part XII. Extensions</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="bk01pt11ch28s02.html">Prev</a> </td><th width="60%" align="center">The GNU C++ Library</th><td width="20%" align="right"> <a accesskey="n" href="bk01pt12pr03.html">Next</a></td></tr></table><hr /></div><div class="part" lang="en" xml:lang="en"><div class="titlepage"><div><div><h1 class="title"><a id="manual.ext"></a>Part XII. Extensions</h1></div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="preface"><a href="bk01pt12pr03.html"></a></span></dt><dt><span class="chapter"><a href="bk01pt12ch29.html">29. Compile Time Checks</a></span></dt><dt><span class="chapter"><a href="debug_mode.html">30. Debug Mode</a></span></dt><dd><dl><dt><span class="sect1"><a href="debug_mode.html#manual.ext.debug_mode.intro">Intro</a></span></dt><dt><span class="sect1"><a href="bk01pt12ch30s02.html">Semantics</a></span></dt><dt><span class="sect1"><a href="bk01pt12ch30s03.html">Using</a></span></dt><dd><dl><dt><span class="sect2"><a href="bk01pt12ch30s03.html#debug_mode.using.mode">Using the Debug Mode</a></span></dt><dt><span class="sect2"><a href="bk01pt12ch30s03.html#debug_mode.using.specific">Using a Specific Debug Container</a></span></dt></dl></dd><dt><span class="sect1"><a href="bk01pt12ch30s04.html">Design</a></span></dt><dd><dl><dt><span class="sect2"><a href="bk01pt12ch30s04.html#manual.ext.debug_mode.design.goals">Goals</a></span></dt><dt><span class="sect2"><a href="bk01pt12ch30s04.html#manual.ext.debug_mode.design.methods">Methods</a></span></dt><dt><span class="sect2"><a href="bk01pt12ch30s04.html#manual.ext.debug_mode.design.other">Other Implementations</a></span></dt></dl></dd></dl></dd><dt><span class="chapter"><a href="parallel_mode.html">31. Parallel Mode</a></span></dt><dd><dl><dt><span class="sect1"><a href="parallel_mode.html#manual.ext.parallel_mode.intro">Intro</a></span></dt><dt><span class="sect1"><a href="bk01pt12ch31s02.html">Semantics</a></span></dt><dt><span class="sect1"><a href="bk01pt12ch31s03.html">Using</a></span></dt><dd><dl><dt><span class="sect2"><a href="bk01pt12ch31s03.html#parallel_mode.using.parallel_mode">Using Parallel Mode</a></span></dt><dt><span class="sect2"><a href="bk01pt12ch31s03.html#manual.ext.parallel_mode.usings">Using Specific Parallel Components</a></span></dt></dl></dd><dt><span class="sect1"><a href="bk01pt12ch31s04.html">Design</a></span></dt><dd><dl><dt><span class="sect2"><a href="bk01pt12ch31s04.html#manual.ext.parallel_mode.design.intro">Interface Basics</a></span></dt><dt><span class="sect2"><a href="bk01pt12ch31s04.html#manual.ext.parallel_mode.design.tuning">Configuration and Tuning</a></span></dt><dt><span class="sect2"><a href="bk01pt12ch31s04.html#manual.ext.parallel_mode.design.impl">Implementation Namespaces</a></span></dt></dl></dd><dt><span class="sect1"><a href="bk01pt12ch31s05.html">Testing</a></span></dt><dt><span class="bibliography"><a href="parallel_mode.html#parallel_mode.biblio">Bibliography</a></span></dt></dl></dd><dt><span class="chapter"><a href="bk01pt12ch32.html">32. Allocators</a></span></dt><dd><dl><dt><span class="sect1"><a href="bk01pt12ch32.html#manual.ext.allocator.mt">mt_allocator</a></span></dt><dd><dl><dt><span class="sect2"><a href="bk01pt12ch32.html#allocator.mt.intro">Intro</a></span></dt><dt><span class="sect2"><a href="bk01pt12ch32.html#allocator.mt.design_issues">Design Issues</a></span></dt><dt><span class="sect2"><a href="bk01pt12ch32.html#allocator.mt.impl">Implementation</a></span></dt><dt><span class="sect2"><a href="bk01pt12ch32.html#allocator.mt.example_single">Single Thread Example</a></span></dt><dt><span class="sect2"><a href="bk01pt12ch32.html#allocator.mt.example_multi">Multiple Thread Example</a></span></dt></dl></dd><dt><span class="sect1"><a href="bitmap_allocator.html">bitmap_allocator</a></span></dt><dd><dl><dt><span class="sect2"><a href="bitmap_allocator.html#allocator.bitmap.design">Design</a></span></dt><dt><span class="sect2"><a href="bitmap_allocator.html#allocator.bitmap.impl">Implementation</a></span></dt></dl></dd></dl></dd><dt><span class="chapter"><a href="bk01pt12ch33.html">33. Containers</a></span></dt><dd><dl><dt><span class="sect1"><a href="bk01pt12ch33.html#manual.ext.containers.pbds">Policy Based Data Structures</a></span></dt><dt><span class="sect1"><a href="bk01pt12ch33s02.html">HP/SGI</a></span></dt><dt><span class="sect1"><a href="bk01pt12ch33s03.html">Deprecated HP/SGI</a></span></dt></dl></dd><dt><span class="chapter"><a href="bk01pt12ch34.html">34. Utilities</a></span></dt><dt><span class="chapter"><a href="bk01pt12ch35.html">35. Algorithms</a></span></dt><dt><span class="chapter"><a href="bk01pt12ch36.html">36. Numerics</a></span></dt><dt><span class="chapter"><a href="bk01pt12ch37.html">37. Iterators</a></span></dt><dt><span class="chapter"><a href="bk01pt12ch38.html">38. Input and Output</a></span></dt><dd><dl><dt><span class="sect1"><a href="bk01pt12ch38.html#manual.ext.io.filebuf_derived">Derived filebufs</a></span></dt></dl></dd><dt><span class="chapter"><a href="bk01pt12ch39.html">39. Demangling</a></span></dt><dt><span class="chapter"><a href="concurrency.html">40. Concurrency</a></span></dt><dd><dl><dt><span class="sect1"><a href="concurrency.html#manual.ext.concurrency.design">Design</a></span></dt><dd><dl><dt><span class="sect2"><a href="concurrency.html#manual.ext.concurrency.design.threads">Interface to Locks and Mutexes</a></span></dt><dt><span class="sect2"><a href="concurrency.html#manual.ext.concurrency.design.atomics">Interface to Atomic Functions</a></span></dt></dl></dd><dt><span class="sect1"><a href="bk01pt12ch40s02.html">Implementation</a></span></dt><dd><dl><dt><span class="sect2"><a href="bk01pt12ch40s02.html#manual.ext.concurrency.impl.atomic_fallbacks">Using Builtin Atomic Functions</a></span></dt><dt><span class="sect2"><a href="bk01pt12ch40s02.html#manual.ext.concurrency.impl.thread">Thread Abstraction</a></span></dt></dl></dd><dt><span class="sect1"><a href="bk01pt12ch40s03.html">Use</a></span></dt></dl></dd></dl></div></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="bk01pt11ch28s02.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="spine.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="bk01pt12pr03.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Performance </td><td width="20%" align="center"><a accesskey="h" href="../spine.html">Home</a></td><td width="40%" align="right" valign="top"> </td></tr></table></div></body></html> diff --git a/libstdc++-v3/doc/html/manual/messages.html b/libstdc++-v3/doc/html/manual/messages.html index e59f5d11cbd..e2ca0d229d7 100644 --- a/libstdc++-v3/doc/html/manual/messages.html +++ b/libstdc++-v3/doc/html/manual/messages.html @@ -133,7 +133,7 @@ model. library locale support is necessary for more than just the <code class="code">LC_MESSAGES</code> mask: <code class="code">LC_CTYPE</code> is also necessary. To avoid any unpleasantness, all bits of the "C" mask - (ie <code class="code">LC_ALL</code>) are set before retrieving messages. + (i.e. <code class="code">LC_ALL</code>) are set before retrieving messages. </p><p> Making the message catalogs can be initially tricky, but become quite simple with practice. For complete info, see the gettext @@ -205,7 +205,7 @@ void test01() There are issues with gettext needing the global locale set to extract a message. This dependence on the global locale makes the current "gnu" model non MT-safe. Future versions - of glibc, ie glibc 2.3.x will fix this, and the C++ library + of glibc, i.e. glibc 2.3.x will fix this, and the C++ library bits are already in place. </p></li></ul></div></li><li><p> Development versions of the GNU "C" library, glibc 2.3 will allow @@ -218,7 +218,7 @@ void test01() library functionality. </p></li><li><p> At some point in the near future, std::numpunct will probably use - std::messages facilities to implement truename/falename + std::messages facilities to implement truename/falsename correctly. This is currently not done, but entries in libstdc++.pot have already been made for "true" and "false" string literals, so all that remains is the std::numpunct coding and the @@ -241,38 +241,38 @@ void test01() model. As of this writing, it is unknown how to query to see if a specified message catalog exists using the gettext package. - </p></li></ul></div></div><div class="bibliography"><div class="titlepage"><div><div><h3 class="title"><a id="facet.messages.biblio"></a>Bibliography</h3></div></div></div><div class="biblioentry"><a id="id486645"></a><p><span class="title"><i> + </p></li></ul></div></div><div class="bibliography"><div class="titlepage"><div><div><h3 class="title"><a id="facet.messages.biblio"></a>Bibliography</h3></div></div></div><div class="biblioentry"><a id="id413448"></a><p><span class="title"><i> The GNU C Library </i>. </span><span class="author"><span class="firstname">Roland</span> <span class="surname">McGrath</span>. </span><span class="author"><span class="firstname">Ulrich</span> <span class="surname">Drepper</span>. </span><span class="copyright">Copyright © 2007 FSF. </span><span class="pagenums">Chapters 6 Character Set Handling, and 7 Locales and Internationalization - . </span></p></div><div class="biblioentry"><a id="id420122"></a><p><span class="title"><i> + . </span></p></div><div class="biblioentry"><a id="id460385"></a><p><span class="title"><i> Correspondence - </i>. </span><span class="author"><span class="firstname">Ulrich</span> <span class="surname">Drepper</span>. </span><span class="copyright">Copyright © 2002 . </span></p></div><div class="biblioentry"><a id="id420151"></a><p><span class="title"><i> + </i>. </span><span class="author"><span class="firstname">Ulrich</span> <span class="surname">Drepper</span>. </span><span class="copyright">Copyright © 2002 . </span></p></div><div class="biblioentry"><a id="id434210"></a><p><span class="title"><i> ISO/IEC 14882:1998 Programming languages - C++ - </i>. </span><span class="copyright">Copyright © 1998 ISO. </span></p></div><div class="biblioentry"><a id="id483860"></a><p><span class="title"><i> + </i>. </span><span class="copyright">Copyright © 1998 ISO. </span></p></div><div class="biblioentry"><a id="id434229"></a><p><span class="title"><i> ISO/IEC 9899:1999 Programming languages - C - </i>. </span><span class="copyright">Copyright © 1999 ISO. </span></p></div><div class="biblioentry"><a id="id483878"></a><p><span class="title"><i> + </i>. </span><span class="copyright">Copyright © 1999 ISO. </span></p></div><div class="biblioentry"><a id="id480692"></a><p><span class="title"><i> System Interface Definitions, Issue 6 (IEEE Std. 1003.1-200x) </i>. </span><span class="copyright">Copyright © 1999 The Open Group/The Institute of Electrical and Electronics Engineers, Inc.. </span><span class="biblioid"> <a class="ulink" href="http://www.opennc.org/austin/docreg.html" target="_top"> </a> - . </span></p></div><div class="biblioentry"><a id="id428875"></a><p><span class="title"><i> + . </span></p></div><div class="biblioentry"><a id="id480719"></a><p><span class="title"><i> The C++ Programming Language, Special Edition </i>. </span><span class="author"><span class="firstname">Bjarne</span> <span class="surname">Stroustrup</span>. </span><span class="copyright">Copyright © 2000 Addison Wesley, Inc.. </span><span class="pagenums">Appendix D. </span><span class="publisher"><span class="publishername"> Addison Wesley - . </span></span></p></div><div class="biblioentry"><a id="id420793"></a><p><span class="title"><i> + . </span></span></p></div><div class="biblioentry"><a id="id410108"></a><p><span class="title"><i> Standard C++ IOStreams and Locales </i>. </span><span class="subtitle"> Advanced Programmer's Guide and Reference . </span><span class="author"><span class="firstname">Angelika</span> <span class="surname">Langer</span>. </span><span class="author"><span class="firstname">Klaus</span> <span class="surname">Kreft</span>. </span><span class="copyright">Copyright © 2000 Addison Wesley Longman, Inc.. </span><span class="publisher"><span class="publishername"> Addison Wesley Longman - . </span></span></p></div><div class="biblioentry"><a id="id487716"></a><p><span class="title"><i> + . </span></span></p></div><div class="biblioentry"><a id="id405725"></a><p><span class="title"><i> Java 2 Platform, Standard Edition, v 1.3.1 API Specification </i>. </span><span class="pagenums">java.util.Properties, java.text.MessageFormat, java.util.Locale, java.util.ResourceBundle. </span><span class="biblioid"> <a class="ulink" href="http://java.sun.com/j2se/1.3/docs/api" target="_top"> </a> - . </span></p></div><div class="biblioentry"><a id="id487737"></a><p><span class="title"><i> + . </span></p></div><div class="biblioentry"><a id="id421361"></a><p><span class="title"><i> GNU gettext tools, version 0.10.38, Native Language Support Library and Tools. </i>. </span><span class="biblioid"> diff --git a/libstdc++-v3/doc/html/manual/parallel_mode.html b/libstdc++-v3/doc/html/manual/parallel_mode.html index 137d041e749..17c3eadda8e 100644 --- a/libstdc++-v3/doc/html/manual/parallel_mode.html +++ b/libstdc++-v3/doc/html/manual/parallel_mode.html @@ -4,18 +4,17 @@ implementation of many algorithms the C++ Standard Library. </p><p> Several of the standard algorithms, for instance -<code class="code">std::sort</code>, are made parallel using OpenMP +<code class="function">std::sort</code>, are made parallel using OpenMP annotations. These parallel mode constructs and can be invoked by explicit source declaration or by compiling existing sources with a specific compiler flag. </p><div class="sect1" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="manual.ext.parallel_mode.intro"></a>Intro</h2></div></div></div><p>The following library components in the include -<code class="code"><numeric></code> are included in the parallel mode:</p><div class="itemizedlist"><ul type="disc"><li><p><code class="code">std::accumulate</code></p></li><li><p><code class="code">std::adjacent_difference</code></p></li><li><p><code class="code">std::inner_product</code></p></li><li><p><code class="code">std::partial_sum</code></p></li></ul></div><p>The following library components in the include -<code class="code"><algorithm></code> are included in the parallel mode:</p><div class="itemizedlist"><ul type="disc"><li><p><code class="code">std::adjacent_find</code></p></li><li><p><code class="code">std::count</code></p></li><li><p><code class="code">std::count_if</code></p></li><li><p><code class="code">std::equal</code></p></li><li><p><code class="code">std::find</code></p></li><li><p><code class="code">std::find_if</code></p></li><li><p><code class="code">std::find_first_of</code></p></li><li><p><code class="code">std::for_each</code></p></li><li><p><code class="code">std::generate</code></p></li><li><p><code class="code">std::generate_n</code></p></li><li><p><code class="code">std::lexicographical_compare</code></p></li><li><p><code class="code">std::mismatch</code></p></li><li><p><code class="code">std::search</code></p></li><li><p><code class="code">std::search_n</code></p></li><li><p><code class="code">std::transform</code></p></li><li><p><code class="code">std::replace</code></p></li><li><p><code class="code">std::replace_if</code></p></li><li><p><code class="code">std::max_element</code></p></li><li><p><code class="code">std::merge</code></p></li><li><p><code class="code">std::min_element</code></p></li><li><p><code class="code">std::nth_element</code></p></li><li><p><code class="code">std::partial_sort</code></p></li><li><p><code class="code">std::partition</code></p></li><li><p><code class="code">std::random_shuffle</code></p></li><li><p><code class="code">std::set_union</code></p></li><li><p><code class="code">std::set_intersection</code></p></li><li><p><code class="code">std::set_symmetric_difference</code></p></li><li><p><code class="code">std::set_difference</code></p></li><li><p><code class="code">std::sort</code></p></li><li><p><code class="code">std::stable_sort</code></p></li><li><p><code class="code">std::unique_copy</code></p></li></ul></div><p>The following library components in the includes -<code class="code"><set></code> and <code class="code"><map></code> are included in the parallel mode:</p><div class="itemizedlist"><ul type="disc"><li><p><code class="code">std::(multi_)map/set<T>::(multi_)map/set(Iterator begin, Iterator end)</code> (bulk construction)</p></li><li><p><code class="code">std::(multi_)map/set<T>::insert(Iterator begin, Iterator end)</code> (bulk insertion)</p></li></ul></div></div><div class="bibliography"><div class="titlepage"><div><div><h2 class="title"><a id="parallel_mode.biblio"></a>Bibliography</h2></div></div></div><div class="biblioentry"><a id="id343037"></a><p><span class="title"><i> +<code class="filename">numeric</code> are included in the parallel mode:</p><div class="itemizedlist"><ul type="disc"><li><p><code class="function">std::accumulate</code></p></li><li><p><code class="function">std::adjacent_difference</code></p></li><li><p><code class="function">std::inner_product</code></p></li><li><p><code class="function">std::partial_sum</code></p></li></ul></div><p>The following library components in the include +<code class="filename">algorithm</code> are included in the parallel mode:</p><div class="itemizedlist"><ul type="disc"><li><p><code class="function">std::adjacent_find</code></p></li><li><p><code class="function">std::count</code></p></li><li><p><code class="function">std::count_if</code></p></li><li><p><code class="function">std::equal</code></p></li><li><p><code class="function">std::find</code></p></li><li><p><code class="function">std::find_if</code></p></li><li><p><code class="function">std::find_first_of</code></p></li><li><p><code class="function">std::for_each</code></p></li><li><p><code class="function">std::generate</code></p></li><li><p><code class="function">std::generate_n</code></p></li><li><p><code class="function">std::lexicographical_compare</code></p></li><li><p><code class="function">std::mismatch</code></p></li><li><p><code class="function">std::search</code></p></li><li><p><code class="function">std::search_n</code></p></li><li><p><code class="function">std::transform</code></p></li><li><p><code class="function">std::replace</code></p></li><li><p><code class="function">std::replace_if</code></p></li><li><p><code class="function">std::max_element</code></p></li><li><p><code class="function">std::merge</code></p></li><li><p><code class="function">std::min_element</code></p></li><li><p><code class="function">std::nth_element</code></p></li><li><p><code class="function">std::partial_sort</code></p></li><li><p><code class="function">std::partition</code></p></li><li><p><code class="function">std::random_shuffle</code></p></li><li><p><code class="function">std::set_union</code></p></li><li><p><code class="function">std::set_intersection</code></p></li><li><p><code class="function">std::set_symmetric_difference</code></p></li><li><p><code class="function">std::set_difference</code></p></li><li><p><code class="function">std::sort</code></p></li><li><p><code class="function">std::stable_sort</code></p></li><li><p><code class="function">std::unique_copy</code></p></li></ul></div></div><div class="bibliography"><div class="titlepage"><div><div><h2 class="title"><a id="parallel_mode.biblio"></a>Bibliography</h2></div></div></div><div class="biblioentry"><a id="id459041"></a><p><span class="title"><i> Parallelization of Bulk Operations for STL Dictionaries </i>. </span><span class="author"><span class="firstname">Johannes</span> <span class="surname">Singler</span>. </span><span class="author"><span class="firstname">Leonor</span> <span class="surname">Frias</span>. </span><span class="copyright">Copyright © 2007 . </span><span class="publisher"><span class="publishername"> Workshop on Highly Parallel Processing on a Chip (HPPC) 2007. (LNCS) - . </span></span></p></div><div class="biblioentry"><a id="id343084"></a><p><span class="title"><i> + . </span></span></p></div><div class="biblioentry"><a id="id484021"></a><p><span class="title"><i> The Multi-Core Standard Template Library </i>. </span><span class="author"><span class="firstname">Johannes</span> <span class="surname">Singler</span>. </span><span class="author"><span class="firstname">Peter</span> <span class="surname">Sanders</span>. </span><span class="author"><span class="firstname">Felix</span> <span class="surname">Putze</span>. </span><span class="copyright">Copyright © 2007 . </span><span class="publisher"><span class="publishername"> Euro-Par 2007: Parallel Processing. (LNCS 4641) diff --git a/libstdc++-v3/doc/html/manual/shared_ptr.html b/libstdc++-v3/doc/html/manual/shared_ptr.html index 21d38d3e3d6..c5aed380204 100644 --- a/libstdc++-v3/doc/html/manual/shared_ptr.html +++ b/libstdc++-v3/doc/html/manual/shared_ptr.html @@ -29,7 +29,7 @@ drops to zero. Derived classes override those functions to destroy resources in a context where the correct dynamic type is known. This is an application of the technique known as type erasure. - </p></div><div class="sect2" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 class="title"><a id="shared_ptr.impl"></a>Implementation</h3></div></div></div><div class="sect3" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="id461761"></a>Class Hierarchy</h4></div></div></div><p> + </p></div><div class="sect2" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 class="title"><a id="shared_ptr.impl"></a>Implementation</h3></div></div></div><div class="sect3" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="id407519"></a>Class Hierarchy</h4></div></div></div><p> A <code class="classname">shared_ptr<T></code> contains a pointer of type <span class="type">T*</span> and an object of type <code class="classname">__shared_count</code>. The shared_count contains a @@ -71,7 +71,7 @@ be forwarded to <span class="type">Tp</span>'s constructor. Unlike the other <code class="classname">_Sp_counted_*</code> classes, this one is parameterized on the type of object, not the type of pointer; this is purely a convenience that simplifies the implementation slightly. - </p></dd></dl></div></div><div class="sect3" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="id360970"></a>Thread Safety</h4></div></div></div><p> + </p></dd></dl></div></div><div class="sect3" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="id419862"></a>Thread Safety</h4></div></div></div><p> The interface of <code class="classname">tr1::shared_ptr</code> was extended for C++0x with support for rvalue-references and the other features from N2351. As with other libstdc++ headers shared by TR1 and C++0x, @@ -129,7 +129,7 @@ compiler, standard library, platform etc. For the version of shared_ptr in libstdc++ the compiler and library are fixed, which makes things much simpler: we have an atomic CAS or we don't, see Lock Policy below for details. -</p></div><div class="sect3" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="id396141"></a>Selecting Lock Policy</h4></div></div></div><p> +</p></div><div class="sect3" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="id395234"></a>Selecting Lock Policy</h4></div></div></div><p> </p><p> There is a single <code class="classname">_Sp_counted_base</code> class, which is a template parameterized on the enum @@ -170,7 +170,7 @@ used when libstdc++ is built without <code class="literal">--enable-threads</cod <code class="filename">ext/atomicity.h</code>, which detect if the program is multi-threaded. If only one thread of execution exists in the program then less expensive non-atomic operations are used. - </p></div><div class="sect3" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="id420953"></a>Dual C++0x and TR1 Implementation</h4></div></div></div><p> + </p></div><div class="sect3" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="id427440"></a>Dual C++0x and TR1 Implementation</h4></div></div></div><p> The classes derived from <code class="classname">_Sp_counted_base</code> (see Class Hierarchy below) and <code class="classname">__shared_count</code> are implemented separately for C++0x and TR1, in <code class="filename">bits/boost_sp_shared_count.h</code> and @@ -181,7 +181,7 @@ The TR1 implementation is considered relatively stable, so is unlikely to change unless bug fixes require it. If the code that is common to both C++0x and TR1 modes needs to diverge further then it might be necessary to duplicate additional classes and only make changes to the C++0x versions. -</p></div><div class="sect3" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="id454146"></a>Related functions and classes</h4></div></div></div><div class="variablelist"><dl><dt><span class="term"><code class="code">dynamic_pointer_cast</code>, <code class="code">static_pointer_cast</code>, +</p></div><div class="sect3" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="id420169"></a>Related functions and classes</h4></div></div></div><div class="variablelist"><dl><dt><span class="term"><code class="code">dynamic_pointer_cast</code>, <code class="code">static_pointer_cast</code>, <code class="code">const_pointer_cast</code></span></dt><dd><p> As noted in N2351, these functions can be implemented non-intrusively using the alias constructor. However the aliasing constructor is only available @@ -214,10 +214,10 @@ is called. Users should not try to use this. As well as the extra constructors, this implementation also needs some members of _Sp_counted_deleter to be protected where they could otherwise be private. - </p></dd></dl></div></div></div><div class="sect2" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 class="title"><a id="shared_ptr.using"></a>Use</h3></div></div></div><div class="sect3" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="id404984"></a>Examples</h4></div></div></div><p> + </p></dd></dl></div></div></div><div class="sect2" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 class="title"><a id="shared_ptr.using"></a>Use</h3></div></div></div><div class="sect3" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="id457752"></a>Examples</h4></div></div></div><p> Examples of use can be found in the testsuite, under <code class="filename">testsuite/tr1/2_general_utilities/shared_ptr</code>. - </p></div><div class="sect3" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="id398405"></a>Unresolved Issues</h4></div></div></div><p> + </p></div><div class="sect3" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="id457768"></a>Unresolved Issues</h4></div></div></div><p> The resolution to C++ Standard Library issue <a class="ulink" href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#674" target="_top">674</a>, "shared_ptr interface changes for consistency with N1856" will need to be implemented after it is accepted into the working @@ -265,7 +265,7 @@ be private. code to work with, Peter Dimov in particular for his help and invaluable advice on thread safety. Phillip Jordan and Paolo Carlini for the lock policy implementation. - </p></div><div class="bibliography"><div class="titlepage"><div><div><h3 class="title"><a id="shared_ptr.biblio"></a>Bibliography</h3></div></div></div><div class="biblioentry"><a id="id485662"></a><p>[<abbr class="abbrev"> + </p></div><div class="bibliography"><div class="titlepage"><div><div><h3 class="title"><a id="shared_ptr.biblio"></a>Bibliography</h3></div></div></div><div class="biblioentry"><a id="id419191"></a><p>[<abbr class="abbrev"> n2351 </abbr>] <span class="title"><i> Improving shared_ptr for C++0x, Revision 2 @@ -274,7 +274,7 @@ be private. . </span><span class="biblioid"> <a class="ulink" href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2351.htm" target="_top"> </a> - . </span></p></div><div class="biblioentry"><a id="id485686"></a><p>[<abbr class="abbrev"> + . </span></p></div><div class="biblioentry"><a id="id405886"></a><p>[<abbr class="abbrev"> n2456 </abbr>] <span class="title"><i> C++ Standard Library Active Issues List (Revision R52) @@ -283,7 +283,7 @@ be private. . </span><span class="biblioid"> <a class="ulink" href="http://open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2456.html" target="_top"> </a> - . </span></p></div><div class="biblioentry"><a id="id403091"></a><p>[<abbr class="abbrev"> + . </span></p></div><div class="biblioentry"><a id="id411352"></a><p>[<abbr class="abbrev"> n2461 </abbr>] <span class="title"><i> Working Draft, Standard for Programming Language C++ @@ -292,7 +292,7 @@ be private. . </span><span class="biblioid"> <a class="ulink" href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2461.pdf" target="_top"> </a> - . </span></p></div><div class="biblioentry"><a id="id514547"></a><p>[<abbr class="abbrev"> + . </span></p></div><div class="biblioentry"><a id="id400175"></a><p>[<abbr class="abbrev"> boostshared_ptr </abbr>] <span class="title"><i> Boost C++ Libraries documentation - shared_ptr class template diff --git a/libstdc++-v3/doc/html/manual/spine.html b/libstdc++-v3/doc/html/manual/spine.html index ba20f193d8e..0a0b3d7f4fe 100644 --- a/libstdc++-v3/doc/html/manual/spine.html +++ b/libstdc++-v3/doc/html/manual/spine.html @@ -2,6 +2,6 @@ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>The GNU C++ Library</title><meta name="generator" content="DocBook XSL Stylesheets V1.73.2" /><link rel="start" href="../spine.html" title="The GNU C++ Library Documentation" /><link rel="up" href="../spine.html" title="The GNU C++ Library Documentation" /><link rel="prev" href="../spine.html" title="The GNU C++ Library Documentation" /><link rel="next" href="intro.html" title="Part I. Introduction" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">The GNU C++ Library</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="../spine.html">Prev</a> </td><th width="60%" align="center"> </th><td width="20%" align="right"> <a accesskey="n" href="intro.html">Next</a></td></tr></table><hr /></div><div class="book" lang="en" xml:lang="en"><div class="titlepage"><div><div><h1 class="title"><a id="manual-index"></a>The GNU C++ Library</h1></div><div><p class="copyright">Copyright © 2008 <a class="ulink" href="http://fsf.org" target="_top">FSF</a> - </p></div><div><div class="legalnotice"><a id="id471282"></a><p> + </p></div><div><div class="legalnotice"><a id="id455107"></a><p> <a class="ulink" href="17_intro/license.html" target="_top">License</a> - </p></div></div></div><hr /></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="part"><a href="intro.html">I. Introduction</a></span></dt><dd><dl><dt><span class="chapter"><a href="bk01pt01ch01.html">1. Status</a></span></dt><dd><dl><dt><span class="sect1"><a href="bk01pt01ch01.html#manual.intro.status.standard">Implementation Status</a></span></dt><dd><dl><dt><span class="sect2"><a href="bk01pt01ch01.html#manual.intro.status.standard.1998">C++ 1998</a></span></dt><dt><span class="sect2"><a href="bk01pt01ch01.html#manual.intro.status.standard.tr1">C++ TR1</a></span></dt><dt><span class="sect2"><a href="bk01pt01ch01.html#manual.intro.status.standard.200x">C++ 200x</a></span></dt></dl></dd><dt><span class="sect1"><a href="bk01pt01ch01s02.html">License</a></span></dt><dd><dl><dt><span class="sect2"><a href="bk01pt01ch01s02.html#manual.intro.status.license.gpl">The Code: GPL</a></span></dt><dt><span class="sect2"><a href="bk01pt01ch01s02.html#manual.intro.status.license.fdl">The Documentation: GPL, FDL</a></span></dt></dl></dd><dt><span class="sect1"><a href="bk01pt01ch01s03.html">Bugs</a></span></dt><dd><dl><dt><span class="sect2"><a href="bk01pt01ch01s03.html#manual.intro.status.bugs.impl">Implementation Bugs</a></span></dt><dt><span class="sect2"><a href="bk01pt01ch01s03.html#manual.intro.status.bugs.iso">Standard Bugs</a></span></dt></dl></dd></dl></dd><dt><span class="chapter"><a href="bk01pt01ch02.html">2. Setup</a></span></dt><dd><dl><dt><span class="sect1"><a href="bk01pt01ch02.html#manual.intro.setup.configure">Configure</a></span></dt><dt><span class="sect1"><a href="build.html">Build</a></span></dt><dd><dl><dt><span class="sect2"><a href="build.html#build.prereq">Prerequisites</a></span></dt><dt><span class="sect2"><a href="build.html#build.configure">Make</a></span></dt></dl></dd><dt><span class="sect1"><a href="test.html">Test</a></span></dt><dd><dl><dt><span class="sect2"><a href="test.html#test.organization">Organization</a></span></dt><dt><span class="sect2"><a href="test.html#test.naming">Naming Conventions</a></span></dt><dt><span class="sect2"><a href="test.html#test.utils">Utilities</a></span></dt><dt><span class="sect2"><a href="test.html#test.run">Running the Testsuite</a></span></dt><dt><span class="sect2"><a href="test.html#test.new_tests">New Test Cases</a></span></dt><dt><span class="sect2"><a href="test.html#test.dejagnu">Test Harness Details</a></span></dt><dt><span class="sect2"><a href="test.html#test.future">Future</a></span></dt></dl></dd></dl></dd><dt><span class="chapter"><a href="using.html">3. Using</a></span></dt><dd><dl><dt><span class="sect1"><a href="using.html#manual.intro.using.lib">Linking Library Binary Files</a></span></dt><dt><span class="sect1"><a href="bk01pt01ch03s02.html">Headers</a></span></dt><dd><dl><dt><span class="sect2"><a href="bk01pt01ch03s02.html#manual.intro.using.headers.all">Header Files</a></span></dt><dt><span class="sect2"><a href="bk01pt01ch03s02.html#manual.intro.using.headers.mixing">Mixing Headers</a></span></dt><dt><span class="sect2"><a href="bk01pt01ch03s02.html#manual.intro.using.headers.cheaders">The C Headers and <code class="code">namespace std</code></a></span></dt><dt><span class="sect2"><a href="bk01pt01ch03s02.html#manual.intro.using.headers.pre">Precompiled Headers</a></span></dt></dl></dd><dt><span class="sect1"><a href="bk01pt01ch03s03.html">Namespaces</a></span></dt><dd><dl><dt><span class="sect2"><a href="bk01pt01ch03s03.html#manual.intro.using.namespaces.all">Available Namespaces</a></span></dt><dt><span class="sect2"><a href="bk01pt01ch03s03.html#manual.intro.using.namespaces.std">namespace std</a></span></dt><dt><span class="sect2"><a href="bk01pt01ch03s03.html#manual.intro.using.namespaces.comp">Using Namespace Composition</a></span></dt></dl></dd><dt><span class="sect1"><a href="bk01pt01ch03s04.html">Macros</a></span></dt><dt><span class="sect1"><a href="bk01pt01ch03s05.html">Concurrency</a></span></dt><dd><dl><dt><span class="sect2"><a href="bk01pt01ch03s05.html#manual.intro.using.concurrency.prereq">Prerequisites</a></span></dt><dt><span class="sect2"><a href="bk01pt01ch03s05.html#manual.intro.using.concurrency.thread_safety">Thread Safety</a></span></dt><dt><span class="sect2"><a href="bk01pt01ch03s05.html#manual.intro.using.concurrency.atomics">Atomics</a></span></dt><dt><span class="sect2"><a href="bk01pt01ch03s05.html#manual.intro.using.concurrency.io">IO</a></span></dt><dt><span class="sect2"><a href="bk01pt01ch03s05.html#manual.intro.using.concurrency.containers">Containers</a></span></dt></dl></dd><dt><span class="sect1"><a href="bk01pt01ch03s06.html">Exception Safety</a></span></dt><dt><span class="sect1"><a href="debug.html">Debugging Support</a></span></dt><dd><dl><dt><span class="sect2"><a href="debug.html#debug.compiler">Using <span class="command"><strong>g++</strong></span></a></span></dt><dt><span class="sect2"><a href="debug.html#debug.req">Debug Versions of Library Binary Files</a></span></dt><dt><span class="sect2"><a href="debug.html#debug.memory">Memory Leak Hunting</a></span></dt><dt><span class="sect2"><a href="debug.html#debug.gdb">Using <span class="command"><strong>gdb</strong></span></a></span></dt><dt><span class="sect2"><a href="debug.html#debug.exceptions">Tracking uncaught exceptions</a></span></dt><dt><span class="sect2"><a href="debug.html#debug.debug_mode">Debug Mode</a></span></dt><dt><span class="sect2"><a href="debug.html#debug.compile_time_checks">Compile Time Checking</a></span></dt></dl></dd></dl></dd></dl></dd><dt><span class="part"><a href="support.html">II. Support</a></span></dt><dd><dl><dt><span class="preface"><a href="bk01pt02pr01.html"></a></span></dt><dt><span class="chapter"><a href="bk01pt02ch04.html">4. Types</a></span></dt><dd><dl><dt><span class="sect1"><a href="bk01pt02ch04.html#manual.support.types.fundamental">Fundamental Types</a></span></dt><dt><span class="sect1"><a href="bk01pt02ch04s02.html">Numeric Properties</a></span></dt><dt><span class="sect1"><a href="bk01pt02ch04s03.html">NULL</a></span></dt></dl></dd><dt><span class="chapter"><a href="bk01pt02ch05.html">5. Dynamic Memory</a></span></dt><dt><span class="chapter"><a href="bk01pt02ch06.html">6. Termination</a></span></dt><dd><dl><dt><span class="sect1"><a href="bk01pt02ch06.html#support.termination.handlers">Termination Handlers</a></span></dt><dt><span class="sect1"><a href="bk01pt02ch06s02.html">Verbose Terminate Handler</a></span></dt></dl></dd></dl></dd><dt><span class="part"><a href="diagnostics.html">III. Diagnostics</a></span></dt><dd><dl><dt><span class="chapter"><a href="bk01pt03ch07.html">7. Exceptions</a></span></dt><dd><dl><dt><span class="sect1"><a href="bk01pt03ch07.html#manual.diagnostics.exceptions.hierarchy">Exception Classes</a></span></dt><dt><span class="sect1"><a href="bk01pt03ch07s02.html">Adding Data to Exceptions</a></span></dt><dt><span class="sect1"><a href="bk01pt03ch07s03.html">Cancellation</a></span></dt></dl></dd><dt><span class="chapter"><a href="bk01pt03ch08.html">8. Concept Checking</a></span></dt></dl></dd><dt><span class="part"><a href="utilities.html">IV. Utilities</a></span></dt><dd><dl><dt><span class="chapter"><a href="bk01pt04ch09.html">9. Functors</a></span></dt><dt><span class="chapter"><a href="bk01pt04ch10.html">10. Pairs</a></span></dt><dt><span class="chapter"><a href="bk01pt04ch11.html">11. Memory</a></span></dt><dd><dl><dt><span class="sect1"><a href="bk01pt04ch11.html#manual.util.memory.allocator">Allocators</a></span></dt><dd><dl><dt><span class="sect2"><a href="bk01pt04ch11.html#allocator.req">Requirements</a></span></dt><dt><span class="sect2"><a href="bk01pt04ch11.html#allocator.design_issues">Design Issues</a></span></dt><dt><span class="sect2"><a href="bk01pt04ch11.html#allocator.impl">Implementation</a></span></dt><dt><span class="sect2"><a href="bk01pt04ch11.html#allocator.using">Using a Specific Allocator</a></span></dt><dt><span class="sect2"><a href="bk01pt04ch11.html#allocator.custom">Custom Allocators</a></span></dt><dt><span class="sect2"><a href="bk01pt04ch11.html#allocator.ext">Extension Allocators</a></span></dt></dl></dd><dt><span class="sect1"><a href="auto_ptr.html">auto_ptr</a></span></dt><dd><dl><dt><span class="sect2"><a href="auto_ptr.html#auto_ptr.limitations">Limitations</a></span></dt><dt><span class="sect2"><a href="auto_ptr.html#auto_ptr.using">Use in Containers</a></span></dt></dl></dd><dt><span class="sect1"><a href="shared_ptr.html">shared_ptr</a></span></dt><dd><dl><dt><span class="sect2"><a href="shared_ptr.html#shared_ptr.req">Requirements</a></span></dt><dt><span class="sect2"><a href="shared_ptr.html#shared_ptr.design_issues">Design Issues</a></span></dt><dt><span class="sect2"><a href="shared_ptr.html#shared_ptr.impl">Implementation</a></span></dt><dt><span class="sect2"><a href="shared_ptr.html#shared_ptr.using">Use</a></span></dt><dt><span class="sect2"><a href="shared_ptr.html#shared_ptr.ack">Acknowledgments</a></span></dt></dl></dd></dl></dd><dt><span class="chapter"><a href="bk01pt04ch12.html">12. Traits</a></span></dt></dl></dd><dt><span class="part"><a href="strings.html">V. Strings</a></span></dt><dd><dl><dt><span class="chapter"><a href="bk01pt05ch13.html">13. String Classes</a></span></dt><dd><dl><dt><span class="sect1"><a href="bk01pt05ch13.html#strings.string.simple">Simple Transformations</a></span></dt><dt><span class="sect1"><a href="bk01pt05ch13s02.html">Case Sensivitity</a></span></dt><dt><span class="sect1"><a href="bk01pt05ch13s03.html">Arbitrary Character Types</a></span></dt><dt><span class="sect1"><a href="bk01pt05ch13s04.html">Tokenizing</a></span></dt><dt><span class="sect1"><a href="bk01pt05ch13s05.html">Shrink to Fit</a></span></dt><dt><span class="sect1"><a href="bk01pt05ch13s06.html">CString (MFC)</a></span></dt></dl></dd></dl></dd><dt><span class="part"><a href="localization.html">VI. Localization</a></span></dt><dd><dl><dt><span class="chapter"><a href="bk01pt06ch14.html">14. Locales</a></span></dt><dd><dl><dt><span class="sect1"><a href="bk01pt06ch14.html#manual.localization.locales.locale">locale</a></span></dt><dd><dl><dt><span class="sect2"><a href="bk01pt06ch14.html#locales.locale.req">Requirements</a></span></dt><dt><span class="sect2"><a href="bk01pt06ch14.html#locales.locale.design">Design</a></span></dt><dt><span class="sect2"><a href="bk01pt06ch14.html#locales.locale.impl">Implementation</a></span></dt><dt><span class="sect2"><a href="bk01pt06ch14.html#locales.locale.future">Future</a></span></dt></dl></dd></dl></dd><dt><span class="chapter"><a href="bk01pt06ch15.html">15. Facets aka Categories</a></span></dt><dd><dl><dt><span class="sect1"><a href="bk01pt06ch15.html#manual.localization.facet.ctype">ctype</a></span></dt><dd><dl><dt><span class="sect2"><a href="bk01pt06ch15.html#facet.ctype.impl">Implementation</a></span></dt><dt><span class="sect2"><a href="bk01pt06ch15.html#facet.ctype.future">Future</a></span></dt></dl></dd><dt><span class="sect1"><a href="codecvt.html">codecvt</a></span></dt><dd><dl><dt><span class="sect2"><a href="codecvt.html#facet.codecvt.req">Requirements</a></span></dt><dt><span class="sect2"><a href="codecvt.html#facet.codecvt.design">Design</a></span></dt><dt><span class="sect2"><a href="codecvt.html#facet.codecvt.impl">Implementation</a></span></dt><dt><span class="sect2"><a href="codecvt.html#facet.codecvt.use">Use</a></span></dt><dt><span class="sect2"><a href="codecvt.html#facet.codecvt.future">Future</a></span></dt></dl></dd><dt><span class="sect1"><a href="messages.html">messages</a></span></dt><dd><dl><dt><span class="sect2"><a href="messages.html#facet.messages.req">Requirements</a></span></dt><dt><span class="sect2"><a href="messages.html#facet.messages.design">Design</a></span></dt><dt><span class="sect2"><a href="messages.html#facet.messages.impl">Implementation</a></span></dt><dt><span class="sect2"><a href="messages.html#facet.messages.use">Use</a></span></dt><dt><span class="sect2"><a href="messages.html#facet.messages.future">Future</a></span></dt></dl></dd></dl></dd></dl></dd><dt><span class="part"><a href="containers.html">VII. Containers</a></span></dt><dd><dl><dt><span class="chapter"><a href="bk01pt07ch16.html">16. Sequences</a></span></dt><dd><dl><dt><span class="sect1"><a href="bk01pt07ch16.html#containers.sequences.list">list</a></span></dt><dd><dl><dt><span class="sect2"><a href="bk01pt07ch16.html#sequences.list.size">list::size() is O(n)</a></span></dt></dl></dd><dt><span class="sect1"><a href="bk01pt07ch16s02.html">vector</a></span></dt><dd><dl><dt><span class="sect2"><a href="bk01pt07ch16s02.html#sequences.vector.management">Space Overhead Management</a></span></dt></dl></dd></dl></dd><dt><span class="chapter"><a href="bk01pt07ch17.html">17. Associative</a></span></dt><dd><dl><dt><span class="sect1"><a href="bk01pt07ch17.html#containers.associative.insert_hints">Insertion Hints</a></span></dt><dt><span class="sect1"><a href="bk01pt07ch17s02.html">bitset</a></span></dt><dd><dl><dt><span class="sect2"><a href="bk01pt07ch17s02.html#associative.bitset.size_variable">Size Variable</a></span></dt><dt><span class="sect2"><a href="bk01pt07ch17s02.html#associative.bitset.type_string">Type String</a></span></dt></dl></dd></dl></dd><dt><span class="chapter"><a href="bk01pt07ch18.html">18. Interacting with C</a></span></dt><dd><dl><dt><span class="sect1"><a href="bk01pt07ch18.html#containers.c.vs_array">Containers vs. Arrays</a></span></dt></dl></dd></dl></dd><dt><span class="part"><a href="iterators.html">VIII. Iterators</a></span></dt><dd><dl><dt><span class="chapter"><a href="bk01pt08ch19.html">19. Predefined</a></span></dt><dd><dl><dt><span class="sect1"><a href="bk01pt08ch19.html#iterators.predefined.vs_pointers">Iterators vs. Pointers</a></span></dt><dt><span class="sect1"><a href="bk01pt08ch19s02.html">One Past the End</a></span></dt></dl></dd></dl></dd><dt><span class="part"><a href="algorithms.html">IX. Algorithms</a></span></dt><dd><dl><dt><span class="preface"><a href="bk01pt09pr02.html"></a></span></dt><dt><span class="chapter"><a href="bk01pt09ch20.html">20. Mutating</a></span></dt><dd><dl><dt><span class="sect1"><a href="bk01pt09ch20.html#algorithms.mutating.swap"><code class="function">swap</code></a></span></dt><dd><dl><dt><span class="sect2"><a href="bk01pt09ch20.html#algorithms.swap.specializations">Specializations</a></span></dt></dl></dd></dl></dd></dl></dd><dt><span class="part"><a href="numerics.html">X. Numerics</a></span></dt><dd><dl><dt><span class="chapter"><a href="bk01pt10ch21.html">21. Complex</a></span></dt><dd><dl><dt><span class="sect1"><a href="bk01pt10ch21.html#numerics.complex.processing">complex Processing</a></span></dt></dl></dd><dt><span class="chapter"><a href="bk01pt10ch22.html">22. Generalized Operations</a></span></dt><dt><span class="chapter"><a href="bk01pt10ch23.html">23. Interacting with C</a></span></dt><dd><dl><dt><span class="sect1"><a href="bk01pt10ch23.html#numerics.c.array">Numerics vs. Arrays</a></span></dt><dt><span class="sect1"><a href="bk01pt10ch23s02.html">C99</a></span></dt></dl></dd></dl></dd><dt><span class="part"><a href="io.html">XI. Input and Output</a></span></dt><dd><dl><dt><span class="chapter"><a href="bk01pt11ch24.html">24. Iostream Objects</a></span></dt><dt><span class="chapter"><a href="bk01pt11ch25.html">25. Stream Buffers</a></span></dt><dd><dl><dt><span class="sect1"><a href="bk01pt11ch25.html#io.streambuf.derived">Derived streambuf Classes</a></span></dt><dt><span class="sect1"><a href="bk01pt11ch25s02.html">Buffering</a></span></dt></dl></dd><dt><span class="chapter"><a href="bk01pt11ch26.html">26. Memory Based Streams</a></span></dt><dd><dl><dt><span class="sect1"><a href="bk01pt11ch26.html#manual.io.memstreams.compat">Compatibility With strstream</a></span></dt></dl></dd><dt><span class="chapter"><a href="bk01pt11ch27.html">27. File Based Streams</a></span></dt><dd><dl><dt><span class="sect1"><a href="bk01pt11ch27.html#manual.io.filestreams.copying_a_file">Copying a File</a></span></dt><dt><span class="sect1"><a href="bk01pt11ch27s02.html">Binary Input and Output</a></span></dt><dt><span class="sect1"><a href="bk01pt11ch27s03.html">More Binary Input and Output</a></span></dt></dl></dd><dt><span class="chapter"><a href="bk01pt11ch28.html">28. Interacting with C</a></span></dt><dd><dl><dt><span class="sect1"><a href="bk01pt11ch28.html#manual.io.c.FILE">Using FILE* and file descriptors</a></span></dt><dt><span class="sect1"><a href="bk01pt11ch28s02.html">Performance</a></span></dt></dl></dd></dl></dd><dt><span class="part"><a href="extensions.html">XII. Extensions</a></span></dt><dd><dl><dt><span class="preface"><a href="bk01pt12pr03.html"></a></span></dt><dt><span class="chapter"><a href="bk01pt12ch29.html">29. Compile Time Checks</a></span></dt><dt><span class="chapter"><a href="debug_mode.html">30. Debug Mode</a></span></dt><dd><dl><dt><span class="sect1"><a href="debug_mode.html#manual.ext.debug_mode.intro">Intro</a></span></dt><dt><span class="sect1"><a href="bk01pt12ch30s02.html">Semantics</a></span></dt><dt><span class="sect1"><a href="bk01pt12ch30s03.html">Using</a></span></dt><dd><dl><dt><span class="sect2"><a href="bk01pt12ch30s03.html#debug_mode.using.mode">Using the Debug Mode</a></span></dt><dt><span class="sect2"><a href="bk01pt12ch30s03.html#debug_mode.using.specific">Using a Specific Debug Container</a></span></dt></dl></dd><dt><span class="sect1"><a href="bk01pt12ch30s04.html">Design</a></span></dt><dd><dl><dt><span class="sect2"><a href="bk01pt12ch30s04.html#manual.ext.debug_mode.design.goals">Goals</a></span></dt><dt><span class="sect2"><a href="bk01pt12ch30s04.html#manual.ext.debug_mode.design.methods">Methods</a></span></dt><dt><span class="sect2"><a href="bk01pt12ch30s04.html#manual.ext.debug_mode.design.other">Other Implementations</a></span></dt></dl></dd></dl></dd><dt><span class="chapter"><a href="parallel_mode.html">31. Parallel Mode</a></span></dt><dd><dl><dt><span class="sect1"><a href="parallel_mode.html#manual.ext.parallel_mode.intro">Intro</a></span></dt><dt><span class="sect1"><a href="bk01pt12ch31s02.html">Semantics</a></span></dt><dt><span class="sect1"><a href="bk01pt12ch31s03.html">Using</a></span></dt><dd><dl><dt><span class="sect2"><a href="bk01pt12ch31s03.html#parallel_mode.using.parallel_mode">Using Parallel Mode</a></span></dt><dt><span class="sect2"><a href="bk01pt12ch31s03.html#manual.ext.parallel_mode.usings">Using Specific Parallel Components</a></span></dt></dl></dd><dt><span class="sect1"><a href="bk01pt12ch31s04.html">Design</a></span></dt><dd><dl><dt><span class="sect2"><a href="bk01pt12ch31s04.html#manual.ext.parallel_mode.design.intro">Interface Basics</a></span></dt><dt><span class="sect2"><a href="bk01pt12ch31s04.html#manual.ext.parallel_mode.design.tuning">Configuration and Tuning</a></span></dt><dt><span class="sect2"><a href="bk01pt12ch31s04.html#manual.ext.parallel_mode.design.impl">Implementation Namespaces</a></span></dt></dl></dd><dt><span class="sect1"><a href="bk01pt12ch31s05.html">Testing</a></span></dt><dt><span class="bibliography"><a href="parallel_mode.html#parallel_mode.biblio">Bibliography</a></span></dt></dl></dd><dt><span class="chapter"><a href="bk01pt12ch32.html">32. Allocators</a></span></dt><dd><dl><dt><span class="sect1"><a href="bk01pt12ch32.html#manual.ext.allocator.mt">mt_allocator</a></span></dt><dd><dl><dt><span class="sect2"><a href="bk01pt12ch32.html#allocator.mt.intro">Intro</a></span></dt><dt><span class="sect2"><a href="bk01pt12ch32.html#allocator.mt.design_issues">Design Issues</a></span></dt><dt><span class="sect2"><a href="bk01pt12ch32.html#allocator.mt.impl">Implementation</a></span></dt><dt><span class="sect2"><a href="bk01pt12ch32.html#allocator.mt.example_single">Single Thread Example</a></span></dt><dt><span class="sect2"><a href="bk01pt12ch32.html#allocator.mt.example_multi">Multiple Thread Example</a></span></dt></dl></dd><dt><span class="sect1"><a href="bitmap_allocator.html">bitmap_allocator</a></span></dt><dd><dl><dt><span class="sect2"><a href="bitmap_allocator.html#allocator.bitmap.design">Design</a></span></dt><dt><span class="sect2"><a href="bitmap_allocator.html#allocator.bitmap.impl">Implementation</a></span></dt></dl></dd></dl></dd><dt><span class="chapter"><a href="bk01pt12ch33.html">33. Containers</a></span></dt><dd><dl><dt><span class="sect1"><a href="bk01pt12ch33.html#manual.ext.containers.pbds">Policy Based Data Structures</a></span></dt><dt><span class="sect1"><a href="bk01pt12ch33s02.html">HP/SGI</a></span></dt><dt><span class="sect1"><a href="bk01pt12ch33s03.html">Deprecated HP/SGI</a></span></dt></dl></dd><dt><span class="chapter"><a href="bk01pt12ch34.html">34. Utilities</a></span></dt><dt><span class="chapter"><a href="bk01pt12ch35.html">35. Algorithms</a></span></dt><dt><span class="chapter"><a href="bk01pt12ch36.html">36. Numerics</a></span></dt><dt><span class="chapter"><a href="bk01pt12ch37.html">37. Iterators</a></span></dt><dt><span class="chapter"><a href="bk01pt12ch38.html">38. Input and Output</a></span></dt><dd><dl><dt><span class="sect1"><a href="bk01pt12ch38.html#manual.ext.io.filebuf_derived">Derived filebufs</a></span></dt></dl></dd><dt><span class="chapter"><a href="bk01pt12ch39.html">39. Demangling</a></span></dt><dt><span class="chapter"><a href="concurrency.html">40. Concurrency</a></span></dt><dd><dl><dt><span class="sect1"><a href="concurrency.html#manual.ext.concurrency.design">Design</a></span></dt><dd><dl><dt><span class="sect2"><a href="concurrency.html#manual.ext.concurrency.design.threads">Interface to Locks and Mutexes</a></span></dt><dt><span class="sect2"><a href="concurrency.html#manual.ext.concurrency.design.atomics">Interface to Atomic Functions</a></span></dt></dl></dd><dt><span class="sect1"><a href="bk01pt12ch40s02.html">Implementation</a></span></dt><dd><dl><dt><span class="sect2"><a href="bk01pt12ch40s02.html#manual.ext.concurrency.impl.atomic_fallbacks">Using Builitin Atomic Functions</a></span></dt><dt><span class="sect2"><a href="bk01pt12ch40s02.html#manual.ext.concurrency.impl.thread">Thread Abstraction</a></span></dt></dl></dd><dt><span class="sect1"><a href="bk01pt12ch40s03.html">Use</a></span></dt></dl></dd></dl></dd><dt><span class="appendix"><a href="appendix_contributing.html">A. Contributing</a></span></dt><dd><dl><dt><span class="sect1"><a href="appendix_contributing.html#contrib.list">Contributor Checklist</a></span></dt><dd><dl><dt><span class="sect2"><a href="appendix_contributing.html#list.reading">Reading</a></span></dt><dt><span class="sect2"><a href="appendix_contributing.html#list.copyright">Assignment</a></span></dt><dt><span class="sect2"><a href="appendix_contributing.html#list.getting">Getting Sources</a></span></dt><dt><span class="sect2"><a href="appendix_contributing.html#list.patches">Submitting Patches</a></span></dt></dl></dd><dt><span class="sect1"><a href="bk01apas02.html">Directory Layout and Source Conventions</a></span></dt><dt><span class="sect1"><a href="bk01apas03.html">Coding Style</a></span></dt><dd><dl><dt><span class="sect2"><a href="bk01apas03.html#coding_style.bad_identifiers">Bad Itentifiers</a></span></dt><dt><span class="sect2"><a href="bk01apas03.html#coding_style.example">By Example</a></span></dt></dl></dd><dt><span class="sect1"><a href="bk01apas04.html">Documentation Style</a></span></dt><dd><dl><dt><span class="sect2"><a href="bk01apas04.html#doc_style.doxygen">Doxygen</a></span></dt><dt><span class="sect2"><a href="bk01apas04.html#doc_style.docbook">Docbook</a></span></dt></dl></dd><dt><span class="sect1"><a href="bk01apas05.html">Design Notes</a></span></dt></dl></dd><dt><span class="appendix"><a href="appendix_porting.html">B. Porting and Maintenance</a></span></dt><dd><dl><dt><span class="sect1"><a href="appendix_porting.html#appendix.porting.build_hacking">Configure and Build Hacking</a></span></dt><dd><dl><dt><span class="sect2"><a href="appendix_porting.html#build_hacking.prereq">Prerequisites</a></span></dt><dt><span class="sect2"><a href="appendix_porting.html#build_hacking.map">Overview: What Comes from Where</a></span></dt><dt><span class="sect2"><a href="appendix_porting.html#build_hacking.scripts">Storing Information in non-AC files (like configure.host)</a></span></dt><dt><span class="sect2"><a href="appendix_porting.html#build_hacking.conventions">Coding and Commenting Conventions</a></span></dt><dt><span class="sect2"><a href="appendix_porting.html#build_hacking.acinclude">The acinclude.m4 layout</a></span></dt><dt><span class="sect2"><a href="appendix_porting.html#build_hacking.enable"><code class="constant">GLIBCXX_ENABLE</code>, the <code class="literal">--enable</code> maker</a></span></dt></dl></dd><dt><span class="sect1"><a href="internals.html">Porting to New Hardware or Operating Systems</a></span></dt><dd><dl><dt><span class="sect2"><a href="internals.html#internals.os">Operating System</a></span></dt><dt><span class="sect2"><a href="internals.html#internals.cpu">CPU</a></span></dt><dt><span class="sect2"><a href="internals.html#internals.char_types">Character Types</a></span></dt><dt><span class="sect2"><a href="internals.html#internals.thread_safety">Thread Safety</a></span></dt><dt><span class="sect2"><a href="internals.html#internals.numeric_limits">Numeric Limits</a></span></dt><dt><span class="sect2"><a href="internals.html#internals.libtool">Libtool</a></span></dt></dl></dd><dt><span class="sect1"><a href="abi.html">ABI Policy and Guidelines</a></span></dt><dd><dl><dt><span class="sect2"><a href="abi.html#abi.cxx_interface">The C++ Interface</a></span></dt><dt><span class="sect2"><a href="abi.html#abi.versioning">Versioning</a></span></dt><dt><span class="sect2"><a href="abi.html#abi.changes_allowed">Allowed Changes</a></span></dt><dt><span class="sect2"><a href="abi.html#abi.changes_no">Prohibited Changes</a></span></dt><dt><span class="sect2"><a href="abi.html#abi.impl">Implementation</a></span></dt><dt><span class="sect2"><a href="abi.html#abi.testing">Testing</a></span></dt><dt><span class="sect2"><a href="abi.html#abi.issues">Outstanding Issues</a></span></dt></dl></dd><dt><span class="sect1"><a href="api.html">API Evolution and Deprecation History</a></span></dt><dd><dl><dt><span class="sect2"><a href="api.html#api.rel_300"><code class="constant">3.0</code></a></span></dt><dt><span class="sect2"><a href="api.html#api.rel_310"><code class="constant">3.1</code></a></span></dt><dt><span class="sect2"><a href="api.html#api.rel_320"><code class="constant">3.2</code></a></span></dt><dt><span class="sect2"><a href="api.html#api.rel_330"><code class="constant">3.3</code></a></span></dt><dt><span class="sect2"><a href="api.html#api.rel_340"><code class="constant">3.4</code></a></span></dt><dt><span class="sect2"><a href="api.html#api.rel_400"><code class="constant">4.0</code></a></span></dt><dt><span class="sect2"><a href="api.html#api.rel_410"><code class="constant">4.1</code></a></span></dt><dt><span class="sect2"><a href="api.html#api.rel_420"><code class="constant">4.2</code></a></span></dt><dt><span class="sect2"><a href="api.html#api.rel_430"><code class="constant">4.3</code></a></span></dt></dl></dd><dt><span class="sect1"><a href="backwards.html">Backwards Compatibility</a></span></dt><dd><dl><dt><span class="sect2"><a href="backwards.html#backwards.first">First</a></span></dt><dt><span class="sect2"><a href="backwards.html#backwards.second">Second</a></span></dt><dt><span class="sect2"><a href="backwards.html#backwards.third">Third</a></span></dt></dl></dd></dl></dd><dt><span class="appendix"><a href="appendix_free.html">C. Free Software Needs Free Documentation</a></span></dt><dt><span class="appendix"><a href="bk01apd.html">D. GNU General Public License</a></span></dt><dd><dl><dt><span class="section"><a href="bk01apd.html#gpl-1">Preamble</a></span></dt><dt><span class="section"><a href="bk01apds02.html">TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION</a></span></dt><dd><dl><dt><span class="section"><a href="bk01apds02.html#gpl-2-0">Section 0</a></span></dt><dt><span class="section"><a href="bk01apds02.html#gpl-2-1">Section 1</a></span></dt><dt><span class="section"><a href="bk01apds02.html#gpl-2-2">Section 2</a></span></dt><dt><span class="section"><a href="bk01apds02.html#gpl-2-3">Section 3</a></span></dt><dt><span class="section"><a href="bk01apds02.html#gpl-2-4">Section 4</a></span></dt><dt><span class="section"><a href="bk01apds02.html#gpl-2-5">Section 5</a></span></dt><dt><span class="section"><a href="bk01apds02.html#gpl-2-6">Section 6</a></span></dt><dt><span class="section"><a href="bk01apds02.html#gpl-2-7">Section 7</a></span></dt><dt><span class="section"><a href="bk01apds02.html#gpl-2-8">Section 8</a></span></dt><dt><span class="section"><a href="bk01apds02.html#gpl-2-9">Section 9</a></span></dt><dt><span class="section"><a href="bk01apds02.html#gpl-2-10">Section 10</a></span></dt><dt><span class="section"><a href="bk01apds02.html#gpl-2-11">NO WARRANTY Section 11</a></span></dt><dt><span class="section"><a href="bk01apds02.html#gpl-2-12">Section 12</a></span></dt></dl></dd><dt><span class="section"><a href="bk01apds03.html">How to Apply These Terms to Your New Programs</a></span></dt></dl></dd><dt><span class="appendix"><a href="bk01ape.html">E. GNU Free Documentation License</a></span></dt></dl></div><div class="list-of-tables"><p><b>List of Tables</b></p><dl><dt>1.1. <a href="bk01pt01ch01.html#id395297">C++ TR1 Implementation Status</a></dt><dt>1.2. <a href="bk01pt01ch01.html#id472768">C++ 200x Implementation Status</a></dt><dt>3.1. <a href="bk01pt01ch03s02.html#id398035">C++ 1998 Library Headers</a></dt><dt>3.2. <a href="bk01pt01ch03s02.html#id397982">C++ 1998 Library Headers for C Library Facilities</a></dt><dt>3.3. <a href="bk01pt01ch03s02.html#id399447">C++ 200x Library Headers</a></dt><dt>3.4. <a href="bk01pt01ch03s02.html#id394222">C++ 200x Library Headers for C Library Facilities</a></dt><dt>3.5. <a href="bk01pt01ch03s02.html#id485624">C++ TR1 Library Headers</a></dt><dt>3.6. <a href="bk01pt01ch03s02.html#id407403">C++ TR1 Library Headers for C Library Facilities</a></dt><dt>3.7. <a href="bk01pt01ch03s02.html#id420398">C++ ABI Headers</a></dt><dt>3.8. <a href="bk01pt01ch03s02.html#id414207">Extension Headers</a></dt><dt>3.9. <a href="bk01pt01ch03s02.html#id458275">Extension Debug Headers</a></dt><dt>3.10. <a href="bk01pt01ch03s02.html#id428288">Extension Parallel Headers</a></dt><dt>30.1. <a href="bk01pt12ch30s03.html#id400605">Debugging Containers</a></dt><dt>30.2. <a href="bk01pt12ch30s03.html#id452759">Debugging Containers C++0x</a></dt><dt>31.1. <a href="bk01pt12ch31s03.html#id419374">Parallel Algorithms</a></dt><dt>32.1. <a href="bitmap_allocator.html#id510462">Bitmap Allocator Memory Map</a></dt><dt>B.1. <a href="api.html#id456920">Extension Allocators</a></dt><dt>B.2. <a href="api.html#id408028">Extension Allocators Continued</a></dt></dl></div></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="../spine.html">Prev</a> </td><td width="20%" align="center"> </td><td width="40%" align="right"> <a accesskey="n" href="intro.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">The GNU C++ Library Documentation </td><td width="20%" align="center"><a accesskey="h" href="../spine.html">Home</a></td><td width="40%" align="right" valign="top"> Part I. Introduction</td></tr></table></div></body></html> + </p></div></div></div><hr /></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="part"><a href="intro.html">I. Introduction</a></span></dt><dd><dl><dt><span class="chapter"><a href="bk01pt01ch01.html">1. Status</a></span></dt><dd><dl><dt><span class="sect1"><a href="bk01pt01ch01.html#manual.intro.status.standard">Implementation Status</a></span></dt><dd><dl><dt><span class="sect2"><a href="bk01pt01ch01.html#manual.intro.status.standard.1998">C++ 1998</a></span></dt><dt><span class="sect2"><a href="bk01pt01ch01.html#manual.intro.status.standard.tr1">C++ TR1</a></span></dt><dt><span class="sect2"><a href="bk01pt01ch01.html#manual.intro.status.standard.200x">C++ 200x</a></span></dt></dl></dd><dt><span class="sect1"><a href="bk01pt01ch01s02.html">License</a></span></dt><dd><dl><dt><span class="sect2"><a href="bk01pt01ch01s02.html#manual.intro.status.license.gpl">The Code: GPL</a></span></dt><dt><span class="sect2"><a href="bk01pt01ch01s02.html#manual.intro.status.license.fdl">The Documentation: GPL, FDL</a></span></dt></dl></dd><dt><span class="sect1"><a href="bk01pt01ch01s03.html">Bugs</a></span></dt><dd><dl><dt><span class="sect2"><a href="bk01pt01ch01s03.html#manual.intro.status.bugs.impl">Implementation Bugs</a></span></dt><dt><span class="sect2"><a href="bk01pt01ch01s03.html#manual.intro.status.bugs.iso">Standard Bugs</a></span></dt></dl></dd></dl></dd><dt><span class="chapter"><a href="bk01pt01ch02.html">2. Setup</a></span></dt><dd><dl><dt><span class="sect1"><a href="bk01pt01ch02.html#manual.intro.setup.configure">Configure</a></span></dt><dt><span class="sect1"><a href="build.html">Build</a></span></dt><dd><dl><dt><span class="sect2"><a href="build.html#build.prereq">Prerequisites</a></span></dt><dt><span class="sect2"><a href="build.html#build.configure">Make</a></span></dt></dl></dd><dt><span class="sect1"><a href="test.html">Test</a></span></dt><dd><dl><dt><span class="sect2"><a href="test.html#test.organization">Organization</a></span></dt><dt><span class="sect2"><a href="test.html#test.naming">Naming Conventions</a></span></dt><dt><span class="sect2"><a href="test.html#test.utils">Utilities</a></span></dt><dt><span class="sect2"><a href="test.html#test.run">Running the Testsuite</a></span></dt><dt><span class="sect2"><a href="test.html#test.new_tests">New Test Cases</a></span></dt><dt><span class="sect2"><a href="test.html#test.dejagnu">Test Harness Details</a></span></dt><dt><span class="sect2"><a href="test.html#test.future">Future</a></span></dt></dl></dd></dl></dd><dt><span class="chapter"><a href="using.html">3. Using</a></span></dt><dd><dl><dt><span class="sect1"><a href="using.html#manual.intro.using.lib">Linking Library Binary Files</a></span></dt><dt><span class="sect1"><a href="bk01pt01ch03s02.html">Headers</a></span></dt><dd><dl><dt><span class="sect2"><a href="bk01pt01ch03s02.html#manual.intro.using.headers.all">Header Files</a></span></dt><dt><span class="sect2"><a href="bk01pt01ch03s02.html#manual.intro.using.headers.mixing">Mixing Headers</a></span></dt><dt><span class="sect2"><a href="bk01pt01ch03s02.html#manual.intro.using.headers.cheaders">The C Headers and <code class="code">namespace std</code></a></span></dt><dt><span class="sect2"><a href="bk01pt01ch03s02.html#manual.intro.using.headers.pre">Precompiled Headers</a></span></dt></dl></dd><dt><span class="sect1"><a href="bk01pt01ch03s03.html">Namespaces</a></span></dt><dd><dl><dt><span class="sect2"><a href="bk01pt01ch03s03.html#manual.intro.using.namespaces.all">Available Namespaces</a></span></dt><dt><span class="sect2"><a href="bk01pt01ch03s03.html#manual.intro.using.namespaces.std">namespace std</a></span></dt><dt><span class="sect2"><a href="bk01pt01ch03s03.html#manual.intro.using.namespaces.comp">Using Namespace Composition</a></span></dt></dl></dd><dt><span class="sect1"><a href="bk01pt01ch03s04.html">Macros</a></span></dt><dt><span class="sect1"><a href="bk01pt01ch03s05.html">Concurrency</a></span></dt><dd><dl><dt><span class="sect2"><a href="bk01pt01ch03s05.html#manual.intro.using.concurrency.prereq">Prerequisites</a></span></dt><dt><span class="sect2"><a href="bk01pt01ch03s05.html#manual.intro.using.concurrency.thread_safety">Thread Safety</a></span></dt><dt><span class="sect2"><a href="bk01pt01ch03s05.html#manual.intro.using.concurrency.atomics">Atomics</a></span></dt><dt><span class="sect2"><a href="bk01pt01ch03s05.html#manual.intro.using.concurrency.io">IO</a></span></dt><dt><span class="sect2"><a href="bk01pt01ch03s05.html#manual.intro.using.concurrency.containers">Containers</a></span></dt></dl></dd><dt><span class="sect1"><a href="bk01pt01ch03s06.html">Exception Safety</a></span></dt><dt><span class="sect1"><a href="debug.html">Debugging Support</a></span></dt><dd><dl><dt><span class="sect2"><a href="debug.html#debug.compiler">Using <span class="command"><strong>g++</strong></span></a></span></dt><dt><span class="sect2"><a href="debug.html#debug.req">Debug Versions of Library Binary Files</a></span></dt><dt><span class="sect2"><a href="debug.html#debug.memory">Memory Leak Hunting</a></span></dt><dt><span class="sect2"><a href="debug.html#debug.gdb">Using <span class="command"><strong>gdb</strong></span></a></span></dt><dt><span class="sect2"><a href="debug.html#debug.exceptions">Tracking uncaught exceptions</a></span></dt><dt><span class="sect2"><a href="debug.html#debug.debug_mode">Debug Mode</a></span></dt><dt><span class="sect2"><a href="debug.html#debug.compile_time_checks">Compile Time Checking</a></span></dt></dl></dd></dl></dd></dl></dd><dt><span class="part"><a href="support.html">II. Support</a></span></dt><dd><dl><dt><span class="preface"><a href="bk01pt02pr01.html"></a></span></dt><dt><span class="chapter"><a href="bk01pt02ch04.html">4. Types</a></span></dt><dd><dl><dt><span class="sect1"><a href="bk01pt02ch04.html#manual.support.types.fundamental">Fundamental Types</a></span></dt><dt><span class="sect1"><a href="bk01pt02ch04s02.html">Numeric Properties</a></span></dt><dt><span class="sect1"><a href="bk01pt02ch04s03.html">NULL</a></span></dt></dl></dd><dt><span class="chapter"><a href="bk01pt02ch05.html">5. Dynamic Memory</a></span></dt><dt><span class="chapter"><a href="bk01pt02ch06.html">6. Termination</a></span></dt><dd><dl><dt><span class="sect1"><a href="bk01pt02ch06.html#support.termination.handlers">Termination Handlers</a></span></dt><dt><span class="sect1"><a href="bk01pt02ch06s02.html">Verbose Terminate Handler</a></span></dt></dl></dd></dl></dd><dt><span class="part"><a href="diagnostics.html">III. Diagnostics</a></span></dt><dd><dl><dt><span class="chapter"><a href="bk01pt03ch07.html">7. Exceptions</a></span></dt><dd><dl><dt><span class="sect1"><a href="bk01pt03ch07.html#manual.diagnostics.exceptions.hierarchy">Exception Classes</a></span></dt><dt><span class="sect1"><a href="bk01pt03ch07s02.html">Adding Data to Exceptions</a></span></dt><dt><span class="sect1"><a href="bk01pt03ch07s03.html">Cancellation</a></span></dt></dl></dd><dt><span class="chapter"><a href="bk01pt03ch08.html">8. Concept Checking</a></span></dt></dl></dd><dt><span class="part"><a href="utilities.html">IV. Utilities</a></span></dt><dd><dl><dt><span class="chapter"><a href="bk01pt04ch09.html">9. Functors</a></span></dt><dt><span class="chapter"><a href="bk01pt04ch10.html">10. Pairs</a></span></dt><dt><span class="chapter"><a href="bk01pt04ch11.html">11. Memory</a></span></dt><dd><dl><dt><span class="sect1"><a href="bk01pt04ch11.html#manual.util.memory.allocator">Allocators</a></span></dt><dd><dl><dt><span class="sect2"><a href="bk01pt04ch11.html#allocator.req">Requirements</a></span></dt><dt><span class="sect2"><a href="bk01pt04ch11.html#allocator.design_issues">Design Issues</a></span></dt><dt><span class="sect2"><a href="bk01pt04ch11.html#allocator.impl">Implementation</a></span></dt><dt><span class="sect2"><a href="bk01pt04ch11.html#allocator.using">Using a Specific Allocator</a></span></dt><dt><span class="sect2"><a href="bk01pt04ch11.html#allocator.custom">Custom Allocators</a></span></dt><dt><span class="sect2"><a href="bk01pt04ch11.html#allocator.ext">Extension Allocators</a></span></dt></dl></dd><dt><span class="sect1"><a href="auto_ptr.html">auto_ptr</a></span></dt><dd><dl><dt><span class="sect2"><a href="auto_ptr.html#auto_ptr.limitations">Limitations</a></span></dt><dt><span class="sect2"><a href="auto_ptr.html#auto_ptr.using">Use in Containers</a></span></dt></dl></dd><dt><span class="sect1"><a href="shared_ptr.html">shared_ptr</a></span></dt><dd><dl><dt><span class="sect2"><a href="shared_ptr.html#shared_ptr.req">Requirements</a></span></dt><dt><span class="sect2"><a href="shared_ptr.html#shared_ptr.design_issues">Design Issues</a></span></dt><dt><span class="sect2"><a href="shared_ptr.html#shared_ptr.impl">Implementation</a></span></dt><dt><span class="sect2"><a href="shared_ptr.html#shared_ptr.using">Use</a></span></dt><dt><span class="sect2"><a href="shared_ptr.html#shared_ptr.ack">Acknowledgments</a></span></dt></dl></dd></dl></dd><dt><span class="chapter"><a href="bk01pt04ch12.html">12. Traits</a></span></dt></dl></dd><dt><span class="part"><a href="strings.html">V. Strings</a></span></dt><dd><dl><dt><span class="chapter"><a href="bk01pt05ch13.html">13. String Classes</a></span></dt><dd><dl><dt><span class="sect1"><a href="bk01pt05ch13.html#strings.string.simple">Simple Transformations</a></span></dt><dt><span class="sect1"><a href="bk01pt05ch13s02.html">Case Sensitivity</a></span></dt><dt><span class="sect1"><a href="bk01pt05ch13s03.html">Arbitrary Character Types</a></span></dt><dt><span class="sect1"><a href="bk01pt05ch13s04.html">Tokenizing</a></span></dt><dt><span class="sect1"><a href="bk01pt05ch13s05.html">Shrink to Fit</a></span></dt><dt><span class="sect1"><a href="bk01pt05ch13s06.html">CString (MFC)</a></span></dt></dl></dd></dl></dd><dt><span class="part"><a href="localization.html">VI. Localization</a></span></dt><dd><dl><dt><span class="chapter"><a href="bk01pt06ch14.html">14. Locales</a></span></dt><dd><dl><dt><span class="sect1"><a href="bk01pt06ch14.html#manual.localization.locales.locale">locale</a></span></dt><dd><dl><dt><span class="sect2"><a href="bk01pt06ch14.html#locales.locale.req">Requirements</a></span></dt><dt><span class="sect2"><a href="bk01pt06ch14.html#locales.locale.design">Design</a></span></dt><dt><span class="sect2"><a href="bk01pt06ch14.html#locales.locale.impl">Implementation</a></span></dt><dt><span class="sect2"><a href="bk01pt06ch14.html#locales.locale.future">Future</a></span></dt></dl></dd></dl></dd><dt><span class="chapter"><a href="bk01pt06ch15.html">15. Facets aka Categories</a></span></dt><dd><dl><dt><span class="sect1"><a href="bk01pt06ch15.html#manual.localization.facet.ctype">ctype</a></span></dt><dd><dl><dt><span class="sect2"><a href="bk01pt06ch15.html#facet.ctype.impl">Implementation</a></span></dt><dt><span class="sect2"><a href="bk01pt06ch15.html#facet.ctype.future">Future</a></span></dt></dl></dd><dt><span class="sect1"><a href="codecvt.html">codecvt</a></span></dt><dd><dl><dt><span class="sect2"><a href="codecvt.html#facet.codecvt.req">Requirements</a></span></dt><dt><span class="sect2"><a href="codecvt.html#facet.codecvt.design">Design</a></span></dt><dt><span class="sect2"><a href="codecvt.html#facet.codecvt.impl">Implementation</a></span></dt><dt><span class="sect2"><a href="codecvt.html#facet.codecvt.use">Use</a></span></dt><dt><span class="sect2"><a href="codecvt.html#facet.codecvt.future">Future</a></span></dt></dl></dd><dt><span class="sect1"><a href="messages.html">messages</a></span></dt><dd><dl><dt><span class="sect2"><a href="messages.html#facet.messages.req">Requirements</a></span></dt><dt><span class="sect2"><a href="messages.html#facet.messages.design">Design</a></span></dt><dt><span class="sect2"><a href="messages.html#facet.messages.impl">Implementation</a></span></dt><dt><span class="sect2"><a href="messages.html#facet.messages.use">Use</a></span></dt><dt><span class="sect2"><a href="messages.html#facet.messages.future">Future</a></span></dt></dl></dd></dl></dd></dl></dd><dt><span class="part"><a href="containers.html">VII. Containers</a></span></dt><dd><dl><dt><span class="chapter"><a href="bk01pt07ch16.html">16. Sequences</a></span></dt><dd><dl><dt><span class="sect1"><a href="bk01pt07ch16.html#containers.sequences.list">list</a></span></dt><dd><dl><dt><span class="sect2"><a href="bk01pt07ch16.html#sequences.list.size">list::size() is O(n)</a></span></dt></dl></dd><dt><span class="sect1"><a href="bk01pt07ch16s02.html">vector</a></span></dt><dd><dl><dt><span class="sect2"><a href="bk01pt07ch16s02.html#sequences.vector.management">Space Overhead Management</a></span></dt></dl></dd></dl></dd><dt><span class="chapter"><a href="bk01pt07ch17.html">17. Associative</a></span></dt><dd><dl><dt><span class="sect1"><a href="bk01pt07ch17.html#containers.associative.insert_hints">Insertion Hints</a></span></dt><dt><span class="sect1"><a href="bk01pt07ch17s02.html">bitset</a></span></dt><dd><dl><dt><span class="sect2"><a href="bk01pt07ch17s02.html#associative.bitset.size_variable">Size Variable</a></span></dt><dt><span class="sect2"><a href="bk01pt07ch17s02.html#associative.bitset.type_string">Type String</a></span></dt></dl></dd></dl></dd><dt><span class="chapter"><a href="bk01pt07ch18.html">18. Interacting with C</a></span></dt><dd><dl><dt><span class="sect1"><a href="bk01pt07ch18.html#containers.c.vs_array">Containers vs. Arrays</a></span></dt></dl></dd></dl></dd><dt><span class="part"><a href="iterators.html">VIII. Iterators</a></span></dt><dd><dl><dt><span class="chapter"><a href="bk01pt08ch19.html">19. Predefined</a></span></dt><dd><dl><dt><span class="sect1"><a href="bk01pt08ch19.html#iterators.predefined.vs_pointers">Iterators vs. Pointers</a></span></dt><dt><span class="sect1"><a href="bk01pt08ch19s02.html">One Past the End</a></span></dt></dl></dd></dl></dd><dt><span class="part"><a href="algorithms.html">IX. Algorithms</a></span></dt><dd><dl><dt><span class="preface"><a href="bk01pt09pr02.html"></a></span></dt><dt><span class="chapter"><a href="bk01pt09ch20.html">20. Mutating</a></span></dt><dd><dl><dt><span class="sect1"><a href="bk01pt09ch20.html#algorithms.mutating.swap"><code class="function">swap</code></a></span></dt><dd><dl><dt><span class="sect2"><a href="bk01pt09ch20.html#algorithms.swap.specializations">Specializations</a></span></dt></dl></dd></dl></dd></dl></dd><dt><span class="part"><a href="numerics.html">X. Numerics</a></span></dt><dd><dl><dt><span class="chapter"><a href="bk01pt10ch21.html">21. Complex</a></span></dt><dd><dl><dt><span class="sect1"><a href="bk01pt10ch21.html#numerics.complex.processing">complex Processing</a></span></dt></dl></dd><dt><span class="chapter"><a href="bk01pt10ch22.html">22. Generalized Operations</a></span></dt><dt><span class="chapter"><a href="bk01pt10ch23.html">23. Interacting with C</a></span></dt><dd><dl><dt><span class="sect1"><a href="bk01pt10ch23.html#numerics.c.array">Numerics vs. Arrays</a></span></dt><dt><span class="sect1"><a href="bk01pt10ch23s02.html">C99</a></span></dt></dl></dd></dl></dd><dt><span class="part"><a href="io.html">XI. Input and Output</a></span></dt><dd><dl><dt><span class="chapter"><a href="bk01pt11ch24.html">24. Iostream Objects</a></span></dt><dt><span class="chapter"><a href="bk01pt11ch25.html">25. Stream Buffers</a></span></dt><dd><dl><dt><span class="sect1"><a href="bk01pt11ch25.html#io.streambuf.derived">Derived streambuf Classes</a></span></dt><dt><span class="sect1"><a href="bk01pt11ch25s02.html">Buffering</a></span></dt></dl></dd><dt><span class="chapter"><a href="bk01pt11ch26.html">26. Memory Based Streams</a></span></dt><dd><dl><dt><span class="sect1"><a href="bk01pt11ch26.html#manual.io.memstreams.compat">Compatibility With strstream</a></span></dt></dl></dd><dt><span class="chapter"><a href="bk01pt11ch27.html">27. File Based Streams</a></span></dt><dd><dl><dt><span class="sect1"><a href="bk01pt11ch27.html#manual.io.filestreams.copying_a_file">Copying a File</a></span></dt><dt><span class="sect1"><a href="bk01pt11ch27s02.html">Binary Input and Output</a></span></dt><dt><span class="sect1"><a href="bk01pt11ch27s03.html">More Binary Input and Output</a></span></dt></dl></dd><dt><span class="chapter"><a href="bk01pt11ch28.html">28. Interacting with C</a></span></dt><dd><dl><dt><span class="sect1"><a href="bk01pt11ch28.html#manual.io.c.FILE">Using FILE* and file descriptors</a></span></dt><dt><span class="sect1"><a href="bk01pt11ch28s02.html">Performance</a></span></dt></dl></dd></dl></dd><dt><span class="part"><a href="extensions.html">XII. Extensions</a></span></dt><dd><dl><dt><span class="preface"><a href="bk01pt12pr03.html"></a></span></dt><dt><span class="chapter"><a href="bk01pt12ch29.html">29. Compile Time Checks</a></span></dt><dt><span class="chapter"><a href="debug_mode.html">30. Debug Mode</a></span></dt><dd><dl><dt><span class="sect1"><a href="debug_mode.html#manual.ext.debug_mode.intro">Intro</a></span></dt><dt><span class="sect1"><a href="bk01pt12ch30s02.html">Semantics</a></span></dt><dt><span class="sect1"><a href="bk01pt12ch30s03.html">Using</a></span></dt><dd><dl><dt><span class="sect2"><a href="bk01pt12ch30s03.html#debug_mode.using.mode">Using the Debug Mode</a></span></dt><dt><span class="sect2"><a href="bk01pt12ch30s03.html#debug_mode.using.specific">Using a Specific Debug Container</a></span></dt></dl></dd><dt><span class="sect1"><a href="bk01pt12ch30s04.html">Design</a></span></dt><dd><dl><dt><span class="sect2"><a href="bk01pt12ch30s04.html#manual.ext.debug_mode.design.goals">Goals</a></span></dt><dt><span class="sect2"><a href="bk01pt12ch30s04.html#manual.ext.debug_mode.design.methods">Methods</a></span></dt><dt><span class="sect2"><a href="bk01pt12ch30s04.html#manual.ext.debug_mode.design.other">Other Implementations</a></span></dt></dl></dd></dl></dd><dt><span class="chapter"><a href="parallel_mode.html">31. Parallel Mode</a></span></dt><dd><dl><dt><span class="sect1"><a href="parallel_mode.html#manual.ext.parallel_mode.intro">Intro</a></span></dt><dt><span class="sect1"><a href="bk01pt12ch31s02.html">Semantics</a></span></dt><dt><span class="sect1"><a href="bk01pt12ch31s03.html">Using</a></span></dt><dd><dl><dt><span class="sect2"><a href="bk01pt12ch31s03.html#parallel_mode.using.parallel_mode">Using Parallel Mode</a></span></dt><dt><span class="sect2"><a href="bk01pt12ch31s03.html#manual.ext.parallel_mode.usings">Using Specific Parallel Components</a></span></dt></dl></dd><dt><span class="sect1"><a href="bk01pt12ch31s04.html">Design</a></span></dt><dd><dl><dt><span class="sect2"><a href="bk01pt12ch31s04.html#manual.ext.parallel_mode.design.intro">Interface Basics</a></span></dt><dt><span class="sect2"><a href="bk01pt12ch31s04.html#manual.ext.parallel_mode.design.tuning">Configuration and Tuning</a></span></dt><dt><span class="sect2"><a href="bk01pt12ch31s04.html#manual.ext.parallel_mode.design.impl">Implementation Namespaces</a></span></dt></dl></dd><dt><span class="sect1"><a href="bk01pt12ch31s05.html">Testing</a></span></dt><dt><span class="bibliography"><a href="parallel_mode.html#parallel_mode.biblio">Bibliography</a></span></dt></dl></dd><dt><span class="chapter"><a href="bk01pt12ch32.html">32. Allocators</a></span></dt><dd><dl><dt><span class="sect1"><a href="bk01pt12ch32.html#manual.ext.allocator.mt">mt_allocator</a></span></dt><dd><dl><dt><span class="sect2"><a href="bk01pt12ch32.html#allocator.mt.intro">Intro</a></span></dt><dt><span class="sect2"><a href="bk01pt12ch32.html#allocator.mt.design_issues">Design Issues</a></span></dt><dt><span class="sect2"><a href="bk01pt12ch32.html#allocator.mt.impl">Implementation</a></span></dt><dt><span class="sect2"><a href="bk01pt12ch32.html#allocator.mt.example_single">Single Thread Example</a></span></dt><dt><span class="sect2"><a href="bk01pt12ch32.html#allocator.mt.example_multi">Multiple Thread Example</a></span></dt></dl></dd><dt><span class="sect1"><a href="bitmap_allocator.html">bitmap_allocator</a></span></dt><dd><dl><dt><span class="sect2"><a href="bitmap_allocator.html#allocator.bitmap.design">Design</a></span></dt><dt><span class="sect2"><a href="bitmap_allocator.html#allocator.bitmap.impl">Implementation</a></span></dt></dl></dd></dl></dd><dt><span class="chapter"><a href="bk01pt12ch33.html">33. Containers</a></span></dt><dd><dl><dt><span class="sect1"><a href="bk01pt12ch33.html#manual.ext.containers.pbds">Policy Based Data Structures</a></span></dt><dt><span class="sect1"><a href="bk01pt12ch33s02.html">HP/SGI</a></span></dt><dt><span class="sect1"><a href="bk01pt12ch33s03.html">Deprecated HP/SGI</a></span></dt></dl></dd><dt><span class="chapter"><a href="bk01pt12ch34.html">34. Utilities</a></span></dt><dt><span class="chapter"><a href="bk01pt12ch35.html">35. Algorithms</a></span></dt><dt><span class="chapter"><a href="bk01pt12ch36.html">36. Numerics</a></span></dt><dt><span class="chapter"><a href="bk01pt12ch37.html">37. Iterators</a></span></dt><dt><span class="chapter"><a href="bk01pt12ch38.html">38. Input and Output</a></span></dt><dd><dl><dt><span class="sect1"><a href="bk01pt12ch38.html#manual.ext.io.filebuf_derived">Derived filebufs</a></span></dt></dl></dd><dt><span class="chapter"><a href="bk01pt12ch39.html">39. Demangling</a></span></dt><dt><span class="chapter"><a href="concurrency.html">40. Concurrency</a></span></dt><dd><dl><dt><span class="sect1"><a href="concurrency.html#manual.ext.concurrency.design">Design</a></span></dt><dd><dl><dt><span class="sect2"><a href="concurrency.html#manual.ext.concurrency.design.threads">Interface to Locks and Mutexes</a></span></dt><dt><span class="sect2"><a href="concurrency.html#manual.ext.concurrency.design.atomics">Interface to Atomic Functions</a></span></dt></dl></dd><dt><span class="sect1"><a href="bk01pt12ch40s02.html">Implementation</a></span></dt><dd><dl><dt><span class="sect2"><a href="bk01pt12ch40s02.html#manual.ext.concurrency.impl.atomic_fallbacks">Using Builtin Atomic Functions</a></span></dt><dt><span class="sect2"><a href="bk01pt12ch40s02.html#manual.ext.concurrency.impl.thread">Thread Abstraction</a></span></dt></dl></dd><dt><span class="sect1"><a href="bk01pt12ch40s03.html">Use</a></span></dt></dl></dd></dl></dd><dt><span class="appendix"><a href="appendix_contributing.html">A. Contributing</a></span></dt><dd><dl><dt><span class="sect1"><a href="appendix_contributing.html#contrib.list">Contributor Checklist</a></span></dt><dd><dl><dt><span class="sect2"><a href="appendix_contributing.html#list.reading">Reading</a></span></dt><dt><span class="sect2"><a href="appendix_contributing.html#list.copyright">Assignment</a></span></dt><dt><span class="sect2"><a href="appendix_contributing.html#list.getting">Getting Sources</a></span></dt><dt><span class="sect2"><a href="appendix_contributing.html#list.patches">Submitting Patches</a></span></dt></dl></dd><dt><span class="sect1"><a href="bk01apas02.html">Directory Layout and Source Conventions</a></span></dt><dt><span class="sect1"><a href="bk01apas03.html">Coding Style</a></span></dt><dd><dl><dt><span class="sect2"><a href="bk01apas03.html#coding_style.bad_identifiers">Bad Identifiers</a></span></dt><dt><span class="sect2"><a href="bk01apas03.html#coding_style.example">By Example</a></span></dt></dl></dd><dt><span class="sect1"><a href="bk01apas04.html">Documentation Style</a></span></dt><dd><dl><dt><span class="sect2"><a href="bk01apas04.html#doc_style.doxygen">Doxygen</a></span></dt><dt><span class="sect2"><a href="bk01apas04.html#doc_style.docbook">Docbook</a></span></dt></dl></dd><dt><span class="sect1"><a href="bk01apas05.html">Design Notes</a></span></dt></dl></dd><dt><span class="appendix"><a href="appendix_porting.html">B. Porting and Maintenance</a></span></dt><dd><dl><dt><span class="sect1"><a href="appendix_porting.html#appendix.porting.build_hacking">Configure and Build Hacking</a></span></dt><dd><dl><dt><span class="sect2"><a href="appendix_porting.html#build_hacking.prereq">Prerequisites</a></span></dt><dt><span class="sect2"><a href="appendix_porting.html#build_hacking.map">Overview: What Comes from Where</a></span></dt><dt><span class="sect2"><a href="appendix_porting.html#build_hacking.scripts">Storing Information in non-AC files (like configure.host)</a></span></dt><dt><span class="sect2"><a href="appendix_porting.html#build_hacking.conventions">Coding and Commenting Conventions</a></span></dt><dt><span class="sect2"><a href="appendix_porting.html#build_hacking.acinclude">The acinclude.m4 layout</a></span></dt><dt><span class="sect2"><a href="appendix_porting.html#build_hacking.enable"><code class="constant">GLIBCXX_ENABLE</code>, the <code class="literal">--enable</code> maker</a></span></dt></dl></dd><dt><span class="sect1"><a href="internals.html">Porting to New Hardware or Operating Systems</a></span></dt><dd><dl><dt><span class="sect2"><a href="internals.html#internals.os">Operating System</a></span></dt><dt><span class="sect2"><a href="internals.html#internals.cpu">CPU</a></span></dt><dt><span class="sect2"><a href="internals.html#internals.char_types">Character Types</a></span></dt><dt><span class="sect2"><a href="internals.html#internals.thread_safety">Thread Safety</a></span></dt><dt><span class="sect2"><a href="internals.html#internals.numeric_limits">Numeric Limits</a></span></dt><dt><span class="sect2"><a href="internals.html#internals.libtool">Libtool</a></span></dt></dl></dd><dt><span class="sect1"><a href="abi.html">ABI Policy and Guidelines</a></span></dt><dd><dl><dt><span class="sect2"><a href="abi.html#abi.cxx_interface">The C++ Interface</a></span></dt><dt><span class="sect2"><a href="abi.html#abi.versioning">Versioning</a></span></dt><dt><span class="sect2"><a href="abi.html#abi.changes_allowed">Allowed Changes</a></span></dt><dt><span class="sect2"><a href="abi.html#abi.changes_no">Prohibited Changes</a></span></dt><dt><span class="sect2"><a href="abi.html#abi.impl">Implementation</a></span></dt><dt><span class="sect2"><a href="abi.html#abi.testing">Testing</a></span></dt><dt><span class="sect2"><a href="abi.html#abi.issues">Outstanding Issues</a></span></dt></dl></dd><dt><span class="sect1"><a href="api.html">API Evolution and Deprecation History</a></span></dt><dd><dl><dt><span class="sect2"><a href="api.html#api.rel_300"><code class="constant">3.0</code></a></span></dt><dt><span class="sect2"><a href="api.html#api.rel_310"><code class="constant">3.1</code></a></span></dt><dt><span class="sect2"><a href="api.html#api.rel_320"><code class="constant">3.2</code></a></span></dt><dt><span class="sect2"><a href="api.html#api.rel_330"><code class="constant">3.3</code></a></span></dt><dt><span class="sect2"><a href="api.html#api.rel_340"><code class="constant">3.4</code></a></span></dt><dt><span class="sect2"><a href="api.html#api.rel_400"><code class="constant">4.0</code></a></span></dt><dt><span class="sect2"><a href="api.html#api.rel_410"><code class="constant">4.1</code></a></span></dt><dt><span class="sect2"><a href="api.html#api.rel_420"><code class="constant">4.2</code></a></span></dt><dt><span class="sect2"><a href="api.html#api.rel_430"><code class="constant">4.3</code></a></span></dt></dl></dd><dt><span class="sect1"><a href="backwards.html">Backwards Compatibility</a></span></dt><dd><dl><dt><span class="sect2"><a href="backwards.html#backwards.first">First</a></span></dt><dt><span class="sect2"><a href="backwards.html#backwards.second">Second</a></span></dt><dt><span class="sect2"><a href="backwards.html#backwards.third">Third</a></span></dt></dl></dd></dl></dd><dt><span class="appendix"><a href="appendix_free.html">C. Free Software Needs Free Documentation</a></span></dt><dt><span class="appendix"><a href="bk01apd.html">D. GNU General Public License</a></span></dt><dd><dl><dt><span class="section"><a href="bk01apd.html#gpl-1">Preamble</a></span></dt><dt><span class="section"><a href="bk01apds02.html">TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION</a></span></dt><dd><dl><dt><span class="section"><a href="bk01apds02.html#gpl-2-0">Section 0</a></span></dt><dt><span class="section"><a href="bk01apds02.html#gpl-2-1">Section 1</a></span></dt><dt><span class="section"><a href="bk01apds02.html#gpl-2-2">Section 2</a></span></dt><dt><span class="section"><a href="bk01apds02.html#gpl-2-3">Section 3</a></span></dt><dt><span class="section"><a href="bk01apds02.html#gpl-2-4">Section 4</a></span></dt><dt><span class="section"><a href="bk01apds02.html#gpl-2-5">Section 5</a></span></dt><dt><span class="section"><a href="bk01apds02.html#gpl-2-6">Section 6</a></span></dt><dt><span class="section"><a href="bk01apds02.html#gpl-2-7">Section 7</a></span></dt><dt><span class="section"><a href="bk01apds02.html#gpl-2-8">Section 8</a></span></dt><dt><span class="section"><a href="bk01apds02.html#gpl-2-9">Section 9</a></span></dt><dt><span class="section"><a href="bk01apds02.html#gpl-2-10">Section 10</a></span></dt><dt><span class="section"><a href="bk01apds02.html#gpl-2-11">NO WARRANTY Section 11</a></span></dt><dt><span class="section"><a href="bk01apds02.html#gpl-2-12">Section 12</a></span></dt></dl></dd><dt><span class="section"><a href="bk01apds03.html">How to Apply These Terms to Your New Programs</a></span></dt></dl></dd><dt><span class="appendix"><a href="bk01ape.html">E. GNU Free Documentation License</a></span></dt></dl></div><div class="list-of-tables"><p><b>List of Tables</b></p><dl><dt>1.1. <a href="bk01pt01ch01.html#id405938">C++ TR1 Implementation Status</a></dt><dt>1.2. <a href="bk01pt01ch01.html#id428196">C++ 200x Implementation Status</a></dt><dt>3.1. <a href="bk01pt01ch03s02.html#id424211">C++ 1998 Library Headers</a></dt><dt>3.2. <a href="bk01pt01ch03s02.html#id410652">C++ 1998 Library Headers for C Library Facilities</a></dt><dt>3.3. <a href="bk01pt01ch03s02.html#id411001">C++ 200x Library Headers</a></dt><dt>3.4. <a href="bk01pt01ch03s02.html#id456739">C++ 200x Library Headers for C Library Facilities</a></dt><dt>3.5. <a href="bk01pt01ch03s02.html#id420313">C++ TR1 Library Headers</a></dt><dt>3.6. <a href="bk01pt01ch03s02.html#id362939">C++ TR1 Library Headers for C Library Facilities</a></dt><dt>3.7. <a href="bk01pt01ch03s02.html#id429435">C++ ABI Headers</a></dt><dt>3.8. <a href="bk01pt01ch03s02.html#id490019">Extension Headers</a></dt><dt>3.9. <a href="bk01pt01ch03s02.html#id421980">Extension Debug Headers</a></dt><dt>3.10. <a href="bk01pt01ch03s02.html#id362228">Extension Parallel Headers</a></dt><dt>30.1. <a href="bk01pt12ch30s03.html#id391620">Debugging Containers</a></dt><dt>30.2. <a href="bk01pt12ch30s03.html#id417569">Debugging Containers C++0x</a></dt><dt>31.1. <a href="bk01pt12ch31s03.html#id407416">Parallel Algorithms</a></dt><dt>32.1. <a href="bitmap_allocator.html#id362834">Bitmap Allocator Memory Map</a></dt><dt>B.1. <a href="api.html#id521812">Extension Allocators</a></dt><dt>B.2. <a href="api.html#id422487">Extension Allocators Continued</a></dt></dl></div></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="../spine.html">Prev</a> </td><td width="20%" align="center"> </td><td width="40%" align="right"> <a accesskey="n" href="intro.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">The GNU C++ Library Documentation </td><td width="20%" align="center"><a accesskey="h" href="../spine.html">Home</a></td><td width="40%" align="right" valign="top"> Part I. Introduction</td></tr></table></div></body></html> diff --git a/libstdc++-v3/doc/html/manual/strings.html b/libstdc++-v3/doc/html/manual/strings.html index 99d8cbed0e3..0b0617fdd79 100644 --- a/libstdc++-v3/doc/html/manual/strings.html +++ b/libstdc++-v3/doc/html/manual/strings.html @@ -1,3 +1,3 @@ <?xml version="1.0" encoding="UTF-8" standalone="no"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> -<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Part V. Strings</title><meta name="generator" content="DocBook XSL Stylesheets V1.73.2" /><meta name="keywords" content=" ISO C++ , library " /><link rel="start" href="../spine.html" title="The GNU C++ Library Documentation" /><link rel="up" href="spine.html" title="The GNU C++ Library" /><link rel="prev" href="shared_ptr.html" title="shared_ptr" /><link rel="next" href="bk01pt05ch13.html" title="Chapter 13. String Classes" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Part V. Strings</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="shared_ptr.html">Prev</a> </td><th width="60%" align="center">The GNU C++ Library</th><td width="20%" align="right"> <a accesskey="n" href="bk01pt05ch13.html">Next</a></td></tr></table><hr /></div><div class="part" lang="en" xml:lang="en"><div class="titlepage"><div><div><h1 class="title"><a id="manual.strings"></a>Part V. Strings</h1></div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="chapter"><a href="bk01pt05ch13.html">13. String Classes</a></span></dt><dd><dl><dt><span class="sect1"><a href="bk01pt05ch13.html#strings.string.simple">Simple Transformations</a></span></dt><dt><span class="sect1"><a href="bk01pt05ch13s02.html">Case Sensivitity</a></span></dt><dt><span class="sect1"><a href="bk01pt05ch13s03.html">Arbitrary Character Types</a></span></dt><dt><span class="sect1"><a href="bk01pt05ch13s04.html">Tokenizing</a></span></dt><dt><span class="sect1"><a href="bk01pt05ch13s05.html">Shrink to Fit</a></span></dt><dt><span class="sect1"><a href="bk01pt05ch13s06.html">CString (MFC)</a></span></dt></dl></dd></dl></div></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="shared_ptr.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="spine.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="bk01pt05ch13.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">shared_ptr </td><td width="20%" align="center"><a accesskey="h" href="../spine.html">Home</a></td><td width="40%" align="right" valign="top"> Chapter 13. String Classes</td></tr></table></div></body></html> +<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Part V. Strings</title><meta name="generator" content="DocBook XSL Stylesheets V1.73.2" /><meta name="keywords" content=" ISO C++ , library " /><link rel="start" href="../spine.html" title="The GNU C++ Library Documentation" /><link rel="up" href="spine.html" title="The GNU C++ Library" /><link rel="prev" href="shared_ptr.html" title="shared_ptr" /><link rel="next" href="bk01pt05ch13.html" title="Chapter 13. String Classes" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Part V. Strings</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="shared_ptr.html">Prev</a> </td><th width="60%" align="center">The GNU C++ Library</th><td width="20%" align="right"> <a accesskey="n" href="bk01pt05ch13.html">Next</a></td></tr></table><hr /></div><div class="part" lang="en" xml:lang="en"><div class="titlepage"><div><div><h1 class="title"><a id="manual.strings"></a>Part V. Strings</h1></div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="chapter"><a href="bk01pt05ch13.html">13. String Classes</a></span></dt><dd><dl><dt><span class="sect1"><a href="bk01pt05ch13.html#strings.string.simple">Simple Transformations</a></span></dt><dt><span class="sect1"><a href="bk01pt05ch13s02.html">Case Sensitivity</a></span></dt><dt><span class="sect1"><a href="bk01pt05ch13s03.html">Arbitrary Character Types</a></span></dt><dt><span class="sect1"><a href="bk01pt05ch13s04.html">Tokenizing</a></span></dt><dt><span class="sect1"><a href="bk01pt05ch13s05.html">Shrink to Fit</a></span></dt><dt><span class="sect1"><a href="bk01pt05ch13s06.html">CString (MFC)</a></span></dt></dl></dd></dl></div></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="shared_ptr.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="spine.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="bk01pt05ch13.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">shared_ptr </td><td width="20%" align="center"><a accesskey="h" href="../spine.html">Home</a></td><td width="40%" align="right" valign="top"> Chapter 13. String Classes</td></tr></table></div></body></html> diff --git a/libstdc++-v3/doc/html/manual/test.html b/libstdc++-v3/doc/html/manual/test.html index 6e3e3718f1b..140e0631ffc 100644 --- a/libstdc++-v3/doc/html/manual/test.html +++ b/libstdc++-v3/doc/html/manual/test.html @@ -293,7 +293,7 @@ runtest --tool libstdc++ --srcdir=/path/to/gcc/libstdc++-v3/testsuite <span class="emphasis"><em>testsuite_thread</em></span> </p><p> This file indicates that the host system can run tests which - incolved multiple threads. + involved multiple threads. </p></li><li><p> <span class="emphasis"><em>testsuite_wchar_t</em></span> </p><p> @@ -324,7 +324,7 @@ runtest --tool libstdc++ --srcdir=/path/to/gcc/libstdc++-v3/testsuite flux. </p><p> We are interested in any strange failures of the testsuite; - please email the main libstdc++ mainling list if you see + please email the main libstdc++ mailing list if you see something odd or have questions. </p></div><div class="sect3" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="test.run.permutations"></a>Test Permutations</h4></div></div></div><p> To run the libstdc++ test suite under the <a class="link" href="debug_mode.html" title="Chapter 30. Debug Mode">debug mode</a>, edit diff --git a/libstdc++-v3/doc/html/spine.html b/libstdc++-v3/doc/html/spine.html index 12840aaa909..e6812dab59e 100644 --- a/libstdc++-v3/doc/html/spine.html +++ b/libstdc++-v3/doc/html/spine.html @@ -2,4 +2,4 @@ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>The GNU C++ Library Documentation</title><meta name="generator" content="DocBook XSL Stylesheets V1.73.2" /><link rel="start" href="spine.html" title="The GNU C++ Library Documentation" /><link rel="next" href="manual/spine.html" title="The GNU C++ Library" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">The GNU C++ Library Documentation</th></tr><tr><td width="20%" align="left"> </td><th width="60%" align="center"> </th><td width="20%" align="right"> <a accesskey="n" href="manual/spine.html">Next</a></td></tr></table><hr /></div><div class="set" lang="en" xml:lang="en"><div class="titlepage"><div><div><h1 class="title"><a id="set-index"></a>The GNU C++ Library Documentation</h1></div><div><div class="authorgroup"><div class="author"><h3 class="author"><span class="firstname">Paolo</span> <span class="surname">Carlini</span></h3></div><div class="author"><h3 class="author"><span class="firstname">Phil</span> <span class="surname">Edwards</span></h3></div><div class="author"><h3 class="author"><span class="firstname">Doug</span> <span class="surname">Gregor</span></h3></div><div class="author"><h3 class="author"><span class="firstname">Benjamin</span> <span class="surname">Kosnik</span></h3></div><div class="author"><h3 class="author"><span class="firstname">Dhruv</span> <span class="surname">Matani</span></h3></div><div class="author"><h3 class="author"><span class="firstname">Jason</span> <span class="surname">Merrill</span></h3></div><div class="author"><h3 class="author"><span class="firstname">Mark</span> <span class="surname">Mitchell</span></h3></div><div class="author"><h3 class="author"><span class="firstname">Nathan</span> <span class="surname">Myers</span></h3></div><div class="author"><h3 class="author"><span class="firstname">Felix</span> <span class="surname">Natter</span></h3></div><div class="author"><h3 class="author"><span class="firstname">Stefan</span> <span class="surname">Olsson</span></h3></div><div class="author"><h3 class="author"><span class="firstname">Johannes</span> <span class="surname">Singler</span></h3></div><div class="author"><h3 class="author"><span class="firstname">Ami</span> <span class="surname">Tavory</span></h3></div><div class="author"><h3 class="author"><span class="firstname">Jonathan</span> <span class="surname">Wakely</span></h3></div></div></div><div><p class="copyright">Copyright © 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 <a class="ulink" href="http://fsf.org" target="_top">FSF</a> - </p></div></div><hr /></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="book"><a href="manual/spine.html">The GNU C++ Library</a></span></dt><dd><dl><dt><span class="part"><a href="manual/intro.html">I. Introduction</a></span></dt><dd><dl><dt><span class="chapter"><a href="manual/bk01pt01ch01.html">1. Status</a></span></dt><dd><dl><dt><span class="sect1"><a href="manual/bk01pt01ch01.html#manual.intro.status.standard">Implementation Status</a></span></dt><dd><dl><dt><span class="sect2"><a href="manual/bk01pt01ch01.html#manual.intro.status.standard.1998">C++ 1998</a></span></dt><dt><span class="sect2"><a href="manual/bk01pt01ch01.html#manual.intro.status.standard.tr1">C++ TR1</a></span></dt><dt><span class="sect2"><a href="manual/bk01pt01ch01.html#manual.intro.status.standard.200x">C++ 200x</a></span></dt></dl></dd><dt><span class="sect1"><a href="manual/bk01pt01ch01s02.html">License</a></span></dt><dd><dl><dt><span class="sect2"><a href="manual/bk01pt01ch01s02.html#manual.intro.status.license.gpl">The Code: GPL</a></span></dt><dt><span class="sect2"><a href="manual/bk01pt01ch01s02.html#manual.intro.status.license.fdl">The Documentation: GPL, FDL</a></span></dt></dl></dd><dt><span class="sect1"><a href="manual/bk01pt01ch01s03.html">Bugs</a></span></dt><dd><dl><dt><span class="sect2"><a href="manual/bk01pt01ch01s03.html#manual.intro.status.bugs.impl">Implementation Bugs</a></span></dt><dt><span class="sect2"><a href="manual/bk01pt01ch01s03.html#manual.intro.status.bugs.iso">Standard Bugs</a></span></dt></dl></dd></dl></dd><dt><span class="chapter"><a href="manual/bk01pt01ch02.html">2. Setup</a></span></dt><dd><dl><dt><span class="sect1"><a href="manual/bk01pt01ch02.html#manual.intro.setup.configure">Configure</a></span></dt><dt><span class="sect1"><a href="manual/build.html">Build</a></span></dt><dd><dl><dt><span class="sect2"><a href="manual/build.html#build.prereq">Prerequisites</a></span></dt><dt><span class="sect2"><a href="manual/build.html#build.configure">Make</a></span></dt></dl></dd><dt><span class="sect1"><a href="manual/test.html">Test</a></span></dt><dd><dl><dt><span class="sect2"><a href="manual/test.html#test.organization">Organization</a></span></dt><dt><span class="sect2"><a href="manual/test.html#test.naming">Naming Conventions</a></span></dt><dt><span class="sect2"><a href="manual/test.html#test.utils">Utilities</a></span></dt><dt><span class="sect2"><a href="manual/test.html#test.run">Running the Testsuite</a></span></dt><dt><span class="sect2"><a href="manual/test.html#test.new_tests">New Test Cases</a></span></dt><dt><span class="sect2"><a href="manual/test.html#test.dejagnu">Test Harness Details</a></span></dt><dt><span class="sect2"><a href="manual/test.html#test.future">Future</a></span></dt></dl></dd></dl></dd><dt><span class="chapter"><a href="manual/using.html">3. Using</a></span></dt><dd><dl><dt><span class="sect1"><a href="manual/using.html#manual.intro.using.lib">Linking Library Binary Files</a></span></dt><dt><span class="sect1"><a href="manual/bk01pt01ch03s02.html">Headers</a></span></dt><dd><dl><dt><span class="sect2"><a href="manual/bk01pt01ch03s02.html#manual.intro.using.headers.all">Header Files</a></span></dt><dt><span class="sect2"><a href="manual/bk01pt01ch03s02.html#manual.intro.using.headers.mixing">Mixing Headers</a></span></dt><dt><span class="sect2"><a href="manual/bk01pt01ch03s02.html#manual.intro.using.headers.cheaders">The C Headers and <code class="code">namespace std</code></a></span></dt><dt><span class="sect2"><a href="manual/bk01pt01ch03s02.html#manual.intro.using.headers.pre">Precompiled Headers</a></span></dt></dl></dd><dt><span class="sect1"><a href="manual/bk01pt01ch03s03.html">Namespaces</a></span></dt><dd><dl><dt><span class="sect2"><a href="manual/bk01pt01ch03s03.html#manual.intro.using.namespaces.all">Available Namespaces</a></span></dt><dt><span class="sect2"><a href="manual/bk01pt01ch03s03.html#manual.intro.using.namespaces.std">namespace std</a></span></dt><dt><span class="sect2"><a href="manual/bk01pt01ch03s03.html#manual.intro.using.namespaces.comp">Using Namespace Composition</a></span></dt></dl></dd><dt><span class="sect1"><a href="manual/bk01pt01ch03s04.html">Macros</a></span></dt><dt><span class="sect1"><a href="manual/bk01pt01ch03s05.html">Concurrency</a></span></dt><dd><dl><dt><span class="sect2"><a href="manual/bk01pt01ch03s05.html#manual.intro.using.concurrency.prereq">Prerequisites</a></span></dt><dt><span class="sect2"><a href="manual/bk01pt01ch03s05.html#manual.intro.using.concurrency.thread_safety">Thread Safety</a></span></dt><dt><span class="sect2"><a href="manual/bk01pt01ch03s05.html#manual.intro.using.concurrency.atomics">Atomics</a></span></dt><dt><span class="sect2"><a href="manual/bk01pt01ch03s05.html#manual.intro.using.concurrency.io">IO</a></span></dt><dt><span class="sect2"><a href="manual/bk01pt01ch03s05.html#manual.intro.using.concurrency.containers">Containers</a></span></dt></dl></dd><dt><span class="sect1"><a href="manual/bk01pt01ch03s06.html">Exception Safety</a></span></dt><dt><span class="sect1"><a href="manual/debug.html">Debugging Support</a></span></dt><dd><dl><dt><span class="sect2"><a href="manual/debug.html#debug.compiler">Using <span class="command"><strong>g++</strong></span></a></span></dt><dt><span class="sect2"><a href="manual/debug.html#debug.req">Debug Versions of Library Binary Files</a></span></dt><dt><span class="sect2"><a href="manual/debug.html#debug.memory">Memory Leak Hunting</a></span></dt><dt><span class="sect2"><a href="manual/debug.html#debug.gdb">Using <span class="command"><strong>gdb</strong></span></a></span></dt><dt><span class="sect2"><a href="manual/debug.html#debug.exceptions">Tracking uncaught exceptions</a></span></dt><dt><span class="sect2"><a href="manual/debug.html#debug.debug_mode">Debug Mode</a></span></dt><dt><span class="sect2"><a href="manual/debug.html#debug.compile_time_checks">Compile Time Checking</a></span></dt></dl></dd></dl></dd></dl></dd><dt><span class="part"><a href="manual/support.html">II. Support</a></span></dt><dd><dl><dt><span class="preface"><a href="manual/bk01pt02pr01.html"></a></span></dt><dt><span class="chapter"><a href="manual/bk01pt02ch04.html">4. Types</a></span></dt><dd><dl><dt><span class="sect1"><a href="manual/bk01pt02ch04.html#manual.support.types.fundamental">Fundamental Types</a></span></dt><dt><span class="sect1"><a href="manual/bk01pt02ch04s02.html">Numeric Properties</a></span></dt><dt><span class="sect1"><a href="manual/bk01pt02ch04s03.html">NULL</a></span></dt></dl></dd><dt><span class="chapter"><a href="manual/bk01pt02ch05.html">5. Dynamic Memory</a></span></dt><dt><span class="chapter"><a href="manual/bk01pt02ch06.html">6. Termination</a></span></dt><dd><dl><dt><span class="sect1"><a href="manual/bk01pt02ch06.html#support.termination.handlers">Termination Handlers</a></span></dt><dt><span class="sect1"><a href="manual/bk01pt02ch06s02.html">Verbose Terminate Handler</a></span></dt></dl></dd></dl></dd><dt><span class="part"><a href="manual/diagnostics.html">III. Diagnostics</a></span></dt><dd><dl><dt><span class="chapter"><a href="manual/bk01pt03ch07.html">7. Exceptions</a></span></dt><dd><dl><dt><span class="sect1"><a href="manual/bk01pt03ch07.html#manual.diagnostics.exceptions.hierarchy">Exception Classes</a></span></dt><dt><span class="sect1"><a href="manual/bk01pt03ch07s02.html">Adding Data to Exceptions</a></span></dt><dt><span class="sect1"><a href="manual/bk01pt03ch07s03.html">Cancellation</a></span></dt></dl></dd><dt><span class="chapter"><a href="manual/bk01pt03ch08.html">8. Concept Checking</a></span></dt></dl></dd><dt><span class="part"><a href="manual/utilities.html">IV. Utilities</a></span></dt><dd><dl><dt><span class="chapter"><a href="manual/bk01pt04ch09.html">9. Functors</a></span></dt><dt><span class="chapter"><a href="manual/bk01pt04ch10.html">10. Pairs</a></span></dt><dt><span class="chapter"><a href="manual/bk01pt04ch11.html">11. Memory</a></span></dt><dd><dl><dt><span class="sect1"><a href="manual/bk01pt04ch11.html#manual.util.memory.allocator">Allocators</a></span></dt><dd><dl><dt><span class="sect2"><a href="manual/bk01pt04ch11.html#allocator.req">Requirements</a></span></dt><dt><span class="sect2"><a href="manual/bk01pt04ch11.html#allocator.design_issues">Design Issues</a></span></dt><dt><span class="sect2"><a href="manual/bk01pt04ch11.html#allocator.impl">Implementation</a></span></dt><dt><span class="sect2"><a href="manual/bk01pt04ch11.html#allocator.using">Using a Specific Allocator</a></span></dt><dt><span class="sect2"><a href="manual/bk01pt04ch11.html#allocator.custom">Custom Allocators</a></span></dt><dt><span class="sect2"><a href="manual/bk01pt04ch11.html#allocator.ext">Extension Allocators</a></span></dt></dl></dd><dt><span class="sect1"><a href="manual/auto_ptr.html">auto_ptr</a></span></dt><dd><dl><dt><span class="sect2"><a href="manual/auto_ptr.html#auto_ptr.limitations">Limitations</a></span></dt><dt><span class="sect2"><a href="manual/auto_ptr.html#auto_ptr.using">Use in Containers</a></span></dt></dl></dd><dt><span class="sect1"><a href="manual/shared_ptr.html">shared_ptr</a></span></dt><dd><dl><dt><span class="sect2"><a href="manual/shared_ptr.html#shared_ptr.req">Requirements</a></span></dt><dt><span class="sect2"><a href="manual/shared_ptr.html#shared_ptr.design_issues">Design Issues</a></span></dt><dt><span class="sect2"><a href="manual/shared_ptr.html#shared_ptr.impl">Implementation</a></span></dt><dt><span class="sect2"><a href="manual/shared_ptr.html#shared_ptr.using">Use</a></span></dt><dt><span class="sect2"><a href="manual/shared_ptr.html#shared_ptr.ack">Acknowledgments</a></span></dt></dl></dd></dl></dd><dt><span class="chapter"><a href="manual/bk01pt04ch12.html">12. Traits</a></span></dt></dl></dd><dt><span class="part"><a href="manual/strings.html">V. Strings</a></span></dt><dd><dl><dt><span class="chapter"><a href="manual/bk01pt05ch13.html">13. String Classes</a></span></dt><dd><dl><dt><span class="sect1"><a href="manual/bk01pt05ch13.html#strings.string.simple">Simple Transformations</a></span></dt><dt><span class="sect1"><a href="manual/bk01pt05ch13s02.html">Case Sensivitity</a></span></dt><dt><span class="sect1"><a href="manual/bk01pt05ch13s03.html">Arbitrary Character Types</a></span></dt><dt><span class="sect1"><a href="manual/bk01pt05ch13s04.html">Tokenizing</a></span></dt><dt><span class="sect1"><a href="manual/bk01pt05ch13s05.html">Shrink to Fit</a></span></dt><dt><span class="sect1"><a href="manual/bk01pt05ch13s06.html">CString (MFC)</a></span></dt></dl></dd></dl></dd><dt><span class="part"><a href="manual/localization.html">VI. Localization</a></span></dt><dd><dl><dt><span class="chapter"><a href="manual/bk01pt06ch14.html">14. Locales</a></span></dt><dd><dl><dt><span class="sect1"><a href="manual/bk01pt06ch14.html#manual.localization.locales.locale">locale</a></span></dt><dd><dl><dt><span class="sect2"><a href="manual/bk01pt06ch14.html#locales.locale.req">Requirements</a></span></dt><dt><span class="sect2"><a href="manual/bk01pt06ch14.html#locales.locale.design">Design</a></span></dt><dt><span class="sect2"><a href="manual/bk01pt06ch14.html#locales.locale.impl">Implementation</a></span></dt><dt><span class="sect2"><a href="manual/bk01pt06ch14.html#locales.locale.future">Future</a></span></dt></dl></dd></dl></dd><dt><span class="chapter"><a href="manual/bk01pt06ch15.html">15. Facets aka Categories</a></span></dt><dd><dl><dt><span class="sect1"><a href="manual/bk01pt06ch15.html#manual.localization.facet.ctype">ctype</a></span></dt><dd><dl><dt><span class="sect2"><a href="manual/bk01pt06ch15.html#facet.ctype.impl">Implementation</a></span></dt><dt><span class="sect2"><a href="manual/bk01pt06ch15.html#facet.ctype.future">Future</a></span></dt></dl></dd><dt><span class="sect1"><a href="manual/codecvt.html">codecvt</a></span></dt><dd><dl><dt><span class="sect2"><a href="manual/codecvt.html#facet.codecvt.req">Requirements</a></span></dt><dt><span class="sect2"><a href="manual/codecvt.html#facet.codecvt.design">Design</a></span></dt><dt><span class="sect2"><a href="manual/codecvt.html#facet.codecvt.impl">Implementation</a></span></dt><dt><span class="sect2"><a href="manual/codecvt.html#facet.codecvt.use">Use</a></span></dt><dt><span class="sect2"><a href="manual/codecvt.html#facet.codecvt.future">Future</a></span></dt></dl></dd><dt><span class="sect1"><a href="manual/messages.html">messages</a></span></dt><dd><dl><dt><span class="sect2"><a href="manual/messages.html#facet.messages.req">Requirements</a></span></dt><dt><span class="sect2"><a href="manual/messages.html#facet.messages.design">Design</a></span></dt><dt><span class="sect2"><a href="manual/messages.html#facet.messages.impl">Implementation</a></span></dt><dt><span class="sect2"><a href="manual/messages.html#facet.messages.use">Use</a></span></dt><dt><span class="sect2"><a href="manual/messages.html#facet.messages.future">Future</a></span></dt></dl></dd></dl></dd></dl></dd><dt><span class="part"><a href="manual/containers.html">VII. Containers</a></span></dt><dd><dl><dt><span class="chapter"><a href="manual/bk01pt07ch16.html">16. Sequences</a></span></dt><dd><dl><dt><span class="sect1"><a href="manual/bk01pt07ch16.html#containers.sequences.list">list</a></span></dt><dd><dl><dt><span class="sect2"><a href="manual/bk01pt07ch16.html#sequences.list.size">list::size() is O(n)</a></span></dt></dl></dd><dt><span class="sect1"><a href="manual/bk01pt07ch16s02.html">vector</a></span></dt><dd><dl><dt><span class="sect2"><a href="manual/bk01pt07ch16s02.html#sequences.vector.management">Space Overhead Management</a></span></dt></dl></dd></dl></dd><dt><span class="chapter"><a href="manual/bk01pt07ch17.html">17. Associative</a></span></dt><dd><dl><dt><span class="sect1"><a href="manual/bk01pt07ch17.html#containers.associative.insert_hints">Insertion Hints</a></span></dt><dt><span class="sect1"><a href="manual/bk01pt07ch17s02.html">bitset</a></span></dt><dd><dl><dt><span class="sect2"><a href="manual/bk01pt07ch17s02.html#associative.bitset.size_variable">Size Variable</a></span></dt><dt><span class="sect2"><a href="manual/bk01pt07ch17s02.html#associative.bitset.type_string">Type String</a></span></dt></dl></dd></dl></dd><dt><span class="chapter"><a href="manual/bk01pt07ch18.html">18. Interacting with C</a></span></dt><dd><dl><dt><span class="sect1"><a href="manual/bk01pt07ch18.html#containers.c.vs_array">Containers vs. Arrays</a></span></dt></dl></dd></dl></dd><dt><span class="part"><a href="manual/iterators.html">VIII. Iterators</a></span></dt><dd><dl><dt><span class="chapter"><a href="manual/bk01pt08ch19.html">19. Predefined</a></span></dt><dd><dl><dt><span class="sect1"><a href="manual/bk01pt08ch19.html#iterators.predefined.vs_pointers">Iterators vs. Pointers</a></span></dt><dt><span class="sect1"><a href="manual/bk01pt08ch19s02.html">One Past the End</a></span></dt></dl></dd></dl></dd><dt><span class="part"><a href="manual/algorithms.html">IX. Algorithms</a></span></dt><dd><dl><dt><span class="preface"><a href="manual/bk01pt09pr02.html"></a></span></dt><dt><span class="chapter"><a href="manual/bk01pt09ch20.html">20. Mutating</a></span></dt><dd><dl><dt><span class="sect1"><a href="manual/bk01pt09ch20.html#algorithms.mutating.swap"><code class="function">swap</code></a></span></dt><dd><dl><dt><span class="sect2"><a href="manual/bk01pt09ch20.html#algorithms.swap.specializations">Specializations</a></span></dt></dl></dd></dl></dd></dl></dd><dt><span class="part"><a href="manual/numerics.html">X. Numerics</a></span></dt><dd><dl><dt><span class="chapter"><a href="manual/bk01pt10ch21.html">21. Complex</a></span></dt><dd><dl><dt><span class="sect1"><a href="manual/bk01pt10ch21.html#numerics.complex.processing">complex Processing</a></span></dt></dl></dd><dt><span class="chapter"><a href="manual/bk01pt10ch22.html">22. Generalized Operations</a></span></dt><dt><span class="chapter"><a href="manual/bk01pt10ch23.html">23. Interacting with C</a></span></dt><dd><dl><dt><span class="sect1"><a href="manual/bk01pt10ch23.html#numerics.c.array">Numerics vs. Arrays</a></span></dt><dt><span class="sect1"><a href="manual/bk01pt10ch23s02.html">C99</a></span></dt></dl></dd></dl></dd><dt><span class="part"><a href="manual/io.html">XI. Input and Output</a></span></dt><dd><dl><dt><span class="chapter"><a href="manual/bk01pt11ch24.html">24. Iostream Objects</a></span></dt><dt><span class="chapter"><a href="manual/bk01pt11ch25.html">25. Stream Buffers</a></span></dt><dd><dl><dt><span class="sect1"><a href="manual/bk01pt11ch25.html#io.streambuf.derived">Derived streambuf Classes</a></span></dt><dt><span class="sect1"><a href="manual/bk01pt11ch25s02.html">Buffering</a></span></dt></dl></dd><dt><span class="chapter"><a href="manual/bk01pt11ch26.html">26. Memory Based Streams</a></span></dt><dd><dl><dt><span class="sect1"><a href="manual/bk01pt11ch26.html#manual.io.memstreams.compat">Compatibility With strstream</a></span></dt></dl></dd><dt><span class="chapter"><a href="manual/bk01pt11ch27.html">27. File Based Streams</a></span></dt><dd><dl><dt><span class="sect1"><a href="manual/bk01pt11ch27.html#manual.io.filestreams.copying_a_file">Copying a File</a></span></dt><dt><span class="sect1"><a href="manual/bk01pt11ch27s02.html">Binary Input and Output</a></span></dt><dt><span class="sect1"><a href="manual/bk01pt11ch27s03.html">More Binary Input and Output</a></span></dt></dl></dd><dt><span class="chapter"><a href="manual/bk01pt11ch28.html">28. Interacting with C</a></span></dt><dd><dl><dt><span class="sect1"><a href="manual/bk01pt11ch28.html#manual.io.c.FILE">Using FILE* and file descriptors</a></span></dt><dt><span class="sect1"><a href="manual/bk01pt11ch28s02.html">Performance</a></span></dt></dl></dd></dl></dd><dt><span class="part"><a href="manual/extensions.html">XII. Extensions</a></span></dt><dd><dl><dt><span class="preface"><a href="manual/bk01pt12pr03.html"></a></span></dt><dt><span class="chapter"><a href="manual/bk01pt12ch29.html">29. Compile Time Checks</a></span></dt><dt><span class="chapter"><a href="manual/debug_mode.html">30. Debug Mode</a></span></dt><dd><dl><dt><span class="sect1"><a href="manual/debug_mode.html#manual.ext.debug_mode.intro">Intro</a></span></dt><dt><span class="sect1"><a href="manual/bk01pt12ch30s02.html">Semantics</a></span></dt><dt><span class="sect1"><a href="manual/bk01pt12ch30s03.html">Using</a></span></dt><dd><dl><dt><span class="sect2"><a href="manual/bk01pt12ch30s03.html#debug_mode.using.mode">Using the Debug Mode</a></span></dt><dt><span class="sect2"><a href="manual/bk01pt12ch30s03.html#debug_mode.using.specific">Using a Specific Debug Container</a></span></dt></dl></dd><dt><span class="sect1"><a href="manual/bk01pt12ch30s04.html">Design</a></span></dt><dd><dl><dt><span class="sect2"><a href="manual/bk01pt12ch30s04.html#manual.ext.debug_mode.design.goals">Goals</a></span></dt><dt><span class="sect2"><a href="manual/bk01pt12ch30s04.html#manual.ext.debug_mode.design.methods">Methods</a></span></dt><dt><span class="sect2"><a href="manual/bk01pt12ch30s04.html#manual.ext.debug_mode.design.other">Other Implementations</a></span></dt></dl></dd></dl></dd><dt><span class="chapter"><a href="manual/parallel_mode.html">31. Parallel Mode</a></span></dt><dd><dl><dt><span class="sect1"><a href="manual/parallel_mode.html#manual.ext.parallel_mode.intro">Intro</a></span></dt><dt><span class="sect1"><a href="manual/bk01pt12ch31s02.html">Semantics</a></span></dt><dt><span class="sect1"><a href="manual/bk01pt12ch31s03.html">Using</a></span></dt><dd><dl><dt><span class="sect2"><a href="manual/bk01pt12ch31s03.html#parallel_mode.using.parallel_mode">Using Parallel Mode</a></span></dt><dt><span class="sect2"><a href="manual/bk01pt12ch31s03.html#manual.ext.parallel_mode.usings">Using Specific Parallel Components</a></span></dt></dl></dd><dt><span class="sect1"><a href="manual/bk01pt12ch31s04.html">Design</a></span></dt><dd><dl><dt><span class="sect2"><a href="manual/bk01pt12ch31s04.html#manual.ext.parallel_mode.design.intro">Interface Basics</a></span></dt><dt><span class="sect2"><a href="manual/bk01pt12ch31s04.html#manual.ext.parallel_mode.design.tuning">Configuration and Tuning</a></span></dt><dt><span class="sect2"><a href="manual/bk01pt12ch31s04.html#manual.ext.parallel_mode.design.impl">Implementation Namespaces</a></span></dt></dl></dd><dt><span class="sect1"><a href="manual/bk01pt12ch31s05.html">Testing</a></span></dt><dt><span class="bibliography"><a href="manual/parallel_mode.html#parallel_mode.biblio">Bibliography</a></span></dt></dl></dd><dt><span class="chapter"><a href="manual/bk01pt12ch32.html">32. Allocators</a></span></dt><dd><dl><dt><span class="sect1"><a href="manual/bk01pt12ch32.html#manual.ext.allocator.mt">mt_allocator</a></span></dt><dd><dl><dt><span class="sect2"><a href="manual/bk01pt12ch32.html#allocator.mt.intro">Intro</a></span></dt><dt><span class="sect2"><a href="manual/bk01pt12ch32.html#allocator.mt.design_issues">Design Issues</a></span></dt><dt><span class="sect2"><a href="manual/bk01pt12ch32.html#allocator.mt.impl">Implementation</a></span></dt><dt><span class="sect2"><a href="manual/bk01pt12ch32.html#allocator.mt.example_single">Single Thread Example</a></span></dt><dt><span class="sect2"><a href="manual/bk01pt12ch32.html#allocator.mt.example_multi">Multiple Thread Example</a></span></dt></dl></dd><dt><span class="sect1"><a href="manual/bitmap_allocator.html">bitmap_allocator</a></span></dt><dd><dl><dt><span class="sect2"><a href="manual/bitmap_allocator.html#allocator.bitmap.design">Design</a></span></dt><dt><span class="sect2"><a href="manual/bitmap_allocator.html#allocator.bitmap.impl">Implementation</a></span></dt></dl></dd></dl></dd><dt><span class="chapter"><a href="manual/bk01pt12ch33.html">33. Containers</a></span></dt><dd><dl><dt><span class="sect1"><a href="manual/bk01pt12ch33.html#manual.ext.containers.pbds">Policy Based Data Structures</a></span></dt><dt><span class="sect1"><a href="manual/bk01pt12ch33s02.html">HP/SGI</a></span></dt><dt><span class="sect1"><a href="manual/bk01pt12ch33s03.html">Deprecated HP/SGI</a></span></dt></dl></dd><dt><span class="chapter"><a href="manual/bk01pt12ch34.html">34. Utilities</a></span></dt><dt><span class="chapter"><a href="manual/bk01pt12ch35.html">35. Algorithms</a></span></dt><dt><span class="chapter"><a href="manual/bk01pt12ch36.html">36. Numerics</a></span></dt><dt><span class="chapter"><a href="manual/bk01pt12ch37.html">37. Iterators</a></span></dt><dt><span class="chapter"><a href="manual/bk01pt12ch38.html">38. Input and Output</a></span></dt><dd><dl><dt><span class="sect1"><a href="manual/bk01pt12ch38.html#manual.ext.io.filebuf_derived">Derived filebufs</a></span></dt></dl></dd><dt><span class="chapter"><a href="manual/bk01pt12ch39.html">39. Demangling</a></span></dt><dt><span class="chapter"><a href="manual/concurrency.html">40. Concurrency</a></span></dt><dd><dl><dt><span class="sect1"><a href="manual/concurrency.html#manual.ext.concurrency.design">Design</a></span></dt><dd><dl><dt><span class="sect2"><a href="manual/concurrency.html#manual.ext.concurrency.design.threads">Interface to Locks and Mutexes</a></span></dt><dt><span class="sect2"><a href="manual/concurrency.html#manual.ext.concurrency.design.atomics">Interface to Atomic Functions</a></span></dt></dl></dd><dt><span class="sect1"><a href="manual/bk01pt12ch40s02.html">Implementation</a></span></dt><dd><dl><dt><span class="sect2"><a href="manual/bk01pt12ch40s02.html#manual.ext.concurrency.impl.atomic_fallbacks">Using Builitin Atomic Functions</a></span></dt><dt><span class="sect2"><a href="manual/bk01pt12ch40s02.html#manual.ext.concurrency.impl.thread">Thread Abstraction</a></span></dt></dl></dd><dt><span class="sect1"><a href="manual/bk01pt12ch40s03.html">Use</a></span></dt></dl></dd></dl></dd><dt><span class="appendix"><a href="manual/appendix_contributing.html">A. Contributing</a></span></dt><dd><dl><dt><span class="sect1"><a href="manual/appendix_contributing.html#contrib.list">Contributor Checklist</a></span></dt><dd><dl><dt><span class="sect2"><a href="manual/appendix_contributing.html#list.reading">Reading</a></span></dt><dt><span class="sect2"><a href="manual/appendix_contributing.html#list.copyright">Assignment</a></span></dt><dt><span class="sect2"><a href="manual/appendix_contributing.html#list.getting">Getting Sources</a></span></dt><dt><span class="sect2"><a href="manual/appendix_contributing.html#list.patches">Submitting Patches</a></span></dt></dl></dd><dt><span class="sect1"><a href="manual/bk01apas02.html">Directory Layout and Source Conventions</a></span></dt><dt><span class="sect1"><a href="manual/bk01apas03.html">Coding Style</a></span></dt><dd><dl><dt><span class="sect2"><a href="manual/bk01apas03.html#coding_style.bad_identifiers">Bad Itentifiers</a></span></dt><dt><span class="sect2"><a href="manual/bk01apas03.html#coding_style.example">By Example</a></span></dt></dl></dd><dt><span class="sect1"><a href="manual/bk01apas04.html">Documentation Style</a></span></dt><dd><dl><dt><span class="sect2"><a href="manual/bk01apas04.html#doc_style.doxygen">Doxygen</a></span></dt><dt><span class="sect2"><a href="manual/bk01apas04.html#doc_style.docbook">Docbook</a></span></dt></dl></dd><dt><span class="sect1"><a href="manual/bk01apas05.html">Design Notes</a></span></dt></dl></dd><dt><span class="appendix"><a href="manual/appendix_porting.html">B. Porting and Maintenance</a></span></dt><dd><dl><dt><span class="sect1"><a href="manual/appendix_porting.html#appendix.porting.build_hacking">Configure and Build Hacking</a></span></dt><dd><dl><dt><span class="sect2"><a href="manual/appendix_porting.html#build_hacking.prereq">Prerequisites</a></span></dt><dt><span class="sect2"><a href="manual/appendix_porting.html#build_hacking.map">Overview: What Comes from Where</a></span></dt><dt><span class="sect2"><a href="manual/appendix_porting.html#build_hacking.scripts">Storing Information in non-AC files (like configure.host)</a></span></dt><dt><span class="sect2"><a href="manual/appendix_porting.html#build_hacking.conventions">Coding and Commenting Conventions</a></span></dt><dt><span class="sect2"><a href="manual/appendix_porting.html#build_hacking.acinclude">The acinclude.m4 layout</a></span></dt><dt><span class="sect2"><a href="manual/appendix_porting.html#build_hacking.enable"><code class="constant">GLIBCXX_ENABLE</code>, the <code class="literal">--enable</code> maker</a></span></dt></dl></dd><dt><span class="sect1"><a href="manual/internals.html">Porting to New Hardware or Operating Systems</a></span></dt><dd><dl><dt><span class="sect2"><a href="manual/internals.html#internals.os">Operating System</a></span></dt><dt><span class="sect2"><a href="manual/internals.html#internals.cpu">CPU</a></span></dt><dt><span class="sect2"><a href="manual/internals.html#internals.char_types">Character Types</a></span></dt><dt><span class="sect2"><a href="manual/internals.html#internals.thread_safety">Thread Safety</a></span></dt><dt><span class="sect2"><a href="manual/internals.html#internals.numeric_limits">Numeric Limits</a></span></dt><dt><span class="sect2"><a href="manual/internals.html#internals.libtool">Libtool</a></span></dt></dl></dd><dt><span class="sect1"><a href="manual/abi.html">ABI Policy and Guidelines</a></span></dt><dd><dl><dt><span class="sect2"><a href="manual/abi.html#abi.cxx_interface">The C++ Interface</a></span></dt><dt><span class="sect2"><a href="manual/abi.html#abi.versioning">Versioning</a></span></dt><dt><span class="sect2"><a href="manual/abi.html#abi.changes_allowed">Allowed Changes</a></span></dt><dt><span class="sect2"><a href="manual/abi.html#abi.changes_no">Prohibited Changes</a></span></dt><dt><span class="sect2"><a href="manual/abi.html#abi.impl">Implementation</a></span></dt><dt><span class="sect2"><a href="manual/abi.html#abi.testing">Testing</a></span></dt><dt><span class="sect2"><a href="manual/abi.html#abi.issues">Outstanding Issues</a></span></dt></dl></dd><dt><span class="sect1"><a href="manual/api.html">API Evolution and Deprecation History</a></span></dt><dd><dl><dt><span class="sect2"><a href="manual/api.html#api.rel_300"><code class="constant">3.0</code></a></span></dt><dt><span class="sect2"><a href="manual/api.html#api.rel_310"><code class="constant">3.1</code></a></span></dt><dt><span class="sect2"><a href="manual/api.html#api.rel_320"><code class="constant">3.2</code></a></span></dt><dt><span class="sect2"><a href="manual/api.html#api.rel_330"><code class="constant">3.3</code></a></span></dt><dt><span class="sect2"><a href="manual/api.html#api.rel_340"><code class="constant">3.4</code></a></span></dt><dt><span class="sect2"><a href="manual/api.html#api.rel_400"><code class="constant">4.0</code></a></span></dt><dt><span class="sect2"><a href="manual/api.html#api.rel_410"><code class="constant">4.1</code></a></span></dt><dt><span class="sect2"><a href="manual/api.html#api.rel_420"><code class="constant">4.2</code></a></span></dt><dt><span class="sect2"><a href="manual/api.html#api.rel_430"><code class="constant">4.3</code></a></span></dt></dl></dd><dt><span class="sect1"><a href="manual/backwards.html">Backwards Compatibility</a></span></dt><dd><dl><dt><span class="sect2"><a href="manual/backwards.html#backwards.first">First</a></span></dt><dt><span class="sect2"><a href="manual/backwards.html#backwards.second">Second</a></span></dt><dt><span class="sect2"><a href="manual/backwards.html#backwards.third">Third</a></span></dt></dl></dd></dl></dd><dt><span class="appendix"><a href="manual/appendix_free.html">C. Free Software Needs Free Documentation</a></span></dt><dt><span class="appendix"><a href="manual/bk01apd.html">D. GNU General Public License</a></span></dt><dd><dl><dt><span class="section"><a href="manual/bk01apd.html#gpl-1">Preamble</a></span></dt><dt><span class="section"><a href="manual/bk01apds02.html">TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION</a></span></dt><dd><dl><dt><span class="section"><a href="manual/bk01apds02.html#gpl-2-0">Section 0</a></span></dt><dt><span class="section"><a href="manual/bk01apds02.html#gpl-2-1">Section 1</a></span></dt><dt><span class="section"><a href="manual/bk01apds02.html#gpl-2-2">Section 2</a></span></dt><dt><span class="section"><a href="manual/bk01apds02.html#gpl-2-3">Section 3</a></span></dt><dt><span class="section"><a href="manual/bk01apds02.html#gpl-2-4">Section 4</a></span></dt><dt><span class="section"><a href="manual/bk01apds02.html#gpl-2-5">Section 5</a></span></dt><dt><span class="section"><a href="manual/bk01apds02.html#gpl-2-6">Section 6</a></span></dt><dt><span class="section"><a href="manual/bk01apds02.html#gpl-2-7">Section 7</a></span></dt><dt><span class="section"><a href="manual/bk01apds02.html#gpl-2-8">Section 8</a></span></dt><dt><span class="section"><a href="manual/bk01apds02.html#gpl-2-9">Section 9</a></span></dt><dt><span class="section"><a href="manual/bk01apds02.html#gpl-2-10">Section 10</a></span></dt><dt><span class="section"><a href="manual/bk01apds02.html#gpl-2-11">NO WARRANTY Section 11</a></span></dt><dt><span class="section"><a href="manual/bk01apds02.html#gpl-2-12">Section 12</a></span></dt></dl></dd><dt><span class="section"><a href="manual/bk01apds03.html">How to Apply These Terms to Your New Programs</a></span></dt></dl></dd><dt><span class="appendix"><a href="manual/bk01ape.html">E. GNU Free Documentation License</a></span></dt></dl></dd><dt><span class="book"><a href="bk02.html"></a></span></dt><dd><dl><dt><span class="article"><a href="api.html">API and Source Level Documentation</a></span></dt></dl></dd><dt><span class="book"><a href="bk03.html"></a></span></dt><dd><dl><dt><span class="article"><a href="faq.html">Frequently Asked Questions</a></span></dt></dl></dd></dl></div></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"> </td><td width="20%" align="center"> </td><td width="40%" align="right"> <a accesskey="n" href="manual/spine.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top"> </td><td width="20%" align="center"> </td><td width="40%" align="right" valign="top"> The GNU C++ Library</td></tr></table></div></body></html> + </p></div></div><hr /></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="book"><a href="manual/spine.html">The GNU C++ Library</a></span></dt><dd><dl><dt><span class="part"><a href="manual/intro.html">I. Introduction</a></span></dt><dd><dl><dt><span class="chapter"><a href="manual/bk01pt01ch01.html">1. Status</a></span></dt><dd><dl><dt><span class="sect1"><a href="manual/bk01pt01ch01.html#manual.intro.status.standard">Implementation Status</a></span></dt><dd><dl><dt><span class="sect2"><a href="manual/bk01pt01ch01.html#manual.intro.status.standard.1998">C++ 1998</a></span></dt><dt><span class="sect2"><a href="manual/bk01pt01ch01.html#manual.intro.status.standard.tr1">C++ TR1</a></span></dt><dt><span class="sect2"><a href="manual/bk01pt01ch01.html#manual.intro.status.standard.200x">C++ 200x</a></span></dt></dl></dd><dt><span class="sect1"><a href="manual/bk01pt01ch01s02.html">License</a></span></dt><dd><dl><dt><span class="sect2"><a href="manual/bk01pt01ch01s02.html#manual.intro.status.license.gpl">The Code: GPL</a></span></dt><dt><span class="sect2"><a href="manual/bk01pt01ch01s02.html#manual.intro.status.license.fdl">The Documentation: GPL, FDL</a></span></dt></dl></dd><dt><span class="sect1"><a href="manual/bk01pt01ch01s03.html">Bugs</a></span></dt><dd><dl><dt><span class="sect2"><a href="manual/bk01pt01ch01s03.html#manual.intro.status.bugs.impl">Implementation Bugs</a></span></dt><dt><span class="sect2"><a href="manual/bk01pt01ch01s03.html#manual.intro.status.bugs.iso">Standard Bugs</a></span></dt></dl></dd></dl></dd><dt><span class="chapter"><a href="manual/bk01pt01ch02.html">2. Setup</a></span></dt><dd><dl><dt><span class="sect1"><a href="manual/bk01pt01ch02.html#manual.intro.setup.configure">Configure</a></span></dt><dt><span class="sect1"><a href="manual/build.html">Build</a></span></dt><dd><dl><dt><span class="sect2"><a href="manual/build.html#build.prereq">Prerequisites</a></span></dt><dt><span class="sect2"><a href="manual/build.html#build.configure">Make</a></span></dt></dl></dd><dt><span class="sect1"><a href="manual/test.html">Test</a></span></dt><dd><dl><dt><span class="sect2"><a href="manual/test.html#test.organization">Organization</a></span></dt><dt><span class="sect2"><a href="manual/test.html#test.naming">Naming Conventions</a></span></dt><dt><span class="sect2"><a href="manual/test.html#test.utils">Utilities</a></span></dt><dt><span class="sect2"><a href="manual/test.html#test.run">Running the Testsuite</a></span></dt><dt><span class="sect2"><a href="manual/test.html#test.new_tests">New Test Cases</a></span></dt><dt><span class="sect2"><a href="manual/test.html#test.dejagnu">Test Harness Details</a></span></dt><dt><span class="sect2"><a href="manual/test.html#test.future">Future</a></span></dt></dl></dd></dl></dd><dt><span class="chapter"><a href="manual/using.html">3. Using</a></span></dt><dd><dl><dt><span class="sect1"><a href="manual/using.html#manual.intro.using.lib">Linking Library Binary Files</a></span></dt><dt><span class="sect1"><a href="manual/bk01pt01ch03s02.html">Headers</a></span></dt><dd><dl><dt><span class="sect2"><a href="manual/bk01pt01ch03s02.html#manual.intro.using.headers.all">Header Files</a></span></dt><dt><span class="sect2"><a href="manual/bk01pt01ch03s02.html#manual.intro.using.headers.mixing">Mixing Headers</a></span></dt><dt><span class="sect2"><a href="manual/bk01pt01ch03s02.html#manual.intro.using.headers.cheaders">The C Headers and <code class="code">namespace std</code></a></span></dt><dt><span class="sect2"><a href="manual/bk01pt01ch03s02.html#manual.intro.using.headers.pre">Precompiled Headers</a></span></dt></dl></dd><dt><span class="sect1"><a href="manual/bk01pt01ch03s03.html">Namespaces</a></span></dt><dd><dl><dt><span class="sect2"><a href="manual/bk01pt01ch03s03.html#manual.intro.using.namespaces.all">Available Namespaces</a></span></dt><dt><span class="sect2"><a href="manual/bk01pt01ch03s03.html#manual.intro.using.namespaces.std">namespace std</a></span></dt><dt><span class="sect2"><a href="manual/bk01pt01ch03s03.html#manual.intro.using.namespaces.comp">Using Namespace Composition</a></span></dt></dl></dd><dt><span class="sect1"><a href="manual/bk01pt01ch03s04.html">Macros</a></span></dt><dt><span class="sect1"><a href="manual/bk01pt01ch03s05.html">Concurrency</a></span></dt><dd><dl><dt><span class="sect2"><a href="manual/bk01pt01ch03s05.html#manual.intro.using.concurrency.prereq">Prerequisites</a></span></dt><dt><span class="sect2"><a href="manual/bk01pt01ch03s05.html#manual.intro.using.concurrency.thread_safety">Thread Safety</a></span></dt><dt><span class="sect2"><a href="manual/bk01pt01ch03s05.html#manual.intro.using.concurrency.atomics">Atomics</a></span></dt><dt><span class="sect2"><a href="manual/bk01pt01ch03s05.html#manual.intro.using.concurrency.io">IO</a></span></dt><dt><span class="sect2"><a href="manual/bk01pt01ch03s05.html#manual.intro.using.concurrency.containers">Containers</a></span></dt></dl></dd><dt><span class="sect1"><a href="manual/bk01pt01ch03s06.html">Exception Safety</a></span></dt><dt><span class="sect1"><a href="manual/debug.html">Debugging Support</a></span></dt><dd><dl><dt><span class="sect2"><a href="manual/debug.html#debug.compiler">Using <span class="command"><strong>g++</strong></span></a></span></dt><dt><span class="sect2"><a href="manual/debug.html#debug.req">Debug Versions of Library Binary Files</a></span></dt><dt><span class="sect2"><a href="manual/debug.html#debug.memory">Memory Leak Hunting</a></span></dt><dt><span class="sect2"><a href="manual/debug.html#debug.gdb">Using <span class="command"><strong>gdb</strong></span></a></span></dt><dt><span class="sect2"><a href="manual/debug.html#debug.exceptions">Tracking uncaught exceptions</a></span></dt><dt><span class="sect2"><a href="manual/debug.html#debug.debug_mode">Debug Mode</a></span></dt><dt><span class="sect2"><a href="manual/debug.html#debug.compile_time_checks">Compile Time Checking</a></span></dt></dl></dd></dl></dd></dl></dd><dt><span class="part"><a href="manual/support.html">II. Support</a></span></dt><dd><dl><dt><span class="preface"><a href="manual/bk01pt02pr01.html"></a></span></dt><dt><span class="chapter"><a href="manual/bk01pt02ch04.html">4. Types</a></span></dt><dd><dl><dt><span class="sect1"><a href="manual/bk01pt02ch04.html#manual.support.types.fundamental">Fundamental Types</a></span></dt><dt><span class="sect1"><a href="manual/bk01pt02ch04s02.html">Numeric Properties</a></span></dt><dt><span class="sect1"><a href="manual/bk01pt02ch04s03.html">NULL</a></span></dt></dl></dd><dt><span class="chapter"><a href="manual/bk01pt02ch05.html">5. Dynamic Memory</a></span></dt><dt><span class="chapter"><a href="manual/bk01pt02ch06.html">6. Termination</a></span></dt><dd><dl><dt><span class="sect1"><a href="manual/bk01pt02ch06.html#support.termination.handlers">Termination Handlers</a></span></dt><dt><span class="sect1"><a href="manual/bk01pt02ch06s02.html">Verbose Terminate Handler</a></span></dt></dl></dd></dl></dd><dt><span class="part"><a href="manual/diagnostics.html">III. Diagnostics</a></span></dt><dd><dl><dt><span class="chapter"><a href="manual/bk01pt03ch07.html">7. Exceptions</a></span></dt><dd><dl><dt><span class="sect1"><a href="manual/bk01pt03ch07.html#manual.diagnostics.exceptions.hierarchy">Exception Classes</a></span></dt><dt><span class="sect1"><a href="manual/bk01pt03ch07s02.html">Adding Data to Exceptions</a></span></dt><dt><span class="sect1"><a href="manual/bk01pt03ch07s03.html">Cancellation</a></span></dt></dl></dd><dt><span class="chapter"><a href="manual/bk01pt03ch08.html">8. Concept Checking</a></span></dt></dl></dd><dt><span class="part"><a href="manual/utilities.html">IV. Utilities</a></span></dt><dd><dl><dt><span class="chapter"><a href="manual/bk01pt04ch09.html">9. Functors</a></span></dt><dt><span class="chapter"><a href="manual/bk01pt04ch10.html">10. Pairs</a></span></dt><dt><span class="chapter"><a href="manual/bk01pt04ch11.html">11. Memory</a></span></dt><dd><dl><dt><span class="sect1"><a href="manual/bk01pt04ch11.html#manual.util.memory.allocator">Allocators</a></span></dt><dd><dl><dt><span class="sect2"><a href="manual/bk01pt04ch11.html#allocator.req">Requirements</a></span></dt><dt><span class="sect2"><a href="manual/bk01pt04ch11.html#allocator.design_issues">Design Issues</a></span></dt><dt><span class="sect2"><a href="manual/bk01pt04ch11.html#allocator.impl">Implementation</a></span></dt><dt><span class="sect2"><a href="manual/bk01pt04ch11.html#allocator.using">Using a Specific Allocator</a></span></dt><dt><span class="sect2"><a href="manual/bk01pt04ch11.html#allocator.custom">Custom Allocators</a></span></dt><dt><span class="sect2"><a href="manual/bk01pt04ch11.html#allocator.ext">Extension Allocators</a></span></dt></dl></dd><dt><span class="sect1"><a href="manual/auto_ptr.html">auto_ptr</a></span></dt><dd><dl><dt><span class="sect2"><a href="manual/auto_ptr.html#auto_ptr.limitations">Limitations</a></span></dt><dt><span class="sect2"><a href="manual/auto_ptr.html#auto_ptr.using">Use in Containers</a></span></dt></dl></dd><dt><span class="sect1"><a href="manual/shared_ptr.html">shared_ptr</a></span></dt><dd><dl><dt><span class="sect2"><a href="manual/shared_ptr.html#shared_ptr.req">Requirements</a></span></dt><dt><span class="sect2"><a href="manual/shared_ptr.html#shared_ptr.design_issues">Design Issues</a></span></dt><dt><span class="sect2"><a href="manual/shared_ptr.html#shared_ptr.impl">Implementation</a></span></dt><dt><span class="sect2"><a href="manual/shared_ptr.html#shared_ptr.using">Use</a></span></dt><dt><span class="sect2"><a href="manual/shared_ptr.html#shared_ptr.ack">Acknowledgments</a></span></dt></dl></dd></dl></dd><dt><span class="chapter"><a href="manual/bk01pt04ch12.html">12. Traits</a></span></dt></dl></dd><dt><span class="part"><a href="manual/strings.html">V. Strings</a></span></dt><dd><dl><dt><span class="chapter"><a href="manual/bk01pt05ch13.html">13. String Classes</a></span></dt><dd><dl><dt><span class="sect1"><a href="manual/bk01pt05ch13.html#strings.string.simple">Simple Transformations</a></span></dt><dt><span class="sect1"><a href="manual/bk01pt05ch13s02.html">Case Sensitivity</a></span></dt><dt><span class="sect1"><a href="manual/bk01pt05ch13s03.html">Arbitrary Character Types</a></span></dt><dt><span class="sect1"><a href="manual/bk01pt05ch13s04.html">Tokenizing</a></span></dt><dt><span class="sect1"><a href="manual/bk01pt05ch13s05.html">Shrink to Fit</a></span></dt><dt><span class="sect1"><a href="manual/bk01pt05ch13s06.html">CString (MFC)</a></span></dt></dl></dd></dl></dd><dt><span class="part"><a href="manual/localization.html">VI. Localization</a></span></dt><dd><dl><dt><span class="chapter"><a href="manual/bk01pt06ch14.html">14. Locales</a></span></dt><dd><dl><dt><span class="sect1"><a href="manual/bk01pt06ch14.html#manual.localization.locales.locale">locale</a></span></dt><dd><dl><dt><span class="sect2"><a href="manual/bk01pt06ch14.html#locales.locale.req">Requirements</a></span></dt><dt><span class="sect2"><a href="manual/bk01pt06ch14.html#locales.locale.design">Design</a></span></dt><dt><span class="sect2"><a href="manual/bk01pt06ch14.html#locales.locale.impl">Implementation</a></span></dt><dt><span class="sect2"><a href="manual/bk01pt06ch14.html#locales.locale.future">Future</a></span></dt></dl></dd></dl></dd><dt><span class="chapter"><a href="manual/bk01pt06ch15.html">15. Facets aka Categories</a></span></dt><dd><dl><dt><span class="sect1"><a href="manual/bk01pt06ch15.html#manual.localization.facet.ctype">ctype</a></span></dt><dd><dl><dt><span class="sect2"><a href="manual/bk01pt06ch15.html#facet.ctype.impl">Implementation</a></span></dt><dt><span class="sect2"><a href="manual/bk01pt06ch15.html#facet.ctype.future">Future</a></span></dt></dl></dd><dt><span class="sect1"><a href="manual/codecvt.html">codecvt</a></span></dt><dd><dl><dt><span class="sect2"><a href="manual/codecvt.html#facet.codecvt.req">Requirements</a></span></dt><dt><span class="sect2"><a href="manual/codecvt.html#facet.codecvt.design">Design</a></span></dt><dt><span class="sect2"><a href="manual/codecvt.html#facet.codecvt.impl">Implementation</a></span></dt><dt><span class="sect2"><a href="manual/codecvt.html#facet.codecvt.use">Use</a></span></dt><dt><span class="sect2"><a href="manual/codecvt.html#facet.codecvt.future">Future</a></span></dt></dl></dd><dt><span class="sect1"><a href="manual/messages.html">messages</a></span></dt><dd><dl><dt><span class="sect2"><a href="manual/messages.html#facet.messages.req">Requirements</a></span></dt><dt><span class="sect2"><a href="manual/messages.html#facet.messages.design">Design</a></span></dt><dt><span class="sect2"><a href="manual/messages.html#facet.messages.impl">Implementation</a></span></dt><dt><span class="sect2"><a href="manual/messages.html#facet.messages.use">Use</a></span></dt><dt><span class="sect2"><a href="manual/messages.html#facet.messages.future">Future</a></span></dt></dl></dd></dl></dd></dl></dd><dt><span class="part"><a href="manual/containers.html">VII. Containers</a></span></dt><dd><dl><dt><span class="chapter"><a href="manual/bk01pt07ch16.html">16. Sequences</a></span></dt><dd><dl><dt><span class="sect1"><a href="manual/bk01pt07ch16.html#containers.sequences.list">list</a></span></dt><dd><dl><dt><span class="sect2"><a href="manual/bk01pt07ch16.html#sequences.list.size">list::size() is O(n)</a></span></dt></dl></dd><dt><span class="sect1"><a href="manual/bk01pt07ch16s02.html">vector</a></span></dt><dd><dl><dt><span class="sect2"><a href="manual/bk01pt07ch16s02.html#sequences.vector.management">Space Overhead Management</a></span></dt></dl></dd></dl></dd><dt><span class="chapter"><a href="manual/bk01pt07ch17.html">17. Associative</a></span></dt><dd><dl><dt><span class="sect1"><a href="manual/bk01pt07ch17.html#containers.associative.insert_hints">Insertion Hints</a></span></dt><dt><span class="sect1"><a href="manual/bk01pt07ch17s02.html">bitset</a></span></dt><dd><dl><dt><span class="sect2"><a href="manual/bk01pt07ch17s02.html#associative.bitset.size_variable">Size Variable</a></span></dt><dt><span class="sect2"><a href="manual/bk01pt07ch17s02.html#associative.bitset.type_string">Type String</a></span></dt></dl></dd></dl></dd><dt><span class="chapter"><a href="manual/bk01pt07ch18.html">18. Interacting with C</a></span></dt><dd><dl><dt><span class="sect1"><a href="manual/bk01pt07ch18.html#containers.c.vs_array">Containers vs. Arrays</a></span></dt></dl></dd></dl></dd><dt><span class="part"><a href="manual/iterators.html">VIII. Iterators</a></span></dt><dd><dl><dt><span class="chapter"><a href="manual/bk01pt08ch19.html">19. Predefined</a></span></dt><dd><dl><dt><span class="sect1"><a href="manual/bk01pt08ch19.html#iterators.predefined.vs_pointers">Iterators vs. Pointers</a></span></dt><dt><span class="sect1"><a href="manual/bk01pt08ch19s02.html">One Past the End</a></span></dt></dl></dd></dl></dd><dt><span class="part"><a href="manual/algorithms.html">IX. Algorithms</a></span></dt><dd><dl><dt><span class="preface"><a href="manual/bk01pt09pr02.html"></a></span></dt><dt><span class="chapter"><a href="manual/bk01pt09ch20.html">20. Mutating</a></span></dt><dd><dl><dt><span class="sect1"><a href="manual/bk01pt09ch20.html#algorithms.mutating.swap"><code class="function">swap</code></a></span></dt><dd><dl><dt><span class="sect2"><a href="manual/bk01pt09ch20.html#algorithms.swap.specializations">Specializations</a></span></dt></dl></dd></dl></dd></dl></dd><dt><span class="part"><a href="manual/numerics.html">X. Numerics</a></span></dt><dd><dl><dt><span class="chapter"><a href="manual/bk01pt10ch21.html">21. Complex</a></span></dt><dd><dl><dt><span class="sect1"><a href="manual/bk01pt10ch21.html#numerics.complex.processing">complex Processing</a></span></dt></dl></dd><dt><span class="chapter"><a href="manual/bk01pt10ch22.html">22. Generalized Operations</a></span></dt><dt><span class="chapter"><a href="manual/bk01pt10ch23.html">23. Interacting with C</a></span></dt><dd><dl><dt><span class="sect1"><a href="manual/bk01pt10ch23.html#numerics.c.array">Numerics vs. Arrays</a></span></dt><dt><span class="sect1"><a href="manual/bk01pt10ch23s02.html">C99</a></span></dt></dl></dd></dl></dd><dt><span class="part"><a href="manual/io.html">XI. Input and Output</a></span></dt><dd><dl><dt><span class="chapter"><a href="manual/bk01pt11ch24.html">24. Iostream Objects</a></span></dt><dt><span class="chapter"><a href="manual/bk01pt11ch25.html">25. Stream Buffers</a></span></dt><dd><dl><dt><span class="sect1"><a href="manual/bk01pt11ch25.html#io.streambuf.derived">Derived streambuf Classes</a></span></dt><dt><span class="sect1"><a href="manual/bk01pt11ch25s02.html">Buffering</a></span></dt></dl></dd><dt><span class="chapter"><a href="manual/bk01pt11ch26.html">26. Memory Based Streams</a></span></dt><dd><dl><dt><span class="sect1"><a href="manual/bk01pt11ch26.html#manual.io.memstreams.compat">Compatibility With strstream</a></span></dt></dl></dd><dt><span class="chapter"><a href="manual/bk01pt11ch27.html">27. File Based Streams</a></span></dt><dd><dl><dt><span class="sect1"><a href="manual/bk01pt11ch27.html#manual.io.filestreams.copying_a_file">Copying a File</a></span></dt><dt><span class="sect1"><a href="manual/bk01pt11ch27s02.html">Binary Input and Output</a></span></dt><dt><span class="sect1"><a href="manual/bk01pt11ch27s03.html">More Binary Input and Output</a></span></dt></dl></dd><dt><span class="chapter"><a href="manual/bk01pt11ch28.html">28. Interacting with C</a></span></dt><dd><dl><dt><span class="sect1"><a href="manual/bk01pt11ch28.html#manual.io.c.FILE">Using FILE* and file descriptors</a></span></dt><dt><span class="sect1"><a href="manual/bk01pt11ch28s02.html">Performance</a></span></dt></dl></dd></dl></dd><dt><span class="part"><a href="manual/extensions.html">XII. Extensions</a></span></dt><dd><dl><dt><span class="preface"><a href="manual/bk01pt12pr03.html"></a></span></dt><dt><span class="chapter"><a href="manual/bk01pt12ch29.html">29. Compile Time Checks</a></span></dt><dt><span class="chapter"><a href="manual/debug_mode.html">30. Debug Mode</a></span></dt><dd><dl><dt><span class="sect1"><a href="manual/debug_mode.html#manual.ext.debug_mode.intro">Intro</a></span></dt><dt><span class="sect1"><a href="manual/bk01pt12ch30s02.html">Semantics</a></span></dt><dt><span class="sect1"><a href="manual/bk01pt12ch30s03.html">Using</a></span></dt><dd><dl><dt><span class="sect2"><a href="manual/bk01pt12ch30s03.html#debug_mode.using.mode">Using the Debug Mode</a></span></dt><dt><span class="sect2"><a href="manual/bk01pt12ch30s03.html#debug_mode.using.specific">Using a Specific Debug Container</a></span></dt></dl></dd><dt><span class="sect1"><a href="manual/bk01pt12ch30s04.html">Design</a></span></dt><dd><dl><dt><span class="sect2"><a href="manual/bk01pt12ch30s04.html#manual.ext.debug_mode.design.goals">Goals</a></span></dt><dt><span class="sect2"><a href="manual/bk01pt12ch30s04.html#manual.ext.debug_mode.design.methods">Methods</a></span></dt><dt><span class="sect2"><a href="manual/bk01pt12ch30s04.html#manual.ext.debug_mode.design.other">Other Implementations</a></span></dt></dl></dd></dl></dd><dt><span class="chapter"><a href="manual/parallel_mode.html">31. Parallel Mode</a></span></dt><dd><dl><dt><span class="sect1"><a href="manual/parallel_mode.html#manual.ext.parallel_mode.intro">Intro</a></span></dt><dt><span class="sect1"><a href="manual/bk01pt12ch31s02.html">Semantics</a></span></dt><dt><span class="sect1"><a href="manual/bk01pt12ch31s03.html">Using</a></span></dt><dd><dl><dt><span class="sect2"><a href="manual/bk01pt12ch31s03.html#parallel_mode.using.parallel_mode">Using Parallel Mode</a></span></dt><dt><span class="sect2"><a href="manual/bk01pt12ch31s03.html#manual.ext.parallel_mode.usings">Using Specific Parallel Components</a></span></dt></dl></dd><dt><span class="sect1"><a href="manual/bk01pt12ch31s04.html">Design</a></span></dt><dd><dl><dt><span class="sect2"><a href="manual/bk01pt12ch31s04.html#manual.ext.parallel_mode.design.intro">Interface Basics</a></span></dt><dt><span class="sect2"><a href="manual/bk01pt12ch31s04.html#manual.ext.parallel_mode.design.tuning">Configuration and Tuning</a></span></dt><dt><span class="sect2"><a href="manual/bk01pt12ch31s04.html#manual.ext.parallel_mode.design.impl">Implementation Namespaces</a></span></dt></dl></dd><dt><span class="sect1"><a href="manual/bk01pt12ch31s05.html">Testing</a></span></dt><dt><span class="bibliography"><a href="manual/parallel_mode.html#parallel_mode.biblio">Bibliography</a></span></dt></dl></dd><dt><span class="chapter"><a href="manual/bk01pt12ch32.html">32. Allocators</a></span></dt><dd><dl><dt><span class="sect1"><a href="manual/bk01pt12ch32.html#manual.ext.allocator.mt">mt_allocator</a></span></dt><dd><dl><dt><span class="sect2"><a href="manual/bk01pt12ch32.html#allocator.mt.intro">Intro</a></span></dt><dt><span class="sect2"><a href="manual/bk01pt12ch32.html#allocator.mt.design_issues">Design Issues</a></span></dt><dt><span class="sect2"><a href="manual/bk01pt12ch32.html#allocator.mt.impl">Implementation</a></span></dt><dt><span class="sect2"><a href="manual/bk01pt12ch32.html#allocator.mt.example_single">Single Thread Example</a></span></dt><dt><span class="sect2"><a href="manual/bk01pt12ch32.html#allocator.mt.example_multi">Multiple Thread Example</a></span></dt></dl></dd><dt><span class="sect1"><a href="manual/bitmap_allocator.html">bitmap_allocator</a></span></dt><dd><dl><dt><span class="sect2"><a href="manual/bitmap_allocator.html#allocator.bitmap.design">Design</a></span></dt><dt><span class="sect2"><a href="manual/bitmap_allocator.html#allocator.bitmap.impl">Implementation</a></span></dt></dl></dd></dl></dd><dt><span class="chapter"><a href="manual/bk01pt12ch33.html">33. Containers</a></span></dt><dd><dl><dt><span class="sect1"><a href="manual/bk01pt12ch33.html#manual.ext.containers.pbds">Policy Based Data Structures</a></span></dt><dt><span class="sect1"><a href="manual/bk01pt12ch33s02.html">HP/SGI</a></span></dt><dt><span class="sect1"><a href="manual/bk01pt12ch33s03.html">Deprecated HP/SGI</a></span></dt></dl></dd><dt><span class="chapter"><a href="manual/bk01pt12ch34.html">34. Utilities</a></span></dt><dt><span class="chapter"><a href="manual/bk01pt12ch35.html">35. Algorithms</a></span></dt><dt><span class="chapter"><a href="manual/bk01pt12ch36.html">36. Numerics</a></span></dt><dt><span class="chapter"><a href="manual/bk01pt12ch37.html">37. Iterators</a></span></dt><dt><span class="chapter"><a href="manual/bk01pt12ch38.html">38. Input and Output</a></span></dt><dd><dl><dt><span class="sect1"><a href="manual/bk01pt12ch38.html#manual.ext.io.filebuf_derived">Derived filebufs</a></span></dt></dl></dd><dt><span class="chapter"><a href="manual/bk01pt12ch39.html">39. Demangling</a></span></dt><dt><span class="chapter"><a href="manual/concurrency.html">40. Concurrency</a></span></dt><dd><dl><dt><span class="sect1"><a href="manual/concurrency.html#manual.ext.concurrency.design">Design</a></span></dt><dd><dl><dt><span class="sect2"><a href="manual/concurrency.html#manual.ext.concurrency.design.threads">Interface to Locks and Mutexes</a></span></dt><dt><span class="sect2"><a href="manual/concurrency.html#manual.ext.concurrency.design.atomics">Interface to Atomic Functions</a></span></dt></dl></dd><dt><span class="sect1"><a href="manual/bk01pt12ch40s02.html">Implementation</a></span></dt><dd><dl><dt><span class="sect2"><a href="manual/bk01pt12ch40s02.html#manual.ext.concurrency.impl.atomic_fallbacks">Using Builtin Atomic Functions</a></span></dt><dt><span class="sect2"><a href="manual/bk01pt12ch40s02.html#manual.ext.concurrency.impl.thread">Thread Abstraction</a></span></dt></dl></dd><dt><span class="sect1"><a href="manual/bk01pt12ch40s03.html">Use</a></span></dt></dl></dd></dl></dd><dt><span class="appendix"><a href="manual/appendix_contributing.html">A. Contributing</a></span></dt><dd><dl><dt><span class="sect1"><a href="manual/appendix_contributing.html#contrib.list">Contributor Checklist</a></span></dt><dd><dl><dt><span class="sect2"><a href="manual/appendix_contributing.html#list.reading">Reading</a></span></dt><dt><span class="sect2"><a href="manual/appendix_contributing.html#list.copyright">Assignment</a></span></dt><dt><span class="sect2"><a href="manual/appendix_contributing.html#list.getting">Getting Sources</a></span></dt><dt><span class="sect2"><a href="manual/appendix_contributing.html#list.patches">Submitting Patches</a></span></dt></dl></dd><dt><span class="sect1"><a href="manual/bk01apas02.html">Directory Layout and Source Conventions</a></span></dt><dt><span class="sect1"><a href="manual/bk01apas03.html">Coding Style</a></span></dt><dd><dl><dt><span class="sect2"><a href="manual/bk01apas03.html#coding_style.bad_identifiers">Bad Identifiers</a></span></dt><dt><span class="sect2"><a href="manual/bk01apas03.html#coding_style.example">By Example</a></span></dt></dl></dd><dt><span class="sect1"><a href="manual/bk01apas04.html">Documentation Style</a></span></dt><dd><dl><dt><span class="sect2"><a href="manual/bk01apas04.html#doc_style.doxygen">Doxygen</a></span></dt><dt><span class="sect2"><a href="manual/bk01apas04.html#doc_style.docbook">Docbook</a></span></dt></dl></dd><dt><span class="sect1"><a href="manual/bk01apas05.html">Design Notes</a></span></dt></dl></dd><dt><span class="appendix"><a href="manual/appendix_porting.html">B. Porting and Maintenance</a></span></dt><dd><dl><dt><span class="sect1"><a href="manual/appendix_porting.html#appendix.porting.build_hacking">Configure and Build Hacking</a></span></dt><dd><dl><dt><span class="sect2"><a href="manual/appendix_porting.html#build_hacking.prereq">Prerequisites</a></span></dt><dt><span class="sect2"><a href="manual/appendix_porting.html#build_hacking.map">Overview: What Comes from Where</a></span></dt><dt><span class="sect2"><a href="manual/appendix_porting.html#build_hacking.scripts">Storing Information in non-AC files (like configure.host)</a></span></dt><dt><span class="sect2"><a href="manual/appendix_porting.html#build_hacking.conventions">Coding and Commenting Conventions</a></span></dt><dt><span class="sect2"><a href="manual/appendix_porting.html#build_hacking.acinclude">The acinclude.m4 layout</a></span></dt><dt><span class="sect2"><a href="manual/appendix_porting.html#build_hacking.enable"><code class="constant">GLIBCXX_ENABLE</code>, the <code class="literal">--enable</code> maker</a></span></dt></dl></dd><dt><span class="sect1"><a href="manual/internals.html">Porting to New Hardware or Operating Systems</a></span></dt><dd><dl><dt><span class="sect2"><a href="manual/internals.html#internals.os">Operating System</a></span></dt><dt><span class="sect2"><a href="manual/internals.html#internals.cpu">CPU</a></span></dt><dt><span class="sect2"><a href="manual/internals.html#internals.char_types">Character Types</a></span></dt><dt><span class="sect2"><a href="manual/internals.html#internals.thread_safety">Thread Safety</a></span></dt><dt><span class="sect2"><a href="manual/internals.html#internals.numeric_limits">Numeric Limits</a></span></dt><dt><span class="sect2"><a href="manual/internals.html#internals.libtool">Libtool</a></span></dt></dl></dd><dt><span class="sect1"><a href="manual/abi.html">ABI Policy and Guidelines</a></span></dt><dd><dl><dt><span class="sect2"><a href="manual/abi.html#abi.cxx_interface">The C++ Interface</a></span></dt><dt><span class="sect2"><a href="manual/abi.html#abi.versioning">Versioning</a></span></dt><dt><span class="sect2"><a href="manual/abi.html#abi.changes_allowed">Allowed Changes</a></span></dt><dt><span class="sect2"><a href="manual/abi.html#abi.changes_no">Prohibited Changes</a></span></dt><dt><span class="sect2"><a href="manual/abi.html#abi.impl">Implementation</a></span></dt><dt><span class="sect2"><a href="manual/abi.html#abi.testing">Testing</a></span></dt><dt><span class="sect2"><a href="manual/abi.html#abi.issues">Outstanding Issues</a></span></dt></dl></dd><dt><span class="sect1"><a href="manual/api.html">API Evolution and Deprecation History</a></span></dt><dd><dl><dt><span class="sect2"><a href="manual/api.html#api.rel_300"><code class="constant">3.0</code></a></span></dt><dt><span class="sect2"><a href="manual/api.html#api.rel_310"><code class="constant">3.1</code></a></span></dt><dt><span class="sect2"><a href="manual/api.html#api.rel_320"><code class="constant">3.2</code></a></span></dt><dt><span class="sect2"><a href="manual/api.html#api.rel_330"><code class="constant">3.3</code></a></span></dt><dt><span class="sect2"><a href="manual/api.html#api.rel_340"><code class="constant">3.4</code></a></span></dt><dt><span class="sect2"><a href="manual/api.html#api.rel_400"><code class="constant">4.0</code></a></span></dt><dt><span class="sect2"><a href="manual/api.html#api.rel_410"><code class="constant">4.1</code></a></span></dt><dt><span class="sect2"><a href="manual/api.html#api.rel_420"><code class="constant">4.2</code></a></span></dt><dt><span class="sect2"><a href="manual/api.html#api.rel_430"><code class="constant">4.3</code></a></span></dt></dl></dd><dt><span class="sect1"><a href="manual/backwards.html">Backwards Compatibility</a></span></dt><dd><dl><dt><span class="sect2"><a href="manual/backwards.html#backwards.first">First</a></span></dt><dt><span class="sect2"><a href="manual/backwards.html#backwards.second">Second</a></span></dt><dt><span class="sect2"><a href="manual/backwards.html#backwards.third">Third</a></span></dt></dl></dd></dl></dd><dt><span class="appendix"><a href="manual/appendix_free.html">C. Free Software Needs Free Documentation</a></span></dt><dt><span class="appendix"><a href="manual/bk01apd.html">D. GNU General Public License</a></span></dt><dd><dl><dt><span class="section"><a href="manual/bk01apd.html#gpl-1">Preamble</a></span></dt><dt><span class="section"><a href="manual/bk01apds02.html">TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION</a></span></dt><dd><dl><dt><span class="section"><a href="manual/bk01apds02.html#gpl-2-0">Section 0</a></span></dt><dt><span class="section"><a href="manual/bk01apds02.html#gpl-2-1">Section 1</a></span></dt><dt><span class="section"><a href="manual/bk01apds02.html#gpl-2-2">Section 2</a></span></dt><dt><span class="section"><a href="manual/bk01apds02.html#gpl-2-3">Section 3</a></span></dt><dt><span class="section"><a href="manual/bk01apds02.html#gpl-2-4">Section 4</a></span></dt><dt><span class="section"><a href="manual/bk01apds02.html#gpl-2-5">Section 5</a></span></dt><dt><span class="section"><a href="manual/bk01apds02.html#gpl-2-6">Section 6</a></span></dt><dt><span class="section"><a href="manual/bk01apds02.html#gpl-2-7">Section 7</a></span></dt><dt><span class="section"><a href="manual/bk01apds02.html#gpl-2-8">Section 8</a></span></dt><dt><span class="section"><a href="manual/bk01apds02.html#gpl-2-9">Section 9</a></span></dt><dt><span class="section"><a href="manual/bk01apds02.html#gpl-2-10">Section 10</a></span></dt><dt><span class="section"><a href="manual/bk01apds02.html#gpl-2-11">NO WARRANTY Section 11</a></span></dt><dt><span class="section"><a href="manual/bk01apds02.html#gpl-2-12">Section 12</a></span></dt></dl></dd><dt><span class="section"><a href="manual/bk01apds03.html">How to Apply These Terms to Your New Programs</a></span></dt></dl></dd><dt><span class="appendix"><a href="manual/bk01ape.html">E. GNU Free Documentation License</a></span></dt></dl></dd><dt><span class="book"><a href="bk02.html"></a></span></dt><dd><dl><dt><span class="article"><a href="api.html">API and Source Level Documentation</a></span></dt></dl></dd><dt><span class="book"><a href="bk03.html"></a></span></dt><dd><dl><dt><span class="article"><a href="faq.html">Frequently Asked Questions</a></span></dt></dl></dd></dl></div></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"> </td><td width="20%" align="center"> </td><td width="40%" align="right"> <a accesskey="n" href="manual/spine.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top"> </td><td width="20%" align="center"> </td><td width="40%" align="right" valign="top"> The GNU C++ Library</td></tr></table></div></body></html> diff --git a/libstdc++-v3/doc/xml/authors.xml b/libstdc++-v3/doc/xml/authors.xml index dfcdf24d1b9..83795ba076b 100644 --- a/libstdc++-v3/doc/xml/authors.xml +++ b/libstdc++-v3/doc/xml/authors.xml @@ -154,7 +154,7 @@ <authorblurb> <para> - Policy Based Datastructures, Associative Containers, Unordered + Policy Based Data Structures, Associative Containers, Unordered Containers. </para> </authorblurb> diff --git a/libstdc++-v3/doc/xml/faq.xml b/libstdc++-v3/doc/xml/faq.xml index a60bee3e287..6d1feedb698 100644 --- a/libstdc++-v3/doc/xml/faq.xml +++ b/libstdc++-v3/doc/xml/faq.xml @@ -461,7 +461,7 @@ </qandadiv> -<!-- Platorm-Specific Issues --> +<!-- Platform-Specific Issues --> <qandadiv id="faq.platform-specific" xreflabel="Platform-Specific Issues"> <title>Platform-Specific Issues</title> @@ -661,7 +661,7 @@ enough to detect when the minimal support to enable <type>wchar_t</type> and C++ library structures like <classname>wstring</classname> were present. This impacted Solaris, - Darwin, and BSD varients, and is fixed in libstdc++ versions post 4.1.0. + Darwin, and BSD variants, and is fixed in libstdc++ versions post 4.1.0. </para> <para> </para> @@ -1098,7 +1098,7 @@ </question> <answer id="a-extensions_and_backwards_compat"> <para> - See the <link linkend="manual.appendix.porting.backwards">link</link> on backwards compatiblity and <link linkend="appendix.porting.api">link</link> on evolution. + See the <link linkend="manual.appendix.porting.backwards">link</link> on backwards compatibility and <link linkend="appendix.porting.api">link</link> on evolution. </para> </answer> </qandaentry> @@ -1251,4 +1251,4 @@ </article> -</book>
\ No newline at end of file +</book> diff --git a/libstdc++-v3/doc/xml/manual/abi.xml b/libstdc++-v3/doc/xml/manual/abi.xml index c11da9507db..aef14719c04 100644 --- a/libstdc++-v3/doc/xml/manual/abi.xml +++ b/libstdc++-v3/doc/xml/manual/abi.xml @@ -99,7 +99,7 @@ given compiler ABI. In a nutshell: <para> To use a specific version of the C++ ABI, one must use a - corresponding GNU C++ toolchain (Ie, g++ and libstdc++) that + corresponding GNU C++ toolchain (i.e., g++ and libstdc++) that implements the C++ ABI in question. </para> @@ -183,7 +183,7 @@ release of the series to remain link compatible. <para>It is versioned with the following labels and version definitions, where the version definition is the maximum for a particular release. Labels are cumulative. If a particular release - is not listed, it has the same version labels as the preceeding + is not listed, it has the same version labels as the preceding release.</para> <para>This corresponds to the mapfile: gcc/libgcc-std.ver</para> @@ -252,7 +252,7 @@ release of the series to remain link compatible. gcc-3.2.1 release, which has GLIBCPP_3.2.1 for new symbols and GLIBCPP_3.2 for symbols that were introduced in the gcc-3.2.0 release.) If a particular release is not listed, it has the same - version labels as the preceeding release. + version labels as the preceding release. </para> <itemizedlist> <listitem><para>gcc-3.0.0: (Error, not versioned)</para></listitem> @@ -737,7 +737,7 @@ class in registers, the compiler will be forced to use memory. See <ulink url="h <varlistentry> <term><code>namespace std</code></term> <listitem><para> Defaults to exporting all symbols in label -<code>GLIBCXX</code> that do not begin with an underscore, ie +<code>GLIBCXX</code> that do not begin with an underscore, i.e., <code>__test_func</code> would not be exported by default. Select exceptional symbols are allowed to be visible.</para></listitem> </varlistentry> @@ -972,7 +972,7 @@ gcc test.c -g -O2 -L. -lone -ltwo /usr/lib/libstdc++.so.5 /usr/lib/libstdc++.so. difficult. In particular, compiler generated constructs such as implicit instantiations for templates, typeinfo information, and virtual tables all may cause ABI leakage across shared library - boundaries. Because of this, mixing C++ ABI's is not recommended at + boundaries. Because of this, mixing C++ ABIs is not recommended at this time. </para> @@ -1127,4 +1127,4 @@ gcc test.c -g -O2 -L. -lone -ltwo /usr/lib/libstdc++.so.5 /usr/lib/libstdc++.so. </bibliography> -</sect1>
\ No newline at end of file +</sect1> diff --git a/libstdc++-v3/doc/xml/manual/allocator.xml b/libstdc++-v3/doc/xml/manual/allocator.xml index 213d82b7e59..cc325be0dc1 100644 --- a/libstdc++-v3/doc/xml/manual/allocator.xml +++ b/libstdc++-v3/doc/xml/manual/allocator.xml @@ -19,7 +19,7 @@ class template called <classname>allocator</classname>. The <classname>allocator</classname> abstraction is used throughout the library in <classname>string</classname>, container classes, - algorithnms, and parts of iostreams. This class, and base classes of + algorithms, and parts of iostreams. This class, and base classes of it, are the superset of available free store (<quote>heap</quote>) management classes. </para> @@ -261,7 +261,7 @@ directly, for every allocation. (See <filename>include/ext/new_allocator.h</filename>, for instance.) However, that option would involve changing source code to use - the a non-default allocator. Another option is to force the + a non-default allocator. Another option is to force the default allocator to remove caching and pools, and to directly allocate with every call of <function>allocate</function> and directly deallocate with every call of @@ -397,7 +397,7 @@ </para> <para> Includes memory tracking and marking abilities as well as hooks for - throwing exceptinos at configurable intervals (including random, + throwing exceptions at configurable intervals (including random, all, none). </para> </listitem> @@ -447,7 +447,7 @@ <para>The <varname>thr</varname> boolean determines whether the pool should be manipulated atomically or not. When <varname>thr</varname> = <constant>true</constant>, the allocator - is is threadsafe, while <varname>thr</varname> = + is is thread-safe, while <varname>thr</varname> = <constant>false</constant>, and is slightly faster but unsafe for multiple threads. </para> @@ -455,7 +455,7 @@ <para> For thread-enabled configurations, the pool is locked with a single big lock. In some situations, this implementation detail - may result in severe performance degredation. + may result in severe performance degradation. </para> <para> diff --git a/libstdc++-v3/doc/xml/manual/appendix_contributing.xml b/libstdc++-v3/doc/xml/manual/appendix_contributing.xml index 543296a8d5d..f9edbe1ec4b 100644 --- a/libstdc++-v3/doc/xml/manual/appendix_contributing.xml +++ b/libstdc++-v3/doc/xml/manual/appendix_contributing.xml @@ -316,7 +316,7 @@ indicate a place that may require attention for multi-thread safety. <para> </para> <sect2 id="coding_style.bad_identifiers" xreflabel="coding_style.bad"> - <title>Bad Itentifiers</title> + <title>Bad Identifiers</title> <para> Identifiers that conflict and should be avoided. </para> @@ -653,7 +653,7 @@ indicate a place that may require attention for multi-thread safety. for definitions. For C++, where we have member functions that can be either inline definitions or declarations, keeping to this standard allows all member function names for a given class to be - aligned to the same margin, increasing readibility. + aligned to the same margin, increasing readability. 10. Invocation of member functions with "this->" @@ -679,7 +679,7 @@ indicate a place that may require attention for multi-thread safety. 12. Spacing under protected and private in class declarations: space above, none below - ie + i.e. public: int foo; @@ -691,7 +691,7 @@ indicate a place that may require attention for multi-thread safety. 13. Spacing WRT return statements. no extra spacing before returns, no parenthesis - ie + i.e. } return __ret; @@ -708,7 +708,7 @@ indicate a place that may require attention for multi-thread safety. 14. Location of global variables. - All global variables of class type, whether in the "user visable" + All global variables of class type, whether in the "user visible" space (e.g., cin) or the implementation namespace, must be defined as a character array with the appropriate alignment and then later re-initialized to the correct value. @@ -1055,7 +1055,7 @@ indicate a place that may require attention for multi-thread safety. <title>Prerequisites</title> <para> Editing the DocBook sources requires an XML editor. Many - exist: some noteable options + exist: some notable options include <command>emacs</command>, <application>Kate</application>, or <application>Conglomerate</application>. </para> @@ -1083,7 +1083,7 @@ indicate a place that may require attention for multi-thread safety. </para> <para> - For procesessing XML, an XML processor and some style + For processing XML, an XML processor and some style sheets are necessary. Defaults are <command>xsltproc</command> provided by <filename>libxslt</filename>. </para> @@ -1163,10 +1163,10 @@ xmllint --noout --valid <filename>xml/index.xml</filename> faq.xml - index to FAQ api.xml - index to source level / API - All *.txml files are template xml files, ie otherwise empty files with + All *.txml files are template xml files, i.e., otherwise empty files with the correct structure, suitable for filling in with new information. - <emphasis>Cannonical Writing Style</emphasis> + <emphasis>Canonical Writing Style</emphasis> class template function template @@ -1496,7 +1496,7 @@ xmllint --noout --valid <filename>xml/index.xml</filename> "export") is badly needed. When building a shared library, the current compiler/linker cannot - automatically generate the instantiatiations needed. This creates a + automatically generate the instantiations needed. This creates a miserable situation; it means any time something is changed in the library, before a shared library can be built someone must manually copy the declarations of all templates that are needed by other parts @@ -2100,7 +2100,7 @@ xmllint --noout --valid <filename>xml/index.xml</filename> by filebuf. These wrappings have not been completed, though there is scaffolding in place. - The encapulation of certain C header <cstdio> names presents an + The encapsulation of certain C header <cstdio> names presents an interesting problem. It is possible to define an inline std::fprintf() implemented in terms of the 'extern "C"' vfprintf(), but there is no standard vfscanf() to use to implement std::fscanf(). It appears that diff --git a/libstdc++-v3/doc/xml/manual/backwards_compatibility.xml b/libstdc++-v3/doc/xml/manual/backwards_compatibility.xml index 49a0ca813b6..42a64aa98c9 100644 --- a/libstdc++-v3/doc/xml/manual/backwards_compatibility.xml +++ b/libstdc++-v3/doc/xml/manual/backwards_compatibility.xml @@ -148,7 +148,7 @@ considered replaced and rewritten. then using that to set a value for the <code>NAMESPACE_STD</code> macro. At that point, one is able to use <code>NAMESPACE_STD::string</code>, which will evaluate to - <code>std::string</code> or <code>::string</code> (ie, in the + <code>std::string</code> or <code>::string</code> (i.e., in the global namespace on systems that do not put <code>string</code> in <code>std::</code>). </para> @@ -346,7 +346,7 @@ erase(size_type __pos = 0, size_type __n = npos) </programlisting> <para> - Unfortunately, ut <code>clear</code> is not implemented in this + Unfortunately, <code>clear</code> is not implemented in this version, so you should use <code>erase</code> (which is probably faster than <code>operator=(charT*)</code>). </para> @@ -815,7 +815,7 @@ No <code>stream::attach(int fd)</code> <para> For a portable solution (among systems which use - filedescriptors), you need to implement a subclass of + file descriptors), you need to implement a subclass of <code>std::streambuf</code> (or <code>std::basic_streambuf<..></code>) which opens a file given a descriptor, and then pass an instance of this to the @@ -1312,4 +1312,4 @@ AC_DEFUN([AC_HEADER_UNORDERED_SET], [ </bibliography> -</sect1>
\ No newline at end of file +</sect1> diff --git a/libstdc++-v3/doc/xml/manual/bitmap_allocator.xml b/libstdc++-v3/doc/xml/manual/bitmap_allocator.xml index e05fc16c56a..1815a39c4c0 100644 --- a/libstdc++-v3/doc/xml/manual/bitmap_allocator.xml +++ b/libstdc++-v3/doc/xml/manual/bitmap_allocator.xml @@ -240,8 +240,8 @@ else return false.</para></listitem> </para> <para> - Where, k => The constant overhead per node. eg. for list, it is - 8 bytes, and for map it is 12 bytes. c => The size of the + where k is the constant overhead per node (e.g., for list, it is + 8 bytes, and for map it is 12 bytes) and c is the size of the base type on which the map/list is instantiated. Thus, suppose the type1 is int and type2 is double, they are related by the relation sizeof(double) == 2*sizeof(int). Thus, all types must have this @@ -556,4 +556,4 @@ equivalent.</para></listitem> </sect2> -</sect1>
\ No newline at end of file +</sect1> diff --git a/libstdc++-v3/doc/xml/manual/build_hacking.xml b/libstdc++-v3/doc/xml/manual/build_hacking.xml index b420f4f0706..3f47e654fbc 100644 --- a/libstdc++-v3/doc/xml/manual/build_hacking.xml +++ b/libstdc++-v3/doc/xml/manual/build_hacking.xml @@ -104,7 +104,7 @@ <para> Most comments should use {octothorpes, shibboleths, hash marks, - pound signs, whatevers} rather than "dnl". Nearly all comments in + pound signs, whatever} rather than "dnl". Nearly all comments in configure.ac should. Comments inside macros written in ancilliary .m4 files should. About the only comments which should <emphasis>not</emphasis> use #, but use dnl instead, are comments @@ -351,4 +351,4 @@ </sect2> -</sect1>
\ No newline at end of file +</sect1> diff --git a/libstdc++-v3/doc/xml/manual/codecvt.xml b/libstdc++-v3/doc/xml/manual/codecvt.xml index 4c14d6253f0..c836f9d0a53 100644 --- a/libstdc++-v3/doc/xml/manual/codecvt.xml +++ b/libstdc++-v3/doc/xml/manual/codecvt.xml @@ -190,7 +190,7 @@ UTF-16, UTF8, UTF16). <para> For iconv-based implementations, string literals for each of the -encodings (ie. "UCS-2" and "UTF-8") are necessary, +encodings (i.e. "UCS-2" and "UTF-8") are necessary, although for other, non-iconv implementations a table of enumerated values or some other mechanism may be required. @@ -218,7 +218,7 @@ mechanism may be required. </para></listitem> <listitem><para> - Conversion descriptors for both directions of encoding. (ie, both + Conversion descriptors for both directions of encoding. (i.e., both UCS-2 to UTF-8 and UTF-8 to UCS-2.) </para></listitem> @@ -301,7 +301,7 @@ codecvt<char, char, mbstate_t> </code> </para> <para> -This is a degenerate (ie, does nothing) specialization. Implementing +This is a degenerate (i.e., does nothing) specialization. Implementing this was a piece of cake. </para> @@ -727,4 +727,4 @@ codecvt usage. </bibliography> -</sect1>
\ No newline at end of file +</sect1> diff --git a/libstdc++-v3/doc/xml/manual/concurrency.xml b/libstdc++-v3/doc/xml/manual/concurrency.xml index 5740e424373..b21d458e96c 100644 --- a/libstdc++-v3/doc/xml/manual/concurrency.xml +++ b/libstdc++-v3/doc/xml/manual/concurrency.xml @@ -194,7 +194,7 @@ host hardware and operating system. <sect1 id="manual.ext.concurrency.impl" xreflabel="Implementation"> <title>Implementation</title> <sect2 id="manual.ext.concurrency.impl.atomic_fallbacks" xreflabel="Atomic F"> - <title>Using Builitin Atomic Functions</title> + <title>Using Builtin Atomic Functions</title> <para>The functions for atomic operations described above are either implemented via compiler intrinsics (if the underlying host is @@ -261,7 +261,7 @@ hardware, hand-crafted assembly is selected. This is the case for the following <sect2 id="manual.ext.concurrency.impl.thread" xreflabel="Pthread"> <title>Thread Abstraction</title> -<para>A thin layer above IEEE 1003.1 (ie pthreads) is used to abstract +<para>A thin layer above IEEE 1003.1 (i.e. pthreads) is used to abstract the thread interface for GCC. This layer is called "gthread," and is comprised of one header file that wraps the host's default thread layer with a POSIX-like interface. diff --git a/libstdc++-v3/doc/xml/manual/ctype.xml b/libstdc++-v3/doc/xml/manual/ctype.xml index 8ecd7b9c3d2..58f08fbdb68 100644 --- a/libstdc++-v3/doc/xml/manual/ctype.xml +++ b/libstdc++-v3/doc/xml/manual/ctype.xml @@ -99,7 +99,7 @@ characters. <listitem> <para> Get the ctype<wchar_t>::mask stuff under control. Need to - make some kind of static table, and not do lookup evertime + make some kind of static table, and not do lookup every time somebody hits the do_is... functions. Too bad we can't just redefine mask for ctype<wchar_t> </para></listitem> @@ -256,4 +256,4 @@ characters. </bibliography> -</sect1>
\ No newline at end of file +</sect1> diff --git a/libstdc++-v3/doc/xml/manual/debug_mode.xml b/libstdc++-v3/doc/xml/manual/debug_mode.xml index e5f3becd590..223abcf9ae8 100644 --- a/libstdc++-v3/doc/xml/manual/debug_mode.xml +++ b/libstdc++-v3/doc/xml/manual/debug_mode.xml @@ -582,7 +582,7 @@ template<typename _Tp, typename _Allocator = allocator<_Tp> allows release-compiled and debug-compiled code to be linked and executed together without causing unpredictable behavior. This guarantee minimizes the recompilation that users are required to - perform, shortening the detect-compile-debug bughunting cycle + perform, shortening the detect-compile-debug bug hunting cycle and making the debug mode easier to incorporate into development environments by minimizing dependencies.</para> diff --git a/libstdc++-v3/doc/xml/manual/diagnostics.xml b/libstdc++-v3/doc/xml/manual/diagnostics.xml index f43614c861e..bb6ef4d7085 100644 --- a/libstdc++-v3/doc/xml/manual/diagnostics.xml +++ b/libstdc++-v3/doc/xml/manual/diagnostics.xml @@ -39,7 +39,7 @@ <para> Derived from this are several classes that may have a - <classname>string</classname> member: a full heirarchy can be + <classname>string</classname> member: a full hierarchy can be found in the <ulink url="http://gcc.gnu.org/onlinedocs/libstdc++/latest-doxygen/a00233.html">source documentation</ulink>. </para> diff --git a/libstdc++-v3/doc/xml/manual/evolution.xml b/libstdc++-v3/doc/xml/manual/evolution.xml index 296e228311a..19734312fae 100644 --- a/libstdc++-v3/doc/xml/manual/evolution.xml +++ b/libstdc++-v3/doc/xml/manual/evolution.xml @@ -14,7 +14,7 @@ <title>API Evolution and Deprecation History</title> <para> -A list of user-visible changes, in cronological order +A list of user-visible changes, in chronological order </para> <sect2 id="api.rel_300" xreflabel="api.rel_300"> @@ -135,7 +135,7 @@ _Alloc_traits</code> have been removed. <para> Previous versions prior to 3.4 cache allocations in a memory pool, instead of passing through to call the global allocation - operators (ie, <classname>__gnu_cxx::pool_allocator</classname>). More + operators (i.e., <classname>__gnu_cxx::pool_allocator</classname>). More recent versions default to the simpler <classname>__gnu_cxx::new_allocator</classname>. </para> @@ -449,4 +449,4 @@ Namespace pb_ds moved to __gnu_pb_ds. </sect2> -</sect1>
\ No newline at end of file +</sect1> diff --git a/libstdc++-v3/doc/xml/manual/extensions.xml b/libstdc++-v3/doc/xml/manual/extensions.xml index 517d3bba39f..52cebab2ca1 100644 --- a/libstdc++-v3/doc/xml/manual/extensions.xml +++ b/libstdc++-v3/doc/xml/manual/extensions.xml @@ -357,7 +357,7 @@ get_temporary_buffer(5, (int*)0); <listitem><para><code>is_sorted</code> tests whether or not a range is sorted in nondescending order.</para></listitem> </itemizedlist> -<para>25.3.8 (lexigraphical_compare) is extended with +<para>25.3.8 (lexicographical_compare) is extended with </para> <programlisting> lexicographical_compare_3way(_InputIter1 first1, _InputIter1 last1, @@ -488,7 +488,7 @@ get_temporary_buffer(5, (int*)0); <chapter id="manual.ext.demangle" xreflabel="Demangling"> <title>Demangling</title> <para> - Transforming C++ ABI itentifiers (like RTTI symbols) into the + Transforming C++ ABI identifiers (like RTTI symbols) into the original C++ source identifiers is called <quote>demangling.</quote> </para> diff --git a/libstdc++-v3/doc/xml/manual/locale.xml b/libstdc++-v3/doc/xml/manual/locale.xml index a4f20bd974c..b77fdfcaafb 100644 --- a/libstdc++-v3/doc/xml/manual/locale.xml +++ b/libstdc++-v3/doc/xml/manual/locale.xml @@ -50,7 +50,7 @@ Literally, a facet is strictly defined: <itemizedlist> <listitem> <para> - Dontaining the following public data member: + Containing the following public data member: </para> <para> <code>static locale::id id;</code> @@ -95,13 +95,13 @@ Provides an index for looking up specific facets. <para> The major design challenge is fitting an object-orientated and -non-global locale design ontop of POSIX and other relevant stanards, +non-global locale design on top of POSIX and other relevant standards, which include the Single Unix (nee X/Open.) </para> <para> Because C and earlier versions of POSIX falls down so completely, -portibility is an issue. +portability is an issue. </para> </sect2> @@ -461,7 +461,7 @@ global locale" (emphasis Paolo), that is: <programlisting>std::setlocale(LC_ALL, "");</programlisting> <para> - On the other hand, there is *no* viceversa, that is, calling + On the other hand, there is *no* vice versa, that is, calling setlocale has *no* whatsoever on the C++ locale mechanism, in particular on the working of locale(""), which constructs the locale object from the environment of the running program, that is, in @@ -486,7 +486,7 @@ global locale" (emphasis Paolo), that is: <listitem> <para> Document how named locales error check when filling data - members. Ie, a fr_FR locale that doesn't have + members. I.e., a fr_FR locale that doesn't have numpunct::truename(): does it use "true"? Or is it a blank string? What's the convention? </para> @@ -504,7 +504,7 @@ global locale" (emphasis Paolo), that is: <listitem> <para> What should non-required facet instantiations do? If the - generic implemenation is provided, then how to end-users + generic implementation is provided, then how to end-users provide specializations? </para> </listitem> @@ -650,4 +650,4 @@ global locale" (emphasis Paolo), that is: </bibliography> -</sect1>
\ No newline at end of file +</sect1> diff --git a/libstdc++-v3/doc/xml/manual/messages.xml b/libstdc++-v3/doc/xml/manual/messages.xml index d32620fb3ad..dcb504a35d8 100644 --- a/libstdc++-v3/doc/xml/manual/messages.xml +++ b/libstdc++-v3/doc/xml/manual/messages.xml @@ -238,7 +238,7 @@ model. library locale support is necessary for more than just the <code>LC_MESSAGES</code> mask: <code>LC_CTYPE</code> is also necessary. To avoid any unpleasantness, all bits of the "C" mask - (ie <code>LC_ALL</code>) are set before retrieving messages. + (i.e. <code>LC_ALL</code>) are set before retrieving messages. </para> <para> @@ -377,7 +377,7 @@ void test01() There are issues with gettext needing the global locale set to extract a message. This dependence on the global locale makes the current "gnu" model non MT-safe. Future versions - of glibc, ie glibc 2.3.x will fix this, and the C++ library + of glibc, i.e. glibc 2.3.x will fix this, and the C++ library bits are already in place. </para> </listitem> @@ -399,7 +399,7 @@ void test01() <listitem> <para> At some point in the near future, std::numpunct will probably use - std::messages facilities to implement truename/falename + std::messages facilities to implement truename/falsename correctly. This is currently not done, but entries in libstdc++.pot have already been made for "true" and "false" string literals, so all that remains is the std::numpunct coding and the @@ -601,4 +601,4 @@ Library and Tools. </bibliography> -</sect1>
\ No newline at end of file +</sect1> diff --git a/libstdc++-v3/doc/xml/manual/parallel_mode.xml b/libstdc++-v3/doc/xml/manual/parallel_mode.xml index 449cbda29b6..79577487bd9 100644 --- a/libstdc++-v3/doc/xml/manual/parallel_mode.xml +++ b/libstdc++-v3/doc/xml/manual/parallel_mode.xml @@ -83,20 +83,13 @@ specific compiler flag. <listitem><para><function>std::unique_copy</function></para></listitem> </itemizedlist> -<para>The following library components in the includes -<filename class="headerfile">set</filename> and <filename class="headerfile">map</filename> are included in the parallel mode:</para> -<itemizedlist> - <listitem><para><code>std::(multi_)map/set<T>::(multi_)map/set(Iterator begin, Iterator end)</code> (bulk construction)</para></listitem> - <listitem><para><code>std::(multi_)map/set<T>::insert(Iterator begin, Iterator end)</code> (bulk insertion)</para></listitem> -</itemizedlist> - </sect1> <sect1 id="manual.ext.parallel_mode.semantics" xreflabel="Semantics"> <title>Semantics</title> <para> The parallel mode STL algorithms are currently not exception-safe, -i. e. user-defined functors must not throw exceptions. +i.e. user-defined functors must not throw exceptions. </para> <para> Since the current GCC OpenMP implementation does not support @@ -455,10 +448,10 @@ namespace std } </programlisting> -<para>But.... why the elipses? +<para>But.... why the ellipses? </para> -<para> The elipses in the example above represent additional overloads +<para> The ellipses in the example above represent additional overloads required for the parallel version of the function. These additional overloads are used to dispatch calls from the ISO C++ function signature to the appropriate parallel function (or sequential @@ -467,7 +460,7 @@ compile-time or run-time conditions. </para> <para> Compile-time conditions are referred to as "embarrassingly -parallel," and are denoted with the appropriate dispatch object, ie +parallel," and are denoted with the appropriate dispatch object, i.e., one of <code>__gnu_parallel::sequential_tag</code>, <code>__gnu_parallel::parallel_tag</code>, <code>__gnu_parallel::balanced_tag</code>, @@ -533,8 +526,6 @@ int main() const int threads_wanted = 20; omp_set_dynamic(false); omp_set_num_threads(threads_wanted); - if (omp_get_num_threads() != threads_wanted) - abort(); // Do work. @@ -593,7 +584,7 @@ See <ulink url="http://gcc.gnu.org/onlinedocs/libstdc++/latest-doxygen/a00505.ht <title>Run Time Settings and Defaults</title> <para> -The default parallization strategy, the choice of specific algorithm +The default parallelization strategy, the choice of specific algorithm strategy, the minimum threshold limits for individual parallel algorithms, and aspects of the underlying hardware can be specified as desired via manipulation @@ -608,7 +599,7 @@ value of enum <type>__gnu_parallel::_AlgorithmStrategy</type> type. Choices include: <type>heuristic</type>, <type>force_sequential</type>, and <type>force_parallel</type>. The default is -implementation-deduced, ie <type>heuristic</type>. +implementation-deduced, i.e. <type>heuristic</type>. </para> @@ -626,7 +617,7 @@ or <type>QS_BALANCED</type>. <para> Likewise for setting the minimal threshold for algorithm -paralleization. Parallelism always incurs some overhead. Thus, it is +parallelization. Parallelism always incurs some overhead. Thus, it is not helpful to parallelize operations on very small sets of data. Because of this, measures are taken to avoid parallelizing below a certain, pre-determined threshold. For each algorithm, a minimum diff --git a/libstdc++-v3/doc/xml/manual/status_cxx200x.xml b/libstdc++-v3/doc/xml/manual/status_cxx200x.xml index 1c6460a5544..5b49a9cb104 100644 --- a/libstdc++-v3/doc/xml/manual/status_cxx200x.xml +++ b/libstdc++-v3/doc/xml/manual/status_cxx200x.xml @@ -1052,7 +1052,7 @@ particular release. </row> <row> <entry>26.4.7.2</entry> - <entry>Function template <code>generate_cannonical</code></entry> + <entry>Function template <code>generate_canonical</code></entry> <entry></entry> <entry></entry> <entry>missing</entry> @@ -2238,4 +2238,4 @@ Footnotes shared_ptr</ulink> library. </para> -</sect2>
\ No newline at end of file +</sect2> diff --git a/libstdc++-v3/doc/xml/manual/strings.xml b/libstdc++-v3/doc/xml/manual/strings.xml index d8f2035cb6d..418aa232f29 100644 --- a/libstdc++-v3/doc/xml/manual/strings.xml +++ b/libstdc++-v3/doc/xml/manual/strings.xml @@ -35,7 +35,7 @@ <code>transform<></code> is used. </para> <para> - This code will go through some iterations. Here's a simiple + This code will go through some iterations. Here's a simple version: </para> <programlisting> @@ -126,7 +126,7 @@ </sect1> <sect1 id="strings.string.case" xreflabel="Case Sensitivity"> - <title>Case Sensivitity</title> + <title>Case Sensitivity</title> <para> </para> diff --git a/libstdc++-v3/doc/xml/manual/support.xml b/libstdc++-v3/doc/xml/manual/support.xml index 55169590028..3b0ad336680 100644 --- a/libstdc++-v3/doc/xml/manual/support.xml +++ b/libstdc++-v3/doc/xml/manual/support.xml @@ -98,7 +98,7 @@ </para> </sect1> - <sect1 id="manual.support.types.numeric_limits" xreflabel="Numeric Properites"> + <sect1 id="manual.support.types.numeric_limits" xreflabel="Numeric Properties"> <title>Numeric Properties</title> diff --git a/libstdc++-v3/doc/xml/manual/test.xml b/libstdc++-v3/doc/xml/manual/test.xml index 076138d10da..f9abbfd8da4 100644 --- a/libstdc++-v3/doc/xml/manual/test.xml +++ b/libstdc++-v3/doc/xml/manual/test.xml @@ -511,7 +511,7 @@ runtest --tool libstdc++ --srcdir=/path/to/gcc/libstdc++-v3/testsuite </para> <para> This file indicates that the host system can run tests which - incolved multiple threads. + involved multiple threads. </para> </listitem> @@ -563,7 +563,7 @@ runtest --tool libstdc++ --srcdir=/path/to/gcc/libstdc++-v3/testsuite <para> We are interested in any strange failures of the testsuite; - please email the main libstdc++ mainling list if you see + please email the main libstdc++ mailing list if you see something odd or have questions. </para> </sect3> @@ -820,4 +820,4 @@ Currently plans for supported keywords include: </sect2> -</sect1>
\ No newline at end of file +</sect1> diff --git a/libstdc++-v3/doc/xml/manual/using.xml b/libstdc++-v3/doc/xml/manual/using.xml index 2782596201f..67086833a75 100644 --- a/libstdc++-v3/doc/xml/manual/using.xml +++ b/libstdc++-v3/doc/xml/manual/using.xml @@ -110,7 +110,7 @@ </para> <para> - C++98/03 include files. These are available in the default compilation mode, ie <code>-std=c++98</code> or <code>-std=gnu++98</code>. + C++98/03 include files. These are available in the default compilation mode, i.e. <code>-std=c++98</code> or <code>-std=gnu++98</code>. </para> <table frame='all'> @@ -149,7 +149,7 @@ </tgroup> </table> -<para>C++0x include files. These are only available in C++0x compilation mode, ie <code>-std=c++0x</code> or <code>-std=gnu++0x</code>. +<para>C++0x include files. These are only available in C++0x compilation mode, i.e. <code>-std=c++0x</code> or <code>-std=gnu++0x</code>. </para> <para></para> @@ -470,7 +470,7 @@ g++ -Winvalid-pch -I. -include stdc++.h -H -g -O2 hello.cc -o test.exe <itemizedlist> <listitem><para>std</para> <para>The ISO C++ standards specify that "all library entities are defined -within namespace std." This includes namepaces nested +within namespace std." This includes namespaces nested within <code>namespace std</code>, such as <code>namespace std::tr1</code>. </para> @@ -521,7 +521,7 @@ cases where the qualified verbiage becomes unwieldy.) </sect2> - <sect2 id="manual.intro.using.namespaces.comp" xreflabel="Using Namepace Composition"> + <sect2 id="manual.intro.using.namespaces.comp" xreflabel="Using Namespace Composition"> <title>Using Namespace Composition</title> <para> diff --git a/libstdc++-v3/include/Makefile.am b/libstdc++-v3/include/Makefile.am index 68e8e35b3de..0d002273c57 100644 --- a/libstdc++-v3/include/Makefile.am +++ b/libstdc++-v3/include/Makefile.am @@ -620,6 +620,7 @@ c_base_headers = \ ${c_base_srcdir}/csetjmp \ ${c_base_srcdir}/csignal \ ${c_base_srcdir}/cstdarg \ + ${c_base_srcdir}/cstdatomic \ ${c_base_srcdir}/cstdbool \ ${c_base_srcdir}/cstddef \ ${c_base_srcdir}/cstdint \ @@ -643,7 +644,8 @@ if GLIBCXX_C_HEADERS_C_GLOBAL c_compatibility_headers = \ ${c_compatibility_srcdir}/complex.h \ ${c_compatibility_srcdir}/fenv.h \ - ${c_compatibility_srcdir}/tgmath.h + ${c_compatibility_srcdir}/tgmath.h \ + ${c_compatibility_srcdir}/stdatomic.h endif if GLIBCXX_C_HEADERS_C diff --git a/libstdc++-v3/include/Makefile.in b/libstdc++-v3/include/Makefile.in index 94038f8435f..9bd5091f132 100644 --- a/libstdc++-v3/include/Makefile.in +++ b/libstdc++-v3/include/Makefile.in @@ -49,6 +49,7 @@ am__aclocal_m4_deps = $(top_srcdir)/../config/enable.m4 \ $(top_srcdir)/../config/lib-prefix.m4 \ $(top_srcdir)/../config/multi.m4 \ $(top_srcdir)/../config/no-executables.m4 \ + $(top_srcdir)/../config/proginstall.m4 \ $(top_srcdir)/../config/unwind_ipinfo.m4 \ $(top_srcdir)/../libtool.m4 $(top_srcdir)/../ltoptions.m4 \ $(top_srcdir)/../ltsugar.m4 $(top_srcdir)/../ltversion.m4 \ @@ -867,6 +868,7 @@ c_base_headers = \ ${c_base_srcdir}/csetjmp \ ${c_base_srcdir}/csignal \ ${c_base_srcdir}/cstdarg \ + ${c_base_srcdir}/cstdatomic \ ${c_base_srcdir}/cstdbool \ ${c_base_srcdir}/cstddef \ ${c_base_srcdir}/cstdint \ @@ -885,7 +887,8 @@ c_compatibility_builddir = . @GLIBCXX_C_HEADERS_C_GLOBAL_TRUE@c_compatibility_headers = \ @GLIBCXX_C_HEADERS_C_GLOBAL_TRUE@ ${c_compatibility_srcdir}/complex.h \ @GLIBCXX_C_HEADERS_C_GLOBAL_TRUE@ ${c_compatibility_srcdir}/fenv.h \ -@GLIBCXX_C_HEADERS_C_GLOBAL_TRUE@ ${c_compatibility_srcdir}/tgmath.h +@GLIBCXX_C_HEADERS_C_GLOBAL_TRUE@ ${c_compatibility_srcdir}/tgmath.h \ +@GLIBCXX_C_HEADERS_C_GLOBAL_TRUE@ ${c_compatibility_srcdir}/stdatomic.h @GLIBCXX_C_HEADERS_C_STD_TRUE@c_compatibility_headers = @GLIBCXX_C_HEADERS_C_TRUE@c_compatibility_headers = \ diff --git a/libstdc++-v3/include/bits/c++config b/libstdc++-v3/include/bits/c++config index d42cb9feb47..e38cfe05184 100644 --- a/libstdc++-v3/include/bits/c++config +++ b/libstdc++-v3/include/bits/c++config @@ -1,7 +1,7 @@ // Predefined symbols and macros -*- C++ -*- // Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, -// 2006, 2007 Free Software Foundation, Inc. +// 2006, 2007, 2008 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free // software; you can redistribute it and/or modify it under the @@ -216,6 +216,20 @@ namespace std } #endif +// Defines for C compatibility. In particular, define extern "C" +// linkage only when using C++, same with namespaces. +#if __cplusplus +# define _GLIBCXX_BEGIN_EXTERN_C extern "C" { +# define _GLIBCXX_END_EXTERN_C } +#else +# define _GLIBCXX_BEGIN_EXTERN_C +# define _GLIBCXX_END_EXTERN_C +# undef _GLIBCXX_BEGIN_NAMESPACE +# undef _GLIBCXX_END_NAMESPACE +# define _GLIBCXX_BEGIN_NAMESPACE(X) +# define _GLIBCXX_END_NAMESPACE +#endif + // Define if compatibility should be provided for -mlong-double-64. #undef _GLIBCXX_LONG_DOUBLE_COMPAT diff --git a/libstdc++-v3/include/c_compatibility/stdatomic.h b/libstdc++-v3/include/c_compatibility/stdatomic.h new file mode 100644 index 00000000000..e5f7dcfe6c1 --- /dev/null +++ b/libstdc++-v3/include/c_compatibility/stdatomic.h @@ -0,0 +1,387 @@ +// -*- C++ -*- compatibility header. + +// Copyright (C) 2008 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// 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 this library; see the file COPYING. If not, write to +// the Free Software Foundation, 51 Franklin Street, Fifth Floor, +// Boston, MA 02110-1301, USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +/** @file stdatomic.h + * This is a Standard C++ Library header. + */ + +#include <bits/c++config.h> +#include <stddef.h> +#include <stdbool.h> // XXX need to define bool w/o stdbool.h in tr1/cstdbool + +#ifndef _GLIBCXX_STDATOMIC_H +#define _GLIBCXX_STDATOMIC_H 1 + +_GLIBCXX_BEGIN_NAMESPACE(std) +_GLIBCXX_BEGIN_EXTERN_C + + /// Enumeration for memory_order + typedef enum memory_order + { + memory_order_relaxed, + memory_order_acquire, + memory_order_release, + memory_order_acq_rel, + memory_order_seq_cst + } memory_order; + + + // Base for atomic_flag. + struct __atomic_flag_base + { + bool _M_b; + }; + + // Base for atomic_address + struct __atomic_address_base + { + void* _M_i; + }; + + // POD base classes for atomic intgral types. + struct __atomic_bool_base + { + bool _M_i; + }; + + struct __atomic_char_base + { + char _M_i; + }; + + struct __atomic_schar_base + { + signed char _M_i; + }; + + struct __atomic_uchar_base + { + unsigned char _M_i; + }; + + struct __atomic_short_base + { + short _M_i; + }; + + struct __atomic_ushort_base + { + unsigned short _M_i; + }; + + struct __atomic_int_base + { + int _M_i; + }; + + struct __atomic_uint_base + { + unsigned int _M_i; + }; + + struct __atomic_long_base + { + long _M_i; + }; + + struct __atomic_ulong_base + { + unsigned long _M_i; + }; + + struct __atomic_llong_base + { + long long _M_i; + }; + + struct __atomic_ullong_base + { + unsigned long long _M_i; + }; + + struct __atomic_wchar_t_base + { + wchar_t _M_i; + }; + + // Switch atomic integral base types based on C or C++. In + // addition, for "C" only provide type-generic macros for atomic + // operations. (As C++ accomplishes the same thing with sets of + // overloaded functions. +#ifdef __cplusplus + +#define ATOMIC_FLAG_INIT { { false } } +#define _ATOMIC_MEMBER_ ((__a)->_M_base._M_i) + +extern "C++" +{ + struct atomic_flag; + struct atomic_address; + struct atomic_bool; + struct atomic_char; + struct atomic_schar; + struct atomic_uchar; + struct atomic_short; + struct atomic_ushort; + struct atomic_int; + struct atomic_uint; + struct atomic_long; + struct atomic_ulong; + struct atomic_llong; + struct atomic_ullong; + struct atomic_wchar_t; + template<typename _Tp> + struct atomic; +} +#else + +#define ATOMIC_FLAG_INIT { false } +#define _ATOMIC_MEMBER_ ((__a)->_M_i) + + typedef struct __atomic_flag_base atomic_flag; + typedef struct __atomic_address_base atomic_address; + typedef struct __atomic_bool_base atomic_bool; + typedef struct __atomic_char_base atomic_char; + typedef struct __atomic_schar_base atomic_schar; + typedef struct __atomic_uchar_base atomic_uchar; + typedef struct __atomic_short_base atomic_short; + typedef struct __atomic_ushort_base atomic_ushort; + typedef struct __atomic_int_base atomic_int; + typedef struct __atomic_uint_base atomic_uint; + typedef struct __atomic_long_base atomic_long; + typedef struct __atomic_ulong_base atomic_ulong; + typedef struct __atomic_llong_base atomic_llong; + typedef struct __atomic_ullong_base atomic_ullong; + typedef struct __atomic_wchar_t_base atomic_wchar_t; + +#define atomic_is_lock_free(__a) \ + false + +#define atomic_load(__a) \ + _ATOMIC_LOAD_(__a, memory_order_seq_cst) + +#define atomic_load_explicit(__a, __x) \ + _ATOMIC_LOAD_(__a, __x) + +#define atomic_store(__a, __m) \ + _ATOMIC_STORE_(__a, __m, memory_order_seq_cst) + +#define atomic_store_explicit(__a, __m, __x) \ + _ATOMIC_STORE_(__a, __m, __x) + +#define atomic_swap(__a, __m) \ + _ATOMIC_MODIFY_(__a, =, __m, memory_order_seq_cst) + +#define atomic_swap_explicit(__a, __m, __x) \ + _ATOMIC_MODIFY_(__a, =, __m, __x) + +#define atomic_compare_swap(__a, __e, __m) \ + _ATOMIC_CMPSWP_(__a, __e, __m, memory_order_seq_cst) + +#define atomic_compare_swap_explicit(__a, __e, __m, __x, __y) \ + _ATOMIC_CMPSWP_(__a, __e, __m, __x) + +#define atomic_fence(__a, __x) \ + ({ _ATOMIC_FENCE_(__a, __x); }) + +#define atomic_fetch_add_explicit(__a, __m, __x) \ + _ATOMIC_MODIFY_(__a, +=, __m, __x) + +#define atomic_fetch_add(__a, __m) \ + _ATOMIC_MODIFY_(__a, +=, __m, memory_order_seq_cst) + +#define atomic_fetch_sub_explicit(__a, __m, __x) \ + _ATOMIC_MODIFY_(__a, -=, __m, __x) + +#define atomic_fetch_sub(__a, __m) \ + _ATOMIC_MODIFY_(__a, -=, __m, memory_order_seq_cst) + +#define atomic_fetch_and_explicit(__a, __m, __x) \ + _ATOMIC_MODIFY_(__a, &=, __m, __x) + +#define atomic_fetch_and(__a, __m) \ + _ATOMIC_MODIFY_(__a, &=, __m, memory_order_seq_cst) + +#define atomic_fetch_or_explicit(__a, __m, __x) \ + _ATOMIC_MODIFY_(__a, |=, __m, __x) + +#define atomic_fetch_or(__a, __m) \ + _ATOMIC_MODIFY_(__a, |=, __m, memory_order_seq_cst) + +#define atomic_fetch_xor_explicit(__a, __m, __x) \ + _ATOMIC_MODIFY_(__a, ^=, __m, __x) + +#define atomic_fetch_xor(__a, __m) \ + _ATOMIC_MODIFY_(__a, ^=, __m, memory_order_seq_cst) + +#endif + + // Typedefs for other atomic integral types. + typedef atomic_schar atomic_int_least8_t; + typedef atomic_uchar atomic_uint_least8_t; + typedef atomic_short atomic_int_least16_t; + typedef atomic_ushort atomic_uint_least16_t; + typedef atomic_int atomic_int_least32_t; + typedef atomic_uint atomic_uint_least32_t; + typedef atomic_llong atomic_int_least64_t; + typedef atomic_ullong atomic_uint_least64_t; + + typedef atomic_schar atomic_int_fast8_t; + typedef atomic_uchar atomic_uint_fast8_t; + typedef atomic_short atomic_int_fast16_t; + typedef atomic_ushort atomic_uint_fast16_t; + typedef atomic_int atomic_int_fast32_t; + typedef atomic_uint atomic_uint_fast32_t; + typedef atomic_llong atomic_int_fast64_t; + typedef atomic_ullong atomic_uint_fast64_t; + + typedef atomic_long atomic_intptr_t; + typedef atomic_ulong atomic_uintptr_t; + + typedef atomic_long atomic_ssize_t; + typedef atomic_ulong atomic_size_t; + + typedef atomic_llong atomic_intmax_t; + typedef atomic_ullong atomic_uintmax_t; + + typedef atomic_long atomic_ptrdiff_t; + + typedef atomic_int_least16_t atomic_char16_t; + typedef atomic_int_least32_t atomic_char32_t; + + // Accessor functions for atomic_flag. + extern bool + atomic_flag_test_and_set(volatile atomic_flag*); + + extern bool + atomic_flag_test_and_set_explicit(volatile atomic_flag*, memory_order); + + extern void + atomic_flag_clear(volatile atomic_flag*); + + extern void + atomic_flag_clear_explicit(volatile atomic_flag*, memory_order); + + extern void + atomic_flag_fence(const volatile atomic_flag*, memory_order); + + extern void + __atomic_flag_wait_explicit(volatile atomic_flag*, memory_order); + + extern volatile atomic_flag* + __atomic_flag_for_address(const volatile void* __z) __attribute__((const)); + + // External object. + extern const atomic_flag atomic_global_fence_compatibility; + + /// 29.2 Lock-free Property +#define ATOMIC_INTEGRAL_LOCK_FREE 0 +#define ATOMIC_ADDRESS_LOCK_FREE 0 + + // Implementation specific defines. +#define _ATOMIC_LOAD_(__a, __x) \ + ({ volatile __typeof__ _ATOMIC_MEMBER_* __p = &_ATOMIC_MEMBER_; \ + volatile atomic_flag* __g = __atomic_flag_for_address(__p); \ + __atomic_flag_wait_explicit(__g, __x); \ + __typeof__ _ATOMIC_MEMBER_ __r = *__p; \ + atomic_flag_clear_explicit(__g, __x); \ + __r; }) + +#define _ATOMIC_STORE_(__a, __m, __x) \ + ({ volatile __typeof__ _ATOMIC_MEMBER_* __p = &_ATOMIC_MEMBER_; \ + __typeof__(__m) __v = (__m); \ + volatile atomic_flag* __g = __atomic_flag_for_address(__p); \ + __atomic_flag_wait_explicit(__g, __x); \ + *__p = __v; \ + atomic_flag_clear_explicit(__g, __x); \ + __v; }) + +#define _ATOMIC_MODIFY_(__a, __o, __m, __x) \ + ({ volatile __typeof__ _ATOMIC_MEMBER_* __p = &_ATOMIC_MEMBER_; \ + __typeof__(__m) __v = (__m); \ + volatile atomic_flag* __g = __atomic_flag_for_address(__p); \ + __atomic_flag_wait_explicit(__g, __x); \ + __typeof__ _ATOMIC_MEMBER_ __r = *__p; \ + *__p __o __v; \ + atomic_flag_clear_explicit(__g, __x); \ + __r; }) + +#define _ATOMIC_CMPSWP_(__a, __e, __m, __x) \ + ({ volatile __typeof__ _ATOMIC_MEMBER_* __p = &_ATOMIC_MEMBER_; \ + __typeof__(__e) __q = (__e); \ + __typeof__(__m) __v = (__m); \ + bool __r; \ + volatile atomic_flag* __g = __atomic_flag_for_address(__p); \ + __atomic_flag_wait_explicit(__g, __x); \ + __typeof__ _ATOMIC_MEMBER_ __t__ = *__p; \ + if (__t__ == *__q) { *__p = __v; __r = true; } \ + else { *__q = __t__; __r = false; } \ + atomic_flag_clear_explicit(__g, __x); \ + __r; }) + +#define _ATOMIC_FENCE_(__a, __x) \ + ({ volatile __typeof__ _ATOMIC_MEMBER_* __p = &_ATOMIC_MEMBER_; \ + volatile atomic_flag* __g = __atomic_flag_for_address(__p); \ + atomic_flag_fence(__g, __x); \ + }) + +_GLIBCXX_END_EXTERN_C +_GLIBCXX_END_NAMESPACE + +#ifdef __cplusplus +// Inject into global namespace iff C++. +using std::memory_order; +using std::memory_order_relaxed; +using std::memory_order_acquire; +using std::memory_order_release; +using std::memory_order_acq_rel; +using std::memory_order_seq_cst; + +using std::atomic_flag; + +using std::atomic_bool; +using std::atomic_char; +using std::atomic_schar; +using std::atomic_uchar; +using std::atomic_short; +using std::atomic_ushort; +using std::atomic_int; +using std::atomic_uint; +using std::atomic_long; +using std::atomic_ulong; +using std::atomic_llong; +using std::atomic_ullong; +using std::atomic_wchar_t; + +using std::atomic_address; +using std::atomic; + +#endif + +#endif diff --git a/libstdc++-v3/include/c_global/cstdatomic b/libstdc++-v3/include/c_global/cstdatomic new file mode 100644 index 00000000000..22fde89603b --- /dev/null +++ b/libstdc++-v3/include/c_global/cstdatomic @@ -0,0 +1,4100 @@ +// -*- C++ -*- header. + +// Copyright (C) 2008 +// Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// 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 this library; see the file COPYING. If not, write to +// the Free Software Foundation, 51 Franklin Street, Fifth Floor, +// Boston, MA 02110-1301, USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +/** @file cstdatomic + * This is a Standard C++ Library file. You should @c #include this file + * in your programs, rather than any of the "*.h" implementation files. + * + * This is the C++ version of the Standard C Library header @c stdatomic.h, + * and its contents are (mostly) the same as that header, but are all + * contained in the namespace @c std (except for names which are defined + * as macros in C). + */ + +// Based on "C++ Atomic Types and Operations" by Hans Boehm and Lawrence Crowl. +// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2427.html + +#ifndef _GLIBCXX_STDATOMIC +#define _GLIBCXX_STDATOMIC 1 + +#pragma GCC system_header + +#ifndef __GXX_EXPERIMENTAL_CXX0X__ +# include <c++0x_warning.h> +#endif + +#include <stdatomic.h> +#include <cstddef> + +_GLIBCXX_BEGIN_NAMESPACE(std) + + // Can either subclass or encapsulate "C" functionality, and here + // encapsulating works with C++2003's version of POD and so is + // portable across C++2003/200x. + // Both end up being sub-optimal in terms of a constructor + // initialization list, but oh well. + + /// atomic_flag + struct atomic_flag + { + __atomic_flag_base _M_base; + + bool + test_and_set(memory_order __x = memory_order_seq_cst) volatile + { return atomic_flag_test_and_set_explicit(this, __x); } + + void + clear(memory_order __x = memory_order_seq_cst) volatile + { atomic_flag_clear_explicit(this, __x); } + + void + fence(memory_order __x) const volatile + { atomic_flag_fence(this, __x); } + +#if _GLIBCXX_USE_STANDARD_LAYOUT + // Add in non-trivial default constructor that correctly + // initializes member "as if" by ATOMIC_FLAG_INIT. + atomic_flag() { _M_base._M_b = false; } + + private: + atomic_flag(const atomic_flag&); + atomic_flag& operator=(const atomic_flag&); +#endif + }; + + /// 29.4.2, address types + typedef struct atomic_address + { + __atomic_address_base _M_base; + + bool + is_lock_free() const volatile; + + void + store(void*, memory_order = memory_order_seq_cst) volatile; + + void* + load(memory_order = memory_order_seq_cst) volatile; + + void* + swap(void*, memory_order = memory_order_seq_cst) volatile; + + bool + compare_swap(void*&, void*, memory_order, memory_order) volatile; + + bool + compare_swap(void*&, void*, memory_order = memory_order_seq_cst) volatile; + + void + fence(memory_order) const volatile; + + void* + fetch_add(ptrdiff_t, memory_order = memory_order_seq_cst) volatile; + + void* + fetch_sub(ptrdiff_t, memory_order = memory_order_seq_cst) volatile; + + void* + operator=(void* __v) volatile + { store(__v); return __v; } + + void* + operator+=(ptrdiff_t __v) volatile + { return fetch_add(__v); } + + void* + operator-=(ptrdiff_t __v) volatile + { return fetch_sub(__v); } + + friend void + atomic_store_explicit(volatile atomic_address*, void*, memory_order); + + friend void* + atomic_load_explicit(volatile atomic_address*, memory_order); + + friend void* + atomic_swap_explicit(volatile atomic_address*, void*, memory_order); + + friend bool + atomic_compare_swap_explicit(volatile atomic_address*, void**, void*, + memory_order, memory_order); + + friend void + atomic_fence(const volatile atomic_address*, memory_order); + + friend void* + atomic_fetch_add_explicit(volatile atomic_address*, ptrdiff_t, + memory_order); + + friend void* + atomic_fetch_sub_explicit(volatile atomic_address*, ptrdiff_t, + memory_order); + + atomic_address() { } + + explicit atomic_address(void* __v) + { _M_base._M_i = __v; } + + private: + atomic_address(const atomic_address&); + atomic_address& operator=(const atomic_address &); + }; + + + // 29.4.1 atomic integral types + // For each of the integral types, define atomic_[integral type] struct + // + // atomic_bool bool + // atomic_char char + // atomic_schar signed char + // atomic_uchar unsigned char + // atomic_short short + // atomic_ushort unsigned short + // atomic_int int + // atomic_uint unsigned int + // atomic_long long + // atomic_ulong unsigned long + // atomic_llong long long + // atomic_ullong unsigned long long + // atomic_char16_t char16_t + // atomic_char32_t char32_t + // atomic_wchar_t wchar_t + + /// atomic_bool + struct atomic_bool + { + __atomic_bool_base _M_base; + + bool + is_lock_free() const volatile; + + void + store(bool, memory_order = memory_order_seq_cst) volatile; + + bool + load(memory_order = memory_order_seq_cst) volatile; + + bool + swap(bool, memory_order = memory_order_seq_cst) volatile; + + bool + compare_swap(bool&, bool, memory_order, memory_order) volatile; + + bool + compare_swap(bool&, bool, memory_order = memory_order_seq_cst) volatile; + + void + fence(memory_order) const volatile; + + bool + operator=(bool __v) volatile { store(__v); return __v; } + + friend void + atomic_store_explicit(volatile atomic_bool*, bool, memory_order); + + friend bool + atomic_load_explicit(volatile atomic_bool*, memory_order); + + friend bool + atomic_swap_explicit(volatile atomic_bool*, bool, memory_order); + + friend bool + atomic_compare_swap_explicit(volatile atomic_bool*, bool*, bool, + memory_order, memory_order); + friend void + atomic_fence(const volatile atomic_bool*, memory_order); + + atomic_bool() { } + + explicit atomic_bool(bool __v) { _M_base._M_i = __v; } + + private: + atomic_bool(const atomic_bool&); + atomic_bool& operator=(const atomic_bool&); + }; + + /// atomic_char + struct atomic_char + { + __atomic_char_base _M_base; + + bool + is_lock_free() const volatile; + + void + store(char, memory_order = memory_order_seq_cst) volatile; + + char + load(memory_order = memory_order_seq_cst) volatile; + + char + swap(char, memory_order = memory_order_seq_cst) volatile; + + bool + compare_swap(char&, char, memory_order, memory_order) volatile; + + bool + compare_swap(char&, char, memory_order = memory_order_seq_cst) volatile; + + void + fence(memory_order) const volatile; + + char + fetch_add(char, memory_order = memory_order_seq_cst) volatile; + + char + fetch_sub(char, memory_order = memory_order_seq_cst) volatile; + + char + fetch_and(char, memory_order = memory_order_seq_cst) volatile; + + char + fetch_or(char, memory_order = memory_order_seq_cst) volatile; + + char + fetch_xor(char, memory_order = memory_order_seq_cst) volatile; + + char + operator=(char __v) volatile { store(__v); return __v; } + + char + operator++(int) volatile { return fetch_add(1); } + + char + operator--(int) volatile { return fetch_sub(1); } + + char + operator++() volatile { return fetch_add(1) + 1; } + + char + operator--() volatile { return fetch_sub(1) - 1; } + + char + operator+=(char __v) volatile { return fetch_add(__v) + __v; } + + char + operator-=(char __v) volatile { return fetch_sub(__v) - __v; } + + char + operator&=(char __v) volatile { return fetch_and(__v) & __v; } + + char + operator|=(char __v) volatile { return fetch_or(__v) | __v; } + + char + operator^=(char __v) volatile { return fetch_xor(__v) ^ __v; } + + friend void + atomic_store_explicit(volatile atomic_char*, char, memory_order); + + friend char + atomic_load_explicit(volatile atomic_char*, memory_order); + + friend char + atomic_swap_explicit(volatile atomic_char*, char, memory_order); + + friend bool + atomic_compare_swap_explicit(volatile atomic_char*, char*, char, + memory_order, memory_order); + + friend void + atomic_fence(const volatile atomic_char*, memory_order); + + friend char + atomic_fetch_add_explicit(volatile atomic_char*, char, memory_order); + + friend char + atomic_fetch_sub_explicit(volatile atomic_char*, char, memory_order); + + friend char + atomic_fetch_and_explicit(volatile atomic_char*, char, memory_order); + + friend char + atomic_fetch_or_explicit( volatile atomic_char*, char, memory_order); + + friend char + atomic_fetch_xor_explicit(volatile atomic_char*, char, memory_order); + + atomic_char() { } + + atomic_char(char __v) { _M_base._M_i = __v; } + + private: + atomic_char(const atomic_char&); + atomic_char& operator=(const atomic_char&); + }; + + /// atomic_schar + struct atomic_schar + { + __atomic_schar_base _M_base; + + bool + is_lock_free() const volatile; + + void + store(signed char, memory_order = memory_order_seq_cst) volatile; + + signed char + load(memory_order = memory_order_seq_cst) volatile; + + signed char + swap(signed char, memory_order = memory_order_seq_cst) volatile; + + bool + compare_swap(signed char&, signed char, memory_order, + memory_order) volatile; + + bool + compare_swap(signed char&, signed char, + memory_order = memory_order_seq_cst) volatile; + + void + fence(memory_order) const volatile; + + signed char + fetch_add(signed char, memory_order = memory_order_seq_cst) volatile; + + signed char + fetch_sub(signed char, memory_order = memory_order_seq_cst) volatile; + + signed char + fetch_and(signed char, memory_order = memory_order_seq_cst) volatile; + + signed char + fetch_or(signed char, memory_order = memory_order_seq_cst) volatile; + + signed char + fetch_xor(signed char, memory_order = memory_order_seq_cst) volatile; + + signed char + operator=(signed char __v) volatile { store(__v); return __v; } + + signed char + operator++(int) volatile { return fetch_add(1); } + + signed char + operator--(int) volatile { return fetch_sub(1); } + + signed char + operator++() volatile { return fetch_add(1) + 1; } + + signed char + operator--() volatile { return fetch_sub(1) - 1; } + + signed char + operator+=(signed char __v) volatile { return fetch_add(__v) + __v; } + + signed char + operator-=(signed char __v) volatile { return fetch_sub(__v) - __v; } + + signed char + operator&=(signed char __v) volatile { return fetch_and(__v) & __v; } + + signed char + operator|=(signed char __v) volatile { return fetch_or(__v) | __v; } + + signed char + operator^=(signed char __v) volatile { return fetch_xor(__v) ^ __v; } + + friend void + atomic_store_explicit(volatile atomic_schar*, signed char, memory_order); + + friend signed char + atomic_load_explicit(volatile atomic_schar*, memory_order); + + friend signed char + atomic_swap_explicit(volatile atomic_schar*, signed char, memory_order); + + friend bool + atomic_compare_swap_explicit(volatile atomic_schar*, signed char*, + signed char, memory_order, memory_order); + + friend void + atomic_fence(const volatile atomic_schar*, memory_order); + + friend signed char + atomic_fetch_add_explicit(volatile atomic_schar*, + signed char, memory_order); + + friend signed char + atomic_fetch_sub_explicit(volatile atomic_schar*, signed char, + memory_order); + + friend signed char + atomic_fetch_and_explicit(volatile atomic_schar*, signed char, + memory_order); + + friend signed char + atomic_fetch_or_explicit(volatile atomic_schar*, signed char, + memory_order); + + friend signed char + atomic_fetch_xor_explicit(volatile atomic_schar*, signed char, + memory_order); + + atomic_schar() { } + + atomic_schar(signed char __v) { _M_base._M_i = __v; } + + private: + atomic_schar(const atomic_schar&); + atomic_schar& operator=(const atomic_schar&); + }; + + /// atomic_uchar + struct atomic_uchar + { + __atomic_uchar_base _M_base; + + bool + is_lock_free() const volatile; + + void + store(unsigned char, memory_order = memory_order_seq_cst) volatile; + + unsigned char + load(memory_order = memory_order_seq_cst) volatile; + + unsigned char + swap(unsigned char, memory_order = memory_order_seq_cst) volatile; + + bool + compare_swap(unsigned char&, unsigned char, memory_order, + memory_order) volatile; + + bool + compare_swap(unsigned char&, unsigned char, + memory_order = memory_order_seq_cst) volatile; + + void + fence(memory_order) const volatile; + + unsigned char + fetch_add(unsigned char, memory_order = memory_order_seq_cst) volatile; + + unsigned char + fetch_sub(unsigned char, memory_order = memory_order_seq_cst) volatile; + + unsigned char + fetch_and(unsigned char, memory_order = memory_order_seq_cst) volatile; + + unsigned char + fetch_or(unsigned char, memory_order = memory_order_seq_cst) volatile; + + unsigned char + fetch_xor(unsigned char, memory_order = memory_order_seq_cst) volatile; + + unsigned char + operator=(unsigned char __v) volatile { store(__v); return __v; } + + unsigned char + operator++(int) volatile { return fetch_add(1); } + + unsigned char + operator--(int) volatile { return fetch_sub(1); } + + unsigned char + operator++() volatile { return fetch_add(1) + 1; } + + unsigned char + operator--() volatile { return fetch_sub(1) - 1; } + + unsigned char + operator+=(unsigned char __v) volatile { return fetch_add(__v) + __v; } + + unsigned char + operator-=(unsigned char __v) volatile { return fetch_sub(__v) - __v; } + + unsigned char + operator&=(unsigned char __v) volatile { return fetch_and(__v) & __v; } + + unsigned char + operator|=(unsigned char __v) volatile { return fetch_or(__v) | __v; } + + unsigned char + operator^=(unsigned char __v) volatile { return fetch_xor(__v) ^ __v; } + + friend void + atomic_store_explicit(volatile atomic_uchar*, unsigned char, memory_order); + + friend unsigned char + atomic_load_explicit(volatile atomic_uchar*, memory_order); + + friend unsigned char + atomic_swap_explicit(volatile atomic_uchar*, unsigned char, memory_order); + + friend bool + atomic_compare_swap_explicit(volatile atomic_uchar*, unsigned char*, + unsigned char, memory_order, memory_order); + + friend void + atomic_fence(const volatile atomic_uchar*, memory_order); + + friend unsigned char + atomic_fetch_add_explicit(volatile atomic_uchar*, unsigned char, + memory_order); + + friend unsigned char + atomic_fetch_sub_explicit(volatile atomic_uchar*, unsigned char, + memory_order); + + friend unsigned char + atomic_fetch_and_explicit(volatile atomic_uchar*, + unsigned char, memory_order); + + friend unsigned char + atomic_fetch_or_explicit( volatile atomic_uchar*, unsigned char, + memory_order); + + friend unsigned char + atomic_fetch_xor_explicit(volatile atomic_uchar*, unsigned char, + memory_order); + + atomic_uchar() { } + + atomic_uchar(unsigned char __v) { _M_base._M_i = __v; } + + private: + atomic_uchar(const atomic_uchar&); + atomic_uchar& operator=(const atomic_uchar&); + }; + + + /// atomic_short + struct atomic_short + { + __atomic_short_base _M_base; + + bool + is_lock_free() const volatile; + + void + store(short, memory_order = memory_order_seq_cst) volatile; + + short + load(memory_order = memory_order_seq_cst) volatile; + + short + swap(short, memory_order = memory_order_seq_cst) volatile; + + bool + compare_swap(short&, short, memory_order, memory_order) volatile; + + bool + compare_swap(short&, short, memory_order = memory_order_seq_cst) volatile; + + void + fence(memory_order) const volatile; + + short + fetch_add(short, memory_order = memory_order_seq_cst) volatile; + + short + fetch_sub(short, memory_order = memory_order_seq_cst) volatile; + + short + fetch_and(short, memory_order = memory_order_seq_cst) volatile; + + short + fetch_or(short, memory_order = memory_order_seq_cst) volatile; + + short + fetch_xor(short, memory_order = memory_order_seq_cst) volatile; + + short + operator=(short __v) volatile { store(__v); return __v; } + + short + operator++(int) volatile { return fetch_add(1); } + + short + operator--(int) volatile { return fetch_sub(1); } + + short + operator++() volatile { return fetch_add(1) + 1; } + + short + operator--() volatile { return fetch_sub(1) - 1; } + + short + operator+=(short __v) volatile { return fetch_add(__v) + __v; } + + short + operator-=(short __v) volatile { return fetch_sub(__v) - __v; } + + short + operator&=(short __v) volatile { return fetch_and(__v) & __v; } + + short + operator|=(short __v) volatile { return fetch_or(__v) | __v; } + + short + operator^=(short __v) volatile { return fetch_xor(__v) ^ __v; } + + friend void + atomic_store_explicit(volatile atomic_short*, short, memory_order); + + friend short + atomic_load_explicit(volatile atomic_short*, memory_order); + + friend short + atomic_swap_explicit(volatile atomic_short*, short, memory_order); + + friend bool + atomic_compare_swap_explicit(volatile atomic_short*, short*, short, + memory_order, memory_order); + + friend void + atomic_fence(const volatile atomic_short*, memory_order); + + friend short + atomic_fetch_add_explicit(volatile atomic_short*, short, memory_order); + + friend short + atomic_fetch_sub_explicit(volatile atomic_short*, short, memory_order); + + friend short + atomic_fetch_and_explicit(volatile atomic_short*, short, memory_order); + + friend short + atomic_fetch_or_explicit( volatile atomic_short*, short, memory_order); + + friend short + atomic_fetch_xor_explicit(volatile atomic_short*, short, memory_order); + + atomic_short() { } + + atomic_short(short __v) { _M_base._M_i = __v; } + + private: + atomic_short(const atomic_short&); + atomic_short& operator=(const atomic_short&); + }; + + /// atomic_ushort + struct atomic_ushort + { + __atomic_ushort_base _M_base; + + bool + is_lock_free() const volatile; + + void + store(unsigned short, memory_order = memory_order_seq_cst) volatile; + + unsigned short + load(memory_order = memory_order_seq_cst) volatile; + + unsigned short + swap(unsigned short, memory_order = memory_order_seq_cst) volatile; + + bool + compare_swap(unsigned short&, unsigned short, memory_order, + memory_order) volatile; + + bool + compare_swap(unsigned short&, unsigned short, + memory_order = memory_order_seq_cst) volatile; + + void + fence(memory_order) const volatile; + + unsigned short + fetch_add(unsigned short, memory_order = memory_order_seq_cst) volatile; + + unsigned short + fetch_sub(unsigned short, memory_order = memory_order_seq_cst) volatile; + + unsigned short + fetch_and(unsigned short, memory_order = memory_order_seq_cst) volatile; + + unsigned short + fetch_or(unsigned short, memory_order = memory_order_seq_cst) volatile; + + unsigned short + fetch_xor(unsigned short, memory_order = memory_order_seq_cst) volatile; + + unsigned short + operator=(unsigned short __v) volatile { store(__v); return __v; } + + unsigned short + operator++(int) volatile { return fetch_add(1); } + + unsigned short + operator--(int) volatile { return fetch_sub(1); } + + unsigned short + operator++() volatile { return fetch_add(1) + 1; } + + unsigned short + operator--() volatile { return fetch_sub(1) - 1; } + + unsigned short + operator+=(unsigned short __v) volatile { return fetch_add(__v) + __v; } + + unsigned short + operator-=(unsigned short __v) volatile { return fetch_sub(__v) - __v; } + + unsigned short + operator&=(unsigned short __v) volatile { return fetch_and(__v) & __v; } + + unsigned short + operator|=(unsigned short __v) volatile { return fetch_or(__v) | __v; } + + unsigned short + operator^=(unsigned short __v) volatile { return fetch_xor(__v) ^ __v; } + + friend void + atomic_store_explicit(volatile atomic_ushort*, unsigned short, + memory_order); + + friend unsigned short + atomic_load_explicit(volatile atomic_ushort*, memory_order); + + friend unsigned short + atomic_swap_explicit(volatile atomic_ushort*, unsigned short, memory_order); + + friend bool + atomic_compare_swap_explicit(volatile atomic_ushort*, unsigned short*, + unsigned short, memory_order, memory_order); + + friend void + atomic_fence(const volatile atomic_ushort*, memory_order); + + friend unsigned short + atomic_fetch_add_explicit(volatile atomic_ushort*, unsigned short, + memory_order); + + friend unsigned short + atomic_fetch_sub_explicit(volatile atomic_ushort*, unsigned short, + memory_order); + + friend unsigned short + atomic_fetch_and_explicit(volatile atomic_ushort*, unsigned short, + memory_order); + + friend unsigned short + atomic_fetch_or_explicit( volatile atomic_ushort*, unsigned short, + memory_order); + + friend unsigned short + atomic_fetch_xor_explicit(volatile atomic_ushort*, unsigned short, + memory_order); + + atomic_ushort() { } + + atomic_ushort(unsigned short __v) { _M_base._M_i = __v; } + + private: + atomic_ushort(const atomic_ushort&); + atomic_ushort& operator=(const atomic_ushort&); + }; + + /// atomic_int + struct atomic_int + { + __atomic_int_base _M_base; + + bool + is_lock_free() const volatile; + + void + store(int, memory_order = memory_order_seq_cst) volatile; + + int + load(memory_order = memory_order_seq_cst) volatile; + + int + swap(int, memory_order = memory_order_seq_cst) volatile; + + bool + compare_swap(int&, int, memory_order, memory_order) volatile; + + bool + compare_swap(int&, int, memory_order = memory_order_seq_cst) volatile; + + void + fence(memory_order) const volatile; + + int + fetch_add(int, memory_order = memory_order_seq_cst) volatile; + + int + fetch_sub(int, memory_order = memory_order_seq_cst) volatile; + + int + fetch_and(int, memory_order = memory_order_seq_cst) volatile; + + int + fetch_or(int, memory_order = memory_order_seq_cst) volatile; + + int + fetch_xor(int, memory_order = memory_order_seq_cst) volatile; + + int + operator=(int __v) volatile { store(__v); return __v; } + + int + operator++(int) volatile { return fetch_add(1); } + + int + operator--(int) volatile { return fetch_sub(1); } + + int + operator++() volatile { return fetch_add(1) + 1; } + + int + operator--() volatile { return fetch_sub(1) - 1; } + + int + operator+=(int __v) volatile { return fetch_add(__v) + __v; } + + int + operator-=(int __v) volatile { return fetch_sub(__v) - __v; } + + int + operator&=(int __v) volatile { return fetch_and(__v) & __v; } + + int + operator|=(int __v) volatile { return fetch_or(__v) | __v; } + + int + operator^=(int __v) volatile { return fetch_xor(__v) ^ __v; } + + friend void + atomic_store_explicit(volatile atomic_int*, int, memory_order); + + friend int + atomic_load_explicit(volatile atomic_int*, memory_order); + + friend int + atomic_swap_explicit(volatile atomic_int*, int, memory_order); + + friend bool + atomic_compare_swap_explicit(volatile atomic_int*, int*, int, + memory_order, memory_order); + + friend void + atomic_fence(const volatile atomic_int*, memory_order); + + friend int + atomic_fetch_add_explicit(volatile atomic_int*, int, memory_order); + + friend int + atomic_fetch_sub_explicit(volatile atomic_int*, int, memory_order); + + friend int + atomic_fetch_and_explicit(volatile atomic_int*, int, memory_order); + + friend int + atomic_fetch_or_explicit( volatile atomic_int*, int, memory_order); + + friend int + atomic_fetch_xor_explicit(volatile atomic_int*, int, memory_order); + + atomic_int() { } + + atomic_int(int __v) { _M_base._M_i = __v; } + + private: + atomic_int(const atomic_int&); + atomic_int& operator=(const atomic_int&); + }; + + /// atomic_uint + struct atomic_uint + { + __atomic_uint_base _M_base; + + bool + is_lock_free() const volatile; + + void + store(unsigned int, memory_order = memory_order_seq_cst) volatile; + + unsigned int + load(memory_order = memory_order_seq_cst) volatile; + + unsigned int + swap(unsigned int, memory_order = memory_order_seq_cst) volatile; + + bool + compare_swap(unsigned int&, unsigned int, memory_order, + memory_order) volatile; + + bool + compare_swap(unsigned int&, unsigned int, + memory_order = memory_order_seq_cst) volatile; + + void + fence(memory_order) const volatile; + + unsigned int + fetch_add(unsigned int, memory_order = memory_order_seq_cst) volatile; + + unsigned int + fetch_sub(unsigned int, memory_order = memory_order_seq_cst) volatile; + + unsigned int + fetch_and(unsigned int, memory_order = memory_order_seq_cst) volatile; + + unsigned int + fetch_or(unsigned int, memory_order = memory_order_seq_cst) volatile; + + unsigned int + fetch_xor(unsigned int, memory_order = memory_order_seq_cst) volatile; + + unsigned int + operator=(unsigned int __v) volatile { store(__v); return __v; } + + unsigned int + operator++(int) volatile { return fetch_add(1); } + + unsigned int + operator--(int) volatile { return fetch_sub(1); } + + unsigned int + operator++() volatile { return fetch_add(1) + 1; } + + unsigned int + operator--() volatile { return fetch_sub(1) - 1; } + + unsigned int + operator+=(unsigned int __v) volatile { return fetch_add(__v) + __v; } + + unsigned int + operator-=(unsigned int __v) volatile { return fetch_sub(__v) - __v; } + + unsigned int + operator&=(unsigned int __v) volatile { return fetch_and(__v) & __v; } + + unsigned int + operator|=(unsigned int __v) volatile { return fetch_or(__v) | __v; } + + unsigned int + operator^=(unsigned int __v) volatile { return fetch_xor(__v) ^ __v; } + + friend void + atomic_store_explicit(volatile atomic_uint*, unsigned int, memory_order); + + friend unsigned int + atomic_load_explicit(volatile atomic_uint*, memory_order); + + friend unsigned int + atomic_swap_explicit(volatile atomic_uint*, unsigned int, memory_order); + + friend bool + atomic_compare_swap_explicit(volatile atomic_uint*, unsigned int*, + unsigned int, memory_order, memory_order); + + friend void + atomic_fence(const volatile atomic_uint*, memory_order); + + friend unsigned int + atomic_fetch_add_explicit(volatile atomic_uint*, unsigned int, + memory_order); + + friend unsigned int + atomic_fetch_sub_explicit(volatile atomic_uint*, unsigned int, + memory_order); + + friend unsigned int + atomic_fetch_and_explicit(volatile atomic_uint*, unsigned int, + memory_order); + + friend unsigned int + atomic_fetch_or_explicit( volatile atomic_uint*, unsigned int, + memory_order); + + friend unsigned int + atomic_fetch_xor_explicit(volatile atomic_uint*, unsigned int, + memory_order); + + atomic_uint() { } + + atomic_uint(unsigned int __v) { _M_base._M_i = __v; } + + private: + atomic_uint(const atomic_uint&); + atomic_uint& operator=(const atomic_uint&); + }; + + /// atomic_long + struct atomic_long + { + __atomic_long_base _M_base; + + bool + is_lock_free() const volatile; + + void + store(long, memory_order = memory_order_seq_cst) volatile; + + long + load(memory_order = memory_order_seq_cst) volatile; + + long + swap(long, memory_order = memory_order_seq_cst) volatile; + + bool + compare_swap(long&, long, memory_order, memory_order) volatile; + + bool + compare_swap(long&, long, memory_order = memory_order_seq_cst) volatile; + + void + fence(memory_order) const volatile; + + long + fetch_add(long, memory_order = memory_order_seq_cst) volatile; + + long + fetch_sub(long, memory_order = memory_order_seq_cst) volatile; + + long + fetch_and(long, memory_order = memory_order_seq_cst) volatile; + + long + fetch_or(long, memory_order = memory_order_seq_cst) volatile; + + long + fetch_xor(long, memory_order = memory_order_seq_cst) volatile; + + long + operator=(long __v) volatile { store(__v); return __v; } + + long + operator++(int) volatile { return fetch_add(1); } + + long + operator--(int) volatile { return fetch_sub(1); } + + long + operator++() volatile { return fetch_add(1) + 1; } + + long + operator--() volatile { return fetch_sub(1) - 1; } + + long + operator+=(long __v) volatile { return fetch_add(__v) + __v; } + + long + operator-=(long __v) volatile { return fetch_sub(__v) - __v; } + + long + operator&=(long __v) volatile { return fetch_and(__v) & __v; } + + long + operator|=(long __v) volatile { return fetch_or(__v) | __v; } + + long + operator^=(long __v) volatile { return fetch_xor(__v) ^ __v; } + + friend void + atomic_store_explicit(volatile atomic_long*, long, memory_order); + + friend long + atomic_load_explicit(volatile atomic_long*, memory_order); + + friend long + atomic_swap_explicit(volatile atomic_long*, long, memory_order); + + friend bool + atomic_compare_swap_explicit(volatile atomic_long*, long*, long, + memory_order, memory_order); + + friend void + atomic_fence(const volatile atomic_long*, memory_order); + + friend long + atomic_fetch_add_explicit(volatile atomic_long*, long, memory_order); + + friend long + atomic_fetch_sub_explicit(volatile atomic_long*, long, memory_order); + + friend long + atomic_fetch_and_explicit(volatile atomic_long*, long, memory_order); + + friend long + atomic_fetch_or_explicit( volatile atomic_long*, long, memory_order); + + friend long + atomic_fetch_xor_explicit(volatile atomic_long*, long, memory_order); + + atomic_long() { } + + atomic_long(long __v) { _M_base._M_i = __v; } + + private: + atomic_long(const atomic_long&); + atomic_long& operator=(const atomic_long&); + }; + + /// atomic_ulong + struct atomic_ulong + { + __atomic_ulong_base _M_base; + + bool + is_lock_free() const volatile; + + void + store(unsigned long, memory_order = memory_order_seq_cst) volatile; + + unsigned long + load(memory_order = memory_order_seq_cst) volatile; + + unsigned long + swap(unsigned long, memory_order = memory_order_seq_cst) volatile; + + bool + compare_swap(unsigned long&, unsigned long, memory_order, + memory_order) volatile; + + bool + compare_swap(unsigned long&, unsigned long, + memory_order = memory_order_seq_cst) volatile; + + void + fence(memory_order) const volatile; + + unsigned long + fetch_add(unsigned long, memory_order = memory_order_seq_cst) volatile; + + unsigned long + fetch_sub(unsigned long, memory_order = memory_order_seq_cst) volatile; + + unsigned long + fetch_and(unsigned long, memory_order = memory_order_seq_cst) volatile; + + unsigned long + fetch_or(unsigned long, memory_order = memory_order_seq_cst) volatile; + + unsigned long + fetch_xor(unsigned long, memory_order = memory_order_seq_cst) volatile; + + unsigned long + operator=(unsigned long __v) volatile { store(__v); return __v; } + + unsigned long + operator++(int) volatile { return fetch_add(1); } + + unsigned long + operator--(int) volatile { return fetch_sub(1); } + + unsigned long + operator++() volatile { return fetch_add(1) + 1; } + + unsigned long + operator--() volatile { return fetch_sub(1) - 1; } + + unsigned long + operator+=(unsigned long __v) volatile { return fetch_add(__v) + __v; } + + unsigned long + operator-=(unsigned long __v) volatile { return fetch_sub(__v) - __v; } + + unsigned long + operator&=(unsigned long __v) volatile { return fetch_and(__v) & __v; } + + unsigned long + operator|=(unsigned long __v) volatile { return fetch_or(__v) | __v; } + + unsigned long + operator^=(unsigned long __v) volatile { return fetch_xor(__v) ^ __v; } + + friend void + atomic_store_explicit(volatile atomic_ulong*, unsigned long, memory_order); + + friend unsigned long + atomic_load_explicit(volatile atomic_ulong*, memory_order); + + friend unsigned long + atomic_swap_explicit(volatile atomic_ulong*, unsigned long, memory_order); + + friend bool + atomic_compare_swap_explicit(volatile atomic_ulong*, unsigned long*, + unsigned long, memory_order, memory_order); + + friend void + atomic_fence(const volatile atomic_ulong*, memory_order); + + friend unsigned long + atomic_fetch_add_explicit(volatile atomic_ulong*, unsigned long, + memory_order); + + friend unsigned long + atomic_fetch_sub_explicit(volatile atomic_ulong*, unsigned long, + memory_order); + + friend unsigned long + atomic_fetch_and_explicit(volatile atomic_ulong*, unsigned long, + memory_order); + friend unsigned long + atomic_fetch_or_explicit(volatile atomic_ulong*, unsigned long, + memory_order); + + friend unsigned long + atomic_fetch_xor_explicit(volatile atomic_ulong*, unsigned long, + memory_order); + + atomic_ulong() { } + + atomic_ulong(unsigned long __v) { _M_base._M_i = __v; } + + private: + atomic_ulong(const atomic_ulong&); + atomic_ulong& operator=(const atomic_ulong&); + }; + + /// atomic_llong + struct atomic_llong + { + __atomic_llong_base _M_base; + + bool + is_lock_free() const volatile; + + void + store(long long, memory_order = memory_order_seq_cst) volatile; + + long long + load(memory_order = memory_order_seq_cst) volatile; + + long long + swap(long long, memory_order = memory_order_seq_cst) volatile; + + bool + compare_swap(long long&, long long, memory_order, memory_order) volatile; + + bool + compare_swap(long long&, long long, + memory_order = memory_order_seq_cst) volatile; + + void + fence(memory_order) const volatile; + + long long + fetch_add(long long, memory_order = memory_order_seq_cst) volatile; + + long long + fetch_sub(long long, memory_order = memory_order_seq_cst) volatile; + + long long + fetch_and(long long, memory_order = memory_order_seq_cst) volatile; + + long long + fetch_or(long long, memory_order = memory_order_seq_cst) volatile; + + long long + fetch_xor(long long, memory_order = memory_order_seq_cst) volatile; + + long long + operator=(long long __v) volatile { store(__v); return __v; } + + long long + operator++(int) volatile { return fetch_add(1); } + + long long + operator--(int) volatile { return fetch_sub(1); } + + long long + operator++() volatile { return fetch_add(1) + 1; } + + long long + operator--() volatile { return fetch_sub(1) - 1; } + + long long + operator+=(long long __v) volatile { return fetch_add(__v) + __v; } + + long long + operator-=(long long __v) volatile { return fetch_sub(__v) - __v; } + + long long + operator&=(long long __v) volatile { return fetch_and(__v) & __v; } + + long long + operator|=(long long __v) volatile { return fetch_or(__v) | __v; } + + long long + operator^=(long long __v) volatile { return fetch_xor(__v) ^ __v; } + + friend void + atomic_store_explicit(volatile atomic_llong*, long long, memory_order); + + friend long long + atomic_load_explicit(volatile atomic_llong*, memory_order); + + friend long long + atomic_swap_explicit(volatile atomic_llong*, long long, memory_order); + + friend bool + atomic_compare_swap_explicit(volatile atomic_llong*, long long*, + long long, memory_order, memory_order); + + friend void + atomic_fence(const volatile atomic_llong*, memory_order); + + friend long long + atomic_fetch_add_explicit(volatile atomic_llong*, long long, memory_order); + + friend long long + atomic_fetch_sub_explicit(volatile atomic_llong*, long long, memory_order); + + friend long long + atomic_fetch_and_explicit(volatile atomic_llong*, long long, memory_order); + + friend long long + atomic_fetch_or_explicit(volatile atomic_llong*, long long, memory_order); + + friend long long + atomic_fetch_xor_explicit(volatile atomic_llong*, long long, memory_order); + + atomic_llong() { } + + atomic_llong(long long __v) { _M_base._M_i = __v; } + + private: + atomic_llong(const atomic_llong&); + atomic_llong& operator=(const atomic_llong&); + }; + + /// atomic_ullong + struct atomic_ullong + { + __atomic_ullong_base _M_base; + + bool + is_lock_free() const volatile; + + void + store(unsigned long long, memory_order = memory_order_seq_cst) volatile; + + unsigned long long + load(memory_order = memory_order_seq_cst) volatile; + + unsigned long long + swap(unsigned long long, memory_order = memory_order_seq_cst) volatile; + + bool + compare_swap(unsigned long long&, unsigned long long, memory_order, + memory_order) volatile; + + bool + compare_swap(unsigned long long&, unsigned long long, + memory_order = memory_order_seq_cst) volatile; + + void + fence(memory_order) const volatile; + + unsigned long long + fetch_add(unsigned long long, memory_order = memory_order_seq_cst) volatile; + + unsigned long long + fetch_sub(unsigned long long, memory_order = memory_order_seq_cst) volatile; + + unsigned long long + fetch_and(unsigned long long, memory_order = memory_order_seq_cst) volatile; + + unsigned long long + fetch_or(unsigned long long, memory_order = memory_order_seq_cst) volatile; + + unsigned long long + fetch_xor(unsigned long long, memory_order = memory_order_seq_cst) volatile; + + unsigned long long + operator=(unsigned long long __v) volatile + { store(__v); return __v; } + + unsigned long long + operator++(int) volatile + { return fetch_add(1); } + + unsigned long long + operator--(int) volatile + { return fetch_sub(1); } + + unsigned long long + operator++() volatile + { return fetch_add(1) + 1; } + + unsigned long long + operator--() volatile + { return fetch_sub(1) - 1; } + + unsigned long long + operator+=(unsigned long long __v) volatile + { return fetch_add(__v) + __v; } + + unsigned long long + operator-=(unsigned long long __v) volatile + { return fetch_sub(__v) - __v; } + + unsigned long long + operator&=(unsigned long long __v) volatile + { return fetch_and(__v) & __v; } + + unsigned long long + operator|=(unsigned long long __v) volatile + { return fetch_or(__v) | __v; } + + unsigned long long + operator^=(unsigned long long __v) volatile + { return fetch_xor(__v) ^ __v; } + + friend void + atomic_store_explicit(volatile atomic_ullong*, unsigned long long, + memory_order); + friend unsigned long long + atomic_load_explicit(volatile atomic_ullong*, memory_order); + + friend unsigned long long + atomic_swap_explicit(volatile atomic_ullong*, unsigned long long, + memory_order); + + friend bool + atomic_compare_swap_explicit(volatile atomic_ullong*, unsigned long long*, + unsigned long long, memory_order, + memory_order); + + friend void + atomic_fence(const volatile atomic_ullong*, memory_order); + + friend unsigned long long + atomic_fetch_add_explicit(volatile atomic_ullong*, unsigned long long, + memory_order); + + friend unsigned long long + atomic_fetch_sub_explicit(volatile atomic_ullong*, unsigned long long, + memory_order); + + friend unsigned long long + atomic_fetch_and_explicit(volatile atomic_ullong*, unsigned long long, + memory_order); + + friend unsigned long long + atomic_fetch_or_explicit(volatile atomic_ullong*, unsigned long long, + memory_order); + + friend unsigned long long + atomic_fetch_xor_explicit(volatile atomic_ullong*, unsigned long long, + memory_order); + + atomic_ullong() { } + + atomic_ullong(unsigned long long __v) { _M_base._M_i = __v; } + + private: + atomic_ullong(const atomic_ullong&); + atomic_ullong& operator=(const atomic_ullong&); + }; + + /// atomic_wchar_t + struct atomic_wchar_t + { + __atomic_wchar_t_base _M_base; + + bool + is_lock_free() const volatile; + + void + store(wchar_t, memory_order = memory_order_seq_cst) volatile; + + wchar_t + load(memory_order = memory_order_seq_cst) volatile; + + wchar_t + swap(wchar_t, memory_order = memory_order_seq_cst) volatile; + + bool + compare_swap(wchar_t&, wchar_t, memory_order, memory_order) volatile; + + bool + compare_swap(wchar_t&, wchar_t, + memory_order = memory_order_seq_cst) volatile; + + void + fence(memory_order) const volatile; + + wchar_t + fetch_add(wchar_t, memory_order = memory_order_seq_cst) volatile; + + wchar_t + fetch_sub(wchar_t, memory_order = memory_order_seq_cst) volatile; + + wchar_t + fetch_and(wchar_t, memory_order = memory_order_seq_cst) volatile; + + wchar_t + fetch_or(wchar_t, memory_order = memory_order_seq_cst) volatile; + + wchar_t + fetch_xor(wchar_t, memory_order = memory_order_seq_cst) volatile; + + wchar_t + operator=(wchar_t __v) volatile + { store(__v); return __v; } + + wchar_t + operator++(int) volatile + { return fetch_add(1); } + + wchar_t + operator--(int) volatile + { return fetch_sub(1); } + + wchar_t + operator++() volatile + { return fetch_add(1) + 1; } + + wchar_t + operator--() volatile + { return fetch_sub(1) - 1; } + + wchar_t + operator+=(wchar_t __v) volatile + { return fetch_add(__v) + __v; } + + wchar_t + operator-=(wchar_t __v) volatile + { return fetch_sub(__v) - __v; } + + wchar_t + operator&=(wchar_t __v) volatile + { return fetch_and(__v) & __v; } + + wchar_t + operator|=(wchar_t __v) volatile + { return fetch_or(__v) | __v; } + + wchar_t + operator^=(wchar_t __v) volatile + { return fetch_xor(__v) ^ __v; } + + friend void + atomic_store_explicit(volatile atomic_wchar_t*, wchar_t, memory_order); + + friend wchar_t + atomic_load_explicit(volatile atomic_wchar_t*, memory_order); + + friend wchar_t + atomic_swap_explicit(volatile atomic_wchar_t*, wchar_t, memory_order); + + friend bool + atomic_compare_swap_explicit(volatile atomic_wchar_t*, + wchar_t*, wchar_t, memory_order, memory_order); + + friend void + atomic_fence(const volatile atomic_wchar_t*, memory_order); + + friend wchar_t + atomic_fetch_add_explicit(volatile atomic_wchar_t*, wchar_t, memory_order); + + friend wchar_t + atomic_fetch_sub_explicit(volatile atomic_wchar_t*, wchar_t, memory_order); + + friend wchar_t + atomic_fetch_and_explicit(volatile atomic_wchar_t*, wchar_t, memory_order); + + friend wchar_t + atomic_fetch_or_explicit(volatile atomic_wchar_t*, wchar_t, memory_order); + + friend wchar_t + atomic_fetch_xor_explicit(volatile atomic_wchar_t*, wchar_t, memory_order); + + atomic_wchar_t() { } + + atomic_wchar_t(wchar_t __v) { _M_base._M_i = __v; } + + private: + atomic_wchar_t(const atomic_wchar_t&); + atomic_wchar_t& operator=(const atomic_wchar_t&); + }; + + + /// atomic + /// 29.4.3, Generic atomic type, primary class template. + template<typename _Tp> + struct atomic + { + bool + is_lock_free() const volatile; + + void + store(_Tp, memory_order = memory_order_seq_cst) volatile; + + _Tp + load(memory_order = memory_order_seq_cst) volatile; + + _Tp + swap(_Tp __v, memory_order = memory_order_seq_cst) volatile; + + bool + compare_swap(_Tp&, _Tp, memory_order, memory_order) volatile; + + bool + compare_swap(_Tp&, _Tp, memory_order = memory_order_seq_cst) volatile; + + void + fence(memory_order) const volatile; + + _Tp + operator=(_Tp __v) volatile { store(__v); return __v; } + + atomic() { } + + explicit atomic(_Tp __v) : __f(__v) { } + + private: + atomic(const atomic&); + atomic& operator=(const atomic&); + + _Tp __f; + }; + + /// Partial specialization for pointer types. + template<typename _Tp> + struct atomic<_Tp*> : atomic_address + { + _Tp* + load(memory_order = memory_order_seq_cst) volatile; + + _Tp* + swap(_Tp*, memory_order = memory_order_seq_cst) volatile; + + bool + compare_swap(_Tp*&, _Tp*, memory_order, memory_order) volatile; + + bool + compare_swap(_Tp*&, _Tp*, memory_order = memory_order_seq_cst) volatile; + + _Tp* + fetch_add(ptrdiff_t, memory_order = memory_order_seq_cst) volatile; + + _Tp* + fetch_sub(ptrdiff_t, memory_order = memory_order_seq_cst) volatile; + + _Tp* + operator=(_Tp* __v) volatile { store(__v); return __v; } + + _Tp* + operator++(int) volatile { return fetch_add(1); } + + _Tp* + operator--(int) volatile { return fetch_sub(1); } + + _Tp* + operator++() volatile { return fetch_add(1) + 1; } + + _Tp* + operator--() volatile { return fetch_sub(1) - 1; } + + _Tp* + operator+=(ptrdiff_t __v) volatile + { return fetch_add(__v) + __v; } + + _Tp* + operator-=(ptrdiff_t __v) volatile + { return fetch_sub(__v) - __v; } + + atomic() { } + + explicit atomic(_Tp* __v) : atomic_address(__v) { } + + private: + atomic(const atomic&); + atomic& operator=(const atomic&); + }; + + /// Explicit specialization for bool. + template<> + struct atomic<bool> : atomic_bool + { + atomic() { } + + explicit atomic(bool __v) : atomic_bool(__v) { } + + bool + operator=(bool __v) volatile { store(__v); return __v; } + + private: + atomic(const atomic&); + atomic& operator=(const atomic&); + }; + + /// Explicit specialization for void* + template<> + struct atomic<void*> : atomic_address + { + atomic() { } + + explicit atomic(void* __v) : atomic_address(__v) { } + + void* + operator=(void* __v) volatile { store(__v); return __v; } + + private: + atomic(const atomic&); + atomic& operator=(const atomic&); + }; + + /// Explicit specialization for char. + template<> + struct atomic<char> : atomic_char + { + atomic() { } + + explicit atomic(char __v) : atomic_char(__v) { } + + char + operator=(char __v) volatile { store(__v); return __v; } + + private: + atomic(const atomic&); + atomic& operator=(const atomic&); + }; + + + /// Explicit specialization for signed char. + template<> + struct atomic<signed char> : atomic_schar + { + atomic() { } + + explicit atomic(signed char __v) : atomic_schar(__v) { } + + signed char + operator=(signed char __v) volatile { store(__v); return __v; } + + private: + atomic(const atomic&); + atomic& operator=(const atomic&); + }; + + /// Explicit specialization for unsigned char. + template<> + struct atomic<unsigned char> : atomic_uchar + { + atomic() { } + + explicit atomic(unsigned char __v) : atomic_uchar(__v) { } + + unsigned char + operator=(unsigned char __v) volatile { store(__v); return __v; } + + private: + atomic(const atomic&); + atomic& + operator=(const atomic&); + }; + + /// Explicit specialization for short. + template<> + struct atomic<short> : atomic_short + { + atomic() { } + + explicit atomic(short __v) : atomic_short(__v) { } + + short + operator=(short __v) volatile { store(__v); return __v; } + + private: + atomic(const atomic&); + atomic& operator=(const atomic&); + }; + + /// Explicit specialization for unsigned short. + template<> + struct atomic<unsigned short> : atomic_ushort + { + atomic() { } + + explicit atomic(unsigned short __v) : atomic_ushort(__v) { } + + unsigned short + operator=(unsigned short __v) volatile { store(__v); return __v; } + + private: + atomic(const atomic&); + atomic& operator=(const atomic&); + }; + + /// Explicit specialization for int. + template<> + struct atomic<int> : atomic_int + { + atomic() { } + + explicit atomic(int __v) : atomic_int(__v) { } + + int + operator=(int __v) volatile { store(__v); return __v; } + + private: + atomic(const atomic&); + atomic& operator=(const atomic&); + }; + + /// Explicit specialization for unsigned int. + template<> + struct atomic<unsigned int> : atomic_uint + { + atomic() { } + + explicit atomic(unsigned int __v) : atomic_uint(__v) { } + + unsigned int + operator=(unsigned int __v) volatile { store(__v); return __v; } + + private: + atomic(const atomic&); + atomic& operator=(const atomic&); + }; + + /// Explicit specialization for long. + template<> + struct atomic<long> : atomic_long + { + atomic() { } + + explicit atomic(long __v) : atomic_long(__v) { } + + long + operator=(long __v) volatile { store(__v); return __v; } + + private: + atomic(const atomic&); + atomic& operator=(const atomic&); + }; + + /// Explicit specialization for unsigned long. + template<> + struct atomic<unsigned long> : atomic_ulong + { + atomic() { } + + explicit atomic(unsigned long __v) : atomic_ulong(__v) { } + + unsigned long + operator=(unsigned long __v) volatile + { store(__v); return __v; } + + private: + atomic(const atomic&); + atomic& operator=(const atomic&); + }; + + /// Explicit specialization for long long. + template<> + struct atomic<long long> : atomic_llong + { + atomic() { } + + explicit atomic(long long __v) : atomic_llong(__v) { } + + long long + operator=(long long __v) volatile { store(__v); return __v; } + + private: + atomic(const atomic&); + atomic& operator=(const atomic&); + }; + + /// Explicit specialization for unsigned long long. + template<> + struct atomic<unsigned long long> : atomic_ullong + { + atomic() { } + + explicit atomic(unsigned long long __v) : atomic_ullong(__v) { } + + unsigned long long + operator=(unsigned long long __v) volatile { store(__v); return __v; } + + private: + atomic(const atomic&); + atomic& operator=(const atomic&); + }; + + /// Explicit specialization for wchar_t. + template<> + struct atomic<wchar_t> : atomic_wchar_t + { + atomic() { } + + explicit atomic(wchar_t __v) : atomic_wchar_t(__v) { } + + wchar_t + operator=(wchar_t __v) volatile { store(__v); return __v; } + + private: + atomic(const atomic&); + atomic& operator=(const atomic&); + }; + + inline bool + atomic_is_lock_free(const volatile atomic_bool* __a) + { return false; } + + inline bool + atomic_load_explicit(volatile atomic_bool* __a, memory_order __x) + { return _ATOMIC_LOAD_(__a, __x); } + + inline bool + atomic_load(volatile atomic_bool* __a) + { return atomic_load_explicit(__a, memory_order_seq_cst); } + + inline void + atomic_store_explicit(volatile atomic_bool* __a, bool __m, memory_order __x) + { _ATOMIC_STORE_(__a, __m, __x); } + + inline void + atomic_store(volatile atomic_bool* __a, bool __m) + { atomic_store_explicit(__a, __m, memory_order_seq_cst); } + + inline bool + atomic_swap_explicit(volatile atomic_bool* __a, bool __m, memory_order __x) + { return _ATOMIC_MODIFY_(__a, =, __m, __x); } + + inline bool + atomic_swap(volatile atomic_bool* __a, bool __m) + { return atomic_swap_explicit(__a, __m, memory_order_seq_cst); } + + inline bool + atomic_compare_swap_explicit(volatile atomic_bool* __a, bool* __e, bool __m, + memory_order __x, memory_order __y) + { return _ATOMIC_CMPSWP_(__a, __e, __m, __x); } + + inline bool + atomic_compare_swap(volatile atomic_bool* __a, bool* __e, bool __m) + { return atomic_compare_swap_explicit(__a, __e, __m, memory_order_seq_cst, + memory_order_seq_cst); } + + inline void + atomic_fence(const volatile atomic_bool* __a, memory_order __x) + { _ATOMIC_FENCE_(__a, __x); } + + inline bool + atomic_is_lock_free(const volatile atomic_address* __a) + { return false; } + + inline void* + atomic_load_explicit(volatile atomic_address* __a, memory_order __x) + { return _ATOMIC_LOAD_(__a, __x); } + + inline void* + atomic_load(volatile atomic_address* __a) + { return atomic_load_explicit(__a, memory_order_seq_cst); } + + inline void + atomic_store_explicit(volatile atomic_address* __a, void* __m, + memory_order __x) + { _ATOMIC_STORE_(__a, __m, __x); } + + inline void + atomic_store(volatile atomic_address* __a, void* __m) + { atomic_store_explicit(__a, __m, memory_order_seq_cst); } + + inline void* + atomic_swap_explicit(volatile atomic_address* __a, void* __m, + memory_order __x) + { return _ATOMIC_MODIFY_(__a, =, __m, __x); } + + inline void* + atomic_swap(volatile atomic_address* __a, void* __m) + { return atomic_swap_explicit(__a, __m, memory_order_seq_cst); } + + inline bool + atomic_compare_swap_explicit(volatile atomic_address* __a, void** __e, + void* __m, memory_order __x, memory_order __y) + { return _ATOMIC_CMPSWP_(__a, __e, __m, __x); } + + inline bool + atomic_compare_swap(volatile atomic_address* __a, void** __e, void* __m) + { return atomic_compare_swap_explicit(__a, __e, __m, memory_order_seq_cst, + memory_order_seq_cst); } + + inline void + atomic_fence(const volatile atomic_address* __a, memory_order __x) + { _ATOMIC_FENCE_(__a, __x); } + + + inline bool + atomic_is_lock_free(const volatile atomic_char* __a) + { return false; } + + inline char + atomic_load_explicit(volatile atomic_char* __a, memory_order __x) + { return _ATOMIC_LOAD_(__a, __x); } + + inline char + atomic_load(volatile atomic_char* __a) + { return atomic_load_explicit(__a, memory_order_seq_cst); } + + inline void + atomic_store_explicit(volatile atomic_char* __a, char __m, memory_order __x) + { _ATOMIC_STORE_(__a, __m, __x); } + + inline void + atomic_store(volatile atomic_char* __a, char __m) + { atomic_store_explicit(__a, __m, memory_order_seq_cst); } + + inline char + atomic_swap_explicit(volatile atomic_char* __a, char __m, memory_order __x) + { return _ATOMIC_MODIFY_(__a, =, __m, __x); } + + inline char + atomic_swap(volatile atomic_char* __a, char __m) + { return atomic_swap_explicit(__a, __m, memory_order_seq_cst); } + + inline bool + atomic_compare_swap_explicit(volatile atomic_char* __a, char* __e, char __m, + memory_order __x, memory_order __y) + { return _ATOMIC_CMPSWP_(__a, __e, __m, __x); } + + inline bool + atomic_compare_swap(volatile atomic_char* __a, char* __e, char __m) + { return atomic_compare_swap_explicit(__a, __e, __m, memory_order_seq_cst, + memory_order_seq_cst); } + + inline void + atomic_fence(const volatile atomic_char* __a, memory_order __x) + { _ATOMIC_FENCE_(__a, __x); } + + + inline bool + atomic_is_lock_free(const volatile atomic_schar* __a) + { return false; } + + inline signed char + atomic_load_explicit(volatile atomic_schar* __a, memory_order __x) + { return _ATOMIC_LOAD_(__a, __x); } + + inline signed char + atomic_load(volatile atomic_schar* __a) + { return atomic_load_explicit(__a, memory_order_seq_cst); } + + inline void + atomic_store_explicit(volatile atomic_schar* __a, signed char __m, + memory_order __x) + { _ATOMIC_STORE_(__a, __m, __x); } + + inline void + atomic_store(volatile atomic_schar* __a, signed char __m) + { atomic_store_explicit(__a, __m, memory_order_seq_cst); } + + inline signed char + atomic_swap_explicit(volatile atomic_schar* __a, signed char __m, + memory_order __x) + { return _ATOMIC_MODIFY_(__a, =, __m, __x); } + + inline signed char + atomic_swap(volatile atomic_schar* __a, signed char __m) + { return atomic_swap_explicit(__a, __m, memory_order_seq_cst); } + + inline bool + atomic_compare_swap_explicit(volatile atomic_schar* __a, signed char* __e, + signed char __m, memory_order __x, + memory_order __y) + { return _ATOMIC_CMPSWP_(__a, __e, __m, __x); } + + inline bool + atomic_compare_swap(volatile atomic_schar* __a, signed char* __e, + signed char __m) + { return atomic_compare_swap_explicit(__a, __e, __m, memory_order_seq_cst, + memory_order_seq_cst); } + + inline void + atomic_fence(const volatile atomic_schar* __a, memory_order __x) + { _ATOMIC_FENCE_(__a, __x); } + + + inline bool + atomic_is_lock_free(const volatile atomic_uchar* __a) + { return false; } + + inline unsigned char + atomic_load_explicit(volatile atomic_uchar* __a, memory_order __x) + { return _ATOMIC_LOAD_(__a, __x); } + + inline unsigned char + atomic_load(volatile atomic_uchar* __a) + { return atomic_load_explicit(__a, memory_order_seq_cst); } + + inline void + atomic_store_explicit(volatile atomic_uchar* __a, unsigned char __m, + memory_order __x) + { _ATOMIC_STORE_(__a, __m, __x); } + + inline void + atomic_store(volatile atomic_uchar* __a, unsigned char __m) + { atomic_store_explicit(__a, __m, memory_order_seq_cst); } + + inline unsigned char + atomic_swap_explicit(volatile atomic_uchar* __a, unsigned char __m, + memory_order __x) + { return _ATOMIC_MODIFY_(__a, =, __m, __x); } + + inline unsigned char + atomic_swap(volatile atomic_uchar* __a, unsigned char __m) + { return atomic_swap_explicit(__a, __m, memory_order_seq_cst); } + + inline bool + atomic_compare_swap_explicit(volatile atomic_uchar* __a, unsigned char* __e, + unsigned char __m, memory_order __x, + memory_order __y) + { return _ATOMIC_CMPSWP_(__a, __e, __m, __x); } + + inline bool + atomic_compare_swap(volatile atomic_uchar* __a, unsigned char* __e, + unsigned char __m) + { return atomic_compare_swap_explicit(__a, __e, __m, memory_order_seq_cst, + memory_order_seq_cst); } + + inline void + atomic_fence(const volatile atomic_uchar* __a, memory_order __x) + { _ATOMIC_FENCE_(__a, __x); } + + + inline bool + atomic_is_lock_free(const volatile atomic_short* __a) + { return false; } + + inline short + atomic_load_explicit(volatile atomic_short* __a, memory_order __x) + { return _ATOMIC_LOAD_(__a, __x); } + + inline short + atomic_load(volatile atomic_short* __a) + { return atomic_load_explicit(__a, memory_order_seq_cst); } + + inline void + atomic_store_explicit(volatile atomic_short* __a, short __m, + memory_order __x) + { _ATOMIC_STORE_(__a, __m, __x); } + + inline void + atomic_store(volatile atomic_short* __a, short __m) + { atomic_store_explicit(__a, __m, memory_order_seq_cst); } + + inline short + atomic_swap_explicit(volatile atomic_short* __a, short __m, memory_order __x) + { return _ATOMIC_MODIFY_(__a, =, __m, __x); } + + inline short + atomic_swap(volatile atomic_short* __a, short __m) + { return atomic_swap_explicit(__a, __m, memory_order_seq_cst); } + + inline bool + atomic_compare_swap_explicit(volatile atomic_short* __a, short* __e, + short __m, memory_order __x, memory_order __y) + { return _ATOMIC_CMPSWP_(__a, __e, __m, __x); } + + inline bool + atomic_compare_swap(volatile atomic_short* __a, short* __e, short __m) + { return atomic_compare_swap_explicit(__a, __e, __m, memory_order_seq_cst, + memory_order_seq_cst); } + + inline void + atomic_fence(const volatile atomic_short* __a, memory_order __x) + { _ATOMIC_FENCE_(__a, __x); } + + + inline bool + atomic_is_lock_free(const volatile atomic_ushort* __a) + { return false; } + + inline unsigned short + atomic_load_explicit(volatile atomic_ushort* __a, memory_order __x) + { return _ATOMIC_LOAD_(__a, __x); } + + inline unsigned short + atomic_load(volatile atomic_ushort* __a) + { return atomic_load_explicit(__a, memory_order_seq_cst); } + + inline void + atomic_store_explicit(volatile atomic_ushort* __a, unsigned short __m, + memory_order __x) + { _ATOMIC_STORE_(__a, __m, __x); } + + inline void + atomic_store(volatile atomic_ushort* __a, unsigned short __m) + { atomic_store_explicit(__a, __m, memory_order_seq_cst); } + + inline unsigned short + atomic_swap_explicit(volatile atomic_ushort* __a, unsigned short __m, + memory_order __x) + { return _ATOMIC_MODIFY_(__a, =, __m, __x); } + + inline unsigned short + atomic_swap(volatile atomic_ushort* __a, unsigned short __m) + { return atomic_swap_explicit(__a, __m, memory_order_seq_cst); } + + inline bool + atomic_compare_swap_explicit(volatile atomic_ushort* __a, + unsigned short* __e, unsigned short __m, + memory_order __x, memory_order __y) + { return _ATOMIC_CMPSWP_(__a, __e, __m, __x); } + + inline bool + atomic_compare_swap(volatile atomic_ushort* __a, unsigned short* __e, + unsigned short __m) + { return atomic_compare_swap_explicit(__a, __e, __m, memory_order_seq_cst, + memory_order_seq_cst); } + + inline void + atomic_fence(const volatile atomic_ushort* __a, memory_order __x) + { _ATOMIC_FENCE_(__a, __x); } + + + inline bool + atomic_is_lock_free(const volatile atomic_int* __a) + { return false; } + + inline int + atomic_load_explicit(volatile atomic_int* __a, memory_order __x) + { return _ATOMIC_LOAD_(__a, __x); } + + inline int + atomic_load(volatile atomic_int* __a) + { return atomic_load_explicit(__a, memory_order_seq_cst); } + + inline void + atomic_store_explicit(volatile atomic_int* __a, int __m, memory_order __x) + { _ATOMIC_STORE_(__a, __m, __x); } + + inline void + atomic_store(volatile atomic_int* __a, int __m) + { atomic_store_explicit(__a, __m, memory_order_seq_cst); } + + inline int + atomic_swap_explicit(volatile atomic_int* __a, int __m, memory_order __x) + { return _ATOMIC_MODIFY_(__a, =, __m, __x); } + + inline int + atomic_swap(volatile atomic_int* __a, int __m) + { return atomic_swap_explicit(__a, __m, memory_order_seq_cst); } + + inline bool + atomic_compare_swap_explicit(volatile atomic_int* __a, int* __e, int __m, + memory_order __x, memory_order __y) + { return _ATOMIC_CMPSWP_(__a, __e, __m, __x); } + + inline bool + atomic_compare_swap(volatile atomic_int* __a, int* __e, int __m) + { return atomic_compare_swap_explicit(__a, __e, __m, memory_order_seq_cst, + memory_order_seq_cst); } + + inline void + atomic_fence(const volatile atomic_int* __a, memory_order __x) + { _ATOMIC_FENCE_(__a, __x); } + + + inline bool + atomic_is_lock_free(const volatile atomic_uint* __a) + { return false; } + + inline unsigned int + atomic_load_explicit(volatile atomic_uint* __a, memory_order __x) + { return _ATOMIC_LOAD_(__a, __x); } + + inline unsigned int + atomic_load(volatile atomic_uint* __a) + { return atomic_load_explicit(__a, memory_order_seq_cst); } + + inline void + atomic_store_explicit(volatile atomic_uint* __a, unsigned int __m, + memory_order __x) + { _ATOMIC_STORE_(__a, __m, __x); } + + inline void + atomic_store(volatile atomic_uint* __a, unsigned int __m) + { atomic_store_explicit(__a, __m, memory_order_seq_cst); } + + inline unsigned int + atomic_swap_explicit(volatile atomic_uint* __a, unsigned int __m, + memory_order __x) + { return _ATOMIC_MODIFY_(__a, =, __m, __x); } + + inline unsigned int + atomic_swap(volatile atomic_uint* __a, unsigned int __m) + { return atomic_swap_explicit(__a, __m, memory_order_seq_cst); } + + inline bool + atomic_compare_swap_explicit(volatile atomic_uint* __a, unsigned int* __e, + unsigned int __m, memory_order __x, + memory_order __y) + { return _ATOMIC_CMPSWP_(__a, __e, __m, __x); } + + inline bool + atomic_compare_swap(volatile atomic_uint* __a, unsigned int* __e, + unsigned int __m) + { return atomic_compare_swap_explicit(__a, __e, __m, memory_order_seq_cst, + memory_order_seq_cst); } + + inline void + atomic_fence(const volatile atomic_uint* __a, memory_order __x) + { _ATOMIC_FENCE_(__a, __x); } + + + inline bool + atomic_is_lock_free(const volatile atomic_long* __a) + { return false; } + + inline long + atomic_load_explicit(volatile atomic_long* __a, memory_order __x) + { return _ATOMIC_LOAD_(__a, __x); } + + inline long + atomic_load(volatile atomic_long* __a) + { return atomic_load_explicit(__a, memory_order_seq_cst); } + + inline void + atomic_store_explicit(volatile atomic_long* __a, long __m, memory_order __x) + { _ATOMIC_STORE_(__a, __m, __x); } + + inline void + atomic_store(volatile atomic_long* __a, long __m) + { atomic_store_explicit(__a, __m, memory_order_seq_cst); } + + inline long + atomic_swap_explicit(volatile atomic_long* __a, long __m, memory_order __x) + { return _ATOMIC_MODIFY_(__a, =, __m, __x); } + + inline long + atomic_swap(volatile atomic_long* __a, long __m) + { return atomic_swap_explicit(__a, __m, memory_order_seq_cst); } + + inline bool + atomic_compare_swap_explicit(volatile atomic_long* __a, long* __e, long __m, + memory_order __x, memory_order __y) + { return _ATOMIC_CMPSWP_(__a, __e, __m, __x); } + + inline bool + atomic_compare_swap(volatile atomic_long* __a, long* __e, long __m) + { return atomic_compare_swap_explicit(__a, __e, __m, memory_order_seq_cst, + memory_order_seq_cst); } + + inline void + atomic_fence(const volatile atomic_long* __a, memory_order __x) + { _ATOMIC_FENCE_(__a, __x); } + + + inline bool + atomic_is_lock_free(const volatile atomic_ulong* __a) + { return false; } + + inline unsigned long + atomic_load_explicit(volatile atomic_ulong* __a, memory_order __x) + { return _ATOMIC_LOAD_(__a, __x); } + + inline unsigned long + atomic_load(volatile atomic_ulong* __a) + { return atomic_load_explicit(__a, memory_order_seq_cst); } + + inline void + atomic_store_explicit(volatile atomic_ulong* __a, unsigned long __m, + memory_order __x) + { _ATOMIC_STORE_(__a, __m, __x); } + + inline void + atomic_store(volatile atomic_ulong* __a, unsigned long __m) + { atomic_store_explicit(__a, __m, memory_order_seq_cst); } + + inline unsigned long + atomic_swap_explicit(volatile atomic_ulong* __a, unsigned long __m, + memory_order __x) + { return _ATOMIC_MODIFY_(__a, =, __m, __x); } + + inline unsigned long + atomic_swap(volatile atomic_ulong* __a, unsigned long __m) + { return atomic_swap_explicit(__a, __m, memory_order_seq_cst); } + + inline bool + atomic_compare_swap_explicit(volatile atomic_ulong* __a, unsigned long* __e, + unsigned long __m, memory_order __x, + memory_order __y) + { return _ATOMIC_CMPSWP_(__a, __e, __m, __x); } + + inline bool + atomic_compare_swap(volatile atomic_ulong* __a, unsigned long* __e, + unsigned long __m) + { return atomic_compare_swap_explicit(__a, __e, __m, memory_order_seq_cst, + memory_order_seq_cst); } + + inline void + atomic_fence(const volatile atomic_ulong* __a, memory_order __x) + { _ATOMIC_FENCE_(__a, __x); } + + + inline bool + atomic_is_lock_free(const volatile atomic_llong* __a) + { return false; } + + inline long long + atomic_load_explicit(volatile atomic_llong* __a, memory_order __x) + { return _ATOMIC_LOAD_(__a, __x); } + + inline long long + atomic_load(volatile atomic_llong* __a) + { return atomic_load_explicit(__a, memory_order_seq_cst); } + + inline void + atomic_store_explicit(volatile atomic_llong* __a, long long __m, + memory_order __x) + { _ATOMIC_STORE_(__a, __m, __x); } + + inline void + atomic_store(volatile atomic_llong* __a, long long __m) + { atomic_store_explicit(__a, __m, memory_order_seq_cst); } + + inline long long + atomic_swap_explicit(volatile atomic_llong* __a, long long __m, + memory_order __x) + { return _ATOMIC_MODIFY_(__a, =, __m, __x); } + + inline long long + atomic_swap(volatile atomic_llong* __a, long long __m) + { return atomic_swap_explicit(__a, __m, memory_order_seq_cst); } + + inline bool + atomic_compare_swap_explicit(volatile atomic_llong* __a, long long* __e, + long long __m, memory_order __x, + memory_order __y) + { return _ATOMIC_CMPSWP_(__a, __e, __m, __x); } + + inline bool + atomic_compare_swap(volatile atomic_llong* __a, long long* __e, + long long __m) + { return atomic_compare_swap_explicit(__a, __e, __m, memory_order_seq_cst, + memory_order_seq_cst); } + + inline void + atomic_fence(const volatile atomic_llong* __a, memory_order __x) + { _ATOMIC_FENCE_(__a, __x); } + + + inline bool + atomic_is_lock_free(const volatile atomic_ullong* __a) + { return false; } + + inline unsigned long long + atomic_load_explicit(volatile atomic_ullong* __a, memory_order __x) + { return _ATOMIC_LOAD_(__a, __x); } + + inline unsigned long long + atomic_load(volatile atomic_ullong* __a) + { return atomic_load_explicit(__a, memory_order_seq_cst); } + + inline void + atomic_store_explicit(volatile atomic_ullong* __a, unsigned long long __m, + memory_order __x) + { _ATOMIC_STORE_(__a, __m, __x); } + + inline void + atomic_store(volatile atomic_ullong* __a, unsigned long long __m) + { atomic_store_explicit(__a, __m, memory_order_seq_cst); } + + inline unsigned long long + atomic_swap_explicit(volatile atomic_ullong* __a, unsigned long long __m, + memory_order __x) + { return _ATOMIC_MODIFY_(__a, =, __m, __x); } + + inline unsigned long long + atomic_swap(volatile atomic_ullong* __a, unsigned long long __m) + { return atomic_swap_explicit(__a, __m, memory_order_seq_cst); } + + inline bool + atomic_compare_swap_explicit(volatile atomic_ullong* __a, + unsigned long long* __e, unsigned long long __m, + memory_order __x, memory_order __y) + { return _ATOMIC_CMPSWP_(__a, __e, __m, __x); } + + inline bool + atomic_compare_swap(volatile atomic_ullong* __a, unsigned long long* __e, + unsigned long long __m) + { return atomic_compare_swap_explicit(__a, __e, __m, memory_order_seq_cst, + memory_order_seq_cst); } + + inline void + atomic_fence(const volatile atomic_ullong* __a, memory_order __x) + { _ATOMIC_FENCE_(__a, __x); } + + inline bool + atomic_is_lock_free(const volatile atomic_wchar_t* __a) + { return false; } + + inline wchar_t + atomic_load_explicit(volatile atomic_wchar_t* __a, memory_order __x) + { return _ATOMIC_LOAD_(__a, __x); } + + inline wchar_t + atomic_load(volatile atomic_wchar_t* __a) + { return atomic_load_explicit(__a, memory_order_seq_cst); } + + + inline void + atomic_store_explicit(volatile atomic_wchar_t* __a, wchar_t __m, + memory_order __x) + { _ATOMIC_STORE_(__a, __m, __x); } + + inline void + atomic_store(volatile atomic_wchar_t* __a, wchar_t __m) + { atomic_store_explicit(__a, __m, memory_order_seq_cst); } + + inline wchar_t + atomic_swap_explicit(volatile atomic_wchar_t* __a, wchar_t __m, + memory_order __x) + { return _ATOMIC_MODIFY_(__a, =, __m, __x); } + + inline wchar_t + atomic_swap(volatile atomic_wchar_t* __a, wchar_t __m) + { return atomic_swap_explicit(__a, __m, memory_order_seq_cst); } + + inline bool + atomic_compare_swap_explicit(volatile atomic_wchar_t* __a, wchar_t* __e, + wchar_t __m, memory_order __x, memory_order __y) + { return _ATOMIC_CMPSWP_(__a, __e, __m, __x); } + + inline bool + atomic_compare_swap(volatile atomic_wchar_t* __a, wchar_t* __e, wchar_t __m) + { return atomic_compare_swap_explicit(__a, __e, __m, memory_order_seq_cst, + memory_order_seq_cst); } + + inline void + atomic_fence(const volatile atomic_wchar_t* __a, memory_order __x) + { _ATOMIC_FENCE_(__a, __x); } + + inline void* + atomic_fetch_add_explicit(volatile atomic_address* __a, ptrdiff_t __m, + memory_order __x) + { + void* volatile* __p = &((__a)->_M_base._M_i); + volatile atomic_flag* __g = __atomic_flag_for_address(__p); + __atomic_flag_wait_explicit(__g, __x); + void* __r = *__p; + *__p = (void*)((char*)(*__p) + __m); + atomic_flag_clear_explicit(__g, __x); + return __r; + } + + inline void* + atomic_fetch_add(volatile atomic_address* __a, ptrdiff_t __m) + { return atomic_fetch_add_explicit(__a, __m, memory_order_seq_cst); } + + + inline void* + atomic_fetch_sub_explicit(volatile atomic_address* __a, ptrdiff_t __m, + memory_order __x) + { + void* volatile* __p = &((__a)->_M_base._M_i); + volatile atomic_flag* __g = __atomic_flag_for_address(__p); + __atomic_flag_wait_explicit(__g, __x); + void* __r = *__p; + *__p = (void*)((char*)(*__p) - __m); + atomic_flag_clear_explicit(__g, __x); + return __r; + } + + inline void* + atomic_fetch_sub(volatile atomic_address* __a, ptrdiff_t __m) + { return atomic_fetch_sub_explicit(__a, __m, memory_order_seq_cst); } + + + inline char + atomic_fetch_add_explicit(volatile atomic_char* __a, char __m, + memory_order __x) + { return _ATOMIC_MODIFY_(__a, +=, __m, __x); } + + inline char + atomic_fetch_add(volatile atomic_char* __a, char __m) + { atomic_fetch_add_explicit(__a, __m, memory_order_seq_cst); } + + inline char + atomic_fetch_sub_explicit(volatile atomic_char* __a, char __m, + memory_order __x) + { return _ATOMIC_MODIFY_(__a, -=, __m, __x); } + + inline char + atomic_fetch_sub(volatile atomic_char* __a, char __m) + { atomic_fetch_sub_explicit(__a, __m, memory_order_seq_cst); } + + inline char + atomic_fetch_and_explicit(volatile atomic_char* __a, char __m, + memory_order __x) + { return _ATOMIC_MODIFY_(__a, &=, __m, __x); } + + inline char + atomic_fetch_and(volatile atomic_char* __a, char __m) + { atomic_fetch_and_explicit(__a, __m, memory_order_seq_cst); } + + inline char + atomic_fetch_or_explicit(volatile atomic_char* __a, char __m, + memory_order __x) + { return _ATOMIC_MODIFY_(__a, |=, __m, __x); } + + inline char + atomic_fetch_or(volatile atomic_char* __a, char __m) + { atomic_fetch_or_explicit(__a, __m, memory_order_seq_cst); } + + inline char + atomic_fetch_xor_explicit(volatile atomic_char* __a, char __m, + memory_order __x) + { return _ATOMIC_MODIFY_(__a, ^=, __m, __x); } + + inline char + atomic_fetch_xor(volatile atomic_char* __a, char __m) + { atomic_fetch_xor_explicit(__a, __m, memory_order_seq_cst); } + + + inline signed char + atomic_fetch_add_explicit(volatile atomic_schar* __a, signed char __m, + memory_order __x) + { return _ATOMIC_MODIFY_(__a, +=, __m, __x); } + + inline signed char + atomic_fetch_add(volatile atomic_schar* __a, signed char __m) + { atomic_fetch_add_explicit(__a, __m, memory_order_seq_cst); } + + inline signed char + atomic_fetch_sub_explicit(volatile atomic_schar* __a, signed char __m, + memory_order __x) + { return _ATOMIC_MODIFY_(__a, -=, __m, __x); } + + inline signed char + atomic_fetch_sub(volatile atomic_schar* __a, signed char __m) + { atomic_fetch_sub_explicit(__a, __m, memory_order_seq_cst); } + + inline signed char + atomic_fetch_and_explicit(volatile atomic_schar* __a, signed char __m, + memory_order __x) + { return _ATOMIC_MODIFY_(__a, &=, __m, __x); } + + inline signed char + atomic_fetch_and(volatile atomic_schar* __a, signed char __m) + { atomic_fetch_and_explicit(__a, __m, memory_order_seq_cst); } + + inline signed char + atomic_fetch_or_explicit(volatile atomic_schar* __a, signed char __m, + memory_order __x) + { return _ATOMIC_MODIFY_(__a, |=, __m, __x); } + + inline signed char + atomic_fetch_or(volatile atomic_schar* __a, signed char __m) + { atomic_fetch_or_explicit(__a, __m, memory_order_seq_cst); } + + + inline signed char + atomic_fetch_xor_explicit(volatile atomic_schar* __a, signed char __m, + memory_order __x) + { return _ATOMIC_MODIFY_(__a, ^=, __m, __x); } + + inline signed char + atomic_fetch_xor(volatile atomic_schar* __a, signed char __m) + { atomic_fetch_xor_explicit(__a, __m, memory_order_seq_cst); } + + + inline unsigned char + atomic_fetch_add_explicit(volatile atomic_uchar* __a, unsigned char __m, + memory_order __x) + { return _ATOMIC_MODIFY_(__a, +=, __m, __x); } + + inline unsigned char + atomic_fetch_add(volatile atomic_uchar* __a, unsigned char __m) + { atomic_fetch_add_explicit(__a, __m, memory_order_seq_cst); } + + inline unsigned char + atomic_fetch_sub_explicit(volatile atomic_uchar* __a, unsigned char __m, + memory_order __x) + { return _ATOMIC_MODIFY_(__a, -=, __m, __x); } + + inline unsigned char + atomic_fetch_sub(volatile atomic_uchar* __a, unsigned char __m) + { atomic_fetch_sub_explicit(__a, __m, memory_order_seq_cst); } + + + inline unsigned char + atomic_fetch_and_explicit(volatile atomic_uchar* __a, unsigned char __m, + memory_order __x) + { return _ATOMIC_MODIFY_(__a, &=, __m, __x); } + + inline unsigned char + atomic_fetch_and(volatile atomic_uchar* __a, unsigned char __m) + { atomic_fetch_and_explicit(__a, __m, memory_order_seq_cst); } + + inline unsigned char + atomic_fetch_or_explicit(volatile atomic_uchar* __a, unsigned char __m, + memory_order __x) + { return _ATOMIC_MODIFY_(__a, |=, __m, __x); } + + inline unsigned char + atomic_fetch_or(volatile atomic_uchar* __a, unsigned char __m) + { atomic_fetch_or_explicit(__a, __m, memory_order_seq_cst); } + + inline unsigned char + atomic_fetch_xor_explicit(volatile atomic_uchar* __a, + unsigned char __m, memory_order __x) + { return _ATOMIC_MODIFY_(__a, ^=, __m, __x); } + + inline unsigned char + atomic_fetch_xor(volatile atomic_uchar* __a, unsigned char __m) + { atomic_fetch_xor_explicit(__a, __m, memory_order_seq_cst); } + + + inline short + atomic_fetch_add_explicit(volatile atomic_short* __a, short __m, + memory_order __x) + { return _ATOMIC_MODIFY_(__a, +=, __m, __x); } + + inline short + atomic_fetch_add(volatile atomic_short* __a, short __m) + { atomic_fetch_add_explicit(__a, __m, memory_order_seq_cst); } + + inline short + atomic_fetch_sub_explicit(volatile atomic_short* __a, short __m, + memory_order __x) + { return _ATOMIC_MODIFY_(__a, -=, __m, __x); } + + inline short + atomic_fetch_sub(volatile atomic_short* __a, short __m) + { atomic_fetch_sub_explicit(__a, __m, memory_order_seq_cst); } + + inline short + atomic_fetch_and_explicit(volatile atomic_short* __a, short __m, + memory_order __x) + { return _ATOMIC_MODIFY_(__a, &=, __m, __x); } + + inline short + atomic_fetch_and(volatile atomic_short* __a, short __m) + { atomic_fetch_and_explicit(__a, __m, memory_order_seq_cst); } + + inline short + atomic_fetch_or_explicit(volatile atomic_short* __a, short __m, + memory_order __x) + { return _ATOMIC_MODIFY_(__a, |=, __m, __x); } + + inline short + atomic_fetch_or(volatile atomic_short* __a, short __m) + { atomic_fetch_or_explicit(__a, __m, memory_order_seq_cst); } + + inline short + atomic_fetch_xor_explicit(volatile atomic_short* __a, short __m, + memory_order __x) + { return _ATOMIC_MODIFY_(__a, ^=, __m, __x); } + + inline short + atomic_fetch_xor(volatile atomic_short* __a, short __m) + { atomic_fetch_xor_explicit(__a, __m, memory_order_seq_cst); } + + + inline unsigned short + atomic_fetch_add_explicit(volatile atomic_ushort* __a, unsigned short __m, + memory_order __x) + { return _ATOMIC_MODIFY_(__a, +=, __m, __x); } + + inline unsigned short + atomic_fetch_add(volatile atomic_ushort* __a, unsigned short __m) + { atomic_fetch_add_explicit(__a, __m, memory_order_seq_cst); } + + inline unsigned short + atomic_fetch_sub_explicit(volatile atomic_ushort* __a, unsigned short __m, + memory_order __x) + { return _ATOMIC_MODIFY_(__a, -=, __m, __x); } + + inline unsigned short + atomic_fetch_sub(volatile atomic_ushort* __a, unsigned short __m) + { atomic_fetch_sub_explicit(__a, __m, memory_order_seq_cst); } + + inline unsigned short + atomic_fetch_and_explicit(volatile atomic_ushort* __a, unsigned short __m, + memory_order __x) + { return _ATOMIC_MODIFY_(__a, &=, __m, __x); } + + inline unsigned short + atomic_fetch_and(volatile atomic_ushort* __a, unsigned short __m) + { atomic_fetch_and_explicit(__a, __m, memory_order_seq_cst); } + + inline unsigned short + atomic_fetch_or_explicit(volatile atomic_ushort* __a, unsigned short __m, + memory_order __x) + { return _ATOMIC_MODIFY_(__a, |=, __m, __x); } + + inline unsigned short + atomic_fetch_or(volatile atomic_ushort* __a, unsigned short __m) + { atomic_fetch_or_explicit(__a, __m, memory_order_seq_cst); } + + inline unsigned short + atomic_fetch_xor_explicit(volatile atomic_ushort* __a, unsigned short __m, + memory_order __x) + { return _ATOMIC_MODIFY_(__a, ^=, __m, __x); } + + inline unsigned short + atomic_fetch_xor(volatile atomic_ushort* __a, unsigned short __m) + { atomic_fetch_xor_explicit(__a, __m, memory_order_seq_cst); } + + + inline int + atomic_fetch_add_explicit(volatile atomic_int* __a, int __m, + memory_order __x) + { return _ATOMIC_MODIFY_(__a, +=, __m, __x); } + + inline int + atomic_fetch_add(volatile atomic_int* __a, int __m) + { atomic_fetch_add_explicit(__a, __m, memory_order_seq_cst); } + + inline int + atomic_fetch_sub_explicit(volatile atomic_int* __a, int __m, + memory_order __x) + { return _ATOMIC_MODIFY_(__a, -=, __m, __x); } + + inline int + atomic_fetch_sub(volatile atomic_int* __a, int __m) + { atomic_fetch_sub_explicit(__a, __m, memory_order_seq_cst); } + + inline int + atomic_fetch_and_explicit(volatile atomic_int* __a, int __m, + memory_order __x) + { return _ATOMIC_MODIFY_(__a, &=, __m, __x); } + + inline int + atomic_fetch_and(volatile atomic_int* __a, int __m) + { atomic_fetch_and_explicit(__a, __m, memory_order_seq_cst); } + + inline int + atomic_fetch_or_explicit(volatile atomic_int* __a, int __m, + memory_order __x) + { return _ATOMIC_MODIFY_(__a, |=, __m, __x); } + + inline int + atomic_fetch_or(volatile atomic_int* __a, int __m) + { atomic_fetch_or_explicit(__a, __m, memory_order_seq_cst); } + + inline int + atomic_fetch_xor_explicit(volatile atomic_int* __a, int __m, + memory_order __x) + { return _ATOMIC_MODIFY_(__a, ^=, __m, __x); } + + inline int + atomic_fetch_xor(volatile atomic_int* __a, int __m) + { atomic_fetch_xor_explicit(__a, __m, memory_order_seq_cst); } + + + inline unsigned int + atomic_fetch_add_explicit(volatile atomic_uint* __a, unsigned int __m, + memory_order __x) + { return _ATOMIC_MODIFY_(__a, +=, __m, __x); } + + inline unsigned int + atomic_fetch_add(volatile atomic_uint* __a, unsigned int __m) + { atomic_fetch_add_explicit(__a, __m, memory_order_seq_cst); } + + inline unsigned int + atomic_fetch_sub_explicit(volatile atomic_uint* __a, unsigned int __m, + memory_order __x) + { return _ATOMIC_MODIFY_(__a, -=, __m, __x); } + + inline unsigned int + atomic_fetch_sub(volatile atomic_uint* __a, unsigned int __m) + { atomic_fetch_sub_explicit(__a, __m, memory_order_seq_cst); } + + inline unsigned int + atomic_fetch_and_explicit(volatile atomic_uint* __a, unsigned int __m, + memory_order __x) + { return _ATOMIC_MODIFY_(__a, &=, __m, __x); } + + inline unsigned int + atomic_fetch_and(volatile atomic_uint* __a, unsigned int __m) + { atomic_fetch_and_explicit(__a, __m, memory_order_seq_cst); } + + inline unsigned int + atomic_fetch_or_explicit(volatile atomic_uint* __a, unsigned int __m, + memory_order __x) + { return _ATOMIC_MODIFY_(__a, |=, __m, __x); } + + inline unsigned int + atomic_fetch_or(volatile atomic_uint* __a, unsigned int __m) + { atomic_fetch_or_explicit(__a, __m, memory_order_seq_cst); } + + inline unsigned int + atomic_fetch_xor_explicit(volatile atomic_uint* __a, unsigned int __m, + memory_order __x) + { return _ATOMIC_MODIFY_(__a, ^=, __m, __x); } + + inline unsigned int + atomic_fetch_xor(volatile atomic_uint* __a, unsigned int __m) + { atomic_fetch_xor_explicit(__a, __m, memory_order_seq_cst); } + + + inline long + atomic_fetch_add_explicit(volatile atomic_long* __a, long __m, + memory_order __x) + { return _ATOMIC_MODIFY_(__a, +=, __m, __x); } + + inline long + atomic_fetch_add(volatile atomic_long* __a, long __m) + { atomic_fetch_add_explicit(__a, __m, memory_order_seq_cst); } + + inline long + atomic_fetch_sub_explicit(volatile atomic_long* __a, long __m, + memory_order __x) + { return _ATOMIC_MODIFY_(__a, -=, __m, __x); } + + inline long + atomic_fetch_sub(volatile atomic_long* __a, long __m) + { atomic_fetch_sub_explicit(__a, __m, memory_order_seq_cst); } + + inline long + atomic_fetch_and_explicit(volatile atomic_long* __a, long __m, + memory_order __x) + { return _ATOMIC_MODIFY_(__a, &=, __m, __x); } + + inline long + atomic_fetch_and(volatile atomic_long* __a, long __m) + { atomic_fetch_and_explicit(__a, __m, memory_order_seq_cst); } + + inline long + atomic_fetch_or_explicit(volatile atomic_long* __a, long __m, + memory_order __x) + { return _ATOMIC_MODIFY_(__a, |=, __m, __x); } + + inline long + atomic_fetch_or(volatile atomic_long* __a, long __m) + { atomic_fetch_or_explicit(__a, __m, memory_order_seq_cst); } + + inline long + atomic_fetch_xor_explicit(volatile atomic_long* __a, long __m, + memory_order __x) + { return _ATOMIC_MODIFY_(__a, ^=, __m, __x); } + + inline long + atomic_fetch_xor(volatile atomic_long* __a, long __m) + { atomic_fetch_xor_explicit(__a, __m, memory_order_seq_cst); } + + + inline unsigned long + atomic_fetch_add_explicit(volatile atomic_ulong* __a, unsigned long __m, + memory_order __x) + { return _ATOMIC_MODIFY_(__a, +=, __m, __x); } + + inline unsigned long + atomic_fetch_add(volatile atomic_ulong* __a, unsigned long __m) + { atomic_fetch_add_explicit(__a, __m, memory_order_seq_cst); } + + inline unsigned long + atomic_fetch_sub_explicit(volatile atomic_ulong* __a, unsigned long __m, + memory_order __x) + { return _ATOMIC_MODIFY_(__a, -=, __m, __x); } + + inline unsigned long + atomic_fetch_sub(volatile atomic_ulong* __a, unsigned long __m) + { atomic_fetch_sub_explicit(__a, __m, memory_order_seq_cst); } + + inline unsigned long + atomic_fetch_and_explicit(volatile atomic_ulong* __a, unsigned long __m, + memory_order __x) + { return _ATOMIC_MODIFY_(__a, &=, __m, __x); } + + inline unsigned long + atomic_fetch_and(volatile atomic_ulong* __a, unsigned long __m) + { atomic_fetch_and_explicit(__a, __m, memory_order_seq_cst); } + + inline unsigned long + atomic_fetch_or_explicit(volatile atomic_ulong* __a, unsigned long __m, + memory_order __x) + { return _ATOMIC_MODIFY_(__a, |=, __m, __x); } + + inline unsigned long + atomic_fetch_or(volatile atomic_ulong* __a, unsigned long __m) + { atomic_fetch_or_explicit(__a, __m, memory_order_seq_cst); } + + inline unsigned long + atomic_fetch_xor_explicit(volatile atomic_ulong* __a, unsigned long __m, + memory_order __x) + { return _ATOMIC_MODIFY_(__a, ^=, __m, __x); } + + inline unsigned long + atomic_fetch_xor(volatile atomic_ulong* __a, unsigned long __m) + { atomic_fetch_xor_explicit(__a, __m, memory_order_seq_cst); } + + + inline long long + atomic_fetch_add_explicit(volatile atomic_llong* __a, long long __m, + memory_order __x) + { return _ATOMIC_MODIFY_(__a, +=, __m, __x); } + + inline long long + atomic_fetch_add(volatile atomic_llong* __a, long long __m) + { atomic_fetch_add_explicit(__a, __m, memory_order_seq_cst); } + + inline long long + atomic_fetch_sub_explicit(volatile atomic_llong* __a, long long __m, + memory_order __x) + { return _ATOMIC_MODIFY_(__a, -=, __m, __x); } + + inline long long + atomic_fetch_sub(volatile atomic_llong* __a, long long __m) + { atomic_fetch_sub_explicit(__a, __m, memory_order_seq_cst); } + + inline long long + atomic_fetch_and_explicit(volatile atomic_llong* __a, + long long __m, memory_order __x) + { return _ATOMIC_MODIFY_(__a, &=, __m, __x); } + + inline long long + atomic_fetch_and(volatile atomic_llong* __a, long long __m) + { atomic_fetch_and_explicit(__a, __m, memory_order_seq_cst); } + + inline long long + atomic_fetch_or_explicit(volatile atomic_llong* __a, + long long __m, memory_order __x) + { return _ATOMIC_MODIFY_(__a, |=, __m, __x); } + + inline long long + atomic_fetch_or(volatile atomic_llong* __a, long long __m) + { atomic_fetch_or_explicit(__a, __m, memory_order_seq_cst); } + + inline long long + atomic_fetch_xor_explicit(volatile atomic_llong* __a, + long long __m, memory_order __x) + { return _ATOMIC_MODIFY_(__a, ^=, __m, __x); } + + inline long long + atomic_fetch_xor(volatile atomic_llong* __a, long long __m) + { atomic_fetch_xor_explicit(__a, __m, memory_order_seq_cst); } + + + inline unsigned long long + atomic_fetch_add_explicit(volatile atomic_ullong* __a, + unsigned long long __m, memory_order __x) + { return _ATOMIC_MODIFY_(__a, +=, __m, __x); } + + inline unsigned long long + atomic_fetch_add(volatile atomic_ullong* __a, unsigned long long __m) + { atomic_fetch_add_explicit(__a, __m, memory_order_seq_cst); } + + inline unsigned long long + atomic_fetch_sub_explicit(volatile atomic_ullong* __a, + unsigned long long __m, memory_order __x) + { return _ATOMIC_MODIFY_(__a, -=, __m, __x); } + + inline unsigned long long + atomic_fetch_sub(volatile atomic_ullong* __a, unsigned long long __m) + { atomic_fetch_sub_explicit(__a, __m, memory_order_seq_cst); } + + inline unsigned long long + atomic_fetch_and_explicit(volatile atomic_ullong* __a, + unsigned long long __m, memory_order __x) + { return _ATOMIC_MODIFY_(__a, &=, __m, __x); } + + inline unsigned long long + atomic_fetch_and(volatile atomic_ullong* __a, unsigned long long __m) + { atomic_fetch_and_explicit(__a, __m, memory_order_seq_cst); } + + inline unsigned long long + atomic_fetch_or_explicit(volatile atomic_ullong* __a, + unsigned long long __m, memory_order __x) + { return _ATOMIC_MODIFY_(__a, |=, __m, __x); } + + inline unsigned long long + atomic_fetch_or(volatile atomic_ullong* __a, unsigned long long __m) + { atomic_fetch_or_explicit(__a, __m, memory_order_seq_cst); } + + inline unsigned long long + atomic_fetch_xor_explicit(volatile atomic_ullong* __a, + unsigned long long __m, memory_order __x) + { return _ATOMIC_MODIFY_(__a, ^=, __m, __x); } + + inline unsigned long long + atomic_fetch_xor(volatile atomic_ullong* __a, unsigned long long __m) + { atomic_fetch_xor_explicit(__a, __m, memory_order_seq_cst); } + + + inline wchar_t + atomic_fetch_add_explicit(volatile atomic_wchar_t* __a, wchar_t __m, + memory_order __x) + { return _ATOMIC_MODIFY_(__a, +=, __m, __x); } + + inline wchar_t + atomic_fetch_add(volatile atomic_wchar_t* __a, wchar_t __m) + { atomic_fetch_add_explicit(__a, __m, memory_order_seq_cst); } + + inline wchar_t + atomic_fetch_sub_explicit(volatile atomic_wchar_t* __a, wchar_t __m, + memory_order __x) + { return _ATOMIC_MODIFY_(__a, -=, __m, __x); } + + inline wchar_t + atomic_fetch_sub(volatile atomic_wchar_t* __a, wchar_t __m) + { atomic_fetch_sub_explicit(__a, __m, memory_order_seq_cst); } + + inline wchar_t + atomic_fetch_and_explicit(volatile atomic_wchar_t* __a, wchar_t __m, + memory_order __x) + { return _ATOMIC_MODIFY_(__a, &=, __m, __x); } + + inline wchar_t + atomic_fetch_and(volatile atomic_wchar_t* __a, wchar_t __m) + { atomic_fetch_and_explicit(__a, __m, memory_order_seq_cst); } + + inline wchar_t + atomic_fetch_or_explicit(volatile atomic_wchar_t* __a, wchar_t __m, + memory_order __x) + { return _ATOMIC_MODIFY_(__a, |=, __m, __x); } + + inline wchar_t + atomic_fetch_or(volatile atomic_wchar_t* __a, wchar_t __m) + { atomic_fetch_or_explicit(__a, __m, memory_order_seq_cst); } + + inline wchar_t + atomic_fetch_xor_explicit(volatile atomic_wchar_t* __a, wchar_t __m, + memory_order __x) + { return _ATOMIC_MODIFY_(__a, ^=, __m, __x); } + + inline wchar_t + atomic_fetch_xor(volatile atomic_wchar_t* __a, wchar_t __m) + { atomic_fetch_xor_explicit(__a, __m, memory_order_seq_cst); } + + inline bool + atomic_bool::is_lock_free() const volatile + { return false; } + + inline void + atomic_bool::store(bool __m, memory_order __x) volatile + { atomic_store_explicit(this, __m, __x); } + + inline bool + atomic_bool::load(memory_order __x) volatile + { return atomic_load_explicit(this, __x); } + + inline bool + atomic_bool::swap(bool __m, memory_order __x) volatile + { return atomic_swap_explicit(this, __m, __x); } + + inline bool + atomic_bool::compare_swap(bool& __e, bool __m, memory_order __x, + memory_order __y) volatile + { return atomic_compare_swap_explicit(this, &__e, __m, __x, __y); } + + inline bool + atomic_bool::compare_swap(bool& __e, bool __m, memory_order __x) volatile + { + const bool __cond1 = __x == memory_order_release; + const bool __cond2 = __x == memory_order_acq_rel; + memory_order __mo1(__cond1 ? memory_order_relaxed : __x); + memory_order __mo2(__cond2 ? memory_order_acquire : __mo1); + return atomic_compare_swap_explicit(this, &__e, __m, __x, __mo2); + } + + inline void + atomic_bool::fence(memory_order __x) const volatile + { return atomic_fence(this, __x); } + + + inline bool + atomic_char::is_lock_free() const volatile + { return false; } + + inline void + atomic_char::store(char __m, memory_order __x) volatile + { atomic_store_explicit(this, __m, __x); } + + inline char + atomic_char::load(memory_order __x) volatile + { return atomic_load_explicit(this, __x); } + + inline char + atomic_char::swap(char __m, memory_order __x) volatile + { return atomic_swap_explicit(this, __m, __x); } + + inline bool + atomic_char::compare_swap(char& __e, char __m, + memory_order __x, memory_order __y) volatile + { return atomic_compare_swap_explicit(this, &__e, __m, __x, __y); } + + inline bool + atomic_char::compare_swap(char& __e, char __m, memory_order __x) volatile + { + const bool __cond1 = __x == memory_order_release; + const bool __cond2 = __x == memory_order_acq_rel; + memory_order __mo1(__cond1 ? memory_order_relaxed : __x); + memory_order __mo2(__cond2 ? memory_order_acquire : __mo1); + return atomic_compare_swap_explicit(this, &__e, __m, __x, __mo2); + } + + inline void + atomic_char::fence(memory_order __x) const volatile + { return atomic_fence(this, __x); } + + + inline bool + atomic_schar::is_lock_free() const volatile + { return false; } + + inline void + atomic_schar::store(signed char __m, memory_order __x) volatile + { atomic_store_explicit(this, __m, __x); } + + inline signed char + atomic_schar::load(memory_order __x) volatile + { return atomic_load_explicit(this, __x); } + + inline signed char + atomic_schar::swap(signed char __m, memory_order __x) volatile + { return atomic_swap_explicit(this, __m, __x); } + + inline bool + atomic_schar::compare_swap(signed char& __e, signed char __m, + memory_order __x, memory_order __y) volatile + { return atomic_compare_swap_explicit(this, &__e, __m, __x, __y); } + + inline bool + atomic_schar::compare_swap(signed char& __e, signed char __m, + memory_order __x) volatile + { + const bool __cond1 = __x == memory_order_release; + const bool __cond2 = __x == memory_order_acq_rel; + memory_order __mo1(__cond1 ? memory_order_relaxed : __x); + memory_order __mo2(__cond2 ? memory_order_acquire : __mo1); + return atomic_compare_swap_explicit(this, &__e, __m, __x, __mo2); + } + + inline void + atomic_schar::fence(memory_order __x) const volatile + { return atomic_fence(this, __x); } + + inline bool + atomic_uchar::is_lock_free() const volatile + { return false; } + + inline void + atomic_uchar::store(unsigned char __m, memory_order __x) volatile + { atomic_store_explicit(this, __m, __x); } + + inline unsigned char + atomic_uchar::load(memory_order __x) volatile + { return atomic_load_explicit(this, __x); } + + inline unsigned char + atomic_uchar::swap(unsigned char __m, memory_order __x) volatile + { return atomic_swap_explicit(this, __m, __x); } + + inline bool + atomic_uchar::compare_swap(unsigned char& __e, unsigned char __m, + memory_order __x, memory_order __y) volatile + { return atomic_compare_swap_explicit(this, &__e, __m, __x, __y); } + + inline bool + atomic_uchar::compare_swap(unsigned char& __e, unsigned char __m, + memory_order __x) volatile + { + const bool __cond1 = __x == memory_order_release; + const bool __cond2 = __x == memory_order_acq_rel; + memory_order __mo1(__cond1 ? memory_order_relaxed : __x); + memory_order __mo2(__cond2 ? memory_order_acquire : __mo1); + return atomic_compare_swap_explicit(this, &__e, __m, __x, __mo2); + } + + inline void + atomic_uchar::fence(memory_order __x) const volatile + { return atomic_fence(this, __x); } + + + inline bool + atomic_short::is_lock_free() const volatile + { return false; } + + inline void + atomic_short::store(short __m, memory_order __x) volatile + { atomic_store_explicit(this, __m, __x); } + + inline short + atomic_short::load(memory_order __x) volatile + { return atomic_load_explicit(this, __x); } + + inline short + atomic_short::swap(short __m, memory_order __x) volatile + { return atomic_swap_explicit(this, __m, __x); } + + inline bool + atomic_short::compare_swap(short& __e, short __m, + memory_order __x, memory_order __y) volatile + { return atomic_compare_swap_explicit(this, &__e, __m, __x, __y); } + + inline bool + atomic_short::compare_swap(short& __e, short __m, memory_order __x) volatile + { + const bool __cond1 = __x == memory_order_release; + const bool __cond2 = __x == memory_order_acq_rel; + memory_order __mo1(__cond1 ? memory_order_relaxed : __x); + memory_order __mo2(__cond2 ? memory_order_acquire : __mo1); + return atomic_compare_swap_explicit(this, &__e, __m, __x, __mo2); + } + + inline void + atomic_short::fence(memory_order __x) const volatile + { return atomic_fence(this, __x); } + + + inline bool + atomic_ushort::is_lock_free() const volatile + { return false; } + + inline void + atomic_ushort::store(unsigned short __m, memory_order __x) volatile + { atomic_store_explicit(this, __m, __x); } + + inline unsigned short + atomic_ushort::load(memory_order __x) volatile + { return atomic_load_explicit(this, __x); } + + inline unsigned short + atomic_ushort::swap(unsigned short __m, memory_order __x) volatile + { return atomic_swap_explicit(this, __m, __x); } + + inline bool + atomic_ushort::compare_swap(unsigned short& __e, unsigned short __m, + memory_order __x, memory_order __y) volatile + { return atomic_compare_swap_explicit(this, &__e, __m, __x, __y); } + + inline bool + atomic_ushort::compare_swap(unsigned short& __e, unsigned short __m, + memory_order __x) volatile + { + const bool __cond1 = __x == memory_order_release; + const bool __cond2 = __x == memory_order_acq_rel; + memory_order __mo1(__cond1 ? memory_order_relaxed : __x); + memory_order __mo2(__cond2 ? memory_order_acquire : __mo1); + return atomic_compare_swap_explicit(this, &__e, __m, __x, __mo2); + } + + inline void + atomic_ushort::fence(memory_order __x) const volatile + { return atomic_fence(this, __x); } + + + inline bool + atomic_int::is_lock_free() const volatile + { return false; } + + inline void + atomic_int::store(int __m, memory_order __x) volatile + { atomic_store_explicit(this, __m, __x); } + + inline int + atomic_int::load(memory_order __x) volatile + { return atomic_load_explicit(this, __x); } + + inline int + atomic_int::swap(int __m, memory_order __x) volatile + { return atomic_swap_explicit(this, __m, __x); } + + inline bool + atomic_int::compare_swap(int& __e, int __m, memory_order __x, + memory_order __y) volatile + { return atomic_compare_swap_explicit(this, &__e, __m, __x, __y); } + + inline bool + atomic_int::compare_swap(int& __e, int __m, memory_order __x) volatile + { + const bool __cond1 = __x == memory_order_release; + const bool __cond2 = __x == memory_order_acq_rel; + memory_order __mo1(__cond1 ? memory_order_relaxed : __x); + memory_order __mo2(__cond2 ? memory_order_acquire : __mo1); + return atomic_compare_swap_explicit(this, &__e, __m, __x, __mo2); + } + + inline void + atomic_int::fence(memory_order __x) const volatile + { return atomic_fence(this, __x); } + + + inline bool + atomic_uint::is_lock_free() const volatile + { return false; } + + inline void + atomic_uint::store(unsigned int __m, memory_order __x) volatile + { atomic_store_explicit(this, __m, __x); } + + inline unsigned int + atomic_uint::load(memory_order __x) volatile + { return atomic_load_explicit(this, __x); } + + inline unsigned int + atomic_uint::swap(unsigned int __m, memory_order __x) volatile + { return atomic_swap_explicit(this, __m, __x); } + + inline bool + atomic_uint::compare_swap(unsigned int& __e, unsigned int __m, + memory_order __x, memory_order __y) volatile + { return atomic_compare_swap_explicit(this, &__e, __m, __x, __y); } + + inline bool + atomic_uint::compare_swap(unsigned int& __e, unsigned int __m, + memory_order __x) volatile + { + const bool __cond1 = __x == memory_order_release; + const bool __cond2 = __x == memory_order_acq_rel; + memory_order __mo1(__cond1 ? memory_order_relaxed : __x); + memory_order __mo2(__cond2 ? memory_order_acquire : __mo1); + return atomic_compare_swap_explicit(this, &__e, __m, __x, __mo2); + } + + inline void + atomic_uint::fence(memory_order __x) const volatile + { return atomic_fence(this, __x); } + + + inline bool + atomic_long::is_lock_free() const volatile + { return false; } + + inline void + atomic_long::store(long __m, memory_order __x) volatile + { atomic_store_explicit(this, __m, __x); } + + inline long + atomic_long::load(memory_order __x) volatile + { return atomic_load_explicit(this, __x); } + + inline long + atomic_long::swap(long __m, memory_order __x) volatile + { return atomic_swap_explicit(this, __m, __x); } + + inline bool + atomic_long::compare_swap(long& __e, long __m, + memory_order __x, memory_order __y) volatile + { return atomic_compare_swap_explicit(this, &__e, __m, __x, __y); } + + inline bool + atomic_long::compare_swap(long& __e, long __m, memory_order __x) volatile + { + const bool __cond1 = __x == memory_order_release; + const bool __cond2 = __x == memory_order_acq_rel; + memory_order __mo1(__cond1 ? memory_order_relaxed : __x); + memory_order __mo2(__cond2 ? memory_order_acquire : __mo1); + return atomic_compare_swap_explicit(this, &__e, __m, __x, __mo2); + } + + inline void + atomic_long::fence(memory_order __x) const volatile + { return atomic_fence(this, __x); } + + + inline bool + atomic_ulong::is_lock_free() const volatile + { return false; } + + inline void + atomic_ulong::store(unsigned long __m, memory_order __x) volatile + { atomic_store_explicit(this, __m, __x); } + + inline unsigned long + atomic_ulong::load(memory_order __x) volatile + { return atomic_load_explicit(this, __x); } + + inline unsigned long + atomic_ulong::swap(unsigned long __m, memory_order __x) volatile + { return atomic_swap_explicit(this, __m, __x); } + + inline bool + atomic_ulong::compare_swap(unsigned long& __e, unsigned long __m, + memory_order __x, memory_order __y) volatile + { return atomic_compare_swap_explicit(this, &__e, __m, __x, __y); } + + inline bool + atomic_ulong::compare_swap(unsigned long& __e, unsigned long __m, + memory_order __x) volatile + { + const bool __cond1 = __x == memory_order_release; + const bool __cond2 = __x == memory_order_acq_rel; + memory_order __mo1(__cond1 ? memory_order_relaxed : __x); + memory_order __mo2(__cond2 ? memory_order_acquire : __mo1); + return atomic_compare_swap_explicit(this, &__e, __m, __x, __mo2); + } + + inline void + atomic_ulong::fence(memory_order __x) const volatile + { return atomic_fence(this, __x); } + + + inline bool + atomic_llong::is_lock_free() const volatile + { return false; } + + inline void + atomic_llong::store(long long __m, memory_order __x) volatile + { atomic_store_explicit(this, __m, __x); } + + inline long long + atomic_llong::load(memory_order __x) volatile + { return atomic_load_explicit(this, __x); } + + inline long long + atomic_llong::swap(long long __m, memory_order __x) volatile + { return atomic_swap_explicit(this, __m, __x); } + + inline bool + atomic_llong::compare_swap(long long& __e, long long __m, + memory_order __x, memory_order __y) volatile + { return atomic_compare_swap_explicit(this, &__e, __m, __x, __y); } + + inline bool + atomic_llong::compare_swap(long long& __e, long long __m, + memory_order __x) volatile + { + const bool __cond1 = __x == memory_order_release; + const bool __cond2 = __x == memory_order_acq_rel; + memory_order __mo1(__cond1 ? memory_order_relaxed : __x); + memory_order __mo2(__cond2 ? memory_order_acquire : __mo1); + return atomic_compare_swap_explicit(this, &__e, __m, __x, __mo2); + } + + inline void + atomic_llong::fence(memory_order __x) const volatile + { return atomic_fence(this, __x); } + + + inline bool + atomic_ullong::is_lock_free() const volatile + { return false; } + + inline void + atomic_ullong::store(unsigned long long __m, memory_order __x) volatile + { atomic_store_explicit(this, __m, __x); } + + inline unsigned long long + atomic_ullong::load(memory_order __x) volatile + { return atomic_load_explicit(this, __x); } + + inline unsigned long long + atomic_ullong::swap(unsigned long long __m, memory_order __x) volatile + { return atomic_swap_explicit(this, __m, __x); } + + inline bool + atomic_ullong::compare_swap(unsigned long long& __e, unsigned long long __m, + memory_order __x, memory_order __y) volatile + { return atomic_compare_swap_explicit(this, &__e, __m, __x, __y); } + + inline bool + atomic_ullong::compare_swap(unsigned long long& __e, unsigned long long __m, + memory_order __x) volatile + { + const bool __cond1 = __x == memory_order_release; + const bool __cond2 = __x == memory_order_acq_rel; + memory_order __mo1(__cond1 ? memory_order_relaxed : __x); + memory_order __mo2(__cond2 ? memory_order_acquire : __mo1); + return atomic_compare_swap_explicit(this, &__e, __m, __x, __mo2); + } + + inline void + atomic_ullong::fence(memory_order __x) const volatile + { return atomic_fence(this, __x); } + + + inline bool + atomic_wchar_t::is_lock_free() const volatile + { return false; } + + inline void + atomic_wchar_t::store(wchar_t __m, memory_order __x) volatile + { atomic_store_explicit(this, __m, __x); } + + inline wchar_t + atomic_wchar_t::load(memory_order __x) volatile + { return atomic_load_explicit(this, __x); } + + inline wchar_t + atomic_wchar_t::swap(wchar_t __m, memory_order __x) volatile + { return atomic_swap_explicit(this, __m, __x); } + + inline bool + atomic_wchar_t::compare_swap(wchar_t& __e, wchar_t __m, + memory_order __x, memory_order __y) volatile + { return atomic_compare_swap_explicit(this, &__e, __m, __x, __y); } + + inline bool + atomic_wchar_t::compare_swap(wchar_t& __e, wchar_t __m, + memory_order __x) volatile + { + const bool __cond1 = __x == memory_order_release; + const bool __cond2 = __x == memory_order_acq_rel; + memory_order __mo1(__cond1 ? memory_order_relaxed : __x); + memory_order __mo2(__cond2 ? memory_order_acquire : __mo1); + return atomic_compare_swap_explicit(this, &__e, __m, __x, __mo2); + } + + inline void + atomic_wchar_t::fence(memory_order __x) const volatile + { return atomic_fence(this, __x); } + + + inline void* + atomic_address::fetch_add(ptrdiff_t __m, memory_order __x) volatile + { return atomic_fetch_add_explicit(this, __m, __x); } + + inline void* + atomic_address::fetch_sub(ptrdiff_t __m, memory_order __x) volatile + { return atomic_fetch_sub_explicit(this, __m, __x); } + + + inline char + atomic_char::fetch_add(char __m, memory_order __x) volatile + { return atomic_fetch_add_explicit(this, __m, __x); } + + + inline char + atomic_char::fetch_sub(char __m, memory_order __x) volatile + { return atomic_fetch_sub_explicit(this, __m, __x); } + + + inline char + atomic_char::fetch_and(char __m, memory_order __x) volatile + { return atomic_fetch_and_explicit(this, __m, __x); } + + + inline char + atomic_char::fetch_or(char __m, memory_order __x) volatile + { return atomic_fetch_or_explicit(this, __m, __x); } + + + inline char + atomic_char::fetch_xor(char __m, memory_order __x) volatile + { return atomic_fetch_xor_explicit(this, __m, __x); } + + + inline signed char + atomic_schar::fetch_add(signed char __m, memory_order __x) volatile + { return atomic_fetch_add_explicit(this, __m, __x); } + + + inline signed char + atomic_schar::fetch_sub(signed char __m, memory_order __x) volatile + { return atomic_fetch_sub_explicit(this, __m, __x); } + + + inline signed char + atomic_schar::fetch_and(signed char __m, memory_order __x) volatile + { return atomic_fetch_and_explicit(this, __m, __x); } + + + inline signed char + atomic_schar::fetch_or(signed char __m, memory_order __x) volatile + { return atomic_fetch_or_explicit(this, __m, __x); } + + + inline signed char + atomic_schar::fetch_xor(signed char __m, memory_order __x) volatile + { return atomic_fetch_xor_explicit(this, __m, __x); } + + + inline unsigned char + atomic_uchar::fetch_add(unsigned char __m, memory_order __x) volatile + { return atomic_fetch_add_explicit(this, __m, __x); } + + + inline unsigned char + atomic_uchar::fetch_sub(unsigned char __m, memory_order __x) volatile + { return atomic_fetch_sub_explicit(this, __m, __x); } + + + inline unsigned char + atomic_uchar::fetch_and(unsigned char __m, memory_order __x) volatile + { return atomic_fetch_and_explicit(this, __m, __x); } + + + inline unsigned char + atomic_uchar::fetch_or(unsigned char __m, memory_order __x) volatile + { return atomic_fetch_or_explicit(this, __m, __x); } + + + inline unsigned char + atomic_uchar::fetch_xor(unsigned char __m, memory_order __x) volatile + { return atomic_fetch_xor_explicit(this, __m, __x); } + + + inline short + atomic_short::fetch_add(short __m, memory_order __x) volatile + { return atomic_fetch_add_explicit(this, __m, __x); } + + + inline short + atomic_short::fetch_sub(short __m, memory_order __x) volatile + { return atomic_fetch_sub_explicit(this, __m, __x); } + + + inline short + atomic_short::fetch_and(short __m, memory_order __x) volatile + { return atomic_fetch_and_explicit(this, __m, __x); } + + + inline short + atomic_short::fetch_or(short __m, memory_order __x) volatile + { return atomic_fetch_or_explicit(this, __m, __x); } + + + inline short + atomic_short::fetch_xor(short __m, memory_order __x) volatile + { return atomic_fetch_xor_explicit(this, __m, __x); } + + + inline unsigned short + atomic_ushort::fetch_add(unsigned short __m, memory_order __x) volatile + { return atomic_fetch_add_explicit(this, __m, __x); } + + + inline unsigned short + atomic_ushort::fetch_sub(unsigned short __m, memory_order __x) volatile + { return atomic_fetch_sub_explicit(this, __m, __x); } + + + inline unsigned short + atomic_ushort::fetch_and(unsigned short __m, memory_order __x) volatile + { return atomic_fetch_and_explicit(this, __m, __x); } + + + inline unsigned short + atomic_ushort::fetch_or(unsigned short __m, memory_order __x) volatile + { return atomic_fetch_or_explicit(this, __m, __x); } + + + inline unsigned short + atomic_ushort::fetch_xor(unsigned short __m, memory_order __x) volatile + { return atomic_fetch_xor_explicit(this, __m, __x); } + + + inline int + atomic_int::fetch_add(int __m, memory_order __x) volatile + { return atomic_fetch_add_explicit(this, __m, __x); } + + + inline int + atomic_int::fetch_sub(int __m, memory_order __x) volatile + { return atomic_fetch_sub_explicit(this, __m, __x); } + + + inline int + atomic_int::fetch_and(int __m, memory_order __x) volatile + { return atomic_fetch_and_explicit(this, __m, __x); } + + + inline int + atomic_int::fetch_or(int __m, memory_order __x) volatile + { return atomic_fetch_or_explicit(this, __m, __x); } + + + inline int + atomic_int::fetch_xor(int __m, memory_order __x) volatile + { return atomic_fetch_xor_explicit(this, __m, __x); } + + + inline unsigned int + atomic_uint::fetch_add(unsigned int __m, memory_order __x) volatile + { return atomic_fetch_add_explicit(this, __m, __x); } + + + inline unsigned int + atomic_uint::fetch_sub(unsigned int __m, memory_order __x) volatile + { return atomic_fetch_sub_explicit(this, __m, __x); } + + + inline unsigned int + atomic_uint::fetch_and(unsigned int __m, memory_order __x) volatile + { return atomic_fetch_and_explicit(this, __m, __x); } + + + inline unsigned int + atomic_uint::fetch_or(unsigned int __m, memory_order __x) volatile + { return atomic_fetch_or_explicit(this, __m, __x); } + + + inline unsigned int + atomic_uint::fetch_xor(unsigned int __m, memory_order __x) volatile + { return atomic_fetch_xor_explicit(this, __m, __x); } + + + inline long + atomic_long::fetch_add(long __m, memory_order __x) volatile + { return atomic_fetch_add_explicit(this, __m, __x); } + + + inline long + atomic_long::fetch_sub(long __m, memory_order __x) volatile + { return atomic_fetch_sub_explicit(this, __m, __x); } + + + inline long + atomic_long::fetch_and(long __m, memory_order __x) volatile + { return atomic_fetch_and_explicit(this, __m, __x); } + + + inline long + atomic_long::fetch_or(long __m, memory_order __x) volatile + { return atomic_fetch_or_explicit(this, __m, __x); } + + + inline long + atomic_long::fetch_xor(long __m, memory_order __x) volatile + { return atomic_fetch_xor_explicit(this, __m, __x); } + + + inline unsigned long + atomic_ulong::fetch_add(unsigned long __m, memory_order __x) volatile + { return atomic_fetch_add_explicit(this, __m, __x); } + + + inline unsigned long + atomic_ulong::fetch_sub(unsigned long __m, memory_order __x) volatile + { return atomic_fetch_sub_explicit(this, __m, __x); } + + + inline unsigned long + atomic_ulong::fetch_and(unsigned long __m, memory_order __x) volatile + { return atomic_fetch_and_explicit(this, __m, __x); } + + + inline unsigned long + atomic_ulong::fetch_or(unsigned long __m, memory_order __x) volatile + { return atomic_fetch_or_explicit(this, __m, __x); } + + + inline unsigned long + atomic_ulong::fetch_xor(unsigned long __m, memory_order __x) volatile + { return atomic_fetch_xor_explicit(this, __m, __x); } + + + inline long long + atomic_llong::fetch_add(long long __m, memory_order __x) volatile + { return atomic_fetch_add_explicit(this, __m, __x); } + + + inline long long + atomic_llong::fetch_sub(long long __m, memory_order __x) volatile + { return atomic_fetch_sub_explicit(this, __m, __x); } + + + inline long long + atomic_llong::fetch_and(long long __m, memory_order __x) volatile + { return atomic_fetch_and_explicit(this, __m, __x); } + + + inline long long + atomic_llong::fetch_or(long long __m, memory_order __x) volatile + { return atomic_fetch_or_explicit(this, __m, __x); } + + + inline long long + atomic_llong::fetch_xor(long long __m, memory_order __x) volatile + { return atomic_fetch_xor_explicit(this, __m, __x); } + + + inline unsigned long long + atomic_ullong::fetch_add(unsigned long long __m, memory_order __x) volatile + { return atomic_fetch_add_explicit(this, __m, __x); } + + + inline unsigned long long + atomic_ullong::fetch_sub(unsigned long long __m, memory_order __x) volatile + { return atomic_fetch_sub_explicit(this, __m, __x); } + + + inline unsigned long long + atomic_ullong::fetch_and(unsigned long long __m, memory_order __x) volatile + { return atomic_fetch_and_explicit(this, __m, __x); } + + + inline unsigned long long + atomic_ullong::fetch_or(unsigned long long __m, memory_order __x) volatile + { return atomic_fetch_or_explicit(this, __m, __x); } + + + inline unsigned long long + atomic_ullong::fetch_xor(unsigned long long __m, memory_order __x) volatile + { return atomic_fetch_xor_explicit(this, __m, __x); } + + + inline wchar_t + atomic_wchar_t::fetch_add(wchar_t __m, memory_order __x) volatile + { return atomic_fetch_add_explicit(this, __m, __x); } + + + inline wchar_t + atomic_wchar_t::fetch_sub(wchar_t __m, memory_order __x) volatile + { return atomic_fetch_sub_explicit(this, __m, __x); } + + + inline wchar_t + atomic_wchar_t::fetch_and(wchar_t __m, memory_order __x) volatile + { return atomic_fetch_and_explicit(this, __m, __x); } + + + inline wchar_t + atomic_wchar_t::fetch_or(wchar_t __m, memory_order __x) volatile + { return atomic_fetch_or_explicit(this, __m, __x); } + + + inline wchar_t + atomic_wchar_t::fetch_xor(wchar_t __m, memory_order __x) volatile + { return atomic_fetch_xor_explicit(this, __m, __x); } + + + inline bool + atomic_address::is_lock_free() const volatile + { return false; } + + inline void + atomic_address::store(void* __m, memory_order __x) volatile + { atomic_store_explicit(this, __m, __x); } + + inline void* + atomic_address::load(memory_order __x) volatile + { return atomic_load_explicit(this, __x); } + + inline void* + atomic_address::swap(void* __m, memory_order __x) volatile + { return atomic_swap_explicit(this, __m, __x); } + + inline bool + atomic_address::compare_swap(void*& __e, void* __m, + memory_order __x, memory_order __y) volatile + { return atomic_compare_swap_explicit(this, &__e, __m, __x, __y); } + + inline bool + atomic_address::compare_swap(void*& __e, void* __m, + memory_order __x) volatile + { + const bool __cond1 = __x == memory_order_release; + const bool __cond2 = __x == memory_order_acq_rel; + memory_order __mo1(__cond1 ? memory_order_relaxed : __x); + memory_order __mo2(__cond2 ? memory_order_acquire : __mo1); + return atomic_compare_swap_explicit(this, &__e, __m, __x, __mo2); + } + + inline void + atomic_address::fence(memory_order __x) const volatile + { return atomic_fence(this, __x); } + + + template<typename _Tp> + inline bool + atomic<_Tp>::is_lock_free() const volatile + { return false; } + + template<typename _Tp> + inline void + atomic<_Tp>::store(_Tp __v, memory_order __x) volatile + // XXX + // { _ATOMIC_STORE_(this, __v, __x); } + { } + + template<typename _Tp> + inline _Tp + atomic<_Tp>::load(memory_order __x) volatile + // XXX + // { return _ATOMIC_LOAD_(this, __x); } + { } + + template<typename _Tp> + inline _Tp + atomic<_Tp>::swap(_Tp __v, memory_order __x) volatile + // XXX + // { return _ATOMIC_MODIFY_(this, =, __v, __x); } + { } + + template<typename _Tp> + inline bool + atomic<_Tp>::compare_swap(_Tp& __r, _Tp __v, memory_order __x, + memory_order __y) volatile + // XXX + // { return _ATOMIC_CMPSWP_(this, &__r, __v, __x); } + { } + + template<typename _Tp> + inline bool + atomic<_Tp>::compare_swap(_Tp& __r, _Tp __v, memory_order __x) volatile + { + const bool __cond1 = __x == memory_order_release; + const bool __cond2 = __x == memory_order_acq_rel; + memory_order __mo1(__cond1 ? memory_order_relaxed : __x); + memory_order __mo2(__cond2 ? memory_order_acquire : __mo1); + return compare_swap(__r, __v, __x, __mo2); + } + + template<typename _Tp> + _Tp* + atomic<_Tp*>::load(memory_order __x) volatile + { return static_cast<_Tp*>(atomic_address::load(__x)); } + + template<typename _Tp> + _Tp* + atomic<_Tp*>::swap(_Tp* __v, memory_order __x) volatile + { return static_cast<_Tp*>(atomic_address::swap(__v, __x)); } + + template<typename _Tp> + bool + atomic<_Tp*>::compare_swap(_Tp*& __r, _Tp* __v, memory_order __x, + memory_order __y) volatile + { return atomic_address::compare_swap(*reinterpret_cast<void**>(&__r), + static_cast<void*>(__v), __x, __y); } + + template<typename _Tp> + bool + atomic<_Tp*>::compare_swap(_Tp*& __r, _Tp* __v, memory_order __x) volatile + { + const bool __cond1 = __x == memory_order_release; + const bool __cond2 = __x == memory_order_acq_rel; + memory_order __mo1(__cond1 ? memory_order_relaxed : __x); + memory_order __mo2(__cond2 ? memory_order_acquire : __mo1); + return compare_swap(__r, __v, __x, __mo2); + } + + template<typename _Tp> + _Tp* + atomic<_Tp*>::fetch_add(ptrdiff_t __v, memory_order __x) volatile + { + void* __p = atomic_fetch_add_explicit(this, sizeof(_Tp) * __v, __x); + return static_cast<_Tp*>(__p); + } + + template<typename _Tp> + _Tp* + atomic<_Tp*>::fetch_sub(ptrdiff_t __v, memory_order __x) volatile + { + void* __p = atomic_fetch_sub_explicit(this, sizeof(_Tp) * __v, __x); + return static_cast<_Tp*>(__p); + } + +_GLIBCXX_END_NAMESPACE + +#endif + + diff --git a/libstdc++-v3/include/ext/typelist.h b/libstdc++-v3/include/ext/typelist.h index b7cd95434e6..03f28a78323 100644 --- a/libstdc++-v3/include/ext/typelist.h +++ b/libstdc++-v3/include/ext/typelist.h @@ -1,6 +1,6 @@ // -*- C++ -*- -// Copyright (C) 2005, 2006 Free Software Foundation, Inc. +// Copyright (C) 2005, 2006, 2008 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free // software; you can redistribute it and/or modify it under the @@ -71,10 +71,21 @@ namespace typelist typedef Typelist tail; }; - template<typename Fn, class Typelist> + // Apply all typelist types to unary functor. + template<typename Fn, typename Typelist> void apply(Fn&, Typelist); + /// Apply all typelist types to generator functor. + template<typename Gn, typename Typelist> + void + apply_generator(Gn&, Typelist); + + // Apply all typelist types and values to generator functor. + template<typename Gn, typename TypelistT, typename TypelistV> + void + apply_generator(Gn&, TypelistT, TypelistV); + template<typename Typelist0, typename Typelist1> struct append; @@ -135,20 +146,64 @@ namespace detail struct apply_<Fn, chain<Hd, Tl> > { void - operator() (Fn& f) + operator()(Fn& f) { f.operator()(Hd()); apply_<Fn, Tl> next; next(f); } - }; + }; template<typename Fn> struct apply_<Fn, null_type> { void operator()(Fn&) { } - }; + }; + + template<typename Gn, typename Typelist_Chain> + struct apply_generator1_; + + template<typename Gn, typename Hd, typename Tl> + struct apply_generator1_<Gn, chain<Hd, Tl> > + { + void + operator()(Gn& g) + { + g.template operator()<Hd>(); + apply_generator1_<Gn, Tl> next; + next(g); + } + }; + + template<typename Gn> + struct apply_generator1_<Gn, null_type> + { + void + operator()(Gn&) { } + }; + + template<typename Gn, typename TypelistT_Chain, typename TypelistV_Chain> + struct apply_generator2_; + + template<typename Gn, typename Hd1, typename TlT, typename Hd2, typename TlV> + struct apply_generator2_<Gn, chain<Hd1, TlT>, chain<Hd2, TlV> > + { + void + operator()(Gn& g) + { + g.template operator()<Hd1, Hd2>(); + apply_generator2_<Gn, TlT, TlV> next; + next(g); + } + }; + + template<typename Gn> + struct apply_generator2_<Gn, null_type, null_type> + { + void + operator()(Gn&) { } + }; template<typename Typelist_Chain0, typename Typelist_Chain1> struct append_; @@ -294,20 +349,20 @@ namespace detail struct chain_flatten_; template<typename Hd_Tl> - struct chain_flatten_<chain<Hd_Tl, null_type> > - { - typedef typename Hd_Tl::root type; - }; + struct chain_flatten_<chain<Hd_Tl, null_type> > + { + typedef typename Hd_Tl::root type; + }; template<typename Hd_Typelist, class Tl_Typelist> - struct chain_flatten_<chain<Hd_Typelist, Tl_Typelist> > - { - private: - typedef typename chain_flatten_<Tl_Typelist>::type rest_type; - typedef append<Hd_Typelist, node<rest_type> > append_type; - public: - typedef typename append_type::type::root type; - }; + struct chain_flatten_<chain<Hd_Typelist, Tl_Typelist> > + { + private: + typedef typename chain_flatten_<Tl_Typelist>::type rest_type; + typedef append<Hd_Typelist, node<rest_type> > append_type; + public: + typedef typename append_type::type::root type; + }; } // namespace detail } // namespace typelist @@ -333,7 +388,7 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx) namespace typelist { - template<typename Fn, class Typelist> + template<typename Fn, typename Typelist> void apply(Fn& fn, Typelist) { @@ -341,6 +396,24 @@ namespace typelist a(fn); } + template<typename Fn, typename Typelist> + void + apply_generator(Fn& fn, Typelist) + { + detail::apply_generator1_<Fn, typename Typelist::root> a; + a(fn); + } + + template<typename Fn, typename TypelistT, typename TypelistV> + void + apply_generator(Fn& fn, TypelistT, TypelistV) + { + typedef typename TypelistT::root rootT; + typedef typename TypelistV::root rootV; + detail::apply_generator2_<Fn, rootT, rootV> a; + a(fn); + } + template<typename Typelist0, typename Typelist1> struct append { diff --git a/libstdc++-v3/include/parallel/compiletime_settings.h b/libstdc++-v3/include/parallel/compiletime_settings.h index edaea3856ad..8ab89aa8ee9 100644 --- a/libstdc++-v3/include/parallel/compiletime_settings.h +++ b/libstdc++-v3/include/parallel/compiletime_settings.h @@ -73,17 +73,9 @@ * __gnu_parallel::parallel_random_shuffle(). */ #define _GLIBCXX_RANDOM_SHUFFLE_CONSIDER_L1 0 #endif -#ifndef _GLIBCXX_RANDOM_SHUFFLE_CONSIDER_TLB +#ifndef _GLIBCXX_RANDOM_SHUFFLE_CONSIDER_TLB /** @brief Switch on many _GLIBCXX_PARALLEL_ASSERTions in parallel code. * Consider the size of the TLB for * __gnu_parallel::parallel_random_shuffle(). */ #define _GLIBCXX_RANDOM_SHUFFLE_CONSIDER_TLB 0 #endif - -#ifndef _GLIBCXX_MULTIWAY_MERGESORT_COPY_LAST -/** @brief First copy the data, sort it locally, and merge it back - * (0); or copy it back after everything is done (1). - * - * Recommendation: 0 */ -#define _GLIBCXX_MULTIWAY_MERGESORT_COPY_LAST 0 -#endif diff --git a/libstdc++-v3/include/parallel/features.h b/libstdc++-v3/include/parallel/features.h index 2e09980405e..7150c20affc 100644 --- a/libstdc++-v3/include/parallel/features.h +++ b/libstdc++-v3/include/parallel/features.h @@ -61,66 +61,6 @@ #define _GLIBCXX_BAL_QUICKSORT 1 #endif -#ifndef _GLIBCXX_LOSER_TREE -/** @def _GLIBCXX_LOSER_TREE - * @brief Include guarded (sequences may run empty) loser tree, - * moving objects. - * @see __gnu_parallel::_Settings multiway_merge_algorithm */ -#define _GLIBCXX_LOSER_TREE 1 -#endif - -#ifndef _GLIBCXX_LOSER_TREE_EXPLICIT -/** @def _GLIBCXX_LOSER_TREE_EXPLICIT - * @brief Include standard loser tree, storing two flags for infimum - * and supremum. - * @see __gnu_parallel::_Settings multiway_merge_algorithm */ -#define _GLIBCXX_LOSER_TREE_EXPLICIT 0 -#endif - -#ifndef _GLIBCXX_LOSER_TREE_REFERENCE -/** @def _GLIBCXX_LOSER_TREE_REFERENCE - * @brief Include some loser tree variant. - * @see __gnu_parallel::_Settings multiway_merge_algorithm */ -#define _GLIBCXX_LOSER_TREE_REFERENCE 0 -#endif - -#ifndef _GLIBCXX_LOSER_TREE_POINTER -/** @def _GLIBCXX_LOSER_TREE_POINTER - * @brief Include some loser tree variant. - * @see __gnu_parallel::_Settings multiway_merge_algorithm */ -#define _GLIBCXX_LOSER_TREE_POINTER 1 -#endif - -#ifndef _GLIBCXX_LOSER_TREE_UNGUARDED -/** @def _GLIBCXX_LOSER_TREE_UNGUARDED - * @brief Include unguarded (sequences must not run empty) loser - * tree, moving objects. - * @see __gnu_parallel::_Settings multiway_merge_algorithm */ -#define _GLIBCXX_LOSER_TREE_UNGUARDED 0 -#endif - -#ifndef _GLIBCXX_LOSER_TREE_POINTER_UNGUARDED -/** @def _GLIBCXX_LOSER_TREE_POINTER_UNGUARDED - * @brief Include some loser tree variant. - * @see __gnu_parallel::_Settings multiway_merge_algorithm */ -#define _GLIBCXX_LOSER_TREE_POINTER_UNGUARDED 1 -#endif - -#ifndef _GLIBCXX_LOSER_TREE_COMBINED -/** @def _GLIBCXX_LOSER_TREE_COMBINED - * @brief Include some loser tree variant. - * @see __gnu_parallel::_Settings multiway_merge_algorithm */ -#define _GLIBCXX_LOSER_TREE_COMBINED 0 -#endif - -#ifndef _GLIBCXX_LOSER_TREE_SENTINEL -/** @def _GLIBCXX_LOSER_TREE_SENTINEL - * @brief Include some loser tree variant. - * @see __gnu_parallel::_Settings multiway_merge_algorithm */ -#define _GLIBCXX_LOSER_TREE_SENTINEL 0 -#endif - - #ifndef _GLIBCXX_FIND_GROWING_BLOCKS /** @brief Include the growing blocks variant for std::find. * @see __gnu_parallel::_Settings::find_algorithm */ diff --git a/libstdc++-v3/include/parallel/losertree.h b/libstdc++-v3/include/parallel/losertree.h index ddeb0d36d6c..cae15c0826e 100644 --- a/libstdc++-v3/include/parallel/losertree.h +++ b/libstdc++-v3/include/parallel/losertree.h @@ -47,878 +47,725 @@ namespace __gnu_parallel { -#if _GLIBCXX_LOSER_TREE_EXPLICIT - -/** @brief Guarded loser tree, copying the whole element into the -* tree structure. -* -* Guarding is done explicitly through two flags per element, inf -* and sup This is a quite slow variant. -*/ -template<typename T, typename Comparator = std::less<T> > - class LoserTreeExplicit +/** + * @brief Guarded loser/tournament tree. + * + * The smallest element is at the top. + * + * Guarding is done explicitly through one flag sup per element, + * inf is not needed due to a better initialization routine. This + * is a well-performing variant. + * + * @param T the element type + * @param Comparator the comparator to use, defaults to std::less<T> + */ +template<typename T, typename Comparator> +class LoserTreeBase +{ +protected: + /** @brief Internal representation of a LoserTree element. */ + struct Loser { - private: - struct Loser - { - // The relevant element. - T key; - - // Is this an infimum or supremum element? - bool inf, sup; - - // Number of the sequence the element comes from. - int source; - }; - - unsigned int size, offset; - Loser* losers; - Comparator comp; - - public: - LoserTreeExplicit(unsigned int _size, Comparator _comp = std::less<T>()) - : comp(_comp) - { - size = _size; - offset = size; - losers = new Loser[size]; - for (unsigned int l = 0; l < size; ++l) - { - //losers[l].key = ... stays unset - losers[l].inf = true; - losers[l].sup = false; - //losers[l].source = -1; //sentinel - } - } - - ~LoserTreeExplicit() - { delete[] losers; } + /** @brief flag, true iff this is a "maximum" sentinel. */ + bool sup; + /** @brief index of the source sequence. */ + int source; + /** @brief key of the element in the LoserTree. */ + T key; + }; - int - get_min_source() - { return losers[0].source; } + unsigned int ik, k, offset; + + /** log_2{k} */ + unsigned int _M_log_k; + + /** @brief LoserTree elements. */ + Loser* losers; + + /** @brief Comparator to use. */ + Comparator comp; + + /** + * @brief State flag that determines whether the LoserTree is empty. + * + * Only used for building the LoserTree. + */ + bool first_insert; + +public: + /** + * @brief The constructor. + * + * @param _k The number of sequences to merge. + * @param _comp The comparator to use. + */ + LoserTreeBase(unsigned int _k, Comparator _comp) + : comp(_comp) + { + ik = _k; + + // Compute log_2{k} for the Loser Tree + _M_log_k = log2(ik - 1) + 1; + + // Next greater power of 2. + k = 1 << _M_log_k; + offset = k; + + // Avoid default-constructing losers[].key + losers = static_cast<Loser*>(::operator new(2 * k * sizeof(Loser))); + for (unsigned int i = ik - 1; i < k; ++i) + losers[i + k].sup = true; + + first_insert = true; + } + + /** + * @brief The destructor. + */ + ~LoserTreeBase() + { ::operator delete(losers); } + + /** + * @brief Initializes the sequence "source" with the element "key". + * + * @param key the element to insert + * @param source index of the source sequence + * @param sup flag that determines whether the value to insert is an + * explicit supremum. + */ + inline void + insert_start(const T& key, int source, bool sup) + { + unsigned int pos = k + source; + + if(first_insert) + { + // Construct all keys, so we can easily deconstruct them. + for (unsigned int i = 0; i < (2 * k); ++i) + new(&(losers[i].key)) T(key); + first_insert = false; + } + else + new(&(losers[pos].key)) T(key); + + losers[pos].sup = sup; + losers[pos].source = source; + } + + /** + * @return the index of the sequence with the smallest element. + */ + int get_min_source() + { return losers[0].source; } +}; + +/** + * @brief Stable LoserTree variant. + * + * Provides the stable implementations of insert_start, init_winner, + * init and delete_min_insert. + * + * Unstable variant is done using partial specialisation below. + */ +template<bool stable/* default == true */, typename T, typename Comparator> +class LoserTree : public LoserTreeBase<T, Comparator> +{ + typedef LoserTreeBase<T, Comparator> Base; + using Base::k; + using Base::losers; + using Base::first_insert; + +public: + LoserTree(unsigned int _k, Comparator _comp) + : Base::LoserTreeBase(_k, _comp) + {} + + unsigned int + init_winner(unsigned int root) + { + if (root >= k) + { + return root; + } + else + { + unsigned int left = init_winner (2 * root); + unsigned int right = init_winner (2 * root + 1); + if (losers[right].sup + || (!losers[left].sup + && !comp(losers[right].key, losers[left].key))) + { + // Left one is less or equal. + losers[root] = losers[right]; + return left; + } + else + { + // Right one is less. + losers[root] = losers[left]; + return right; + } + } + } + + void init() + { losers[0] = losers[init_winner(1)]; } + + /** + * @brief Delete the smallest element and insert a new element from + * the previously smallest element's sequence. + * + * This implementation is stable. + */ + // Do not pass a const reference since key will be used as local variable. + void delete_min_insert(T key, bool sup) + { + int source = losers[0].source; + for (unsigned int pos = (k + source) / 2; pos > 0; pos /= 2) + { + // The smaller one gets promoted, ties are broken by source. + if ((sup && (!losers[pos].sup || losers[pos].source < source)) + || (!sup && !losers[pos].sup + && ((comp(losers[pos].key, key)) + || (!comp(key, losers[pos].key) + && losers[pos].source < source)))) + { + // The other one is smaller. + std::swap(losers[pos].sup, sup); + std::swap(losers[pos].source, source); + std::swap(losers[pos].key, key); + } + } + + losers[0].sup = sup; + losers[0].source = source; + losers[0].key = key; + } +}; + +/** + * @brief Unstable LoserTree variant. + * + * Stability (non-stable here) is selected with partial specialization. + */ +template<typename T, typename Comparator> +class LoserTree</* stable == */false, T, Comparator> : + public LoserTreeBase<T, Comparator> +{ + typedef LoserTreeBase<T, Comparator> Base; + using Base::_M_log_k; + using Base::k; + using Base::losers; + using Base::first_insert; + +public: + LoserTree(unsigned int _k, Comparator _comp) + : Base::LoserTreeBase(_k, _comp) + {} + + /** + * Computes the winner of the competition at position "root". + * + * Called recursively (starting at 0) to build the initial tree. + * + * @param root index of the "game" to start. + */ + unsigned int + init_winner (unsigned int root) + { + if (root >= k) + { + return root; + } + else + { + unsigned int left = init_winner (2 * root); + unsigned int right = init_winner (2 * root + 1); + if (losers[right].sup || + (!losers[left].sup + && !comp(losers[right].key, losers[left].key))) + { + // Left one is less or equal. + losers[root] = losers[right]; + return left; + } + else + { + // Right one is less. + losers[root] = losers[left]; + return right; + } + } + } + + inline void + init() + { losers[0] = losers[init_winner(1)]; } + + /** + * Delete the key smallest element and insert the element key instead. + * + * @param key the key to insert + * @param sup true iff key is an explicitly marked supremum + */ + // Do not pass a const reference since key will be used as local variable. + inline void + delete_min_insert(T key, bool sup) + { +#if _GLIBCXX_ASSERTIONS + // loser trees are only used for at least 2 sequences + _GLIBCXX_PARALLEL_ASSERT(_M_log_k > 1); +#endif - void - insert_start(T key, int source, bool sup) + int source = losers[0].source; + for (unsigned int pos = (k + source) / 2; pos > 0; pos /= 2) { - bool inf = false; - for (unsigned int pos = (offset + source) / 2; pos > 0; pos /= 2) - { - if ((!inf && !losers[pos].inf && !sup && !losers[pos].sup - && comp(losers[pos].key, key)) || losers[pos].inf || sup) - { - // The other one is smaller. - std::swap(losers[pos].key, key); - std::swap(losers[pos].inf, inf); - std::swap(losers[pos].sup, sup); - std::swap(losers[pos].source, source); - } - } - - losers[0].key = key; - losers[0].inf = inf; - losers[0].sup = sup; - losers[0].source = source; + // The smaller one gets promoted. + if (sup || (!losers[pos].sup && comp(losers[pos].key, key))) + { + // The other one is smaller. + std::swap(losers[pos].sup, sup); + std::swap(losers[pos].source, source); + std::swap(losers[pos].key, key); + } } - void - init() { } + losers[0].sup = sup; + losers[0].source = source; + losers[0].key = key; + } +}; - void - delete_min_insert(T key, bool sup) - { - bool inf = false; - int source = losers[0].source; - for (unsigned int pos = (offset + source) / 2; pos > 0; pos /= 2) - { - // The smaller one gets promoted. - if ((!inf && !losers[pos].inf && !sup && !losers[pos].sup - && comp(losers[pos].key, key)) - || losers[pos].inf || sup) - { - // The other one is smaller. - std::swap(losers[pos].key, key); - std::swap(losers[pos].inf, inf); - std::swap(losers[pos].sup, sup); - std::swap(losers[pos].source, source); - } - } - - losers[0].key = key; - losers[0].inf = inf; - losers[0].sup = sup; - losers[0].source = source; - } - - void - insert_start_stable(T key, int source, bool sup) - { - bool inf = false; - for (unsigned int pos = (offset + source) / 2; pos > 0; pos /= 2) - { - if ((!inf && !losers[pos].inf && !sup && !losers[pos].sup - && ((comp(losers[pos].key, key)) - || (!comp(key, losers[pos].key) - && losers[pos].source < source))) - || losers[pos].inf || sup) - { - // Take next key. - std::swap(losers[pos].key, key); - std::swap(losers[pos].inf, inf); - std::swap(losers[pos].sup, sup); - std::swap(losers[pos].source, source); - } - } - - losers[0].key = key; - losers[0].inf = inf; - losers[0].sup = sup; - losers[0].source = source; - } - void - init_stable() { } - - void - delete_min_insert_stable(T key, bool sup) - { - bool inf = false; - int source = losers[0].source; - for (unsigned int pos = (offset + source) / 2; pos > 0; pos /= 2) - { - if ((!inf && !losers[pos].inf && !sup && !losers[pos].sup - && ((comp(losers[pos].key, key)) - || (!comp(key, losers[pos].key) - && losers[pos].source < source))) - || losers[pos].inf || sup) - { - std::swap(losers[pos].key, key); - std::swap(losers[pos].inf, inf); - std::swap(losers[pos].sup, sup); - std::swap(losers[pos].source, source); - } - } - - losers[0].key = key; - losers[0].inf = inf; - losers[0].sup = sup; - losers[0].source = source; - } +/** + * @brief Base class of Loser Tree implementation using pointers. + */ +template<typename T, typename Comparator> +class LoserTreePointerBase +{ +protected: + /** @brief Internal representation of LoserTree elements. */ + struct Loser + { + bool sup; + int source; + const T* keyp; }; -#endif - -#if _GLIBCXX_LOSER_TREE + unsigned int ik, k, offset; + Loser* losers; + Comparator comp; -/** @brief Guarded loser tree, either copying the whole element into -* the tree structure, or looking up the element via the index. -* -* Guarding is done explicitly through one flag sup per element, -* inf is not needed due to a better initialization routine. This -* is a well-performing variant. -*/ -template<typename T, typename Comparator = std::less<T> > - class LoserTree - { - private: - struct Loser - { - bool sup; - int source; - T key; - }; - - unsigned int ik, k, offset; - Loser* losers; - Comparator comp; - bool first_insert; - - public: - LoserTree(unsigned int _k, Comparator _comp = std::less<T>()) +public: + LoserTreePointerBase(unsigned int _k, Comparator _comp = std::less<T>()) : comp(_comp) - { - ik = _k; - - // Next greater power of 2. - k = 1 << (log2(ik - 1) + 1); - offset = k; - // Avoid default-constructing losers[].key - losers = static_cast<Loser*>(::operator new(2 * k * sizeof(Loser))); - for (unsigned int i = ik - 1; i < k; ++i) - losers[i + k].sup = true; - - first_insert = true; - } + { + ik = _k; - ~LoserTree() - { ::operator delete(losers); } + // Next greater power of 2. + k = 1 << (log2(ik - 1) + 1); + offset = k; + losers = new Loser[k * 2]; + for (unsigned int i = ik - 1; i < k; i++) + losers[i + k].sup = true; + } - int - get_min_source() - { return losers[0].source; } + ~LoserTreePointerBase() + { ::operator delete(losers); } - void - insert_start(const T& key, int source, bool sup) - { - unsigned int pos = k + source; - - if(first_insert) - { - // Construct all keys, so we can easily deconstruct them. - for (unsigned int i = 0; i < (2 * k); ++i) - ::new(&(losers[i].key)) T(key); - first_insert = false; - } - else - ::new(&(losers[pos].key)) T(key); - - losers[pos].sup = sup; - losers[pos].source = source; - } + int get_min_source() + { return losers[0].source; } - unsigned int - init_winner (unsigned int root) - { - if (root >= k) - { - return root; - } - else - { - unsigned int left = init_winner (2 * root); - unsigned int right = init_winner (2 * root + 1); - if (losers[right].sup - || (!losers[left].sup - && !comp(losers[right].key, losers[left].key))) - { - // Left one is less or equal. - losers[root] = losers[right]; - return left; - } - else - { - // Right one is less. - losers[root] = losers[left]; - return right; - } - } - } + void insert_start(const T& key, int source, bool sup) + { + unsigned int pos = k + source; + + losers[pos].sup = sup; + losers[pos].source = source; + losers[pos].keyp = &key; + } +}; + +/** + * @brief Stable LoserTree implementation. + * + * The unstable variant is implemented using partial instantiation below. + */ +template<bool stable/* default == true */, typename T, typename Comparator> +class LoserTreePointer : public LoserTreePointerBase<T, Comparator> +{ + typedef LoserTreePointerBase<T, Comparator> Base; + using Base::k; + using Base::losers; - void - init() - { losers[0] = losers[init_winner(1)]; } +public: + LoserTreePointer(unsigned int _k, Comparator _comp = std::less<T>()) + : Base::LoserTreePointerBase(_k, _comp) + {} - // Do not pass const reference since key will be used as local variable. - void - delete_min_insert(T key, bool sup) - { - int source = losers[0].source; - for (unsigned int pos = (k + source) / 2; pos > 0; pos /= 2) - { - // The smaller one gets promoted. - if (sup || (!losers[pos].sup && comp(losers[pos].key, key))) - { - // The other one is smaller. - std::swap(losers[pos].sup, sup); - std::swap(losers[pos].source, source); - std::swap(losers[pos].key, key); - } - } - - losers[0].sup = sup; - losers[0].source = source; - losers[0].key = key; - } + unsigned int + init_winner(unsigned int root) + { + if (root >= k) + { + return root; + } + else + { + unsigned int left = init_winner (2 * root); + unsigned int right = init_winner (2 * root + 1); + if (losers[right].sup + || (!losers[left].sup && !comp(*losers[right].keyp, + *losers[left].keyp))) + { + // Left one is less or equal. + losers[root] = losers[right]; + return left; + } + else + { + // Right one is less. + losers[root] = losers[left]; + return right; + } + } + } + + void init() + { losers[0] = losers[init_winner(1)]; } + + void delete_min_insert(const T& key, bool sup) + { + const T* keyp = &key; + int source = losers[0].source; + for (unsigned int pos = (k + source) / 2; pos > 0; pos /= 2) + { + // The smaller one gets promoted, ties are broken by source. + if ((sup && (!losers[pos].sup || losers[pos].source < source)) || + (!sup && !losers[pos].sup && + ((comp(*losers[pos].keyp, *keyp)) || + (!comp(*keyp, *losers[pos].keyp) + && losers[pos].source < source)))) + { + // The other one is smaller. + std::swap(losers[pos].sup, sup); + std::swap(losers[pos].source, source); + std::swap(losers[pos].keyp, keyp); + } + } + + losers[0].sup = sup; + losers[0].source = source; + losers[0].keyp = keyp; + } +}; + +/** + * @brief Unstable LoserTree implementation. + * + * The stable variant is above. + */ +template<typename T, typename Comparator> +class LoserTreePointer</* stable == */false, T, Comparator> : + public LoserTreePointerBase<T, Comparator> +{ + typedef LoserTreePointerBase<T, Comparator> Base; + using Base::k; + using Base::losers; - void - insert_start_stable(const T& key, int source, bool sup) - { return insert_start(key, source, sup); } +public: + LoserTreePointer(unsigned int _k, Comparator _comp = std::less<T>()) + : Base::LoserTreePointerBase(_k, _comp) + {} - unsigned int - init_winner_stable (unsigned int root) - { - if (root >= k) - { - return root; - } - else - { - unsigned int left = init_winner (2 * root); - unsigned int right = init_winner (2 * root + 1); - if (losers[right].sup + unsigned int + init_winner(unsigned int root) + { + if (root >= k) + { + return root; + } + else + { + unsigned int left = init_winner (2 * root); + unsigned int right = init_winner (2 * root + 1); + if (losers[right].sup || (!losers[left].sup - && !comp(losers[right].key, losers[left].key))) - { - // Left one is less or equal. - losers[root] = losers[right]; - return left; - } - else - { - // Right one is less. - losers[root] = losers[left]; - return right; - } - } - } - - void - init_stable() - { losers[0] = losers[init_winner_stable(1)]; } - - // Do not pass const reference since key will be used as local variable. - void - delete_min_insert_stable(T key, bool sup) - { - int source = losers[0].source; - for (unsigned int pos = (k + source) / 2; pos > 0; pos /= 2) - { - // The smaller one gets promoted, ties are broken by source. - if ( (sup && (!losers[pos].sup || losers[pos].source < source)) - || (!sup && !losers[pos].sup - && ((comp(losers[pos].key, key)) - || (!comp(key, losers[pos].key) - && losers[pos].source < source)))) - { - // The other one is smaller. - std::swap(losers[pos].sup, sup); - std::swap(losers[pos].source, source); - std::swap(losers[pos].key, key); - } - } - - losers[0].sup = sup; - losers[0].source = source; - losers[0].key = key; - } - }; - -#endif - -#if _GLIBCXX_LOSER_TREE_REFERENCE - -/** @brief Guarded loser tree, either copying the whole element into -* the tree structure, or looking up the element via the index. -* -* Guarding is done explicitly through one flag sup per element, -* inf is not needed due to a better initialization routine. This -* is a well-performing variant. -*/ -template<typename T, typename Comparator = std::less<T> > - class LoserTreeReference + && !comp(*losers[right].keyp, *losers[left].keyp))) + { + // Left one is less or equal. + losers[root] = losers[right]; + return left; + } + else + { + // Right one is less. + losers[root] = losers[left]; + return right; + } + } + } + + void init() + { losers[0] = losers[init_winner(1)]; } + + void delete_min_insert(const T& key, bool sup) { -#undef COPY -#ifdef COPY -#define KEY(i) losers[i].key -#define KEY_SOURCE(i) key -#else -#define KEY(i) keys[losers[i].source] -#define KEY_SOURCE(i) keys[i] -#endif - private: - struct Loser - { - bool sup; - int source; -#ifdef COPY - T key; -#endif - }; + const T* keyp = &key; + int source = losers[0].source; + for (unsigned int pos = (k + source) / 2; pos > 0; pos /= 2) + { + // The smaller one gets promoted. + if (sup || (!losers[pos].sup && comp(*losers[pos].keyp, *keyp))) + { + // The other one is smaller. + std::swap(losers[pos].sup, sup); + std::swap(losers[pos].source, source); + std::swap(losers[pos].keyp, keyp); + } + } + + losers[0].sup = sup; + losers[0].source = source; + losers[0].keyp = keyp; + } +}; + +/** @brief Base class for unguarded LoserTree implementation. + * + * The whole element is copied into the tree structure. + * + * No guarding is done, therefore not a single input sequence must + * run empty. Unused sequence heads are marked with a sentinel which + * is > all elements that are to be merged. + * + * This is a very fast variant. + */ +template<typename T, typename Comparator> +class LoserTreeUnguardedBase +{ +protected: + struct Loser + { + int source; + T key; + }; - unsigned int ik, k, offset; - Loser* losers; -#ifndef COPY - T* keys; -#endif - Comparator comp; + unsigned int ik, k, offset; + Loser* losers; + Comparator comp; - public: - LoserTreeReference(unsigned int _k, Comparator _comp = std::less<T>()) +public: + inline + LoserTreeUnguardedBase(unsigned int _k, const T _sentinel, + Comparator _comp = std::less<T>()) : comp(_comp) - { - ik = _k; - - // Next greater power of 2. - k = 1 << (log2(ik - 1) + 1); - offset = k; - losers = new Loser[k * 2]; -#ifndef COPY - keys = new T[ik]; -#endif - for (unsigned int i = ik - 1; i < k; ++i) - losers[i + k].sup = true; - } - - ~LoserTreeReference() - { - delete[] losers; -#ifndef COPY - delete[] keys; -#endif - } - - int - get_min_source() - { return losers[0].source; } - - void - insert_start(T key, int source, bool sup) - { - unsigned int pos = k + source; - - losers[pos].sup = sup; - losers[pos].source = source; - KEY(pos) = key; - } - - unsigned int - init_winner(unsigned int root) - { - if (root >= k) - { - return root; - } - else - { - unsigned int left = init_winner (2 * root); - unsigned int right = init_winner (2 * root + 1); - if ( losers[right].sup || - (!losers[left].sup && !comp(KEY(right), KEY(left)))) - { - // Left one is less or equal. - losers[root] = losers[right]; - return left; - } - else - { - // Right one is less. - losers[root] = losers[left]; - return right; - } - } - } - - void - init() - { - losers[0] = losers[init_winner(1)]; - } - - void - delete_min_insert(T key, bool sup) - { - int source = losers[0].source; - for (unsigned int pos = (k + source) / 2; pos > 0; pos /= 2) - { - // The smaller one gets promoted. - if (sup || (!losers[pos].sup && comp(KEY(pos), KEY_SOURCE(source)))) - { - // The other one is smaller. - std::swap(losers[pos].sup, sup); - std::swap(losers[pos].source, source); -#ifdef COPY - std::swap(KEY(pos), KEY_SOURCE(source)); -#endif - } - } - - losers[0].sup = sup; - losers[0].source = source; -#ifdef COPY - KEY(0) = KEY_SOURCE(source); + { + ik = _k; + + // Next greater power of 2. + k = 1 << (log2(ik - 1) + 1); + offset = k; + // Avoid default-constructing losers[].key + losers = static_cast<Loser*>(::operator new(2 * k * sizeof(Loser))); + + for (unsigned int i = /*k + ik - 1*/0; i < (2 * k); ++i) + { + losers[i].key = _sentinel; + losers[i].source = -1; + } + } + + inline ~LoserTreeUnguardedBase() + { ::operator delete(losers); } + + inline int + get_min_source() + { + // no dummy sequence can ever be at the top! +#if _GLIBCXX_ASSERTIONS + _GLIBCXX_PARALLEL_ASSERT(losers[0].source != -1); #endif - } + return losers[0].source; + } - void - insert_start_stable(T key, int source, bool sup) - { return insert_start(key, source, sup); } - - unsigned int - init_winner_stable(unsigned int root) - { - if (root >= k) - { - return root; - } - else - { - unsigned int left = init_winner (2 * root); - unsigned int right = init_winner (2 * root + 1); - if (losers[right].sup - || (!losers[left].sup && !comp(KEY(right), KEY(left)))) - { - // Left one is less or equal. - losers[root] = losers[right]; - return left; - } - else - { - // Right one is less. - losers[root] = losers[left]; - return right; - } - } - } - - void - init_stable() - { losers[0] = losers[init_winner_stable(1)]; } - - void - delete_min_insert_stable(T key, bool sup) - { - int source = losers[0].source; - for (unsigned int pos = (k + source) / 2; pos > 0; pos /= 2) - { - // The smaller one gets promoted, ties are broken by source. - if ((sup && (!losers[pos].sup || losers[pos].source < source)) - || (!sup && !losers[pos].sup - && ((comp(KEY(pos), KEY_SOURCE(source))) - || (!comp(KEY_SOURCE(source), KEY(pos)) - && losers[pos].source < source)))) - { - // The other one is smaller. - std::swap(losers[pos].sup, sup); - std::swap(losers[pos].source, source); -#ifdef COPY - std::swap(KEY(pos), KEY_SOURCE(source)); -#endif - } - } + inline void + insert_start(const T& key, int source, bool) + { + unsigned int pos = k + source; + + new(&(losers[pos].key)) T(key); + losers[pos].source = source; + } +}; + +/** + * @brief Stable implementation of unguarded LoserTree. + * + * Unstable variant is selected below with partial specialization. + */ +template<bool stable/* default == true */, typename T, typename Comparator> +class LoserTreeUnguarded : public LoserTreeUnguardedBase<T, Comparator> +{ + typedef LoserTreeUnguardedBase<T, Comparator> Base; + using Base::k; + using Base::losers; + +public: + LoserTreeUnguarded(unsigned int _k, const T _sentinel, + Comparator _comp = std::less<T>()) + : Base::LoserTreeUnguardedBase(_k, _sentinel, _comp) + {} + + unsigned int + init_winner(unsigned int root) + { + if (root >= k) + { + return root; + } + else + { + unsigned int left = init_winner (2 * root); + unsigned int right = init_winner (2 * root + 1); + if (!comp(losers[right].key, losers[left].key)) + { + // Left one is less or equal. + losers[root] = losers[right]; + return left; + } + else + { + // Right one is less. + losers[root] = losers[left]; + return right; + } + } + } + + inline void + init() + { + losers[0] = losers[init_winner(1)]; - losers[0].sup = sup; - losers[0].source = source; -#ifdef COPY - KEY(0) = KEY_SOURCE(source); + // no dummy sequence can ever be at the top at the beginning (0 sequences!) +#if _GLIBCXX_ASSERTIONS + _GLIBCXX_PARALLEL_ASSERT(losers[0].source != -1); #endif - } - }; -#undef KEY -#undef KEY_SOURCE + } + // Do not pass a const reference since key will be used as local variable. + inline void + delete_min_insert(T key, bool) + { + // No dummy sequence can ever be at the top and be retrieved! +#if _GLIBCXX_ASSERTIONS + _GLIBCXX_PARALLEL_ASSERT(losers[0].source != -1); #endif -#if _GLIBCXX_LOSER_TREE_POINTER - -/** @brief Guarded loser tree, either copying the whole element into - the tree structure, or looking up the element via the index. -* Guarding is done explicitly through one flag sup per element, -* inf is not needed due to a better initialization routine. -* This is a well-performing variant. -*/ -template<typename T, typename Comparator = std::less<T> > - class LoserTreePointer + int source = losers[0].source; + printf("%d\n", source); + for (unsigned int pos = (k + source) / 2; pos > 0; pos /= 2) + { + // The smaller one gets promoted, ties are broken by source. + if (comp(losers[pos].key, key) + || (!comp(key, losers[pos].key) && losers[pos].source < source)) + { + // The other one is smaller. + std::swap(losers[pos].source, source); + std::swap(losers[pos].key, key); + } + } + + losers[0].source = source; + losers[0].key = key; + } +}; + +/** + * @brief Non-Stable implementation of unguarded LoserTree. + * + * Stable implementation is above. + */ +template<typename T, typename Comparator> +class LoserTreeUnguarded</* stable == */false, T, Comparator> : + public LoserTreeUnguardedBase<T, Comparator> +{ + typedef LoserTreeUnguardedBase<T, Comparator> Base; + using Base::k; + using Base::losers; + +public: + LoserTreeUnguarded(unsigned int _k, const T _sentinel, + Comparator _comp = std::less<T>()) + : Base::LoserTreeUnguardedBase(_k, _sentinel, _comp) + {} + + unsigned int + init_winner (unsigned int root) { - private: - struct Loser - { - bool sup; - int source; - const T* keyp; - }; - - unsigned int ik, k, offset; - Loser* losers; - Comparator comp; - - public: - LoserTreePointer(unsigned int _k, Comparator _comp = std::less<T>()) - : comp(_comp) - { - ik = _k; - - // Next greater power of 2. - k = 1 << (log2(ik - 1) + 1); - offset = k; - losers = new Loser[k * 2]; - for (unsigned int i = ik - 1; i < k; ++i) - losers[i + k].sup = true; - } - - ~LoserTreePointer() - { delete[] losers; } - - int - get_min_source() - { return losers[0].source; } - - void - insert_start(const T& key, int source, bool sup) - { - unsigned int pos = k + source; - - losers[pos].sup = sup; - losers[pos].source = source; - losers[pos].keyp = &key; - } - - unsigned int - init_winner(unsigned int root) - { - if (root >= k) - return root; - else - { - unsigned int left = init_winner (2 * root); - unsigned int right = init_winner (2 * root + 1); - if (losers[right].sup - || (!losers[left].sup - && !comp(*losers[right].keyp, *losers[left].keyp))) - { - // Left one is less or equal. - losers[root] = losers[right]; - return left; - } - else - { - // Right one is less. - losers[root] = losers[left]; - return right; - } - } - } - - void - init() - { losers[0] = losers[init_winner(1)]; } - - void - delete_min_insert(const T& key, bool sup) - { - const T* keyp = &key; - int source = losers[0].source; - for (unsigned int pos = (k + source) / 2; pos > 0; pos /= 2) - { - // The smaller one gets promoted. - if (sup || (!losers[pos].sup && comp(*losers[pos].keyp, *keyp))) - { - // The other one is smaller. - std::swap(losers[pos].sup, sup); - std::swap(losers[pos].source, source); - std::swap(losers[pos].keyp, keyp); - } - } - - losers[0].sup = sup; - losers[0].source = source; - losers[0].keyp = keyp; - } - - void - insert_start_stable(const T& key, int source, bool sup) - { return insert_start(key, source, sup); } - - unsigned int - init_winner_stable(unsigned int root) - { - if (root >= k) - { - return root; - } - else - { - unsigned int left = init_winner (2 * root); - unsigned int right = init_winner (2 * root + 1); - if (losers[right].sup - || (!losers[left].sup && !comp(*losers[right].keyp, - *losers[left].keyp))) - { - // Left one is less or equal. - losers[root] = losers[right]; - return left; - } - else - { - // Right one is less. - losers[root] = losers[left]; - return right; - } - } - } - - void - init_stable() - { losers[0] = losers[init_winner_stable(1)]; } - - void - delete_min_insert_stable(const T& key, bool sup) - { - const T* keyp = &key; - int source = losers[0].source; - for (unsigned int pos = (k + source) / 2; pos > 0; pos /= 2) - { - // The smaller one gets promoted, ties are broken by source. - if ( (sup && (!losers[pos].sup || losers[pos].source < source)) - || (!sup && !losers[pos].sup && - ((comp(*losers[pos].keyp, *keyp)) - || (!comp(*keyp, *losers[pos].keyp) - && losers[pos].source < source)))) - { - // The other one is smaller. - std::swap(losers[pos].sup, sup); - std::swap(losers[pos].source, source); - std::swap(losers[pos].keyp, keyp); - } - } - - losers[0].sup = sup; - losers[0].source = source; - losers[0].keyp = keyp; - } - }; - + if (root >= k) + { + return root; + } + else + { + unsigned int left = init_winner (2 * root); + unsigned int right = init_winner (2 * root + 1); + +#if _GLIBCXX_ASSERTIONS + // If left one is sentinel then right one must be, too. + if (losers[left].source == -1) + _GLIBCXX_PARALLEL_ASSERT(losers[right].source == -1); #endif -#if _GLIBCXX_LOSER_TREE_UNGUARDED - -/** @brief Unguarded loser tree, copying the whole element into the -* tree structure. -* -* No guarding is done, therefore not a single input sequence must -* run empty. This is a very fast variant. -*/ -template<typename T, typename Comparator = std::less<T> > - class LoserTreeUnguarded + if (!comp(losers[right].key, losers[left].key)) + { + // Left one is less or equal. + losers[root] = losers[right]; + return left; + } + else + { + // Right one is less. + losers[root] = losers[left]; + return right; + } + } + } + + inline void + init() { - private: - struct Loser - { - int source; - T key; - }; - - unsigned int ik, k, offset; - unsigned int* mapping; - Loser* losers; - Comparator comp; - - void - map(unsigned int root, unsigned int begin, unsigned int end) - { - if (begin + 1 == end) - mapping[begin] = root; - else - { - // Next greater or equal power of 2. - unsigned int left = 1 << (log2(end - begin - 1)); - map(root * 2, begin, begin + left); - map(root * 2 + 1, begin + left, end); - } - } - - public: - LoserTreeUnguarded(unsigned int _k, Comparator _comp = std::less<T>()) - : comp(_comp) - { - ik = _k; - // Next greater or equal power of 2. - k = 1 << (log2(ik - 1) + 1); - offset = k; - losers = new Loser[k + ik]; - mapping = new unsigned int[ik]; - map(1, 0, ik); - } - - ~LoserTreeUnguarded() - { - delete[] losers; - delete[] mapping; - } - - int - get_min_source() - { return losers[0].source; } - - void - insert_start(const T& key, int source, bool) - { - unsigned int pos = mapping[source]; - losers[pos].source = source; - losers[pos].key = key; - } - - unsigned int - init_winner(unsigned int root, unsigned int begin, unsigned int end) - { - if (begin + 1 == end) - return mapping[begin]; - else - { - // Next greater or equal power of 2. - unsigned int division = 1 << (log2(end - begin - 1)); - unsigned int left = init_winner(2 * root, begin, begin + division); - unsigned int right = - init_winner(2 * root + 1, begin + division, end); - if (!comp(losers[right].key, losers[left].key)) - { - // Left one is less or equal. - losers[root] = losers[right]; - return left; - } - else - { - // Right one is less. - losers[root] = losers[left]; - return right; - } - } - } - - void - init() - { losers[0] = losers[init_winner(1, 0, ik)]; } - - // Do not pass const reference since key will be used as local variable. - void - delete_min_insert(const T& key, bool) - { - losers[0].key = key; - T& keyr = losers[0].key; - int& source = losers[0].source; - for (int pos = mapping[source] / 2; pos > 0; pos /= 2) - { - // The smaller one gets promoted. - if (comp(losers[pos].key, keyr)) - { - // The other one is smaller. - std::swap(losers[pos].source, source); - std::swap(losers[pos].key, keyr); - } - } - } - - void - insert_start_stable(const T& key, int source, bool) - { return insert_start(key, source, false); } - - void - init_stable() - { init(); } - - void - delete_min_insert_stable(const T& key, bool) - { - losers[0].key = key; - T& keyr = losers[0].key; - int& source = losers[0].source; - for (int pos = mapping[source] / 2; pos > 0; pos /= 2) - { - // The smaller one gets promoted, ties are broken by source. - if (comp(losers[pos].key, keyr) - || (!comp(keyr, losers[pos].key) - && losers[pos].source < source)) - { - // The other one is smaller. - std::swap(losers[pos].source, source); - std::swap(losers[pos].key, keyr); - } - } - } - }; + losers[0] = losers[init_winner(1)]; + // no dummy sequence can ever be at the top at the beginning (0 sequences!) +#if _GLIBCXX_ASSERTIONS + _GLIBCXX_PARALLEL_ASSERT(losers[0].source != -1); #endif + } -#if _GLIBCXX_LOSER_TREE_POINTER_UNGUARDED + // Do not pass a const reference since key will be used as local variable. + inline void + delete_min_insert(T key, bool) + { + printf("wrong\n"); + int source = losers[0].source; + for (unsigned int pos = (k + source) / 2; pos > 0; pos /= 2) + { + // The smaller one gets promoted. + if (comp(losers[pos].key, key)) + { + // The other one is smaller. + std::swap(losers[pos].source, source); + std::swap(losers[pos].key, key); + } + } + + losers[0].source = source; + losers[0].key = key; + } +}; /** @brief Unguarded loser tree, keeping only pointers to the * elements in the tree structure. @@ -926,175 +773,233 @@ template<typename T, typename Comparator = std::less<T> > * No guarding is done, therefore not a single input sequence must * run empty. This is a very fast variant. */ -template<typename T, typename Comparator = std::less<T> > - class LoserTreePointerUnguarded +template<typename T, typename Comparator> +class LoserTreePointerUnguardedBase +{ +protected: + struct Loser { - private: - struct Loser - { - int source; - const T* keyp; - }; - - unsigned int ik, k, offset; - unsigned int* mapping; - Loser* losers; - Comparator comp; - - void map(unsigned int root, unsigned int begin, unsigned int end) - { - if (begin + 1 == end) - mapping[begin] = root; - else - { - // Next greater or equal power of 2. - unsigned int left = 1 << (log2(end - begin - 1)); - map(root * 2, begin, begin + left); - map(root * 2 + 1, begin + left, end); - } - } - - public: - LoserTreePointerUnguarded(unsigned int _k, - Comparator _comp = std::less<T>()) - : comp(_comp) - { - ik = _k; - - // Next greater power of 2. - k = 1 << (log2(ik - 1) + 1); - offset = k; - losers = new Loser[k + ik]; - mapping = new unsigned int[ik]; - map(1, 0, ik); - } - - ~LoserTreePointerUnguarded() - { - delete[] losers; - delete[] mapping; - } - - int - get_min_source() - { return losers[0].source; } - - void - insert_start(const T& key, int source, bool) - { - unsigned int pos = mapping[source]; - losers[pos].source = source; - losers[pos].keyp = &key; - } - - unsigned int - init_winner(unsigned int root, unsigned int begin, unsigned int end) - { - if (begin + 1 == end) - return mapping[begin]; - else - { - // Next greater or equal power of 2. - unsigned int division = 1 << (log2(end - begin - 1)); - unsigned int left = init_winner(2 * root, begin, begin + division); - unsigned int right = init_winner(2 * root + 1, - begin + division, end); - if (!comp(*losers[right].keyp, *losers[left].keyp)) - { - // Left one is less or equal. - losers[root] = losers[right]; - return left; - } - else - { - // Right one is less. - losers[root] = losers[left]; - return right; - } - } - } + int source; + const T* keyp; + }; - void - init() - { losers[0] = losers[init_winner(1, 0, ik)]; } + unsigned int ik, k, offset; + Loser* losers; + const T sentinel; + Comparator comp; - void - delete_min_insert(const T& key, bool) - { - const T* keyp = &key; - int& source = losers[0].source; - for (int pos = mapping[source] / 2; pos > 0; pos /= 2) - { - // The smaller one gets promoted. - if (comp(*losers[pos].keyp, *keyp)) - { - // The other one is smaller. - std::swap(losers[pos].source, source); - std::swap(losers[pos].keyp, keyp); - } - } - - losers[0].keyp = keyp; - } +public: - void - insert_start_stable(const T& key, int source, bool) - { return insert_start(key, source, false); } + inline + LoserTreePointerUnguardedBase(unsigned int _k, const T _sentinel, + Comparator _comp = std::less<T>()) + : sentinel(_sentinel), comp(_comp) + { + ik = _k; + + // Next greater power of 2. + k = 1 << (log2(ik - 1) + 1); + offset = k; + // Avoid default-constructing losers[].key + losers = new Loser[2 * k]; + + for (unsigned int i = /*k + ik - 1*/0; i < (2 * k); ++i) + { + losers[i].keyp = &sentinel; + losers[i].source = -1; + } + } + + inline ~LoserTreePointerUnguardedBase() + { delete[] losers; } + + inline int + get_min_source() + { + // no dummy sequence can ever be at the top! +#if _GLIBCXX_ASSERTIONS + _GLIBCXX_PARALLEL_ASSERT(losers[0].source != -1); +#endif + return losers[0].source; + } - void - init_stable() - { init(); } + inline void + insert_start(const T& key, int source, bool) + { + unsigned int pos = k + source; + + losers[pos].keyp = &key; + losers[pos].source = source; + } +}; + +/** + * @brief Stable unguarded LoserTree variant storing pointers. + * + * Unstable variant is implemented below using partial specialization. + */ +template<bool stable/* default == true */, typename T, typename Comparator> +class LoserTreePointerUnguarded : + public LoserTreePointerUnguardedBase<T, Comparator> +{ + typedef LoserTreePointerUnguardedBase<T, Comparator> Base; + using Base::k; + using Base::losers; + +public: + LoserTreePointerUnguarded(unsigned int _k, const T _sentinel, + Comparator _comp = std::less<T>()) + : Base::LoserTreePointerUnguardedBase(_k, _sentinel, _comp) + {} + + unsigned int + init_winner(unsigned int root) + { + if (root >= k) + { + return root; + } + else + { + unsigned int left = init_winner (2 * root); + unsigned int right = init_winner (2 * root + 1); + if (!comp(*losers[right].keyp, *losers[left].keyp)) + { + // Left one is less or equal. + losers[root] = losers[right]; + return left; + } + else + { + // Right one is less. + losers[root] = losers[left]; + return right; + } + } + } + + inline void + init() + { + losers[0] = losers[init_winner(1)]; - void - delete_min_insert_stable(const T& key, bool) - { - int& source = losers[0].source; - const T* keyp = &key; - for (int pos = mapping[source] / 2; pos > 0; pos /= 2) - { - // The smaller one gets promoted, ties are broken by source. - if (comp(*losers[pos].keyp, *keyp) - || (!comp(*keyp, *losers[pos].keyp) - && losers[pos].source < source)) - { - // The other one is smaller. - std::swap(losers[pos].source, source); - std::swap(losers[pos].keyp, keyp); - } - } - losers[0].keyp = keyp; - } - }; + // no dummy sequence can ever be at the top at the beginning (0 sequences!) +#if _GLIBCXX_ASSERTIONS + _GLIBCXX_PARALLEL_ASSERT(losers[0].source != -1); #endif + } -template<typename _ValueTp, class Comparator> - struct loser_tree_traits + inline void + delete_min_insert(const T& key, bool sup) { -#if _GLIBCXX_LOSER_TREE - typedef LoserTree<_ValueTp, Comparator> LT; -#else -# if _GLIBCXX_LOSER_TREE_POINTER - typedef LoserTreePointer<_ValueTp, Comparator> LT; -# else -# error Must define some type in losertree.h. -# endif + const T* keyp = &key; + int source = losers[0].source; + for (unsigned int pos = (k + source) / 2; pos > 0; pos /= 2) + { + // The smaller one gets promoted, ties are broken by source. + if (comp(*losers[pos].keyp, *keyp) + || (!comp(*keyp, *losers[pos].keyp) && losers[pos].source < source)) + { + // The other one is smaller. + std::swap(losers[pos].source, source); + std::swap(losers[pos].keyp, keyp); + } + } + + losers[0].source = source; + losers[0].keyp = keyp; + + // no dummy sequence can ever be at the top! +#if _GLIBCXX_ASSERTIONS + _GLIBCXX_PARALLEL_ASSERT(losers[0].source != -1); +#endif + } +}; + +/** + * @brief Unstable unguarded LoserTree variant storing pointers. + * + * Stable variant is above. + */ +template<typename T, typename Comparator> +class LoserTreePointerUnguarded</* stable == */false, T, Comparator> : + public LoserTreePointerUnguardedBase<T, Comparator> +{ + typedef LoserTreePointerUnguardedBase<T, Comparator> Base; + using Base::k; + using Base::losers; + +public: + LoserTreePointerUnguarded(unsigned int _k, const T _sentinel, + Comparator _comp = std::less<T>()) + : Base::LoserTreePointerUnguardedBase(_k, _sentinel, _comp) + {} + + unsigned int + init_winner(unsigned int root) + { + if (root >= k) + { + return root; + } + else + { + unsigned int left = init_winner (2 * root); + unsigned int right = init_winner (2 * root + 1); + +#if _GLIBCXX_ASSERTIONS + // If left one is sentinel then right one must be, too. + if (losers[left].source == -1) + _GLIBCXX_PARALLEL_ASSERT(losers[right].source == -1); #endif - }; -template<typename _ValueTp, class Comparator> - struct loser_tree_unguarded_traits + if (!comp(*losers[right].keyp, *losers[left].keyp)) + { + // Left one is less or equal. + losers[root] = losers[right]; + return left; + } + else + { + // Right one is less. + losers[root] = losers[left]; + return right; + } + } + } + + inline void + init() { -#if _GLIBCXX_LOSER_TREE_UNGUARDED - typedef LoserTreeUnguarded<_ValueTp, Comparator> LT; -#else -# if _GLIBCXX_LOSER_TREE_POINTER_UNGUARDED - typedef LoserTreePointerUnguarded<_ValueTp, Comparator> LT; -# else -# error Must define some unguarded type in losertree.h. -# endif + losers[0] = losers[init_winner(1)]; + + // no dummy sequence can ever be at the top at the beginning (0 sequences!) +#if _GLIBCXX_ASSERTIONS + _GLIBCXX_PARALLEL_ASSERT(losers[0].source != -1); #endif - }; + } -} + inline void + delete_min_insert(const T& key, bool sup) + { + const T* keyp = &key; + int source = losers[0].source; + for (unsigned int pos = (k + source) / 2; pos > 0; pos /= 2) + { + // The smaller one gets promoted. + if (comp(*(losers[pos].keyp), *keyp)) + { + // The other one is smaller. + std::swap(losers[pos].source, source); + std::swap(losers[pos].keyp, keyp); + } + } + + losers[0].source = source; + losers[0].keyp = keyp; + } +}; + +} // namespace __gnu_parallel #endif diff --git a/libstdc++-v3/include/parallel/merge.h b/libstdc++-v3/include/parallel/merge.h index f12f3110871..6e0f2e382c3 100644 --- a/libstdc++-v3/include/parallel/merge.h +++ b/libstdc++-v3/include/parallel/merge.h @@ -239,19 +239,26 @@ namespace __gnu_parallel std::iterator_traits<RandomAccessIterator1>:: difference_type max_length, Comparator comp) { - typedef typename std::iterator_traits<RandomAccessIterator1>::value_type - value_type; + typedef typename + std::iterator_traits<RandomAccessIterator1>::value_type value_type; typedef typename std::iterator_traits<RandomAccessIterator1>:: difference_type difference_type1 /* == difference_type2 */; typedef typename std::iterator_traits<RandomAccessIterator3>:: difference_type difference_type3; + typedef typename std::pair<RandomAccessIterator1, RandomAccessIterator1> + iterator_pair; std::pair<RandomAccessIterator1, RandomAccessIterator1> seqs[2] = { std::make_pair(begin1, end1), std::make_pair(begin2, end2) }; - RandomAccessIterator3 - target_end = parallel_multiway_merge(seqs, seqs + 2, target, - comp, max_length, true, false); + RandomAccessIterator3 + target_end = parallel_multiway_merge + < /* stable = */ true, /* sentinels = */ false>( + seqs, seqs + 2, target, comp, + multiway_merge_exact_splitting + < /* stable = */ true, iterator_pair*, + Comparator, difference_type1>, + max_length); return target_end; } diff --git a/libstdc++-v3/include/parallel/multiway_merge.h b/libstdc++-v3/include/parallel/multiway_merge.h index 6cc724b6015..40a2f1bc6af 100644 --- a/libstdc++-v3/include/parallel/multiway_merge.h +++ b/libstdc++-v3/include/parallel/multiway_merge.h @@ -40,7 +40,7 @@ * This file is a GNU parallel extension to the Standard C++ Library. */ -// Written by Johannes Singler. +// Written by Johannes Singler and Manuel Holtgrewe. #ifndef _GLIBCXX_PARALLEL_MULTIWAY_MERGE_H #define _GLIBCXX_PARALLEL_MULTIWAY_MERGE_H @@ -50,7 +50,6 @@ #include <bits/stl_algo.h> #include <parallel/features.h> #include <parallel/parallel.h> -#include <parallel/merge.h> #include <parallel/losertree.h> #if _GLIBCXX_ASSERTIONS #include <parallel/checkers.h> @@ -59,27 +58,34 @@ /** @brief Length of a sequence described by a pair of iterators. */ #define _GLIBCXX_PARALLEL_LENGTH(s) ((s).second - (s).first) -// XXX need iterator typedefs namespace __gnu_parallel { + +// Announce guarded and unguarded iterator. + template<typename RandomAccessIterator, typename Comparator> class guarded_iterator; +// Making the arguments const references seems to dangerous, +// the user-defined comparator might not be const. template<typename RandomAccessIterator, typename Comparator> inline bool operator<(guarded_iterator<RandomAccessIterator, Comparator>& bi1, - guarded_iterator<RandomAccessIterator, Comparator>& bi2); + guarded_iterator<RandomAccessIterator, Comparator>& bi2); template<typename RandomAccessIterator, typename Comparator> inline bool operator<=(guarded_iterator<RandomAccessIterator, Comparator>& bi1, - guarded_iterator<RandomAccessIterator, Comparator>& bi2); + guarded_iterator<RandomAccessIterator, Comparator>& bi2); - /** @brief Iterator wrapper supporting an implicit supremum at the end - of the sequence, dominating all comparisons. - * Deriving from RandomAccessIterator is not possible since - * RandomAccessIterator need not be a class. - */ +/** @brief Iterator wrapper supporting an implicit supremum at the end + * of the sequence, dominating all comparisons. + * + * The implicit supremum comes with a performance cost. + * + * Deriving from RandomAccessIterator is not possible since + * RandomAccessIterator need not be a class. + */ template<typename RandomAccessIterator, typename Comparator> class guarded_iterator { @@ -100,7 +106,7 @@ template<typename RandomAccessIterator, typename Comparator> * @param comp Comparator provided for associated overloaded * compare operators. */ guarded_iterator(RandomAccessIterator begin, - RandomAccessIterator end, Comparator& comp) + RandomAccessIterator end, Comparator& comp) : current(begin), end(end), comp(comp) { } @@ -115,7 +121,7 @@ template<typename RandomAccessIterator, typename Comparator> /** @brief Dereference operator. * @return Referenced element. */ - typename std::iterator_traits<RandomAccessIterator>::value_type + typename std::iterator_traits<RandomAccessIterator>::value_type& operator*() { return *current; } @@ -158,7 +164,7 @@ template<typename RandomAccessIterator, typename Comparator> template<typename RandomAccessIterator, typename Comparator> inline bool operator<=(guarded_iterator<RandomAccessIterator, Comparator>& bi1, - guarded_iterator<RandomAccessIterator, Comparator>& bi2) + guarded_iterator<RandomAccessIterator, Comparator>& bi2) { if (bi2.current == bi2.end) //bi1 is sup return bi1.current != bi1.end; //bi2 is not sup @@ -185,7 +191,7 @@ template<typename RandomAccessIterator, typename Comparator> { private: /** @brief Current iterator position. */ - RandomAccessIterator& current; + RandomAccessIterator current; /** @brief Comparator. */ mutable Comparator& comp; @@ -195,7 +201,7 @@ template<typename RandomAccessIterator, typename Comparator> * @param end Unused, only for compatibility. * @param comp Unused, only for compatibility. */ unguarded_iterator(RandomAccessIterator begin, - RandomAccessIterator end, Comparator& comp) + RandomAccessIterator end, Comparator& comp) : current(begin), comp(comp) { } @@ -210,7 +216,7 @@ template<typename RandomAccessIterator, typename Comparator> /** @brief Dereference operator. * @return Referenced element. */ - typename std::iterator_traits<RandomAccessIterator>::value_type + typename std::iterator_traits<RandomAccessIterator>::value_type& operator*() { return *current; } @@ -256,159 +262,41 @@ template<typename RandomAccessIterator, typename Comparator> return !(bi1.comp)(*bi2, *bi1); } -/** Prepare a set of sequences to be merged without a (end) guard - * @param seqs_begin - * @param seqs_end - * @param comp - * @param min_sequence - * @param stable - * @pre (seqs_end - seqs_begin > 0) */ -template<typename RandomAccessIteratorIterator, typename Comparator> - typename std::iterator_traits< - typename std::iterator_traits<RandomAccessIteratorIterator>::value_type - ::first_type>::difference_type - prepare_unguarded(RandomAccessIteratorIterator seqs_begin, - RandomAccessIteratorIterator seqs_end, Comparator comp, - int& min_sequence, bool stable) - { - _GLIBCXX_CALL(seqs_end - seqs_begin) - - typedef typename std::iterator_traits<RandomAccessIteratorIterator> - ::value_type::first_type - RandomAccessIterator1; - typedef typename std::iterator_traits<RandomAccessIterator1>::value_type - value_type; - typedef typename std::iterator_traits<RandomAccessIterator1> - ::difference_type - difference_type; - - if ((*seqs_begin).first == (*seqs_begin).second) - { - // Empty sequence found, it's the first one. - min_sequence = 0; - return -1; - } - - // Last element in sequence. - value_type min = *((*seqs_begin).second - 1); - min_sequence = 0; - for (RandomAccessIteratorIterator s = seqs_begin + 1; s != seqs_end; ++s) - { - if ((*s).first == (*s).second) - { - // Empty sequence found. - min_sequence = static_cast<int>(s - seqs_begin); - return -1; - } - - // Last element in sequence. - const value_type& v = *((*s).second - 1); - if (comp(v, min)) //strictly smaller - { - min = v; - min_sequence = static_cast<int>(s - seqs_begin); - } - } - - difference_type overhang_size = 0; - - int s = 0; - for (s = 0; s <= min_sequence; ++s) - { - RandomAccessIterator1 split; - if (stable) - split = std::upper_bound(seqs_begin[s].first, seqs_begin[s].second, - min, comp); - else - split = std::lower_bound(seqs_begin[s].first, seqs_begin[s].second, - min, comp); - - overhang_size += seqs_begin[s].second - split; - } - - for (; s < (seqs_end - seqs_begin); ++s) - { - RandomAccessIterator1 split = std::lower_bound( - seqs_begin[s].first, seqs_begin[s].second, min, comp); - overhang_size += seqs_begin[s].second - split; - } - - // So many elements will be left over afterwards. - return overhang_size; - } - -/** Prepare a set of sequences to be merged with a (end) guard (sentinel) - * @param seqs_begin - * @param seqs_end - * @param comp */ -template<typename RandomAccessIteratorIterator, typename Comparator> - typename std::iterator_traits<typename std::iterator_traits< - RandomAccessIteratorIterator>::value_type::first_type>::difference_type - prepare_unguarded_sentinel(RandomAccessIteratorIterator seqs_begin, - RandomAccessIteratorIterator seqs_end, - Comparator comp) - { - _GLIBCXX_CALL(seqs_end - seqs_begin) - - typedef typename std::iterator_traits<RandomAccessIteratorIterator> - ::value_type::first_type - RandomAccessIterator1; - typedef typename std::iterator_traits<RandomAccessIterator1> - ::value_type - value_type; - typedef typename std::iterator_traits<RandomAccessIterator1> - ::difference_type - difference_type; - - // Last element in sequence. - value_type* max = NULL; - for (RandomAccessIteratorIterator s = seqs_begin; s != seqs_end; ++s) - { - if ((*s).first == (*s).second) - continue; - - // Last element in sequence. - value_type& v = *((*s).second - 1); - - // Strictly greater. - if (!max || comp(*max, v)) - max = &v; - } - - difference_type overhang_size = 0; - for (RandomAccessIteratorIterator s = seqs_begin; s != seqs_end; ++s) - { - RandomAccessIterator1 split = - std::lower_bound((*s).first, (*s).second, *max, comp); - overhang_size += (*s).second - split; - - // Set sentinel. - *((*s).second) = *max; - } - - // So many elements will be left over afterwards. - return overhang_size; - } - /** @brief Highly efficient 3-way merging procedure. - * @param seqs_begin Begin iterator of iterator pair input sequence. - * @param seqs_end End iterator of iterator pair input sequence. - * @param target Begin iterator out output sequence. - * @param comp Comparator. - * @param length Maximum length to merge. - * @param stable Unused, stable anyway. - * @return End iterator of output sequence. */ + * + * Merging is done with the algorithm implementation described by Peter + * Sanders. Basically, the idea is to minimize the number of necessary + * comparison after merging out an element. The implementation trick + * that makes this fast is that the order of the sequences is stored + * in the instruction pointer (translated into labels in C++). + * + * This works well for merging up to 4 sequences. + * + * Note that making the merging stable does <em>not</em> come at a + * performance hit. + * + * Whether the merging is done guarded or unguarded is selected by the + * used iterator class. + * + * @param seqs_begin Begin iterator of iterator pair input sequence. + * @param seqs_end End iterator of iterator pair input sequence. + * @param target Begin iterator out output sequence. + * @param comp Comparator. + * @param length Maximum length to merge. + * + * @return End iterator of output sequence. + */ template<template<typename RAI, typename C> class iterator, typename RandomAccessIteratorIterator, typename RandomAccessIterator3, typename _DifferenceTp, typename Comparator> RandomAccessIterator3 - multiway_merge_3_variant(RandomAccessIteratorIterator seqs_begin, - RandomAccessIteratorIterator seqs_end, - RandomAccessIterator3 target, - Comparator comp, _DifferenceTp length, - bool stable) + multiway_merge_3_variant( + RandomAccessIteratorIterator seqs_begin, + RandomAccessIteratorIterator seqs_end, + RandomAccessIterator3 target, + Comparator comp, _DifferenceTp length) { _GLIBCXX_CALL(length); @@ -423,6 +311,10 @@ template<template<typename RAI, typename C> class iterator, if (length == 0) return target; +#if _GLIBCXX_ASSERTIONS + _DifferenceTp orig_length = length; +#endif + iterator<RandomAccessIterator1, Comparator> seq0(seqs_begin[0].first, seqs_begin[0].second, comp), seq1(seqs_begin[1].first, seqs_begin[1].second, comp), @@ -450,17 +342,16 @@ template<template<typename RAI, typename C> class iterator, else goto s210; } - -#define _GLIBCXX_PARALLEL_MERGE_3_CASE(a,b,c,c0,c1)\ +#define _GLIBCXX_PARALLEL_MERGE_3_CASE(a,b,c,c0,c1) \ s ## a ## b ## c : \ *target = *seq ## a; \ - ++target; \ - --length; \ - ++seq ## a; \ - if (length == 0) goto finish; \ - if (seq ## a c0 seq ## b) goto s ## a ## b ## c; \ - if (seq ## a c1 seq ## c) goto s ## b ## a ## c; \ - goto s ## b ## c ## a; + ++target; \ + --length; \ + ++seq ## a; \ + if (length == 0) goto finish; \ + if (seq ## a c0 seq ## b) goto s ## a ## b ## c; \ + if (seq ## a c1 seq ## c) goto s ## b ## a ## c; \ + goto s ## b ## c ## a; _GLIBCXX_PARALLEL_MERGE_3_CASE(0, 1, 2, <=, <=); _GLIBCXX_PARALLEL_MERGE_3_CASE(1, 2, 0, <=, < ); @@ -474,6 +365,14 @@ template<template<typename RAI, typename C> class iterator, finish: ; +#if _GLIBCXX_ASSERTIONS + _GLIBCXX_PARALLEL_ASSERT( + ((RandomAccessIterator1)seq0 - seqs_begin[0].first) + + ((RandomAccessIterator1)seq1 - seqs_begin[1].first) + + ((RandomAccessIterator1)seq2 - seqs_begin[2].first) + == orig_length); +#endif + seqs_begin[0].first = seq0; seqs_begin[1].first = seq1; seqs_begin[2].first = seq2; @@ -481,95 +380,31 @@ template<template<typename RAI, typename C> class iterator, return target; } -template<typename RandomAccessIteratorIterator, - typename RandomAccessIterator3, - typename _DifferenceTp, - typename Comparator> - RandomAccessIterator3 - multiway_merge_3_combined(RandomAccessIteratorIterator seqs_begin, - RandomAccessIteratorIterator seqs_end, - RandomAccessIterator3 target, - Comparator comp, - _DifferenceTp length, bool stable) - { - _GLIBCXX_CALL(length); - - typedef _DifferenceTp difference_type; - typedef typename std::iterator_traits<RandomAccessIteratorIterator> - ::value_type::first_type - RandomAccessIterator1; - typedef typename std::iterator_traits<RandomAccessIterator1>::value_type - value_type; - - int min_seq; - RandomAccessIterator3 target_end; - - // Stable anyway. - difference_type overhang = - prepare_unguarded(seqs_begin, seqs_end, comp, min_seq, true); - - difference_type total_length = 0; - for (RandomAccessIteratorIterator s = seqs_begin; s != seqs_end; ++s) - total_length += _GLIBCXX_PARALLEL_LENGTH(*s); - - if (overhang != -1) - { - difference_type unguarded_length = - std::min(length, total_length - overhang); - target_end = multiway_merge_3_variant<unguarded_iterator> - (seqs_begin, seqs_end, target, comp, unguarded_length, stable); - overhang = length - unguarded_length; - } - else - { - // Empty sequence found. - overhang = length; - target_end = target; - } - -#if _GLIBCXX_ASSERTIONS - _GLIBCXX_PARALLEL_ASSERT(target_end == target + length - overhang); - _GLIBCXX_PARALLEL_ASSERT(is_sorted(target, target_end, comp)); -#endif - - switch (min_seq) - { - case 0: - // Iterators will be advanced accordingly. - target_end = merge_advance(seqs_begin[1].first, seqs_begin[1].second, - seqs_begin[2].first, seqs_begin[2].second, - target_end, overhang, comp); - break; - case 1: - target_end = merge_advance(seqs_begin[0].first, seqs_begin[0].second, - seqs_begin[2].first, seqs_begin[2].second, - target_end, overhang, comp); - break; - case 2: - target_end = merge_advance(seqs_begin[0].first, seqs_begin[0].second, - seqs_begin[1].first, seqs_begin[1].second, - target_end, overhang, comp); - break; - default: - _GLIBCXX_PARALLEL_ASSERT(false); - } - -#if _GLIBCXX_ASSERTIONS - _GLIBCXX_PARALLEL_ASSERT(target_end == target + length); - _GLIBCXX_PARALLEL_ASSERT(is_sorted(target, target_end, comp)); -#endif - - return target_end; - } - -/** @brief Highly efficient 4-way merging procedure. - * @param seqs_begin Begin iterator of iterator pair input sequence. - * @param seqs_end End iterator of iterator pair input sequence. - * @param target Begin iterator out output sequence. - * @param comp Comparator. - * @param length Maximum length to merge. - * @param stable Unused, stable anyway. - * @return End iterator of output sequence. */ +/** + * @brief Highly efficient 4-way merging procedure. + * + * Merging is done with the algorithm implementation described by Peter + * Sanders. Basically, the idea is to minimize the number of necessary + * comparison after merging out an element. The implementation trick + * that makes this fast is that the order of the sequences is stored + * in the instruction pointer (translated into goto labels in C++). + * + * This works well for merging up to 4 sequences. + * + * Note that making the merging stable does <em>not</em> come at a + * performance hit. + * + * Whether the merging is done guarded or unguarded is selected by the + * used iterator class. + * + * @param seqs_begin Begin iterator of iterator pair input sequence. + * @param seqs_end End iterator of iterator pair input sequence. + * @param target Begin iterator out output sequence. + * @param comp Comparator. + * @param length Maximum length to merge. + * + * @return End iterator of output sequence. + */ template<template<typename RAI, typename C> class iterator, typename RandomAccessIteratorIterator, typename RandomAccessIterator3, @@ -579,7 +414,7 @@ template<template<typename RAI, typename C> class iterator, multiway_merge_4_variant(RandomAccessIteratorIterator seqs_begin, RandomAccessIteratorIterator seqs_end, RandomAccessIterator3 target, - Comparator comp, _DifferenceTp length, bool stable) + Comparator comp, _DifferenceTp length) { _GLIBCXX_CALL(length); typedef _DifferenceTp difference_type; @@ -676,280 +511,20 @@ template<template<typename RAI, typename C> class iterator, return target; } -template<typename RandomAccessIteratorIterator, - typename RandomAccessIterator3, - typename _DifferenceTp, - typename Comparator> - RandomAccessIterator3 - multiway_merge_4_combined(RandomAccessIteratorIterator seqs_begin, - RandomAccessIteratorIterator seqs_end, - RandomAccessIterator3 target, - Comparator comp, - _DifferenceTp length, bool stable) - { - _GLIBCXX_CALL(length); - typedef _DifferenceTp difference_type; - - typedef typename std::iterator_traits<RandomAccessIteratorIterator> - ::value_type::first_type - RandomAccessIterator1; - typedef typename std::iterator_traits<RandomAccessIterator1>::value_type - value_type; - - int min_seq; - RandomAccessIterator3 target_end; - - // Stable anyway. - difference_type overhang = - prepare_unguarded(seqs_begin, seqs_end, comp, min_seq, true); - - difference_type total_length = 0; - for (RandomAccessIteratorIterator s = seqs_begin; s != seqs_end; ++s) - total_length += _GLIBCXX_PARALLEL_LENGTH(*s); - - if (overhang != -1) - { - difference_type unguarded_length = - std::min(length, total_length - overhang); - target_end = multiway_merge_4_variant<unguarded_iterator> - (seqs_begin, seqs_end, target, comp, unguarded_length, stable); - overhang = length - unguarded_length; - } - else - { - // Empty sequence found. - overhang = length; - target_end = target; - } - -#if _GLIBCXX_ASSERTIONS - _GLIBCXX_PARALLEL_ASSERT(target_end == target + length - overhang); - _GLIBCXX_PARALLEL_ASSERT(is_sorted(target, target_end, comp)); -#endif - - std::vector<std::pair<RandomAccessIterator1, RandomAccessIterator1> > - one_missing(seqs_begin, seqs_end); - one_missing.erase(one_missing.begin() + min_seq); //remove - - target_end = multiway_merge_3_variant<guarded_iterator>( - one_missing.begin(), one_missing.end(), - target_end, comp, overhang, stable); - - // Insert back again. - one_missing.insert(one_missing.begin() + min_seq, seqs_begin[min_seq]); - // Write back modified iterators. - copy(one_missing.begin(), one_missing.end(), seqs_begin); - -#if _GLIBCXX_ASSERTIONS - _GLIBCXX_PARALLEL_ASSERT(target_end == target + length); - _GLIBCXX_PARALLEL_ASSERT(is_sorted(target, target_end, comp)); -#endif - - return target_end; - } - -/** @brief Basic multi-way merging procedure. - * - * The head elements are kept in a sorted array, new heads are - * inserted linearly. - * @param seqs_begin Begin iterator of iterator pair input sequence. - * @param seqs_end End iterator of iterator pair input sequence. - * @param target Begin iterator out output sequence. - * @param comp Comparator. - * @param length Maximum length to merge. - * @param stable Stable merging incurs a performance penalty. - * @return End iterator of output sequence. - */ -template<typename RandomAccessIteratorIterator, - typename RandomAccessIterator3, - typename _DifferenceTp, - typename Comparator> - RandomAccessIterator3 - multiway_merge_bubble(RandomAccessIteratorIterator seqs_begin, - RandomAccessIteratorIterator seqs_end, - RandomAccessIterator3 target, - Comparator comp, _DifferenceTp length, bool stable) - { - _GLIBCXX_CALL(length) - - typedef _DifferenceTp difference_type; - typedef typename std::iterator_traits<RandomAccessIteratorIterator> - ::value_type::first_type - RandomAccessIterator1; - typedef typename std::iterator_traits<RandomAccessIterator1>::value_type - value_type; - - int k = static_cast<int>(seqs_end - seqs_begin); - int nrs; // Number of remaining sequences. - - // Avoid default constructor. - value_type* fe = static_cast<value_type*>( - ::operator new(sizeof(value_type) * k)); // Front elements. - int* source = new int[k]; - difference_type total_length = 0; - - // Write entries into queue. - nrs = 0; - for (int pi = 0; pi < k; ++pi) - { - if (seqs_begin[pi].first != seqs_begin[pi].second) - { - ::new(&(fe[nrs])) value_type(*(seqs_begin[pi].first)); - source[nrs] = pi; - ++nrs; - total_length += _GLIBCXX_PARALLEL_LENGTH(seqs_begin[pi]); - } - } - - if (stable) - { - // Bubble sort fe and source by fe. - for (int k = 0; k < nrs - 1; ++k) - for (int pi = nrs - 1; pi > k; --pi) - if (comp(fe[pi], fe[pi - 1]) || - (!comp(fe[pi - 1], fe[pi]) && source[pi] < source[pi - 1])) - { - std::swap(fe[pi - 1], fe[pi]); - std::swap(source[pi - 1], source[pi]); - } - } - else - { - for (int k = 0; k < nrs - 1; ++k) - for (int pi = nrs - 1; pi > k; --pi) - if (comp(fe[pi], fe[pi-1])) - { - std::swap(fe[pi-1], fe[pi]); - std::swap(source[pi-1], source[pi]); - } - } - - // Iterate. - if (stable) - { - int j; - while (nrs > 0 && length > 0) - { - if (source[0] < source[1]) - { - // fe[0] <= fe[1] - while ((nrs == 1 || !comp(fe[1], fe[0])) && length > 0) - { - *target = fe[0]; - ++target; - ++(seqs_begin[source[0]].first); - --length; - if (seqs_begin[source[0]].first - == seqs_begin[source[0]].second) - { - // Move everything to the left. - for (int s = 0; s < nrs - 1; ++s) - { - fe[s] = fe[s + 1]; - source[s] = source[s + 1]; - } - fe[nrs - 1].~value_type(); //Destruct explicitly. - --nrs; - break; - } - else - fe[0] = *(seqs_begin[source[0]].first); - } - } - else - { - // fe[0] < fe[1] - while ((nrs == 1 || comp(fe[0], fe[1])) && length > 0) - { - *target = fe[0]; - ++target; - ++(seqs_begin[source[0]].first); - --length; - if (seqs_begin[source[0]].first - == seqs_begin[source[0]].second) - { - for (int s = 0; s < nrs - 1; ++s) - { - fe[s] = fe[s + 1]; - source[s] = source[s + 1]; - } - fe[nrs - 1].~value_type(); //Destruct explicitly. - --nrs; - break; - } - else - fe[0] = *(seqs_begin[source[0]].first); - } - } - - // Sink down. - j = 1; - while ((j < nrs) && (comp(fe[j], fe[j - 1]) - || (!comp(fe[j - 1], fe[j]) - && (source[j] < source[j - 1])))) - { - std::swap(fe[j - 1], fe[j]); - std::swap(source[j - 1], source[j]); - ++j; - } - } - } - else - { - int j; - while (nrs > 0 && length > 0) - { - // fe[0] <= fe[1] - while (nrs == 1 || (!comp(fe[1], fe[0])) && length > 0) - { - *target = fe[0]; - ++target; - ++seqs_begin[source[0]].first; - --length; - if (seqs_begin[source[0]].first - == seqs_begin[source[0]].second) - { - for (int s = 0; s < (nrs - 1); ++s) - { - fe[s] = fe[s + 1]; - source[s] = source[s + 1]; - } - fe[nrs - 1].~value_type(); //Destruct explicitly. - --nrs; - break; - } - else - fe[0] = *(seqs_begin[source[0]].first); - } - - // Sink down. - j = 1; - while ((j < nrs) && comp(fe[j], fe[j - 1])) - { - std::swap(fe[j - 1], fe[j]); - std::swap(source[j - 1], source[j]); - ++j; - } - } - } - - ::operator delete(fe); //Destructors already called. - delete[] source; - - return target; - } - /** @brief Multi-way merging procedure for a high branching factor, - * guarded case. + * guarded case. * - * The head elements are kept in a loser tree. - * @param seqs_begin Begin iterator of iterator pair input sequence. - * @param seqs_end End iterator of iterator pair input sequence. - * @param target Begin iterator out output sequence. - * @param comp Comparator. - * @param length Maximum length to merge. - * @param stable Stable merging incurs a performance penalty. - * @return End iterator of output sequence. + * This merging variant uses a LoserTree class as selected by <tt>LT</tt>. + * + * Stability is selected through the used LoserTree class <tt>LT</tt>. + * + * @param seqs_begin Begin iterator of iterator pair input sequence. + * @param seqs_end End iterator of iterator pair input sequence. + * @param target Begin iterator out output sequence. + * @param comp Comparator. + * @param length Maximum length to merge. + * + * @return End iterator of output sequence. */ template<typename LT, typename RandomAccessIteratorIterator, @@ -961,7 +536,7 @@ template<typename LT, RandomAccessIteratorIterator seqs_end, RandomAccessIterator3 target, Comparator comp, - _DifferenceTp length, bool stable) + _DifferenceTp length) { _GLIBCXX_CALL(length) @@ -994,82 +569,52 @@ template<typename LT, for (int t = 0; t < k; ++t) { - if (stable) - { - if (seqs_begin[t].first == seqs_begin[t].second) - lt.insert_start_stable(*arbitrary_element, t, true); - else - lt.insert_start_stable(*seqs_begin[t].first, t, false); - } + if (seqs_begin[t].first == seqs_begin[t].second) + lt.insert_start(*arbitrary_element, t, true); else - { - if (seqs_begin[t].first == seqs_begin[t].second) - lt.insert_start(*arbitrary_element, t, true); - else - lt.insert_start(*seqs_begin[t].first, t, false); - } + lt.insert_start(*seqs_begin[t].first, t, false); } - if (stable) - lt.init_stable(); - else - lt.init(); + lt.init(); - total_length = std::min(total_length, length); + const difference_type const_total_length(std::min(total_length, length)); int source; - if (stable) + for (difference_type i = 0; i < const_total_length; ++i) { - for (difference_type i = 0; i < total_length; ++i) - { - // Take out. - source = lt.get_min_source(); + //take out + source = lt.get_min_source(); - *(target++) = *(seqs_begin[source].first++); + *(target++) = *(seqs_begin[source].first++); - // Feed. - if (seqs_begin[source].first == seqs_begin[source].second) - lt.delete_min_insert_stable(*arbitrary_element, true); - else - // Replace from same source. - lt.delete_min_insert_stable(*seqs_begin[source].first, false); - - } - } - else - { - for (difference_type i = 0; i < total_length; ++i) - { - //take out - source = lt.get_min_source(); - - *(target++) = *(seqs_begin[source].first++); - - // Feed. - if (seqs_begin[source].first == seqs_begin[source].second) - lt.delete_min_insert(*arbitrary_element, true); - else - // Replace from same source. - lt.delete_min_insert(*seqs_begin[source].first, false); - } + // Feed. + if (seqs_begin[source].first == seqs_begin[source].second) + lt.delete_min_insert(*arbitrary_element, true); + else + // Replace from same source. + lt.delete_min_insert(*seqs_begin[source].first, false); } return target; } /** @brief Multi-way merging procedure for a high branching factor, - * unguarded case. + * unguarded case. * - * The head elements are kept in a loser tree. - * @param seqs_begin Begin iterator of iterator pair input sequence. - * @param seqs_end End iterator of iterator pair input sequence. - * @param target Begin iterator out output sequence. - * @param comp Comparator. - * @param length Maximum length to merge. - * @param stable Stable merging incurs a performance penalty. - * @return End iterator of output sequence. - * @pre No input will run out of elements during the merge. + * Merging is done using the LoserTree class <tt>LT</tt>. + * + * Stability is selected by the used LoserTrees. + * + * @pre No input will run out of elements during the merge. + * + * @param seqs_begin Begin iterator of iterator pair input sequence. + * @param seqs_end End iterator of iterator pair input sequence. + * @param target Begin iterator out output sequence. + * @param comp Comparator. + * @param length Maximum length to merge. + * + * @return End iterator of output sequence. */ template<typename LT, typename RandomAccessIteratorIterator, @@ -1079,8 +624,8 @@ template<typename LT, multiway_merge_loser_tree_unguarded(RandomAccessIteratorIterator seqs_begin, RandomAccessIteratorIterator seqs_end, RandomAccessIterator3 target, - Comparator comp, - _DifferenceTp length, bool stable) + int min_seq, Comparator comp, + _DifferenceTp length) { _GLIBCXX_CALL(length) typedef _DifferenceTp difference_type; @@ -1093,7 +638,11 @@ template<typename LT, int k = seqs_end - seqs_begin; - LT lt(k, comp); + // Determine the sentinel. The sentinel is largest/last element of the + // sequences with the smallest largest/last element. + value_type sentinel = *(seqs_begin[min_seq].second - 1); + + LT lt(k, sentinel, comp); difference_type total_length = 0; @@ -1102,18 +651,12 @@ template<typename LT, #if _GLIBCXX_ASSERTIONS _GLIBCXX_PARALLEL_ASSERT(seqs_begin[t].first != seqs_begin[t].second); #endif - if (stable) - lt.insert_start_stable(*seqs_begin[t].first, t, false); - else - lt.insert_start(*seqs_begin[t].first, t, false); + lt.insert_start(*seqs_begin[t].first, t, false); total_length += _GLIBCXX_PARALLEL_LENGTH(seqs_begin[t]); } - if (stable) - lt.init_stable(); - else - lt.init(); + lt.init(); // Do not go past end. length = std::min(total_length, length); @@ -1124,203 +667,311 @@ template<typename LT, difference_type i = 0; #endif - if (stable) + RandomAccessIterator3 target_end = target + length; + while (target < target_end) { - RandomAccessIterator3 target_end = target + length; - while (target < target_end) - { - // Take out. - source = lt.get_min_source(); + // Take out. + source = lt.get_min_source(); #if _GLIBCXX_ASSERTIONS - _GLIBCXX_PARALLEL_ASSERT(i == 0 - || !comp(*(seqs_begin[source].first), *(target - 1))); + _GLIBCXX_PARALLEL_ASSERT(0 <= source && source < k); + _GLIBCXX_PARALLEL_ASSERT(i == 0 + || !comp(*(seqs_begin[source].first), *(target - 1))); #endif - *(target++) = *(seqs_begin[source].first++); + // Feed. + *(target++) = *(seqs_begin[source].first++); #if _GLIBCXX_ASSERTIONS - _GLIBCXX_PARALLEL_ASSERT( - (seqs_begin[source].first != seqs_begin[source].second) - || (i == length - 1)); - ++i; + _GLIBCXX_PARALLEL_ASSERT( + (seqs_begin[source].first != seqs_begin[source].second) + || (i >= length - 1)); + ++i; #endif - // Feed. - // Replace from same source. - lt.delete_min_insert_stable(*seqs_begin[source].first, false); - - } - } - else - { - RandomAccessIterator3 target_end = target + length; - while (target < target_end) - { - // Take out. - source = lt.get_min_source(); - -#if _GLIBCXX_ASSERTIONS - if (i > 0 && comp(*(seqs_begin[source].first), *(target - 1))) - printf(" %i %i %i\n", length, i, source); - _GLIBCXX_PARALLEL_ASSERT(i == 0 - || !comp(*(seqs_begin[source].first), *(target - 1))); -#endif - - *(target++) = *(seqs_begin[source].first++); - -#if _GLIBCXX_ASSERTIONS - if (!((seqs_begin[source].first != seqs_begin[source].second) - || (i >= length - 1))) - printf(" %i %i %i\n", length, i, source); - _GLIBCXX_PARALLEL_ASSERT( - (seqs_begin[source].first != seqs_begin[source].second) - || (i >= length - 1)); - ++i; -#endif - // Feed. - // Replace from same source. - lt.delete_min_insert(*seqs_begin[source].first, false); - } + // Replace from same source. + lt.delete_min_insert(*seqs_begin[source].first, false); } return target; } -template<typename RandomAccessIteratorIterator, - typename RandomAccessIterator3, - typename _DifferenceTp, - typename Comparator> + +/** @brief Multi-way merging procedure for a high branching factor, + * requiring sentinels to exist. + * @param stable The value must the same as for the used LoserTrees. + * @param UnguardedLoserTree Loser Tree variant to use for the unguarded + * merging. + * @param GuardedLoserTree Loser Tree variant to use for the guarded + * merging. + * + * @param seqs_begin Begin iterator of iterator pair input sequence. + * @param seqs_end End iterator of iterator pair input sequence. + * @param target Begin iterator out output sequence. + * @param comp Comparator. + * @param length Maximum length to merge. + * + * @return End iterator of output sequence. + */ +template< + typename UnguardedLoserTree, + typename RandomAccessIteratorIterator, + typename RandomAccessIterator3, + typename _DifferenceTp, + typename Comparator> RandomAccessIterator3 - multiway_merge_loser_tree_combined(RandomAccessIteratorIterator seqs_begin, + multiway_merge_loser_tree_sentinel(RandomAccessIteratorIterator seqs_begin, RandomAccessIteratorIterator seqs_end, RandomAccessIterator3 target, Comparator comp, - _DifferenceTp length, bool stable) + _DifferenceTp length) { _GLIBCXX_CALL(length) typedef _DifferenceTp difference_type; - + typedef std::iterator_traits<RandomAccessIteratorIterator> traits_type; typedef typename std::iterator_traits<RandomAccessIteratorIterator> ::value_type::first_type RandomAccessIterator1; typedef typename std::iterator_traits<RandomAccessIterator1>::value_type value_type; - int min_seq; RandomAccessIterator3 target_end; - difference_type overhang = prepare_unguarded(seqs_begin, seqs_end, - comp, min_seq, stable); difference_type total_length = 0; for (RandomAccessIteratorIterator s = seqs_begin; s != seqs_end; ++s) - total_length += _GLIBCXX_PARALLEL_LENGTH(*s); - - if (overhang != -1) { - difference_type unguarded_length = - std::min(length, total_length - overhang); - target_end = multiway_merge_loser_tree_unguarded - <typename loser_tree_unguarded_traits<value_type, Comparator>::LT> - (seqs_begin, seqs_end, target, comp, unguarded_length, stable); - overhang = length - unguarded_length; - } - else - { - // Empty sequence found. - overhang = length; - target_end = target; - } + total_length += _GLIBCXX_PARALLEL_LENGTH(*s); -#if _GLIBCXX_ASSERTIONS - _GLIBCXX_PARALLEL_ASSERT(target_end == target + length - overhang); - _GLIBCXX_PARALLEL_ASSERT(is_sorted(target, target_end, comp)); -#endif + // Move the sequends end behind the sentinel spots. This has the + // effect that the sentinel appears to be within the sequence. Then, + // we can use the unguarded variant if we merge out as many + // non-sentinel elements as we have. + ++((*s).second); + } - target_end = multiway_merge_loser_tree - <typename loser_tree_traits<value_type, Comparator>::LT> - (seqs_begin, seqs_end, target_end, comp, overhang, stable); + difference_type unguarded_length = + std::min(length, total_length); + target_end = multiway_merge_loser_tree_unguarded + <UnguardedLoserTree> + (seqs_begin, seqs_end, target, 0, comp, unguarded_length); #if _GLIBCXX_ASSERTIONS _GLIBCXX_PARALLEL_ASSERT(target_end == target + length); _GLIBCXX_PARALLEL_ASSERT(is_sorted(target, target_end, comp)); #endif + // Restore the sequence ends so the sentinels are not contained in the + // sequence any more (see comment in loop above). + for (RandomAccessIteratorIterator s = seqs_begin; s != seqs_end; ++s) + { --((*s).second); } + return target_end; } -template<typename RandomAccessIteratorIterator, - typename RandomAccessIterator3, - typename _DifferenceTp, - typename Comparator> - RandomAccessIterator3 - multiway_merge_loser_tree_sentinel(RandomAccessIteratorIterator seqs_begin, - RandomAccessIteratorIterator seqs_end, - RandomAccessIterator3 target, - Comparator comp, - _DifferenceTp length, bool stable) +/** + * @brief Traits for determining whether the loser tree should + * use pointers or copies. + * + * The field "use_pointer" is used to determine whether to use pointers in + * the loser trees or whether to copy the values into the loser tree. + * + * The default behavior is to use pointers if the data type is 4 times as + * big as the pointer to it. + * + * Specialize for your data type to customize the behavior. + * + * Example: + * + * template<> + * struct loser_tree_traits<int> + * { static const bool use_pointer = false; }; + * + * template<> + * struct loser_tree_traits<heavyweight_type> + * { static const bool use_pointer = true; }; + * + * @param T type to give the loser tree traits for. + */ +template <typename T> +struct loser_tree_traits +{ + /** + * @brief True iff to use pointers instead of values in loser trees. + * + * The default behavior is to use pointers if the data type is four + * times as big as the pointer to it. + */ + static const bool use_pointer = (sizeof(T) > 4 * sizeof(T*)); +}; + +/** + * @brief Switch for 3-way merging with sentinels turned off. + * + * Note that 3-way merging is always stable! + */ +template< + bool sentinels /*default == false*/, + typename RandomAccessIteratorIterator, + typename RandomAccessIterator3, + typename _DifferenceTp, + typename Comparator> +struct multiway_merge_3_variant_sentinel_switch +{ + RandomAccessIterator3 operator()( + RandomAccessIteratorIterator seqs_begin, + RandomAccessIteratorIterator seqs_end, + RandomAccessIterator3 target, + Comparator comp, _DifferenceTp length) { - _GLIBCXX_CALL(length) + return multiway_merge_3_variant<guarded_iterator>( + seqs_begin, seqs_end, target, comp, length); + } +}; - typedef _DifferenceTp difference_type; - typedef std::iterator_traits<RandomAccessIteratorIterator> traits_type; +/** + * @brief Switch for 3-way merging with sentinels turned on. + * + * Note that 3-way merging is always stable! + */ +template< + typename RandomAccessIteratorIterator, + typename RandomAccessIterator3, + typename _DifferenceTp, + typename Comparator> +struct multiway_merge_3_variant_sentinel_switch + <true, RandomAccessIteratorIterator, RandomAccessIterator3, + _DifferenceTp, Comparator> +{ + RandomAccessIterator3 operator()( + RandomAccessIteratorIterator seqs_begin, + RandomAccessIteratorIterator seqs_end, + RandomAccessIterator3 target, + Comparator comp, _DifferenceTp length) + { + return multiway_merge_3_variant<unguarded_iterator>( + seqs_begin, seqs_end, target, comp, length); + } +}; + +/** + * @brief Switch for 4-way merging with sentinels turned off. + * + * Note that 4-way merging is always stable! + */ +template< + bool sentinels /*default == false*/, + typename RandomAccessIteratorIterator, + typename RandomAccessIterator3, + typename _DifferenceTp, + typename Comparator> +struct multiway_merge_4_variant_sentinel_switch +{ + RandomAccessIterator3 operator()( + RandomAccessIteratorIterator seqs_begin, + RandomAccessIteratorIterator seqs_end, + RandomAccessIterator3 target, + Comparator comp, _DifferenceTp length) + { + return multiway_merge_4_variant<guarded_iterator>( + seqs_begin, seqs_end, target, comp, length); + } +}; + +/** + * @brief Switch for 4-way merging with sentinels turned on. + * + * Note that 4-way merging is always stable! + */ +template< + typename RandomAccessIteratorIterator, + typename RandomAccessIterator3, + typename _DifferenceTp, + typename Comparator> +struct multiway_merge_4_variant_sentinel_switch + <true, RandomAccessIteratorIterator, RandomAccessIterator3, + _DifferenceTp, Comparator> +{ + RandomAccessIterator3 operator()( + RandomAccessIteratorIterator seqs_begin, + RandomAccessIteratorIterator seqs_end, + RandomAccessIterator3 target, + Comparator comp, _DifferenceTp length) + { + return multiway_merge_4_variant<unguarded_iterator>( + seqs_begin, seqs_end, target, comp, length); + } +}; + +/** + * @brief Switch for k-way merging with sentinels turned on. + */ +template< + bool sentinels, + bool stable, + typename RandomAccessIteratorIterator, + typename RandomAccessIterator3, + typename _DifferenceTp, + typename Comparator> +struct multiway_merge_k_variant_sentinel_switch +{ + RandomAccessIterator3 operator()( + RandomAccessIteratorIterator seqs_begin, + RandomAccessIteratorIterator seqs_end, + RandomAccessIterator3 target, + Comparator comp, _DifferenceTp length) + { typedef typename std::iterator_traits<RandomAccessIteratorIterator> ::value_type::first_type RandomAccessIterator1; typedef typename std::iterator_traits<RandomAccessIterator1>::value_type value_type; - RandomAccessIterator3 target_end; - difference_type overhang = - prepare_unguarded_sentinel(seqs_begin, seqs_end, comp); - - difference_type total_length = 0; - for (RandomAccessIteratorIterator s = seqs_begin; s != seqs_end; ++s) - { - total_length += _GLIBCXX_PARALLEL_LENGTH(*s); - - // Sentinel spot. - ++((*s).second); - } - - difference_type unguarded_length = - std::min(length, total_length - overhang); - target_end = multiway_merge_loser_tree_unguarded - <typename loser_tree_unguarded_traits<value_type, Comparator>::LT> - (seqs_begin, seqs_end, target, comp, unguarded_length, stable); - overhang = length - unguarded_length; - -#if _GLIBCXX_ASSERTIONS - _GLIBCXX_PARALLEL_ASSERT(target_end == target + length - overhang); - _GLIBCXX_PARALLEL_ASSERT(is_sorted(target, target_end, comp)); -#endif - - // Copy rest stable. - for (RandomAccessIteratorIterator s = seqs_begin; - s != seqs_end && overhang > 0; ++s) - { - // Restore. - --((*s).second); - difference_type local_length = - std::min<difference_type>(overhang, _GLIBCXX_PARALLEL_LENGTH(*s)); - target_end = std::copy((*s).first, (*s).first + local_length, - target_end); - (*s).first += local_length; - overhang -= local_length; - } + return multiway_merge_loser_tree_sentinel< + typename __gnu_cxx::__conditional_type< + loser_tree_traits<value_type>::use_pointer + , LoserTreePointerUnguarded<stable, value_type, Comparator> + , LoserTreeUnguarded<stable, value_type, Comparator> + >::__type>(seqs_begin, seqs_end, target, comp, length); + } +}; -#if _GLIBCXX_ASSERTIONS - _GLIBCXX_PARALLEL_ASSERT(overhang == 0); - _GLIBCXX_PARALLEL_ASSERT(target_end == target + length); - _GLIBCXX_PARALLEL_ASSERT(is_sorted(target, target_end, comp)); -#endif +/** + * @brief Switch for k-way merging with sentinels turned off. + */ +template< + bool stable, + typename RandomAccessIteratorIterator, + typename RandomAccessIterator3, + typename _DifferenceTp, + typename Comparator> +struct multiway_merge_k_variant_sentinel_switch + <false, stable, RandomAccessIteratorIterator, RandomAccessIterator3, + _DifferenceTp, Comparator> +{ + RandomAccessIterator3 operator()( + RandomAccessIteratorIterator seqs_begin, + RandomAccessIteratorIterator seqs_end, + RandomAccessIterator3 target, + Comparator comp, _DifferenceTp length) + { + typedef typename std::iterator_traits<RandomAccessIteratorIterator> + ::value_type::first_type + RandomAccessIterator1; + typedef typename std::iterator_traits<RandomAccessIterator1>::value_type + value_type; - return target_end; + return multiway_merge_loser_tree< + typename __gnu_cxx::__conditional_type< + loser_tree_traits<value_type>::use_pointer + , LoserTreePointer<stable, value_type, Comparator> + , LoserTree<stable, value_type, Comparator> + >::__type >(seqs_begin, seqs_end, target, comp, length); } +}; /** @brief Sequential multi-way merging switch. * - * The _GLIBCXX_PARALLEL_DECISION if based on the branching factor and + * The _GLIBCXX_PARALLEL_DECISION is based on the branching factor and * runtime settings. * @param seqs_begin Begin iterator of iterator pair input sequence. * @param seqs_end End iterator of iterator pair input sequence. @@ -1330,17 +981,18 @@ template<typename RandomAccessIteratorIterator, * @param stable Stable merging incurs a performance penalty. * @param sentinel The sequences have a sentinel element. * @return End iterator of output sequence. */ -template<typename RandomAccessIteratorIterator, - typename RandomAccessIterator3, - typename _DifferenceTp, - typename Comparator> +template< + bool stable, + bool sentinels, + typename RandomAccessIteratorIterator, + typename RandomAccessIterator3, + typename _DifferenceTp, + typename Comparator> RandomAccessIterator3 - multiway_merge(RandomAccessIteratorIterator seqs_begin, + sequential_multiway_merge(RandomAccessIteratorIterator seqs_begin, RandomAccessIteratorIterator seqs_end, RandomAccessIterator3 target, - Comparator comp, _DifferenceTp length, - bool stable, bool sentinel, - sequential_tag) + Comparator comp, _DifferenceTp length) { _GLIBCXX_CALL(length) @@ -1353,17 +1005,14 @@ template<typename RandomAccessIteratorIterator, #if _GLIBCXX_ASSERTIONS for (RandomAccessIteratorIterator s = seqs_begin; s != seqs_end; ++s) - _GLIBCXX_PARALLEL_ASSERT(is_sorted((*s).first, (*s).second, comp)); + { + _GLIBCXX_PARALLEL_ASSERT(is_sorted((*s).first, (*s).second, comp)); + } #endif - RandomAccessIterator3 return_target = target; + RandomAccessIterator3 return_target = target; int k = static_cast<int>(seqs_end - seqs_begin); - _MultiwayMergeAlgorithm mwma = _Settings::get().multiway_merge_algorithm; - - if (!sentinel && mwma == LOSER_TREE_SENTINEL) - mwma = LOSER_TREE_COMBINED; - switch (k) { case 0: @@ -1382,113 +1031,30 @@ template<typename RandomAccessIteratorIterator, target, length, comp); break; case 3: - switch (mwma) - { - case LOSER_TREE_COMBINED: - return_target = multiway_merge_3_combined(seqs_begin, - seqs_end, - target, - comp, length, - stable); - break; - case LOSER_TREE_SENTINEL: - return_target = - multiway_merge_3_variant<unguarded_iterator>(seqs_begin, - seqs_end, - target, - comp, length, - stable); - break; - default: - return_target = - multiway_merge_3_variant<guarded_iterator>(seqs_begin, - seqs_end, - target, - comp, length, - stable); - break; - } + return_target = multiway_merge_3_variant_sentinel_switch< + sentinels + , RandomAccessIteratorIterator + , RandomAccessIterator3 + , _DifferenceTp + , Comparator>()(seqs_begin, seqs_end, target, comp, length); break; case 4: - switch (mwma) - { - case LOSER_TREE_COMBINED: - return_target = multiway_merge_4_combined(seqs_begin, - seqs_end, - target, - comp, length, stable); - break; - case LOSER_TREE_SENTINEL: - return_target = - multiway_merge_4_variant<unguarded_iterator>(seqs_begin, - seqs_end, - target, - comp, length, - stable); - break; - default: - return_target = multiway_merge_4_variant<guarded_iterator>( - seqs_begin, - seqs_end, - target, - comp, length, stable); - break; - } + return_target = multiway_merge_4_variant_sentinel_switch< + sentinels + , RandomAccessIteratorIterator + , RandomAccessIterator3 + , _DifferenceTp + , Comparator>()(seqs_begin, seqs_end, target, comp, length); break; default: - { - switch (mwma) - { - case BUBBLE: - return_target = multiway_merge_bubble(seqs_begin, - seqs_end, - target, - comp, length, stable); - break; -#if _GLIBCXX_LOSER_TREE_EXPLICIT - case LOSER_TREE_EXPLICIT: - return_target = multiway_merge_loser_tree< - LoserTreeExplicit<value_type, Comparator> >(seqs_begin, - seqs_end, - target, - comp, length, - stable); - break; -#endif -#if _GLIBCXX_LOSER_TREE - case LOSER_TREE: - return_target = multiway_merge_loser_tree< - LoserTree<value_type, Comparator> >(seqs_begin, - seqs_end, - target, - comp, length, - stable); - break; -#endif -#if _GLIBCXX_LOSER_TREE_COMBINED - case LOSER_TREE_COMBINED: - return_target = multiway_merge_loser_tree_combined(seqs_begin, - seqs_end, - target, - comp, length, - stable); - break; -#endif -#if _GLIBCXX_LOSER_TREE_SENTINEL - case LOSER_TREE_SENTINEL: - return_target = multiway_merge_loser_tree_sentinel(seqs_begin, - seqs_end, - target, - comp, length, - stable); - break; -#endif - default: - // multiway_merge algorithm not implemented. - _GLIBCXX_PARALLEL_ASSERT(0); - break; - } - } + return_target = multiway_merge_k_variant_sentinel_switch< + sentinels + , stable + , RandomAccessIteratorIterator + , RandomAccessIterator3 + , _DifferenceTp + , Comparator>()(seqs_begin, seqs_end, target, comp, length); + break; } #if _GLIBCXX_ASSERTIONS _GLIBCXX_PARALLEL_ASSERT(is_sorted(target, target + length, comp)); @@ -1497,38 +1063,246 @@ template<typename RandomAccessIteratorIterator, return return_target; } +/** + * @brief Stable sorting functor. + * + * Used to reduce code instanciation in multiway_merge_sampling_splitting. + */ +template<bool stable, class RandomAccessIterator, class StrictWeakOrdering> +struct sampling_sorter +{ + void operator()(RandomAccessIterator first, RandomAccessIterator last, + StrictWeakOrdering comp) + { __gnu_sequential::stable_sort(first, last, comp); } +}; + +/** + * @brief Non-stable sorting functor. + * + * Used to reduce code instanciation in multiway_merge_sampling_splitting. + */ +template<class RandomAccessIterator, class StrictWeakOrdering> +struct sampling_sorter<false, RandomAccessIterator, StrictWeakOrdering> +{ + void operator()(RandomAccessIterator first, RandomAccessIterator last, + StrictWeakOrdering comp) + { __gnu_sequential::sort(first, last, comp); } +}; + +/** + * @brief Sampling based splitting for parallel multiway-merge routine. + */ +template< + bool stable + , typename RandomAccessIteratorIterator + , typename Comparator + , typename difference_type> +void multiway_merge_sampling_splitting( + RandomAccessIteratorIterator seqs_begin, + RandomAccessIteratorIterator seqs_end, + Comparator comp, difference_type length, + difference_type total_length, + std::vector<std::pair<difference_type, difference_type> > *pieces) +{ + typedef typename std::iterator_traits<RandomAccessIteratorIterator> + ::value_type::first_type + RandomAccessIterator1; + typedef typename std::iterator_traits<RandomAccessIterator1>::value_type + value_type; + + // k sequences. + int k = static_cast<int>(seqs_end - seqs_begin); + + int num_threads = omp_get_num_threads(); + + difference_type num_samples = + __gnu_parallel::_Settings::get().merge_oversampling * num_threads; + + value_type* samples = static_cast<value_type*>( + ::operator new(sizeof(value_type) * k * num_samples)); + // Sample. + for (int s = 0; s < k; ++s) + for (difference_type i = 0; i < num_samples; ++i) + { + difference_type sample_index = + static_cast<difference_type>( + _GLIBCXX_PARALLEL_LENGTH(seqs_begin[s]) * (double(i + 1) / + (num_samples + 1)) * (double(length) + / total_length)); + new(&(samples[s * num_samples + i])) value_type( + seqs_begin[s].first[sample_index]); + } + + // Sort stable or non-stable, depending on value of template parameter + // "stable". + sampling_sorter<stable, value_type*, Comparator>()( + samples, samples + (num_samples * k), comp); + + for (int slab = 0; slab < num_threads; ++slab) + // For each slab / processor. + for (int seq = 0; seq < k; ++seq) + { + // For each sequence. + if (slab > 0) + pieces[slab][seq].first = + std::upper_bound( + seqs_begin[seq].first, + seqs_begin[seq].second, + samples[num_samples * k * slab / num_threads], + comp) + - seqs_begin[seq].first; + else + { + // Absolute beginning. + pieces[slab][seq].first = 0; + } + if ((slab + 1) < num_threads) + pieces[slab][seq].second = + std::upper_bound( + seqs_begin[seq].first, + seqs_begin[seq].second, + samples[num_samples * k * (slab + 1) / + num_threads], comp) + - seqs_begin[seq].first; + else + pieces[slab][seq].second = _GLIBCXX_PARALLEL_LENGTH(seqs_begin[seq]); + } + ::operator delete(samples); +} + +/** + * @brief Exact splitting for parallel multiway-merge routine. + */ +template< + bool stable + , typename RandomAccessIteratorIterator + , typename Comparator + , typename difference_type> +void multiway_merge_exact_splitting( + RandomAccessIteratorIterator seqs_begin, + RandomAccessIteratorIterator seqs_end, + Comparator comp, + difference_type length, + difference_type total_length, + std::vector<std::pair<difference_type, difference_type> > *pieces) +{ + typedef typename std::iterator_traits<RandomAccessIteratorIterator> + ::value_type::first_type + RandomAccessIterator1; + + const bool tight = (total_length == length); + + // k sequences. + const int k = static_cast<int>(seqs_end - seqs_begin); + + const int num_threads = omp_get_num_threads(); + + // (Settings::multiway_merge_splitting == __gnu_parallel::_Settings::EXACT). + std::vector<RandomAccessIterator1>* offsets = + new std::vector<RandomAccessIterator1>[num_threads]; + std::vector< + std::pair<RandomAccessIterator1, RandomAccessIterator1> + > se(k); + + copy(seqs_begin, seqs_end, se.begin()); + + difference_type* borders = + new difference_type[num_threads + 1]; + equally_split(length, num_threads, borders); + + for (int s = 0; s < (num_threads - 1); ++s) + { + offsets[s].resize(k); + multiseq_partition( + se.begin(), se.end(), borders[s + 1], + offsets[s].begin(), comp); + + // Last one also needed and available. + if (!tight) + { + offsets[num_threads - 1].resize(k); + multiseq_partition(se.begin(), se.end(), + difference_type(length), + offsets[num_threads - 1].begin(), comp); + } + } + + + for (int slab = 0; slab < num_threads; ++slab) + { + // For each slab / processor. + for (int seq = 0; seq < k; ++seq) + { + // For each sequence. + if (slab == 0) + { + // Absolute beginning. + pieces[slab][seq].first = 0; + } + else + pieces[slab][seq].first = + pieces[slab - 1][seq].second; + if (!tight || slab < (num_threads - 1)) + pieces[slab][seq].second = + offsets[slab][seq] - seqs_begin[seq].first; + else + { + // slab == num_threads - 1 + pieces[slab][seq].second = + _GLIBCXX_PARALLEL_LENGTH(seqs_begin[seq]); + } + } + } + delete[] offsets; +} + /** @brief Parallel multi-way merge routine. * - * The _GLIBCXX_PARALLEL_DECISION if based on the branching factor - * and runtime settings. - * @param seqs_begin Begin iterator of iterator pair input sequence. - * @param seqs_end End iterator of iterator pair input sequence. - * @param target Begin iterator out output sequence. - * @param comp Comparator. - * @param length Maximum length to merge. - * @param stable Stable merging incurs a performance penalty. - * @param sentinel Ignored. - * @return End iterator of output sequence. + * The _GLIBCXX_PARALLEL_DECISION is based on the branching factor + * and runtime settings. + * + * Must not be called if the number of sequences is 1. + * + * @param Splitter functor to split input (either exact or sampling based) + * + * @param seqs_begin Begin iterator of iterator pair input sequence. + * @param seqs_end End iterator of iterator pair input sequence. + * @param target Begin iterator out output sequence. + * @param comp Comparator. + * @param length Maximum length to merge. + * @param stable Stable merging incurs a performance penalty. + * @param sentinel Ignored. + * @return End iterator of output sequence. */ -template<typename RandomAccessIteratorIterator, - typename RandomAccessIterator3, - typename _DifferenceTp, - typename Comparator> +template< + bool stable, + bool sentinels, + typename RandomAccessIteratorIterator, + typename RandomAccessIterator3, + typename _DifferenceTp, + typename Splitter, + typename Comparator + > RandomAccessIterator3 parallel_multiway_merge(RandomAccessIteratorIterator seqs_begin, RandomAccessIteratorIterator seqs_end, - RandomAccessIterator3 target, - Comparator comp, - _DifferenceTp length, bool stable, bool sentinel) + RandomAccessIterator3 target, + Comparator comp, + Splitter splitter, + _DifferenceTp length) { +#if _GLIBCXX_ASSERTIONS + _GLIBCXX_PARALLEL_ASSERT(seqs_end - seqs_begin > 1); +#endif + _GLIBCXX_CALL(length) typedef _DifferenceTp difference_type; typedef typename std::iterator_traits<RandomAccessIteratorIterator> ::value_type::first_type RandomAccessIterator1; - typedef typename std::iterator_traits<RandomAccessIterator1>::value_type - value_type; + typedef typename + std::iterator_traits<RandomAccessIterator1>::value_type value_type; // k sequences. int k = static_cast<int>(seqs_end - seqs_begin); @@ -1543,13 +1317,10 @@ template<typename RandomAccessIteratorIterator, if (total_length == 0 || k == 0) return target; - bool tight = (total_length == length); - std::vector<std::pair<difference_type, difference_type> >* pieces; thread_index_t num_threads = static_cast<thread_index_t>( - std::min<difference_type>(get_max_threads(), total_length)); - const _Settings& __s = _Settings::get(); + std::min<difference_type>(get_max_threads(), total_length)); # pragma omp parallel num_threads (num_threads) { @@ -1562,126 +1333,12 @@ template<typename RandomAccessIteratorIterator, for (int s = 0; s < num_threads; ++s) pieces[s].resize(k); - difference_type num_samples = __s.merge_oversampling - * num_threads; + difference_type num_samples = + __gnu_parallel::_Settings::get().merge_oversampling * + num_threads; - if (__s.multiway_merge_splitting == SAMPLING) - { - value_type* samples = static_cast<value_type*>( - ::operator new(sizeof(value_type) * k * num_samples)); - // Sample. - for (int s = 0; s < k; ++s) - for (difference_type i = 0; i < num_samples; ++i) - { - difference_type sample_index = - static_cast<difference_type>( - _GLIBCXX_PARALLEL_LENGTH(seqs_begin[s]) - * (double(i + 1) / (num_samples + 1)) - * (double(length) / total_length)); - ::new(&(samples[s * num_samples + i])) - value_type(seqs_begin[s].first[sample_index]); - } - - if (stable) - __gnu_sequential::stable_sort(samples, samples - + (num_samples * k), comp); - else - __gnu_sequential::sort(samples, samples - + (num_samples * k), comp); - - for (int slab = 0; slab < num_threads; ++slab) - // For each slab / processor. - for (int seq = 0; seq < k; ++seq) - { - // For each sequence. - if (slab > 0) - pieces[slab][seq].first = - std::upper_bound(seqs_begin[seq].first, - seqs_begin[seq].second, - samples[num_samples * k - * slab / num_threads], - comp) - - seqs_begin[seq].first; - else - { - // Absolute beginning. - pieces[slab][seq].first = 0; - } - if ((slab + 1) < num_threads) - pieces[slab][seq].second = - std::upper_bound(seqs_begin[seq].first, - seqs_begin[seq].second, - samples[num_samples * k - * (slab + 1) - / num_threads], comp) - - seqs_begin[seq].first; - else - pieces[slab][seq].second - = _GLIBCXX_PARALLEL_LENGTH(seqs_begin[seq]); - } - ::operator delete(samples); - } - else - { - // (_Settings::multiway_merge_splitting == _Settings::EXACT). - std::vector<RandomAccessIterator1>* offsets = - new std::vector<RandomAccessIterator1>[num_threads]; - std::vector< - std::pair<RandomAccessIterator1, RandomAccessIterator1> - > se(k); - - copy(seqs_begin, seqs_end, se.begin()); - - difference_type* borders = - new difference_type[num_threads + 1]; - equally_split(length, num_threads, borders); - - for (int s = 0; s < (num_threads - 1); ++s) - { - offsets[s].resize(k); - multiseq_partition( - se.begin(), se.end(), borders[s + 1], - offsets[s].begin(), comp); - - // Last one also needed and available. - if (!tight) - { - offsets[num_threads - 1].resize(k); - multiseq_partition(se.begin(), se.end(), - difference_type(length), - offsets[num_threads - 1].begin(), - comp); - } - } - - - for (int slab = 0; slab < num_threads; ++slab) - { - // For each slab / processor. - for (int seq = 0; seq < k; ++seq) - { - // For each sequence. - if (slab == 0) - { - // Absolute beginning. - pieces[slab][seq].first = 0; - } - else - pieces[slab][seq].first = - pieces[slab - 1][seq].second; - if (!tight || slab < (num_threads - 1)) - pieces[slab][seq].second = - offsets[slab][seq] - seqs_begin[seq].first; - else - { - // slab == num_threads - 1 - pieces[slab][seq].second = - _GLIBCXX_PARALLEL_LENGTH(seqs_begin[seq]); - } - } - } - delete[] offsets; - } + splitter(seqs_begin, seqs_end, comp, length, total_length, + pieces); } //single thread_index_t iam = omp_get_thread_num(); @@ -1701,15 +1358,14 @@ template<typename RandomAccessIteratorIterator, for (int s = 0; s < k; ++s) { chunks[s] = std::make_pair( - seqs_begin[s].first + pieces[iam][s].first, - seqs_begin[s].first + pieces[iam][s].second); + seqs_begin[s].first + pieces[iam][s].first, + seqs_begin[s].first + pieces[iam][s].second); local_length += _GLIBCXX_PARALLEL_LENGTH(chunks[s]); } - multiway_merge( + sequential_multiway_merge<stable, sentinels>( chunks, chunks + k, target + target_position, comp, - std::min(local_length, length - target_position), - stable, false, sequential_tag()); + std::min(local_length, length - target_position)); delete[] chunks; } @@ -1727,7 +1383,7 @@ template<typename RandomAccessIteratorIterator, (pieces[iam][1].second - pieces[iam][1].first), comp); } - } //parallel + } // parallel #if _GLIBCXX_ASSERTIONS _GLIBCXX_PARALLEL_ASSERT(is_sorted(target, target + length, comp)); @@ -1743,88 +1399,605 @@ template<typename RandomAccessIteratorIterator, } /** - * @brief Multi-way merging front-end. - * @param seqs_begin Begin iterator of iterator pair input sequence. - * @param seqs_end End iterator of iterator pair input sequence. - * @param target Begin iterator out output sequence. - * @param comp Comparator. - * @param length Maximum length to merge. - * @param stable Stable merging incurs a performance penalty. - * @return End iterator of output sequence. + * @brief Multiway Merge Frontend. + * + * Merge the sequences specified by seqs_begin and seqs_end into + * target. seqs_begin and seqs_end must point to a sequence of + * pairs. These pairs must contain an iterator to the beginning + * of a sequence in their first entry and an iterator the end of + * the same sequence in their second entry. + * + * Ties are broken arbitrarily. See stable_multiway_merge for a variant + * that breaks ties by sequence number but is slower. + * + * The first entries of the pairs (i.e. the begin iterators) will be moved + * forward. + * + * The output sequence has to provide enough space for all elements + * that are written to it. + * + * This function will merge the input sequences: + * + * - not stable + * - parallel, depending on the input size and Settings + * - using sampling for splitting + * - not using sentinels + * + * Example: + * + * <pre> + * int sequences[10][10]; + * for (int i = 0; i < 10; ++i) + * for (int j = 0; i < 10; ++j) + * sequences[i][j] = j; + * + * int out[33]; + * std::vector<std::pair<int*> > seqs; + * for (int i = 0; i < 10; ++i) + * { seqs.push(std::make_pair<int*>(sequences[i], sequences[i] + 10)) } + * + * multiway_merge(seqs.begin(), seqs.end(), target, std::less<int>(), 33); + * </pre> + * + * @see stable_multiway_merge + * + * @pre All input sequences must be sorted. + * @pre Target must provide enough space to merge out length elements or + * the number of elements in all sequences, whichever is smaller. + * + * @post [target, return value) contains merged elements from the + * input sequences. + * @post return value - target = min(length, number of elements in all + * sequences). + * + * @param RandomAccessIteratorPairIterator iterator over sequence + * of pairs of iterators + * @param RandomAccessIteratorOut iterator over target sequence + * @param _DifferenceTp difference type for the sequence + * @param Comparator strict weak ordering type to compare elements + * in sequences + * + * @param seqs_begin begin of sequence sequence + * @param seqs_end end of sequence sequence + * @param target target sequence to merge to. + * @param comp strict weak ordering to use for element comparison. + * @param length the number of elements to merge into target. + * + * @return end iterator of output sequence */ -template<typename RandomAccessIteratorPairIterator, - typename RandomAccessIterator3, - typename _DifferenceTp, - typename Comparator> - RandomAccessIterator3 - multiway_merge(RandomAccessIteratorPairIterator seqs_begin, - RandomAccessIteratorPairIterator seqs_end, - RandomAccessIterator3 target, Comparator comp, - _DifferenceTp length, bool stable) - { +template< + typename RandomAccessIteratorPairIterator + , typename RandomAccessIteratorOut + , typename _DifferenceTp + , typename Comparator> +RandomAccessIteratorOut +multiway_merge(RandomAccessIteratorPairIterator seqs_begin + , RandomAccessIteratorPairIterator seqs_end + , RandomAccessIteratorOut target + , Comparator comp, _DifferenceTp length) +{ + typedef _DifferenceTp difference_type; + _GLIBCXX_CALL(seqs_end - seqs_begin) + + // catch special case: no sequences + if (seqs_begin == seqs_end) + return target; + + // Execute merge; maybe parallel, depending on the number of merged + // elements and the number of sequences and global thresholds in + // Settings. + RandomAccessIteratorOut target_end; + if ((seqs_end - seqs_begin > 1) && + _GLIBCXX_PARALLEL_CONDITION( + ((seqs_end - seqs_begin) >= + __gnu_parallel::_Settings::get().multiway_merge_minimal_k) + && ((sequence_index_t)length >= + __gnu_parallel::_Settings::get().multiway_merge_minimal_n))) + target_end = parallel_multiway_merge + </* stable = */ false, /* sentinels = */ false> + (seqs_begin, seqs_end, target, comp, + multiway_merge_sampling_splitting</* stable = */ false, + RandomAccessIteratorPairIterator, Comparator, _DifferenceTp>, + static_cast<difference_type>(length)); + else + target_end = sequential_multiway_merge + </* stable = */false, /* sentinels = */ false>( + seqs_begin, seqs_end, + target, comp, length); + + return target_end; +} + +template< + typename RandomAccessIteratorPairIterator + , typename RandomAccessIteratorOut + , typename _DifferenceTp + , typename Comparator> +RandomAccessIteratorOut +multiway_merge(RandomAccessIteratorPairIterator seqs_begin + , RandomAccessIteratorPairIterator seqs_end + , RandomAccessIteratorOut target + , Comparator comp, _DifferenceTp length + , __gnu_parallel::sequential_tag) +{ + typedef _DifferenceTp difference_type; + _GLIBCXX_CALL(seqs_end - seqs_begin) + + // catch special case: no sequences + if (seqs_begin == seqs_end) + return target; + + // Execute multiway merge *sequentially*. + return sequential_multiway_merge + </* stable = */ false, /* sentinels = */ false> + (seqs_begin, seqs_end, target, comp, length); +} + +template< + typename RandomAccessIteratorPairIterator + , typename RandomAccessIteratorOut + , typename _DifferenceTp + , typename Comparator> +RandomAccessIteratorOut +multiway_merge(RandomAccessIteratorPairIterator seqs_begin + , RandomAccessIteratorPairIterator seqs_end + , RandomAccessIteratorOut target + , Comparator comp, _DifferenceTp length + , __gnu_parallel::exact_tag) +{ typedef _DifferenceTp difference_type; _GLIBCXX_CALL(seqs_end - seqs_begin) + // catch special case: no sequences if (seqs_begin == seqs_end) return target; - const _Settings& __s = _Settings::get(); - - RandomAccessIterator3 target_end; - if (_GLIBCXX_PARALLEL_CONDITION( - ((seqs_end - seqs_begin) >= __s.multiway_merge_minimal_k) - && ((sequence_index_t)length >= __s.multiway_merge_minimal_n))) - target_end = parallel_multiway_merge(seqs_begin, seqs_end, - target, comp, - static_cast<difference_type>(length), - stable, false); + // Execute merge; maybe parallel, depending on the number of merged + // elements and the number of sequences and global thresholds in + // Settings. + RandomAccessIteratorOut target_end; + if ((seqs_end - seqs_begin > 1) && + _GLIBCXX_PARALLEL_CONDITION( + ((seqs_end - seqs_begin) >= + __gnu_parallel::_Settings::get().multiway_merge_minimal_k) + && ((sequence_index_t)length >= + __gnu_parallel::_Settings::get().multiway_merge_minimal_n))) + target_end = parallel_multiway_merge + </* stable = */ false, /* sentinels = */ false>( + seqs_begin, seqs_end, + target, comp, + multiway_merge_exact_splitting</* stable = */ false, + RandomAccessIteratorPairIterator, Comparator, _DifferenceTp>, + static_cast<difference_type>(length)); else - target_end = multiway_merge(seqs_begin, seqs_end, target, comp, length, - stable, false, sequential_tag()); + target_end = sequential_multiway_merge + </* stable = */ false, /* sentinels = */ false>( + seqs_begin, seqs_end, + target, comp, length); return target_end; - } +} -/** @brief Multi-way merging front-end. - * @param seqs_begin Begin iterator of iterator pair input sequence. - * @param seqs_end End iterator of iterator pair input sequence. - * @param target Begin iterator out output sequence. - * @param comp Comparator. - * @param length Maximum length to merge. - * @param stable Stable merging incurs a performance penalty. - * @return End iterator of output sequence. - * @pre For each @c i, @c seqs_begin[i].second must be the end - * marker of the sequence, but also reference the one more sentinel - * element. */ -template<typename RandomAccessIteratorPairIterator, - typename RandomAccessIterator3, - typename _DifferenceTp, - typename Comparator> - RandomAccessIterator3 - multiway_merge_sentinel(RandomAccessIteratorPairIterator seqs_begin, - RandomAccessIteratorPairIterator seqs_end, - RandomAccessIterator3 target, - Comparator comp, - _DifferenceTp length, - bool stable) - { +template< + typename RandomAccessIteratorPairIterator + , typename RandomAccessIteratorOut + , typename _DifferenceTp + , typename Comparator> +RandomAccessIteratorOut +stable_multiway_merge(RandomAccessIteratorPairIterator seqs_begin + , RandomAccessIteratorPairIterator seqs_end + , RandomAccessIteratorOut target + , Comparator comp, _DifferenceTp length) +{ typedef _DifferenceTp difference_type; + _GLIBCXX_CALL(seqs_end - seqs_begin) + // catch special case: no sequences if (seqs_begin == seqs_end) return target; + // Execute merge; maybe parallel, depending on the number of merged + // elements and the number of sequences and global thresholds in + // Settings. + RandomAccessIteratorOut target_end; + if ((seqs_end - seqs_begin > 1) && + _GLIBCXX_PARALLEL_CONDITION( + ((seqs_end - seqs_begin) >= + __gnu_parallel::_Settings::get().multiway_merge_minimal_k) + && ((sequence_index_t)length >= + __gnu_parallel::_Settings::get().multiway_merge_minimal_n))) + target_end = parallel_multiway_merge + </* stable = */ true, /* sentinels = */ false>( + seqs_begin, seqs_end, + target, comp, + multiway_merge_sampling_splitting</* stable = */ true, + RandomAccessIteratorPairIterator, Comparator, _DifferenceTp>, + static_cast<difference_type>(length)); + else + target_end = sequential_multiway_merge + </* stable = */ true, /* sentinels = */ false>( + seqs_begin, seqs_end, + target, comp, length); + + return target_end; +} + +template< + typename RandomAccessIteratorPairIterator + , typename RandomAccessIteratorOut + , typename _DifferenceTp + , typename Comparator> +RandomAccessIteratorOut +stable_multiway_merge(RandomAccessIteratorPairIterator seqs_begin + , RandomAccessIteratorPairIterator seqs_end + , RandomAccessIteratorOut target + , Comparator comp, _DifferenceTp length + , __gnu_parallel::sequential_tag) +{ + typedef _DifferenceTp difference_type; + _GLIBCXX_CALL(seqs_end - seqs_begin) + + // catch special case: no sequences + if (seqs_begin == seqs_end) + { return target; } + + // Execute multiway merge *sequentially*. + return sequential_multiway_merge + </* stable = */ true, /* sentinels = */ false> + (seqs_begin, seqs_end, target, comp, length); +} + +template< + typename RandomAccessIteratorPairIterator + , typename RandomAccessIteratorOut + , typename _DifferenceTp + , typename Comparator> +RandomAccessIteratorOut +stable_multiway_merge(RandomAccessIteratorPairIterator seqs_begin + , RandomAccessIteratorPairIterator seqs_end + , RandomAccessIteratorOut target + , Comparator comp, _DifferenceTp length + , __gnu_parallel::exact_tag) +{ + typedef _DifferenceTp difference_type; _GLIBCXX_CALL(seqs_end - seqs_begin) - const _Settings& __s = _Settings::get(); - const bool cond1 = seqs_end - seqs_begin >= __s.multiway_merge_minimal_k; - const bool cond2 = sequence_index_t(length) >= __s.multiway_merge_minimal_n; - if (_GLIBCXX_PARALLEL_CONDITION(cond1 && cond2)) - return parallel_multiway_merge(seqs_begin, seqs_end, target, comp, - length, stable, true); + // catch special case: no sequences + if (seqs_begin == seqs_end) + { return target; } + + // Execute merge; maybe parallel, depending on the number of merged + // elements and the number of sequences and global thresholds in + // Settings. + RandomAccessIteratorOut target_end; + if ((seqs_end - seqs_begin > 1) && + _GLIBCXX_PARALLEL_CONDITION( + ((seqs_end - seqs_begin) >= + __gnu_parallel::_Settings::get().multiway_merge_minimal_k) + && ((sequence_index_t)length >= + __gnu_parallel::_Settings::get().multiway_merge_minimal_n))) + target_end = parallel_multiway_merge + </* stable = */ true, /* sentinels = */ false>( + seqs_begin, seqs_end, + target, comp, + multiway_merge_exact_splitting + </* stable = */ true, RandomAccessIteratorPairIterator, + Comparator, _DifferenceTp>, + static_cast<difference_type>(length)); else - return multiway_merge(seqs_begin, seqs_end, target, comp, length, stable, - true, sequential_tag()); - } + target_end = sequential_multiway_merge</* stable = */ true, + /* sentinels = */ false>( + seqs_begin, seqs_end, + target, comp, length); + + return target_end; +} + +/** + * @brief Multiway Merge Frontend. + * + * Merge the sequences specified by seqs_begin and seqs_end into + * target. seqs_begin and seqs_end must point to a sequence of + * pairs. These pairs must contain an iterator to the beginning + * of a sequence in their first entry and an iterator the end of + * the same sequence in their second entry. + * + * Ties are broken arbitrarily. See stable_multiway_merge for a variant + * that breaks ties by sequence number but is slower. + * + * The first entries of the pairs (i.e. the begin iterators) will be moved + * forward. + * + * The output sequence has to provide enough space for all elements + * that are written to it. + * + * This function will merge the input sequences: + * + * - not stable + * - parallel, depending on the input size and Settings + * - using sampling for splitting + * - using sentinels + * + * You have to take care that the element the end iterator points to is + * readable and contains a value that is greater than any other non-sentinel + * value in all sequences. + * + * Example: + * + * <pre> + * int sequences[10][11]; + * for (int i = 0; i < 10; ++i) + * for (int j = 0; i < 11; ++j) + * sequences[i][j] = j; // last one is sentinel! + * + * int out[33]; + * std::vector<std::pair<int*> > seqs; + * for (int i = 0; i < 10; ++i) + * { seqs.push(std::make_pair<int*>(sequences[i], sequences[i] + 10)) } + * + * multiway_merge(seqs.begin(), seqs.end(), target, std::less<int>(), 33); + * </pre> + * + * @pre All input sequences must be sorted. + * @pre Target must provide enough space to merge out length elements or + * the number of elements in all sequences, whichever is smaller. + * @pre For each @c i, @c seqs_begin[i].second must be the end + * marker of the sequence, but also reference the one more sentinel + * element. + * + * @post [target, return value) contains merged elements from the + * input sequences. + * @post return value - target = min(length, number of elements in all + * sequences). + * + * @see stable_multiway_merge_sentinels + * + * @param RandomAccessIteratorPairIterator iterator over sequence + * of pairs of iterators + * @param RandomAccessIteratorOut iterator over target sequence + * @param _DifferenceTp difference type for the sequence + * @param Comparator strict weak ordering type to compare elements + * in sequences + * + * @param seqs_begin begin of sequence sequence + * @param seqs_end end of sequence sequence + * @param target target sequence to merge to. + * @param comp strict weak ordering to use for element comparison. + * @param length the number of elements to merge into target. + * + * @return end iterator of output sequence + */ +template< + typename RandomAccessIteratorPairIterator + , typename RandomAccessIteratorOut + , typename _DifferenceTp + , typename Comparator> +RandomAccessIteratorOut +multiway_merge_sentinels(RandomAccessIteratorPairIterator seqs_begin + , RandomAccessIteratorPairIterator seqs_end + , RandomAccessIteratorOut target + , Comparator comp, _DifferenceTp length) +{ + typedef _DifferenceTp difference_type; + _GLIBCXX_CALL(seqs_end - seqs_begin) + + // catch special case: no sequences + if (seqs_begin == seqs_end) + { return target; } + + // Execute merge; maybe parallel, depending on the number of merged + // elements and the number of sequences and global thresholds in + // Settings. + RandomAccessIteratorOut target_end; + if ((seqs_end - seqs_begin > 1) && + _GLIBCXX_PARALLEL_CONDITION( + ((seqs_end - seqs_begin) >= + __gnu_parallel::_Settings::get().multiway_merge_minimal_k) + && ((sequence_index_t)length >= + __gnu_parallel::_Settings::get().multiway_merge_minimal_n))) + target_end = parallel_multiway_merge + </* stable = */ false, /* sentinels = */ true> + (seqs_begin, seqs_end, target, comp, + multiway_merge_sampling_splitting + </* stable = */ false, RandomAccessIteratorPairIterator, + Comparator, _DifferenceTp>, + static_cast<difference_type>(length)); + else + target_end = sequential_multiway_merge + </* stable = */false, /* sentinels = */ true>( + seqs_begin, seqs_end, + target, comp, length); + + return target_end; } +template< + typename RandomAccessIteratorPairIterator + , typename RandomAccessIteratorOut + , typename _DifferenceTp + , typename Comparator> +RandomAccessIteratorOut +multiway_merge_sentinels(RandomAccessIteratorPairIterator seqs_begin + , RandomAccessIteratorPairIterator seqs_end + , RandomAccessIteratorOut target + , Comparator comp, _DifferenceTp length + , __gnu_parallel::sequential_tag) +{ + typedef _DifferenceTp difference_type; + _GLIBCXX_CALL(seqs_end - seqs_begin) + + // catch special case: no sequences + if (seqs_begin == seqs_end) + { return target; } + + // Execute multiway merge *sequentially*. + return sequential_multiway_merge + </* stable = */ false, /* sentinels = */ true> + (seqs_begin, seqs_end, target, comp, length); +} + +template< + typename RandomAccessIteratorPairIterator + , typename RandomAccessIteratorOut + , typename _DifferenceTp + , typename Comparator> +RandomAccessIteratorOut +multiway_merge_sentinels(RandomAccessIteratorPairIterator seqs_begin + , RandomAccessIteratorPairIterator seqs_end + , RandomAccessIteratorOut target + , Comparator comp, _DifferenceTp length + , __gnu_parallel::exact_tag) +{ + typedef _DifferenceTp difference_type; + _GLIBCXX_CALL(seqs_end - seqs_begin) + + // catch special case: no sequences + if (seqs_begin == seqs_end) + { return target; } + + // Execute merge; maybe parallel, depending on the number of merged + // elements and the number of sequences and global thresholds in + // Settings. + RandomAccessIteratorOut target_end; + if ((seqs_end - seqs_begin > 1) && + _GLIBCXX_PARALLEL_CONDITION( + ((seqs_end - seqs_begin) >= + __gnu_parallel::_Settings::get().multiway_merge_minimal_k) + && ((sequence_index_t)length >= + __gnu_parallel::_Settings::get().multiway_merge_minimal_n))) + target_end = parallel_multiway_merge + </* stable = */ false, /* sentinels = */ true>( + seqs_begin, seqs_end, + target, comp, + multiway_merge_exact_splitting + </* stable = */ false, RandomAccessIteratorPairIterator, + Comparator, _DifferenceTp>, + static_cast<difference_type>(length)); + else + target_end = sequential_multiway_merge + </* stable = */ false, /* sentinels = */ true>( + seqs_begin, seqs_end, + target, comp, length); + + return target_end; +} + +template< + typename RandomAccessIteratorPairIterator + , typename RandomAccessIteratorOut + , typename _DifferenceTp + , typename Comparator> +RandomAccessIteratorOut +stable_multiway_merge_sentinels(RandomAccessIteratorPairIterator seqs_begin + , RandomAccessIteratorPairIterator seqs_end + , RandomAccessIteratorOut target + , Comparator comp, _DifferenceTp length) +{ + typedef _DifferenceTp difference_type; + _GLIBCXX_CALL(seqs_end - seqs_begin) + + // catch special case: no sequences + if (seqs_begin == seqs_end) + { return target; } + + // Execute merge; maybe parallel, depending on the number of merged + // elements and the number of sequences and global thresholds in + // Settings. + RandomAccessIteratorOut target_end; + if ((seqs_end - seqs_begin > 1) && + _GLIBCXX_PARALLEL_CONDITION( + ((seqs_end - seqs_begin) >= + __gnu_parallel::_Settings::get().multiway_merge_minimal_k) + && ((sequence_index_t)length >= + __gnu_parallel::_Settings::get().multiway_merge_minimal_n))) + target_end = parallel_multiway_merge + </* stable = */ true, /* sentinels = */ true>( + seqs_begin, seqs_end, + target, comp, + multiway_merge_sampling_splitting + </* stable = */ true, RandomAccessIteratorPairIterator, + Comparator, _DifferenceTp>, + static_cast<difference_type>(length)); + else + target_end = sequential_multiway_merge + </* stable = */ true, /* sentinels = */ true>( + seqs_begin, seqs_end, + target, comp, length); + + return target_end; +} + +template< + typename RandomAccessIteratorPairIterator + , typename RandomAccessIteratorOut + , typename _DifferenceTp + , typename Comparator> +RandomAccessIteratorOut +stable_multiway_merge_sentinels(RandomAccessIteratorPairIterator seqs_begin + , RandomAccessIteratorPairIterator seqs_end + , RandomAccessIteratorOut target + , Comparator comp, _DifferenceTp length + , __gnu_parallel::sequential_tag) +{ + typedef _DifferenceTp difference_type; + _GLIBCXX_CALL(seqs_end - seqs_begin) + + // catch special case: no sequences + if (seqs_begin == seqs_end) + { return target; } + + // Execute multiway merge *sequentially*. + return sequential_multiway_merge + </* stable = */ true, /* sentinels = */ true> + (seqs_begin, seqs_end, target, comp, length); +} + +template< + typename RandomAccessIteratorPairIterator + , typename RandomAccessIteratorOut + , typename _DifferenceTp + , typename Comparator> +RandomAccessIteratorOut +stable_multiway_merge_sentinels(RandomAccessIteratorPairIterator seqs_begin + , RandomAccessIteratorPairIterator seqs_end + , RandomAccessIteratorOut target + , Comparator comp, _DifferenceTp length + , __gnu_parallel::exact_tag) +{ + typedef _DifferenceTp difference_type; + _GLIBCXX_CALL(seqs_end - seqs_begin) + + // catch special case: no sequences + if (seqs_begin == seqs_end) + { return target; } + + // Execute merge; maybe parallel, depending on the number of merged + // elements and the number of sequences and global thresholds in + // Settings. + RandomAccessIteratorOut target_end; + if ((seqs_end - seqs_begin > 1) && + _GLIBCXX_PARALLEL_CONDITION( + ((seqs_end - seqs_begin) >= + __gnu_parallel::_Settings::get().multiway_merge_minimal_k) + && ((sequence_index_t)length >= + __gnu_parallel::_Settings::get().multiway_merge_minimal_n))) + target_end = parallel_multiway_merge + </* stable = */ true, /* sentinels = */ true>( + seqs_begin, seqs_end, + target, comp, + multiway_merge_exact_splitting + </* stable = */ true, RandomAccessIteratorPairIterator, + Comparator, _DifferenceTp>, + static_cast<difference_type>(length)); + else + target_end = sequential_multiway_merge + </* stable = */ true, /* sentinels = */ true>( + seqs_begin, seqs_end, + target, comp, length); + + return target_end; +} + +}; // namespace __gnu_parallel + #endif diff --git a/libstdc++-v3/include/parallel/multiway_mergesort.h b/libstdc++-v3/include/parallel/multiway_mergesort.h index c8ceb2f40b7..3791a144d53 100644 --- a/libstdc++-v3/include/parallel/multiway_mergesort.h +++ b/libstdc++-v3/include/parallel/multiway_mergesort.h @@ -80,26 +80,9 @@ template<typename RandomAccessIterator> /** @brief Start indices, per thread. */ difference_type* starts; - /** @brief Temporary arrays for each thread. - * - * Indirection Allows using the temporary storage in different - * ways, without code duplication. - * @see _GLIBCXX_MULTIWAY_MERGESORT_COPY_LAST */ - value_type** temporaries; - -#if _GLIBCXX_MULTIWAY_MERGESORT_COPY_LAST /** @brief Storage in which to sort. */ - RandomAccessIterator* sorting_places; + value_type** temporary; - /** @brief Storage into which to merge. */ - value_type** merging_places; -#else - /** @brief Storage in which to sort. */ - value_type** sorting_places; - - /** @brief Storage into which to merge. */ - RandomAccessIterator* merging_places; -#endif /** @brief Samples. */ value_type* samples; @@ -108,9 +91,6 @@ template<typename RandomAccessIterator> /** @brief Pieces of data to merge @c [thread][sequence] */ std::vector<Piece<difference_type> >* pieces; - - /** @brief Stable sorting desired. */ - bool stable; }; /** @@ -122,7 +102,7 @@ template<typename RandomAccessIterator> template<typename RandomAccessIterator, typename _DifferenceTp> void determine_samples(PMWMSSortingData<RandomAccessIterator>* sd, - _DifferenceTp& num_samples) + _DifferenceTp num_samples) { typedef std::iterator_traits<RandomAccessIterator> traits_type; typedef typename traits_type::value_type value_type; @@ -130,8 +110,6 @@ template<typename RandomAccessIterator, typename _DifferenceTp> thread_index_t iam = omp_get_thread_num(); - num_samples = _Settings::get().sort_mwms_oversampling * sd->num_threads - 1; - difference_type* es = new difference_type[num_samples + 2]; equally_split(sd->starts[iam + 1] - sd->starts[iam], @@ -144,11 +122,201 @@ template<typename RandomAccessIterator, typename _DifferenceTp> delete[] es; } +/** @brief Split consistently. */ +template<bool exact, typename RandomAccessIterator, + typename Comparator, typename SortingPlacesIterator> + struct split_consistently + { + }; + +/** @brief Split by exact splitting. */ +template<typename RandomAccessIterator, typename Comparator, + typename SortingPlacesIterator> + struct split_consistently + <true, RandomAccessIterator, Comparator, SortingPlacesIterator> + { + void operator()( + const thread_index_t iam, + PMWMSSortingData<RandomAccessIterator>* sd, + Comparator& comp, + const typename + std::iterator_traits<RandomAccessIterator>::difference_type + num_samples) + const + { +# pragma omp barrier + + std::vector<std::pair<SortingPlacesIterator, SortingPlacesIterator> > + seqs(sd->num_threads); + for (thread_index_t s = 0; s < sd->num_threads; s++) + seqs[s] = std::make_pair(sd->temporary[s], + sd->temporary[s] + + (sd->starts[s + 1] - sd->starts[s])); + + std::vector<SortingPlacesIterator> offsets(sd->num_threads); + + // if not last thread + if (iam < sd->num_threads - 1) + multiseq_partition(seqs.begin(), seqs.end(), + sd->starts[iam + 1], offsets.begin(), comp); + + for (int seq = 0; seq < sd->num_threads; seq++) + { + // for each sequence + if (iam < (sd->num_threads - 1)) + sd->pieces[iam][seq].end = offsets[seq] - seqs[seq].first; + else + // very end of this sequence + sd->pieces[iam][seq].end = + sd->starts[seq + 1] - sd->starts[seq]; + } + +# pragma omp barrier + + for (thread_index_t seq = 0; seq < sd->num_threads; seq++) + { + // For each sequence. + if (iam > 0) + sd->pieces[iam][seq].begin = sd->pieces[iam - 1][seq].end; + else + // Absolute beginning. + sd->pieces[iam][seq].begin = 0; + } + } + }; + +/** @brief Split by sampling. */ +template<typename RandomAccessIterator, typename Comparator, + typename SortingPlacesIterator> + struct split_consistently<false, RandomAccessIterator, Comparator, + SortingPlacesIterator> + { + void operator()( + const thread_index_t iam, + PMWMSSortingData<RandomAccessIterator>* sd, + Comparator& comp, + const typename + std::iterator_traits<RandomAccessIterator>::difference_type + num_samples) + const + { + typedef std::iterator_traits<RandomAccessIterator> traits_type; + typedef typename traits_type::value_type value_type; + typedef typename traits_type::difference_type difference_type; + + determine_samples(sd, num_samples); + +# pragma omp barrier + +# pragma omp single + __gnu_sequential::sort(sd->samples, + sd->samples + (num_samples * sd->num_threads), + comp); + +# pragma omp barrier + + for (thread_index_t s = 0; s < sd->num_threads; ++s) + { + // For each sequence. + if (num_samples * iam > 0) + sd->pieces[iam][s].begin = + std::lower_bound(sd->temporary[s], + sd->temporary[s] + + (sd->starts[s + 1] - sd->starts[s]), + sd->samples[num_samples * iam], + comp) + - sd->temporary[s]; + else + // Absolute beginning. + sd->pieces[iam][s].begin = 0; + + if ((num_samples * (iam + 1)) < (num_samples * sd->num_threads)) + sd->pieces[iam][s].end = + std::lower_bound(sd->temporary[s], + sd->temporary[s] + + (sd->starts[s + 1] - sd->starts[s]), + sd->samples[num_samples * (iam + 1)], + comp) + - sd->temporary[s]; + else + // Absolute end. + sd->pieces[iam][s].end = sd->starts[s + 1] - sd->starts[s]; + } + } + }; + +template<bool stable, typename RandomAccessIterator, typename Comparator> + struct possibly_stable_sort + { + }; + +template<typename RandomAccessIterator, typename Comparator> + struct possibly_stable_sort<true, RandomAccessIterator, Comparator> + { + void operator()(const RandomAccessIterator& begin, + const RandomAccessIterator& end, Comparator& comp) const + { + __gnu_sequential::stable_sort(begin, end, comp); + } + }; + +template<typename RandomAccessIterator, typename Comparator> + struct possibly_stable_sort<false, RandomAccessIterator, Comparator> + { + void operator()(const RandomAccessIterator begin, + const RandomAccessIterator end, Comparator& comp) const + { + __gnu_sequential::sort(begin, end, comp); + } + }; + +template<bool stable, typename SeqRandomAccessIterator, + typename RandomAccessIterator, typename Comparator, + typename DiffType> + struct possibly_stable_multiway_merge + { + }; + +template<typename SeqRandomAccessIterator, typename RandomAccessIterator, + typename Comparator, typename DiffType> + struct possibly_stable_multiway_merge + <true, SeqRandomAccessIterator, RandomAccessIterator, Comparator, + DiffType> + { + void operator()(const SeqRandomAccessIterator& seqs_begin, + const SeqRandomAccessIterator& seqs_end, + const RandomAccessIterator& target, + Comparator& comp, + DiffType length_am) const + { + stable_multiway_merge(seqs_begin, seqs_end, target, comp, + length_am, sequential_tag()); + } + }; + +template<typename SeqRandomAccessIterator, typename RandomAccessIterator, + typename Comparator, typename DiffType> + struct possibly_stable_multiway_merge + <false, SeqRandomAccessIterator, RandomAccessIterator, Comparator, + DiffType> + { + void operator()(const SeqRandomAccessIterator& seqs_begin, + const SeqRandomAccessIterator& seqs_end, + const RandomAccessIterator& target, + Comparator& comp, + DiffType length_am) const + { + multiway_merge(seqs_begin, seqs_end, target, comp, + length_am, sequential_tag()); + } + }; + /** @brief PMWMS code executed by each thread. * @param sd Pointer to algorithm data. * @param comp Comparator. */ -template<typename RandomAccessIterator, typename Comparator> +template<bool stable, bool exact, typename RandomAccessIterator, + typename Comparator> void parallel_sort_mwms_pu(PMWMSSortingData<RandomAccessIterator>* sd, Comparator& comp) @@ -162,165 +330,65 @@ template<typename RandomAccessIterator, typename Comparator> // Length of this thread's chunk, before merging. difference_type length_local = sd->starts[iam + 1] - sd->starts[iam]; -#if _GLIBCXX_MULTIWAY_MERGESORT_COPY_LAST - typedef RandomAccessIterator SortingPlacesIterator; + // Sort in temporary storage, leave space for sentinel. - // Sort in input storage. - sd->sorting_places[iam] = sd->source + sd->starts[iam]; -#else typedef value_type* SortingPlacesIterator; - // Sort in temporary storage, leave space for sentinel. - sd->sorting_places[iam] = sd->temporaries[iam] = + sd->temporary[iam] = static_cast<value_type*>( ::operator new(sizeof(value_type) * (length_local + 1))); // Copy there. std::uninitialized_copy(sd->source + sd->starts[iam], sd->source + sd->starts[iam] + length_local, - sd->sorting_places[iam]); -#endif - - // Sort locally. - if (sd->stable) - __gnu_sequential::stable_sort(sd->sorting_places[iam], - sd->sorting_places[iam] + length_local, - comp); - else - __gnu_sequential::sort(sd->sorting_places[iam], - sd->sorting_places[iam] + length_local, - comp); - - // Invariant: locally sorted subsequence in sd->sorting_places[iam], - // sd->sorting_places[iam] + length_local. - const _Settings& __s = _Settings::get(); - if (__s.sort_splitting == SAMPLING) - { - difference_type num_samples; - determine_samples(sd, num_samples); - -# pragma omp barrier - -# pragma omp single - __gnu_sequential::sort(sd->samples, - sd->samples + (num_samples * sd->num_threads), - comp); - -# pragma omp barrier - - for (int s = 0; s < sd->num_threads; ++s) - { - // For each sequence. - if (num_samples * iam > 0) - sd->pieces[iam][s].begin = - std::lower_bound(sd->sorting_places[s], - sd->sorting_places[s] - + (sd->starts[s + 1] - sd->starts[s]), - sd->samples[num_samples * iam], - comp) - - sd->sorting_places[s]; - else - // Absolute beginning. - sd->pieces[iam][s].begin = 0; - - if ((num_samples * (iam + 1)) < (num_samples * sd->num_threads)) - sd->pieces[iam][s].end = - std::lower_bound(sd->sorting_places[s], - sd->sorting_places[s] - + (sd->starts[s + 1] - sd->starts[s]), - sd->samples[num_samples * (iam + 1)], - comp) - - sd->sorting_places[s]; - else - // Absolute end. - sd->pieces[iam][s].end = sd->starts[s + 1] - sd->starts[s]; - } - } - else if (__s.sort_splitting == EXACT) - { -# pragma omp barrier + sd->temporary[iam]); - std::vector<std::pair<SortingPlacesIterator, SortingPlacesIterator> > - seqs(sd->num_threads); - for (int s = 0; s < sd->num_threads; ++s) - seqs[s] = std::make_pair(sd->sorting_places[s], - sd->sorting_places[s] - + (sd->starts[s + 1] - sd->starts[s])); + possibly_stable_sort<stable, SortingPlacesIterator, Comparator>() + (sd->temporary[iam], sd->temporary[iam] + length_local, comp); - std::vector<SortingPlacesIterator> offsets(sd->num_threads); + // Invariant: locally sorted subsequence in sd->temporary[iam], + // sd->temporary[iam] + length_local. - // if not last thread - if (iam < sd->num_threads - 1) - multiseq_partition(seqs.begin(), seqs.end(), - sd->starts[iam + 1], offsets.begin(), comp); + // No barrier here: Synchronization is done by the splitting routine. - for (int seq = 0; seq < sd->num_threads; ++seq) - { - // for each sequence - if (iam < (sd->num_threads - 1)) - sd->pieces[iam][seq].end = offsets[seq] - seqs[seq].first; - else - // very end of this sequence - sd->pieces[iam][seq].end = (sd->starts[seq + 1] - - sd->starts[seq]); - } - -# pragma omp barrier - - for (int seq = 0; seq < sd->num_threads; ++seq) - { - // For each sequence. - if (iam > 0) - sd->pieces[iam][seq].begin = sd->pieces[iam - 1][seq].end; - else - // Absolute beginning. - sd->pieces[iam][seq].begin = 0; - } - } + difference_type num_samples = + _Settings::get().sort_mwms_oversampling * sd->num_threads - 1; + split_consistently + <exact, RandomAccessIterator, Comparator, SortingPlacesIterator>() + (iam, sd, comp, num_samples); // Offset from target begin, length after merging. difference_type offset = 0, length_am = 0; - for (int s = 0; s < sd->num_threads; ++s) + for (thread_index_t s = 0; s < sd->num_threads; s++) { length_am += sd->pieces[iam][s].end - sd->pieces[iam][s].begin; offset += sd->pieces[iam][s].begin; } -#if _GLIBCXX_MULTIWAY_MERGESORT_COPY_LAST - // Merge to temporary storage, uninitialized creation not possible - // since there is no multiway_merge calling the placement new - // instead of the assignment operator. - // XXX incorrect (de)construction - sd->merging_places[iam] = sd->temporaries[iam] = - static_cast<value_type*>(::operator new(sizeof(value_type) - * length_am)); -#else - // Merge directly to target. - sd->merging_places[iam] = sd->source + offset; -#endif - std::vector<std::pair<SortingPlacesIterator, SortingPlacesIterator> > - seqs(sd->num_threads); + typedef std::vector< + std::pair<SortingPlacesIterator, SortingPlacesIterator> > + seq_vector_type; + seq_vector_type seqs(sd->num_threads); for (int s = 0; s < sd->num_threads; ++s) { seqs[s] = - std::make_pair(sd->sorting_places[s] + sd->pieces[iam][s].begin, - sd->sorting_places[s] + sd->pieces[iam][s].end); + std::make_pair(sd->temporary[s] + sd->pieces[iam][s].begin, + sd->temporary[s] + sd->pieces[iam][s].end); } - multiway_merge(seqs.begin(), seqs.end(), sd->merging_places[iam], comp, - length_am, sd->stable, false, sequential_tag()); + possibly_stable_multiway_merge< + stable, + typename seq_vector_type::iterator, + RandomAccessIterator, + Comparator, difference_type>() + (seqs.begin(), seqs.end(), + sd->source + offset, comp, + length_am); # pragma omp barrier -#if _GLIBCXX_MULTIWAY_MERGESORT_COPY_LAST - // Write back. - std::copy(sd->merging_places[iam], - sd->merging_places[iam] + length_am, - sd->source + offset); -#endif - - ::operator delete(sd->temporaries[iam]); + ::operator delete(sd->temporary[iam]); } /** @brief PMWMS main call. @@ -329,21 +397,22 @@ template<typename RandomAccessIterator, typename Comparator> * @param comp Comparator. * @param n Length of sequence. * @param num_threads Number of threads to use. - * @param stable Stable sorting. */ -template<typename RandomAccessIterator, typename Comparator> +template<bool stable, bool exact, typename RandomAccessIterator, + typename Comparator> void parallel_sort_mwms(RandomAccessIterator begin, RandomAccessIterator end, - Comparator comp, typename - std::iterator_traits<RandomAccessIterator>:: - difference_type n, int num_threads, bool stable) + Comparator comp, + thread_index_t num_threads) { - _GLIBCXX_CALL(n) + _GLIBCXX_CALL(end - begin) typedef std::iterator_traits<RandomAccessIterator> traits_type; typedef typename traits_type::value_type value_type; typedef typename traits_type::difference_type difference_type; + difference_type n = end - begin; + if (n <= 1) return; @@ -354,7 +423,6 @@ template<typename RandomAccessIterator, typename Comparator> // shared variables PMWMSSortingData<RandomAccessIterator> sd; difference_type* starts; - const _Settings& __s = _Settings::get(); # pragma omp parallel num_threads(num_threads) { @@ -364,23 +432,16 @@ template<typename RandomAccessIterator, typename Comparator> { sd.num_threads = num_threads; sd.source = begin; - sd.temporaries = new value_type*[num_threads]; - -#if _GLIBCXX_MULTIWAY_MERGESORT_COPY_LAST - sd.sorting_places = new RandomAccessIterator[num_threads]; - sd.merging_places = new value_type*[num_threads]; -#else - sd.sorting_places = new value_type*[num_threads]; - sd.merging_places = new RandomAccessIterator[num_threads]; -#endif - if (__s.sort_splitting == SAMPLING) + sd.temporary = new value_type*[num_threads]; + + if (!exact) { - unsigned int size = - (__s.sort_mwms_oversampling * num_threads - 1) + difference_type size = + (_Settings::get().sort_mwms_oversampling * num_threads - 1) * num_threads; sd.samples = static_cast<value_type*>( - ::operator new(size * sizeof(value_type))); + ::operator new(size * sizeof(value_type))); } else sd.samples = NULL; @@ -390,7 +451,6 @@ template<typename RandomAccessIterator, typename Comparator> for (int s = 0; s < num_threads; ++s) sd.pieces[s].resize(num_threads); starts = sd.starts = new difference_type[num_threads + 1]; - sd.stable = stable; difference_type chunk_length = n / num_threads; difference_type split = n % num_threads; @@ -401,18 +461,16 @@ template<typename RandomAccessIterator, typename Comparator> pos += (i < split) ? (chunk_length + 1) : chunk_length; } starts[num_threads] = pos; - } + } //single // Now sort in parallel. - parallel_sort_mwms_pu(&sd, comp); + parallel_sort_mwms_pu<stable, exact>(&sd, comp); } //parallel delete[] starts; - delete[] sd.temporaries; - delete[] sd.sorting_places; - delete[] sd.merging_places; + delete[] sd.temporary; - if (__s.sort_splitting == SAMPLING) + if (!exact) ::operator delete(sd.samples); delete[] sd.offsets; diff --git a/libstdc++-v3/include/parallel/sort.h b/libstdc++-v3/include/parallel/sort.h index edf4eea02d8..83aa2df1b11 100644 --- a/libstdc++-v3/include/parallel/sort.h +++ b/libstdc++-v3/include/parallel/sort.h @@ -71,7 +71,7 @@ namespace __gnu_parallel template<typename RandomAccessIterator, typename Comparator> inline void parallel_sort(RandomAccessIterator begin, RandomAccessIterator end, - Comparator comp, bool stable) + Comparator comp, bool stable) { _GLIBCXX_CALL(end - begin) typedef std::iterator_traits<RandomAccessIterator> traits_type; @@ -79,25 +79,43 @@ namespace __gnu_parallel typedef typename traits_type::difference_type difference_type; if (begin != end) - { - difference_type n = end - begin; + { + difference_type n = end - begin; - if (false) ; + if (false) ; #if _GLIBCXX_MERGESORT - else if (stable || _Settings::get().sort_algorithm == MWMS) - parallel_sort_mwms(begin, end, comp, n, get_max_threads(), stable); + else if (stable) + { + if(_Settings::get().sort_splitting == EXACT) + parallel_sort_mwms<true, true> + (begin, end, comp, get_max_threads()); + else + parallel_sort_mwms<true, false> + (begin, end, comp, get_max_threads()); + } + else if (_Settings::get().sort_algorithm == MWMS) + { + if(_Settings::get().sort_splitting == EXACT) + parallel_sort_mwms<false, true> + (begin, end, comp, get_max_threads()); + else + parallel_sort_mwms<false, false> + (begin, end, comp, get_max_threads()); + } #endif #if _GLIBCXX_QUICKSORT - else if (!stable && _Settings::get().sort_algorithm == QS) - parallel_sort_qs(begin, end, comp, n, get_max_threads()); + else if (!stable && _Settings::get().sort_algorithm == QS) + parallel_sort_qs(begin, end, comp, n, get_max_threads()); #endif #if _GLIBCXX_BAL_QUICKSORT - else if (!stable && _Settings::get().sort_algorithm == QS_BALANCED) - parallel_sort_qsb(begin, end, comp, n, get_max_threads()); + else if (!stable && _Settings::get().sort_algorithm == QS_BALANCED) + parallel_sort_qsb(begin, end, comp, n, get_max_threads()); #endif - else - __gnu_sequential::sort(begin, end, comp); - } + else if(stable) + __gnu_sequential::stable_sort(begin, end, comp); + else + __gnu_sequential::sort(begin, end, comp); + } } } // end namespace __gnu_parallel diff --git a/libstdc++-v3/include/parallel/tags.h b/libstdc++-v3/include/parallel/tags.h index b3f2ec86912..f57add97c7b 100644 --- a/libstdc++-v3/include/parallel/tags.h +++ b/libstdc++-v3/include/parallel/tags.h @@ -44,6 +44,9 @@ namespace __gnu_parallel /** @brief Forces sequential execution at compile time. */ struct sequential_tag { }; + /** @brief Forces exact splitting in multiway merge at compile time. */ + struct exact_tag { }; + /** @brief Recommends parallel execution at compile time. */ struct parallel_tag { }; diff --git a/libstdc++-v3/include/parallel/types.h b/libstdc++-v3/include/parallel/types.h index ded617edb6d..1b646b02084 100644 --- a/libstdc++-v3/include/parallel/types.h +++ b/libstdc++-v3/include/parallel/types.h @@ -87,15 +87,10 @@ namespace __gnu_parallel /// Merging algorithms: // bubblesort-alike, loser-tree variants, enum sentinel. enum _MultiwayMergeAlgorithm - { - BUBBLE, - LOSER_TREE_EXPLICIT, - LOSER_TREE, - LOSER_TREE_COMBINED, - LOSER_TREE_SENTINEL, - ENUM_SENTINEL + { + LOSER_TREE }; - + /// Partial sum algorithms: recursive, linear. enum _PartialSumAlgorithm { diff --git a/libstdc++-v3/include/std/array b/libstdc++-v3/include/std/array index 691f41cbcd8..c84ddb6573f 100644 --- a/libstdc++-v3/include/std/array +++ b/libstdc++-v3/include/std/array @@ -31,8 +31,8 @@ * This is a Standard C++ Library header. */ -#ifndef _GLIBCXX_CXX0X_ARRAY -#define _GLIBCXX_CXX0X_ARRAY 1 +#ifndef _GLIBCXX_ARRAY +#define _GLIBCXX_ARRAY 1 #pragma GCC system_header @@ -60,4 +60,4 @@ # undef _GLIBCXX_INCLUDE_AS_CXX0X #endif -#endif // _GLIBCXX_CXX0X_ARRAY +#endif // _GLIBCXX_ARRAY diff --git a/libstdc++-v3/include/std/date_time b/libstdc++-v3/include/std/date_time index b956a9b0119..0aca6b3b4ac 100644 --- a/libstdc++-v3/include/std/date_time +++ b/libstdc++-v3/include/std/date_time @@ -27,7 +27,7 @@ // invalidate any other reasons why the executable file might be covered by // the GNU General Public License. -/** @file include/date_time +/** @file date_time * This is a Standard C++ Library header. */ diff --git a/libstdc++-v3/include/std/regex b/libstdc++-v3/include/std/regex index 5c257181f2e..9014fbabb2e 100644 --- a/libstdc++-v3/include/std/regex +++ b/libstdc++-v3/include/std/regex @@ -31,8 +31,8 @@ * This is a Standard C++ Library header. */ -#ifndef _GLIBCXX_CXX0X_REGEX -#define _GLIBCXX_CXX0X_REGEX 1 +#ifndef _GLIBCXX_REGEX +#define _GLIBCXX_REGEX 1 #pragma GCC system_header @@ -67,4 +67,4 @@ # undef _GLIBCXX_INCLUDE_AS_CXX0X #endif -#endif // _GLIBCXX_CXX0X_REGEX +#endif // _GLIBCXX_REGEX diff --git a/libstdc++-v3/include/std/system_error b/libstdc++-v3/include/std/system_error index c8973d14735..5081e3f11ec 100644 --- a/libstdc++-v3/include/std/system_error +++ b/libstdc++-v3/include/std/system_error @@ -1,6 +1,6 @@ // <system_error> -*- C++ -*- -// Copyright (C) 2007 Free Software Foundation, Inc. +// Copyright (C) 2007, 2008 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free // software; you can redistribute it and/or modify it under the @@ -27,7 +27,7 @@ // invalidate any other reasons why the executable file might be covered by // the GNU General Public License. -/** @file include/system_error +/** @file system_error * This is a Standard C++ Library header. */ @@ -142,6 +142,9 @@ _GLIBCXX_BEGIN_NAMESPACE(std) error_code _M_code; public: + system_error(error_code __ec = error_code()) + : runtime_error(""), _M_code(__ec) { } + system_error(const string& __what, error_code __ec = error_code()) : runtime_error(__what), _M_code(__ec) { } diff --git a/libstdc++-v3/include/std/tuple b/libstdc++-v3/include/std/tuple index 3dda5301644..38a6bbb47f2 100644 --- a/libstdc++-v3/include/std/tuple +++ b/libstdc++-v3/include/std/tuple @@ -31,8 +31,8 @@ * This is a Standard C++ Library header. */ -#ifndef _GLIBCXX_CXX0X_TUPLE -#define _GLIBCXX_CXX0X_TUPLE 1 +#ifndef _GLIBCXX_TUPLE +#define _GLIBCXX_TUPLE 1 #pragma GCC system_header @@ -644,4 +644,4 @@ namespace std }; // anonymous namespace } -#endif // _GLIBCXX_CXX0X_TUPLE +#endif // _GLIBCXX_TUPLE diff --git a/libstdc++-v3/include/std/type_traits b/libstdc++-v3/include/std/type_traits index 1f9a2d9f72d..66650f540d9 100644 --- a/libstdc++-v3/include/std/type_traits +++ b/libstdc++-v3/include/std/type_traits @@ -31,12 +31,12 @@ * This is a Standard C++ Library header. */ -#ifndef _GLIBCXX_CXX0X_TYPE_TRAITS -#define _GLIBCXX_CXX0X_TYPE_TRAITS 1 +#ifndef _GLIBCXX_TYPE_TRAITS +#define _GLIBCXX_TYPE_TRAITS 1 #pragma GCC system_header -#ifndef __GXX_EXPERIMENTAL_CXX0X__ +#ifndef __GXX_EXPERIMENTAL__ # include <c++0x_warning.h> #endif @@ -553,5 +553,5 @@ namespace std struct make_signed<bool>; } -#endif // _GLIBCXX_CXX0X_TYPE_TRAITS +#endif // _GLIBCXX_TYPE_TRAITS diff --git a/libstdc++-v3/libmath/Makefile.in b/libstdc++-v3/libmath/Makefile.in index f423f83e53e..c2302be25a7 100644 --- a/libstdc++-v3/libmath/Makefile.in +++ b/libstdc++-v3/libmath/Makefile.in @@ -49,6 +49,7 @@ am__aclocal_m4_deps = $(top_srcdir)/../config/enable.m4 \ $(top_srcdir)/../config/lib-prefix.m4 \ $(top_srcdir)/../config/multi.m4 \ $(top_srcdir)/../config/no-executables.m4 \ + $(top_srcdir)/../config/proginstall.m4 \ $(top_srcdir)/../config/unwind_ipinfo.m4 \ $(top_srcdir)/../libtool.m4 $(top_srcdir)/../ltoptions.m4 \ $(top_srcdir)/../ltsugar.m4 $(top_srcdir)/../ltversion.m4 \ diff --git a/libstdc++-v3/libsupc++/Makefile.in b/libstdc++-v3/libsupc++/Makefile.in index 7453d3da8f1..631a3f3fa0d 100644 --- a/libstdc++-v3/libsupc++/Makefile.in +++ b/libstdc++-v3/libsupc++/Makefile.in @@ -51,6 +51,7 @@ am__aclocal_m4_deps = $(top_srcdir)/../config/enable.m4 \ $(top_srcdir)/../config/lib-prefix.m4 \ $(top_srcdir)/../config/multi.m4 \ $(top_srcdir)/../config/no-executables.m4 \ + $(top_srcdir)/../config/proginstall.m4 \ $(top_srcdir)/../config/unwind_ipinfo.m4 \ $(top_srcdir)/../libtool.m4 $(top_srcdir)/../ltoptions.m4 \ $(top_srcdir)/../ltsugar.m4 $(top_srcdir)/../ltversion.m4 \ diff --git a/libstdc++-v3/po/Makefile.in b/libstdc++-v3/po/Makefile.in index e6a32044d1f..c7ce1cafb32 100644 --- a/libstdc++-v3/po/Makefile.in +++ b/libstdc++-v3/po/Makefile.in @@ -49,6 +49,7 @@ am__aclocal_m4_deps = $(top_srcdir)/../config/enable.m4 \ $(top_srcdir)/../config/lib-prefix.m4 \ $(top_srcdir)/../config/multi.m4 \ $(top_srcdir)/../config/no-executables.m4 \ + $(top_srcdir)/../config/proginstall.m4 \ $(top_srcdir)/../config/unwind_ipinfo.m4 \ $(top_srcdir)/../libtool.m4 $(top_srcdir)/../ltoptions.m4 \ $(top_srcdir)/../ltsugar.m4 $(top_srcdir)/../ltversion.m4 \ diff --git a/libstdc++-v3/src/Makefile.am b/libstdc++-v3/src/Makefile.am index 7bd12aa1f60..e6c0aad184a 100644 --- a/libstdc++-v3/src/Makefile.am +++ b/libstdc++-v3/src/Makefile.am @@ -134,6 +134,7 @@ endif # Sources present in the src directory. sources = \ + atomic.cc \ bitmap_allocator.cc \ pool_allocator.cc \ mt_allocator.cc \ @@ -248,6 +249,11 @@ date_time.lo: date_time.cc date_time.o: date_time.cc $(CXXCOMPILE) -std=gnu++0x -c $< +atomic.lo: atomic.cc + $(LTCXXCOMPILE) -x c++ -std=gnu++0x -c $< +atomic.o: atomic.cc + $(CXXCOMPILE) -x c++ -std=gnu++0x -c $< + if GLIBCXX_LDBL_COMPAT # Use special rules for compatibility-ldbl.cc compilation, as we need to # pass -mlong-double-64. diff --git a/libstdc++-v3/src/Makefile.in b/libstdc++-v3/src/Makefile.in index 450e97f9538..744833f75c2 100644 --- a/libstdc++-v3/src/Makefile.in +++ b/libstdc++-v3/src/Makefile.in @@ -50,6 +50,7 @@ am__aclocal_m4_deps = $(top_srcdir)/../config/enable.m4 \ $(top_srcdir)/../config/lib-prefix.m4 \ $(top_srcdir)/../config/multi.m4 \ $(top_srcdir)/../config/no-executables.m4 \ + $(top_srcdir)/../config/proginstall.m4 \ $(top_srcdir)/../config/unwind_ipinfo.m4 \ $(top_srcdir)/../libtool.m4 $(top_srcdir)/../ltoptions.m4 \ $(top_srcdir)/../ltsugar.m4 $(top_srcdir)/../ltversion.m4 \ @@ -69,18 +70,18 @@ am__strip_dir = `echo $$p | sed -e 's|^.*/||'`; am__installdirs = "$(DESTDIR)$(toolexeclibdir)" toolexeclibLTLIBRARIES_INSTALL = $(INSTALL) LTLIBRARIES = $(toolexeclib_LTLIBRARIES) -am__libstdc___la_SOURCES_DIST = bitmap_allocator.cc pool_allocator.cc \ - mt_allocator.cc codecvt.cc compatibility.cc complex_io.cc \ - ctype.cc date_time.cc debug.cc functexcept.cc hash.cc \ - hash_c++0x.cc globals_io.cc hashtable.cc hashtable_c++0x.cc \ - ios.cc ios_failure.cc ios_init.cc ios_locale.cc limits.cc \ - list.cc debug_list.cc locale.cc locale_init.cc \ - locale_facets.cc localename.cc stdexcept.cc strstream.cc \ - system_error.cc tree.cc allocator-inst.cc concept-inst.cc \ - fstream-inst.cc ext-inst.cc ios-inst.cc iostream-inst.cc \ - istream-inst.cc istream.cc locale-inst.cc misc-inst.cc \ - ostream-inst.cc sstream-inst.cc streambuf-inst.cc streambuf.cc \ - string-inst.cc valarray-inst.cc wlocale-inst.cc \ +am__libstdc___la_SOURCES_DIST = atomic.cc bitmap_allocator.cc \ + pool_allocator.cc mt_allocator.cc codecvt.cc compatibility.cc \ + complex_io.cc ctype.cc date_time.cc debug.cc functexcept.cc \ + hash.cc hash_c++0x.cc globals_io.cc hashtable.cc \ + hashtable_c++0x.cc ios.cc ios_failure.cc ios_init.cc \ + ios_locale.cc limits.cc list.cc debug_list.cc locale.cc \ + locale_init.cc locale_facets.cc localename.cc stdexcept.cc \ + strstream.cc system_error.cc tree.cc allocator-inst.cc \ + concept-inst.cc fstream-inst.cc ext-inst.cc ios-inst.cc \ + iostream-inst.cc istream-inst.cc istream.cc locale-inst.cc \ + misc-inst.cc ostream-inst.cc sstream-inst.cc streambuf-inst.cc \ + streambuf.cc string-inst.cc valarray-inst.cc wlocale-inst.cc \ wstring-inst.cc atomicity.cc codecvt_members.cc \ collate_members.cc ctype_members.cc messages_members.cc \ monetary_members.cc numeric_members.cc time_members.cc \ @@ -94,19 +95,19 @@ am__objects_1 = atomicity.lo codecvt_members.lo collate_members.lo \ @ENABLE_PARALLEL_TRUE@ parallel_settings.lo am__objects_4 = basic_file.lo c++locale.lo $(am__objects_2) \ $(am__objects_3) -am__objects_5 = bitmap_allocator.lo pool_allocator.lo mt_allocator.lo \ - codecvt.lo compatibility.lo complex_io.lo ctype.lo \ - date_time.lo debug.lo functexcept.lo hash.lo hash_c++0x.lo \ - globals_io.lo hashtable.lo hashtable_c++0x.lo ios.lo \ - ios_failure.lo ios_init.lo ios_locale.lo limits.lo list.lo \ - debug_list.lo locale.lo locale_init.lo locale_facets.lo \ - localename.lo stdexcept.lo strstream.lo system_error.lo \ - tree.lo allocator-inst.lo concept-inst.lo fstream-inst.lo \ - ext-inst.lo ios-inst.lo iostream-inst.lo istream-inst.lo \ - istream.lo locale-inst.lo misc-inst.lo ostream-inst.lo \ - sstream-inst.lo streambuf-inst.lo streambuf.lo string-inst.lo \ - valarray-inst.lo wlocale-inst.lo wstring-inst.lo \ - $(am__objects_1) $(am__objects_4) +am__objects_5 = atomic.lo bitmap_allocator.lo pool_allocator.lo \ + mt_allocator.lo codecvt.lo compatibility.lo complex_io.lo \ + ctype.lo date_time.lo debug.lo functexcept.lo hash.lo \ + hash_c++0x.lo globals_io.lo hashtable.lo hashtable_c++0x.lo \ + ios.lo ios_failure.lo ios_init.lo ios_locale.lo limits.lo \ + list.lo debug_list.lo locale.lo locale_init.lo \ + locale_facets.lo localename.lo stdexcept.lo strstream.lo \ + system_error.lo tree.lo allocator-inst.lo concept-inst.lo \ + fstream-inst.lo ext-inst.lo ios-inst.lo iostream-inst.lo \ + istream-inst.lo istream.lo locale-inst.lo misc-inst.lo \ + ostream-inst.lo sstream-inst.lo streambuf-inst.lo streambuf.lo \ + string-inst.lo valarray-inst.lo wlocale-inst.lo \ + wstring-inst.lo $(am__objects_1) $(am__objects_4) am_libstdc___la_OBJECTS = $(am__objects_5) libstdc___la_OBJECTS = $(am_libstdc___la_OBJECTS) DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) @@ -367,6 +368,7 @@ host_sources_extra = \ # Sources present in the src directory. sources = \ + atomic.cc \ bitmap_allocator.cc \ pool_allocator.cc \ mt_allocator.cc \ @@ -839,6 +841,11 @@ date_time.lo: date_time.cc date_time.o: date_time.cc $(CXXCOMPILE) -std=gnu++0x -c $< +atomic.lo: atomic.cc + $(LTCXXCOMPILE) -x c++ -std=gnu++0x -c $< +atomic.o: atomic.cc + $(CXXCOMPILE) -x c++ -std=gnu++0x -c $< + # Use special rules for compatibility-ldbl.cc compilation, as we need to # pass -mlong-double-64. @GLIBCXX_LDBL_COMPAT_TRUE@compatibility-ldbl.lo: compatibility-ldbl.cc diff --git a/libstdc++-v3/src/atomic.cc b/libstdc++-v3/src/atomic.cc new file mode 100644 index 00000000000..e43733332db --- /dev/null +++ b/libstdc++-v3/src/atomic.cc @@ -0,0 +1,116 @@ +// Support for atomic operations -*- C++ -*- + +// Copyright (C) 2008 +// Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// 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 this library; see the file COPYING. If not, write to +// the Free Software Foundation, 51 Franklin Street, Fifth Floor, +// Boston, MA 02110-1301, USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#include <stdint.h> +#include <cstdatomic> + +#define LOGSIZE 4 + +namespace +{ + atomic_flag volatile __atomic_flag_anon_table__[ 1 << LOGSIZE ] = + { + ATOMIC_FLAG_INIT, ATOMIC_FLAG_INIT, ATOMIC_FLAG_INIT, ATOMIC_FLAG_INIT, + ATOMIC_FLAG_INIT, ATOMIC_FLAG_INIT, ATOMIC_FLAG_INIT, ATOMIC_FLAG_INIT, + ATOMIC_FLAG_INIT, ATOMIC_FLAG_INIT, ATOMIC_FLAG_INIT, ATOMIC_FLAG_INIT, + ATOMIC_FLAG_INIT, ATOMIC_FLAG_INIT, ATOMIC_FLAG_INIT, ATOMIC_FLAG_INIT, + }; +} // anonymous namespace + +namespace std +{ + extern "C" { + + const atomic_flag atomic_global_fence_compatibility = ATOMIC_FLAG_INIT; + + bool + atomic_flag_test_and_set_explicit(volatile atomic_flag* __a, + memory_order __x) + { +#ifdef _GLIBCXX_ATOMIC_BUILTINS + if (__x >= memory_order_acq_rel) + __sync_synchronize(); + return __sync_lock_test_and_set(&(__a->_M_base._M_b), 1); +#else + bool result = __a->_M_base._M_b; + __a->_M_base._M_b = true; + return result; +#endif + } + + bool + atomic_flag_test_and_set(volatile atomic_flag* __a) + { return atomic_flag_test_and_set_explicit(__a, memory_order_seq_cst); } + + void + atomic_flag_clear_explicit(volatile atomic_flag* __a, memory_order __x) + { +#ifdef _GLIBCXX_ATOMIC_BUILTINS + __sync_lock_release(&(__a->_M_base._M_b)); + if (__x >= memory_order_acq_rel) + __sync_synchronize(); +#else + __a->_M_base._M_b = false; +#endif + } + + void + atomic_flag_clear(volatile atomic_flag* __a) + { atomic_flag_clear_explicit(__a, memory_order_seq_cst); } + + void + atomic_flag_fence(const volatile atomic_flag*, memory_order) + { +#ifdef _GLIBCXX_ATOMIC_BUILTINS + __sync_synchronize(); +#endif + } + + void + __atomic_flag_wait_explicit(volatile atomic_flag* __a, memory_order __x) + { + while (atomic_flag_test_and_set_explicit(__a, __x)) + { }; + } + + volatile atomic_flag* + __atomic_flag_for_address(const volatile void* __z) + { + uintptr_t __u = reinterpret_cast<uintptr_t>(__z); + __u += (__u >> 2) + (__u << 4); + __u += (__u >> 7) + (__u << 5); + __u += (__u >> 17) + (__u << 13); + if (sizeof(uintptr_t) > 4) __u += (__u >> 31); + __u &= ~((~uintptr_t(0)) << LOGSIZE); + return __atomic_flag_anon_table__ + __u; + } + + } // extern "C" +} // namespace std diff --git a/libstdc++-v3/testsuite/17_intro/headers/c++200x/all.cc b/libstdc++-v3/testsuite/17_intro/headers/c++200x/all.cc index 1bc1e6acd7a..6c30410bb6f 100644 --- a/libstdc++-v3/testsuite/17_intro/headers/c++200x/all.cc +++ b/libstdc++-v3/testsuite/17_intro/headers/c++200x/all.cc @@ -36,6 +36,7 @@ #include <csetjmp> #include <csignal> #include <cstdarg> +#include <cstdatomic> #include <cstdbool> #include <cstddef> #include <cstdint> @@ -67,6 +68,7 @@ #include <math.h> #include <setjmp.h> #include <signal.h> +#include <stdatomic.h> #include <stdarg.h> #ifdef _GLIBCXX_HAVE_STDBOOL_H #include <stdbool.h> diff --git a/libstdc++-v3/testsuite/25_algorithms/sort/35588.cc b/libstdc++-v3/testsuite/25_algorithms/sort/35588.cc new file mode 100644 index 00000000000..715fa3b93d2 --- /dev/null +++ b/libstdc++-v3/testsuite/25_algorithms/sort/35588.cc @@ -0,0 +1,32 @@ +// Copyright (C) 2008 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// 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 this library; see the file COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +#include <algorithm> +#include <functional> +#include <tr1/functional> + +// libstdc++/35588 +int main() +{ + using namespace std; + using namespace tr1; + using namespace placeholders; + + int t[10]; + sort(t, t+10, bind(less<int>(), _1, _2)); +} diff --git a/libstdc++-v3/testsuite/29_atomics/atomic/cons/assign_neg.cc b/libstdc++-v3/testsuite/29_atomics/atomic/cons/assign_neg.cc new file mode 100644 index 00000000000..435309860a3 --- /dev/null +++ b/libstdc++-v3/testsuite/29_atomics/atomic/cons/assign_neg.cc @@ -0,0 +1,55 @@ +// { dg-options "-std=gnu++0x" } +// { dg-do compile } + +// Copyright (C) 2008 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// 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 this library; see the file COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#include <cstdatomic> +#include <testsuite_common_types.h> + +int main() +{ + __gnu_test::assignable test; + __gnu_cxx::typelist::apply_generator(test, __gnu_test::atomics_tl()); + return 0; +} + +// { dg-error "within this context" "" { target *-*-* } 310 } +// { dg-error "is private" "" { target *-*-* } 1750 } +// { dg-error "is private" "" { target *-*-* } 1782 } +// { dg-error "is private" "" { target *-*-* } 1799 } +// { dg-error "is private" "" { target *-*-* } 1816 } +// { dg-error "is private" "" { target *-*-* } 1832 } +// { dg-error "is private" "" { target *-*-* } 1848 } +// { dg-error "is private" "" { target *-*-* } 1864 } +// { dg-error "is private" "" { target *-*-* } 1880 } +// { dg-error "is private" "" { target *-*-* } 1896 } +// { dg-error "is private" "" { target *-*-* } 1913 } +// { dg-error "is private" "" { target *-*-* } 1929 } +// { dg-error "is private" "" { target *-*-* } 1945 } +// { dg-error "is private" "" { target *-*-* } 1961 } +// { dg-excess-errors "In member function" } diff --git a/libstdc++-v3/testsuite/29_atomics/atomic/cons/copy_neg.cc b/libstdc++-v3/testsuite/29_atomics/atomic/cons/copy_neg.cc new file mode 100644 index 00000000000..011933a8eb8 --- /dev/null +++ b/libstdc++-v3/testsuite/29_atomics/atomic/cons/copy_neg.cc @@ -0,0 +1,55 @@ +// { dg-options "-std=gnu++0x" } +// { dg-do compile } + +// Copyright (C) 2008 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// 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 this library; see the file COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#include <cstdatomic> +#include <testsuite_common_types.h> + +int main() +{ + __gnu_test::copy_constructible test; + __gnu_cxx::typelist::apply_generator(test, __gnu_test::atomics_tl()); + return 0; +} + +// { dg-error "within this context" "" { target *-*-* } 333 } +// { dg-error "is private" "" { target *-*-* } 1749 } +// { dg-error "is private" "" { target *-*-* } 1781 } +// { dg-error "is private" "" { target *-*-* } 1798 } +// { dg-error "is private" "" { target *-*-* } 1814 } +// { dg-error "is private" "" { target *-*-* } 1831 } +// { dg-error "is private" "" { target *-*-* } 1847 } +// { dg-error "is private" "" { target *-*-* } 1863 } +// { dg-error "is private" "" { target *-*-* } 1879 } +// { dg-error "is private" "" { target *-*-* } 1895 } +// { dg-error "is private" "" { target *-*-* } 1912 } +// { dg-error "is private" "" { target *-*-* } 1928 } +// { dg-error "is private" "" { target *-*-* } 1944 } +// { dg-error "is private" "" { target *-*-* } 1960 } +// { dg-excess-errors "In member function" } diff --git a/libstdc++-v3/testsuite/29_atomics/atomic/cons/default.cc b/libstdc++-v3/testsuite/29_atomics/atomic/cons/default.cc new file mode 100644 index 00000000000..c8af19ad2ed --- /dev/null +++ b/libstdc++-v3/testsuite/29_atomics/atomic/cons/default.cc @@ -0,0 +1,38 @@ +// { dg-options "-std=gnu++0x" } + +// Copyright (C) 2008 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// 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 this library; see the file COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#include <cstdatomic> +#include <testsuite_common_types.h> + +int main() +{ + __gnu_test::default_constructible test; + __gnu_cxx::typelist::apply_generator(test, __gnu_test::atomics_tl()); + return 0; +} diff --git a/libstdc++-v3/testsuite/29_atomics/atomic/cons/explicit_value.cc b/libstdc++-v3/testsuite/29_atomics/atomic/cons/explicit_value.cc new file mode 100644 index 00000000000..da91e26a55d --- /dev/null +++ b/libstdc++-v3/testsuite/29_atomics/atomic/cons/explicit_value.cc @@ -0,0 +1,39 @@ +// { dg-options "-std=gnu++0x" } + +// Copyright (C) 2008 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// 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 this library; see the file COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#include <cstdatomic> +#include <testsuite_common_types.h> + +int main() +{ + __gnu_test::explicit_value_constructible test; + __gnu_cxx::typelist::apply_generator(test, __gnu_test::atomics_tl(), + __gnu_test::integral_types::type()); + return 0; +} diff --git a/libstdc++-v3/testsuite/29_atomics/atomic/requirements/explicit_instantiation/1.cc b/libstdc++-v3/testsuite/29_atomics/atomic/requirements/explicit_instantiation/1.cc new file mode 100644 index 00000000000..5dafd093a01 --- /dev/null +++ b/libstdc++-v3/testsuite/29_atomics/atomic/requirements/explicit_instantiation/1.cc @@ -0,0 +1,37 @@ +// { dg-options "-std=gnu++0x" } +// { dg-do compile } + +// Copyright (C) 2008 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// 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 this library; see the file COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +// This file tests explicit instantiation of basic_string + +#include <cstdatomic> +#include <testsuite_character.h> + +template class std::atomic<__gnu_test::pod_char>; +template class std::atomic<__gnu_test::pod_char*>; diff --git a/libstdc++-v3/testsuite/29_atomics/atomic_address/cons/aggregate.cc b/libstdc++-v3/testsuite/29_atomics/atomic_address/cons/aggregate.cc new file mode 100644 index 00000000000..f6aee27ce51 --- /dev/null +++ b/libstdc++-v3/testsuite/29_atomics/atomic_address/cons/aggregate.cc @@ -0,0 +1,37 @@ +// { dg-options "-std=gnu++0x" } +// { dg-do compile { xfail *-*-* } } + +// Copyright (C) 2008 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// 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 this library; see the file COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#include <cstdatomic> + +int main() +{ + std::atomic_address a = { { NULL } }; // { dg-excess-errors "braces around" } + return 0; +} diff --git a/libstdc++-v3/testsuite/29_atomics/atomic_address/cons/assign_neg.cc b/libstdc++-v3/testsuite/29_atomics/atomic_address/cons/assign_neg.cc new file mode 100644 index 00000000000..ef50b9ed38f --- /dev/null +++ b/libstdc++-v3/testsuite/29_atomics/atomic_address/cons/assign_neg.cc @@ -0,0 +1,42 @@ +// { dg-options "-std=gnu++0x" } +// { dg-do compile } + +// Copyright (C) 2008 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// 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 this library; see the file COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#include <cstdatomic> + +void test01() +{ + // Assign. + typedef std::atomic_address test_type; + test_type t1; + test_type t2; + t1 = t2; +} +// { dg-error "within this context" "" { target *-*-* } 39 } +// { dg-error "is private" "" { target *-*-* } 167 } diff --git a/libstdc++-v3/testsuite/29_atomics/atomic_address/cons/copy_neg.cc b/libstdc++-v3/testsuite/29_atomics/atomic_address/cons/copy_neg.cc new file mode 100644 index 00000000000..57732d83335 --- /dev/null +++ b/libstdc++-v3/testsuite/29_atomics/atomic_address/cons/copy_neg.cc @@ -0,0 +1,41 @@ +// { dg-options "-std=gnu++0x" } +// { dg-do compile } + +// Copyright (C) 2008 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// 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 this library; see the file COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#include <cstdatomic> + +void test01() +{ + // Copy. + typedef std::atomic_address test_type; + test_type t1; + test_type t2(t1); +} +// { dg-error "within this context" "" { target *-*-* } 38 } +// { dg-error "is private" "" { target *-*-* } 166 } diff --git a/libstdc++-v3/testsuite/29_atomics/atomic_address/cons/default.cc b/libstdc++-v3/testsuite/29_atomics/atomic_address/cons/default.cc new file mode 100644 index 00000000000..1d2c6cba50b --- /dev/null +++ b/libstdc++-v3/testsuite/29_atomics/atomic_address/cons/default.cc @@ -0,0 +1,37 @@ +// { dg-options "-std=gnu++0x" } + +// Copyright (C) 2008 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// 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 this library; see the file COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#include <cstdatomic> + +int main() +{ + // Default constructor. + std::atomic_address a; + return 0; +} diff --git a/libstdc++-v3/testsuite/29_atomics/atomic_address/cons/explicit_value.cc b/libstdc++-v3/testsuite/29_atomics/atomic_address/cons/explicit_value.cc new file mode 100644 index 00000000000..b455bf667cd --- /dev/null +++ b/libstdc++-v3/testsuite/29_atomics/atomic_address/cons/explicit_value.cc @@ -0,0 +1,38 @@ +// { dg-options "-std=gnu++0x" } + +// Copyright (C) 2008 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// 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 this library; see the file COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#include <cstdatomic> + +int main() +{ + // Explicit value constructor. + void* v = NULL; + std::atomic_address a(v); + return 0; +} diff --git a/libstdc++-v3/testsuite/29_atomics/atomic_flag/atomic_global_fence_compatibility.cc b/libstdc++-v3/testsuite/29_atomics/atomic_flag/atomic_global_fence_compatibility.cc new file mode 100644 index 00000000000..7ee633ebb32 --- /dev/null +++ b/libstdc++-v3/testsuite/29_atomics/atomic_flag/atomic_global_fence_compatibility.cc @@ -0,0 +1,39 @@ +// { dg-options "-std=gnu++0x" } + +// Copyright (C) 2008 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// 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 this library; see the file COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#include <cstdatomic> + +int main() +{ + using namespace std; + atomic_flag_fence(&atomic_global_fence_compatibility, memory_order_acquire); + atomic_global_fence_compatibility.fence(memory_order_release); + + return 0; +} diff --git a/libstdc++-v3/testsuite/29_atomics/atomic_flag/cons/aggregate.cc b/libstdc++-v3/testsuite/29_atomics/atomic_flag/cons/aggregate.cc new file mode 100644 index 00000000000..151d85fc050 --- /dev/null +++ b/libstdc++-v3/testsuite/29_atomics/atomic_flag/cons/aggregate.cc @@ -0,0 +1,38 @@ +// { dg-options "-std=gnu++0x" } +// { dg-do compile } + +// Copyright (C) 2008 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// 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 this library; see the file COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#include <cstdatomic> + +int main() +{ + // Only safe usage. + std::atomic_flag guard = ATOMIC_FLAG_INIT; + return 0; +} diff --git a/libstdc++-v3/testsuite/29_atomics/atomic_flag/cons/assign_neg.cc b/libstdc++-v3/testsuite/29_atomics/atomic_flag/cons/assign_neg.cc new file mode 100644 index 00000000000..5f8ff15dc52 --- /dev/null +++ b/libstdc++-v3/testsuite/29_atomics/atomic_flag/cons/assign_neg.cc @@ -0,0 +1,42 @@ +// { dg-options "-std=gnu++0x" } +// { dg-do compile } + +// Copyright (C) 2008 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// 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 this library; see the file COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#include <cstdatomic> + +void test01() +{ + // Assign. + typedef std::atomic_flag test_type; + test_type t1; + test_type t2; + t1 = t2; +} +// { dg-error "within this context" "" { xfail *-*-* } 39 } +// { dg-error "is private" "" { xfail *-*-* } 89 } diff --git a/libstdc++-v3/testsuite/29_atomics/atomic_flag/cons/copy_neg.cc b/libstdc++-v3/testsuite/29_atomics/atomic_flag/cons/copy_neg.cc new file mode 100644 index 00000000000..3480d8c5e16 --- /dev/null +++ b/libstdc++-v3/testsuite/29_atomics/atomic_flag/cons/copy_neg.cc @@ -0,0 +1,41 @@ +// { dg-options "-std=gnu++0x" } +// { dg-do compile } + +// Copyright (C) 2008 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// 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 this library; see the file COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#include <cstdatomic> + +void test01() +{ + // Copy. + typedef std::atomic_flag test_type; + test_type t1; + test_type t2(t1); +} +// { dg-error "within this context" "" { xfail *-*-* } 38 } +// { dg-error "is private" "" { xfail *-*-* } 88 } diff --git a/libstdc++-v3/testsuite/29_atomics/atomic_flag/cons/default.cc b/libstdc++-v3/testsuite/29_atomics/atomic_flag/cons/default.cc new file mode 100644 index 00000000000..b4fa3a755b2 --- /dev/null +++ b/libstdc++-v3/testsuite/29_atomics/atomic_flag/cons/default.cc @@ -0,0 +1,37 @@ +// { dg-options "-std=gnu++0x" } + +// Copyright (C) 2008 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// 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 this library; see the file COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#include <cstdatomic> + +int main() +{ + // Default constructor. + std::atomic_flag a; + return 0; +} diff --git a/libstdc++-v3/testsuite/29_atomics/atomic_flag/requirements/standard_layout.cc b/libstdc++-v3/testsuite/29_atomics/atomic_flag/requirements/standard_layout.cc new file mode 100644 index 00000000000..351df912fff --- /dev/null +++ b/libstdc++-v3/testsuite/29_atomics/atomic_flag/requirements/standard_layout.cc @@ -0,0 +1,43 @@ +// { dg-options "-std=gnu++0x" } + +// Copyright (C) 2008 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// 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 this library; see the file COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#include <cstdatomic> +#include <type_traits> +#include <testsuite_hooks.h> + +int main() +{ + bool test __attribute__((unused)) = true; + + typedef std::atomic_flag test_type; + VERIFY( std::has_trivial_default_constructor<test_type>::value ); + VERIFY( std::has_trivial_destructor<test_type>::value ); + + return 0; +} diff --git a/libstdc++-v3/testsuite/29_atomics/atomic_flag/test_and_set/explicit.c b/libstdc++-v3/testsuite/29_atomics/atomic_flag/test_and_set/explicit.c new file mode 100644 index 00000000000..9401af4d13b --- /dev/null +++ b/libstdc++-v3/testsuite/29_atomics/atomic_flag/test_and_set/explicit.c @@ -0,0 +1,40 @@ +// { dg-options "-x c -lstdc++" } + +// Copyright (C) 2008 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// 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 this library; see the file COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#include <stdatomic.h> + +int main() +{ + atomic_flag af = ATOMIC_FLAG_INIT; + + if (!atomic_flag_test_and_set_explicit(&af, memory_order_acquire)) + atomic_flag_clear_explicit(&af, memory_order_release); + + return 0; +} diff --git a/libstdc++-v3/testsuite/29_atomics/atomic_flag/test_and_set/explicit.cc b/libstdc++-v3/testsuite/29_atomics/atomic_flag/test_and_set/explicit.cc new file mode 100644 index 00000000000..c81a75aa99a --- /dev/null +++ b/libstdc++-v3/testsuite/29_atomics/atomic_flag/test_and_set/explicit.cc @@ -0,0 +1,41 @@ +// { dg-options "-std=gnu++0x" } + +// Copyright (C) 2008 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// 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 this library; see the file COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#include <cstdatomic> + +int main() +{ + using namespace std; + atomic_flag af = ATOMIC_FLAG_INIT; + + if (!af.test_and_set(memory_order_acquire)) + af.clear(memory_order_release); + + return 0; +} diff --git a/libstdc++-v3/testsuite/29_atomics/atomic_flag/test_and_set/implicit.c b/libstdc++-v3/testsuite/29_atomics/atomic_flag/test_and_set/implicit.c new file mode 100644 index 00000000000..727421bd12f --- /dev/null +++ b/libstdc++-v3/testsuite/29_atomics/atomic_flag/test_and_set/implicit.c @@ -0,0 +1,40 @@ +// { dg-options "-x c -lstdc++" } + +// Copyright (C) 2008 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// 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 this library; see the file COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#include <stdatomic.h> + +int main() +{ + atomic_flag af = ATOMIC_FLAG_INIT; + + if (!atomic_flag_test_and_set(&af)) + atomic_flag_clear(&af); + + return 0; +} diff --git a/libstdc++-v3/testsuite/29_atomics/atomic_flag/test_and_set/implicit.cc b/libstdc++-v3/testsuite/29_atomics/atomic_flag/test_and_set/implicit.cc new file mode 100644 index 00000000000..82961767e86 --- /dev/null +++ b/libstdc++-v3/testsuite/29_atomics/atomic_flag/test_and_set/implicit.cc @@ -0,0 +1,41 @@ +// { dg-options "-std=gnu++0x" } + +// Copyright (C) 2008 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// 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 this library; see the file COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#include <cstdatomic> + +int main() +{ + using namespace std; + atomic_flag af = ATOMIC_FLAG_INIT; + + if (!af.test_and_set()) + af.clear(); + + return 0; +} diff --git a/libstdc++-v3/testsuite/29_atomics/headers/cstdatomic/functions_std_c++0x.cc b/libstdc++-v3/testsuite/29_atomics/headers/cstdatomic/functions_std_c++0x.cc new file mode 100644 index 00000000000..5444d71f378 --- /dev/null +++ b/libstdc++-v3/testsuite/29_atomics/headers/cstdatomic/functions_std_c++0x.cc @@ -0,0 +1,50 @@ +// { dg-options "-std=gnu++0x" } +// { dg-do compile } + +// Copyright (C) 2008 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// 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 this library; see the file COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +#include <cstdatomic> + +namespace gnu +{ + using std::atomic_flag_test_and_set; + using std::atomic_flag_test_and_set_explicit; + using std::atomic_flag_clear; + using std::atomic_flag_clear_explicit; + using std::atomic_flag_fence; + + using std::atomic_global_fence_compatibility; + + // Sloppy testing for integral types (en masse). + using std::atomic_is_lock_free; + using std::atomic_store; + using std::atomic_store_explicit; + using std::atomic_load; + using std::atomic_load_explicit; + using std::atomic_swap; + using std::atomic_swap_explicit; + using std::atomic_compare_swap; + using std::atomic_compare_swap_explicit; + using std::atomic_fence; + + using std::atomic_fetch_add; + using std::atomic_fetch_add_explicit; + using std::atomic_fetch_sub; + using std::atomic_fetch_sub_explicit; +} diff --git a/libstdc++-v3/testsuite/29_atomics/headers/cstdatomic/macros.cc b/libstdc++-v3/testsuite/29_atomics/headers/cstdatomic/macros.cc new file mode 100644 index 00000000000..62f76ab1f0e --- /dev/null +++ b/libstdc++-v3/testsuite/29_atomics/headers/cstdatomic/macros.cc @@ -0,0 +1,37 @@ +// { dg-options "-std=gnu++0x" } +// { dg-do compile } + +// Copyright (C) 2008 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// 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 this library; see the file COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +#include <cstdatomic> + +namespace gnu +{ +#ifndef ATOMIC_INTEGRAL_LOCK_FREE + #error "ATOMIC_INTEGRAL_LOCK_FREE_must_be_a_macro" +#endif + +#ifndef ATOMIC_ADDRESS_LOCK_FREE + #error "ATOMIC_ADDRESS_LOCK_FREE_must_be_a_macro" +#endif + +#ifndef ATOMIC_FLAG_INIT + #error "ATOMIC_FLAG_INIT_must_be_a_macro" +#endif +} diff --git a/libstdc++-v3/testsuite/29_atomics/headers/cstdatomic/std_c++0x_neg.cc b/libstdc++-v3/testsuite/29_atomics/headers/cstdatomic/std_c++0x_neg.cc new file mode 100644 index 00000000000..f72e8136a58 --- /dev/null +++ b/libstdc++-v3/testsuite/29_atomics/headers/cstdatomic/std_c++0x_neg.cc @@ -0,0 +1,27 @@ +// { dg-do compile } +// { dg-options "-std=gnu++98" } + +// Copyright (C) 2008 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// 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 this library; see the file COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +#include <cstdatomic> // { dg-excess-errors "In file included from" } + +// { dg-error "upcoming ISO" "" { target *-*-* } 36 } + + + diff --git a/libstdc++-v3/testsuite/29_atomics/headers/cstdatomic/types_std_c++0x.cc b/libstdc++-v3/testsuite/29_atomics/headers/cstdatomic/types_std_c++0x.cc new file mode 100644 index 00000000000..31b32c13813 --- /dev/null +++ b/libstdc++-v3/testsuite/29_atomics/headers/cstdatomic/types_std_c++0x.cc @@ -0,0 +1,80 @@ +// { dg-options "-std=gnu++0x" } +// { dg-do compile } + +// Copyright (C) 2008 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// 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 this library; see the file COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +#include <cstdatomic> + +void test01() +{ + using std::memory_order; + using std::memory_order_relaxed; + using std::memory_order_acquire; + using std::memory_order_release; + using std::memory_order_acq_rel; + using std::memory_order_seq_cst; + + using std::atomic_flag; + + // atomics for builtins types + using std::atomic_bool; + using std::atomic_char; + using std::atomic_schar; + using std::atomic_uchar; + using std::atomic_short; + using std::atomic_ushort; + using std::atomic_int; + using std::atomic_uint; + using std::atomic_long; + using std::atomic_ulong; + using std::atomic_llong; + using std::atomic_ullong; + using std::atomic_wchar_t; + using std::atomic_char16_t; + using std::atomic_char32_t; + + // atomics for standard typedefs + using std::atomic_int_least8_t; + using std::atomic_uint_least8_t; + using std::atomic_int_least16_t; + using std::atomic_uint_least16_t; + using std::atomic_int_least32_t; + using std::atomic_uint_least32_t; + using std::atomic_int_least64_t; + using std::atomic_uint_least64_t; + using std::atomic_int_fast8_t; + using std::atomic_uint_fast8_t; + using std::atomic_int_fast16_t; + using std::atomic_uint_fast16_t; + using std::atomic_int_fast32_t; + using std::atomic_uint_fast32_t; + using std::atomic_int_fast64_t; + using std::atomic_uint_fast64_t; + using std::atomic_intptr_t; + using std::atomic_uintptr_t; + using std::atomic_size_t; + using std::atomic_ssize_t; + using std::atomic_ptrdiff_t; + using std::atomic_intmax_t; + using std::atomic_uintmax_t; + + using std::atomic_address; + + &std::atomic_global_fence_compatibility; +} diff --git a/libstdc++-v3/testsuite/29_atomics/headers/stdatomic.h/functions.c b/libstdc++-v3/testsuite/29_atomics/headers/stdatomic.h/functions.c new file mode 100644 index 00000000000..1282c0df906 --- /dev/null +++ b/libstdc++-v3/testsuite/29_atomics/headers/stdatomic.h/functions.c @@ -0,0 +1,38 @@ +// { dg-options "-x c" } +// { dg-do compile } + +// Copyright (C) 2008 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// 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 this library; see the file COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +#include <stdatomic.h> + +int main() +{ + volatile atomic_flag f; + volatile atomic_flag* p = &f; + memory_order m = memory_order_relaxed; + + // For position only. + atomic_flag_test_and_set(p); + atomic_flag_test_and_set_explicit(p, m); + atomic_flag_clear(p); + atomic_flag_clear_explicit(p, m); + atomic_flag_fence(p, m); + + return 0; +} diff --git a/libstdc++-v3/testsuite/29_atomics/headers/stdatomic.h/macros.c b/libstdc++-v3/testsuite/29_atomics/headers/stdatomic.h/macros.c new file mode 100644 index 00000000000..30368a06bf4 --- /dev/null +++ b/libstdc++-v3/testsuite/29_atomics/headers/stdatomic.h/macros.c @@ -0,0 +1,119 @@ +// { dg-options "-x c" } +// { dg-do compile } + +// Copyright (C) 2008 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// 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 this library; see the file COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +#include <stdatomic.h> + +int main() +{ +#ifndef ATOMIC_INTEGRAL_LOCK_FREE + #error "ATOMIC_INTEGRAL_LOCK_FREE_must_be_a_macro" +#endif + +#ifndef ATOMIC_ADDRESS_LOCK_FREE + #error "ATOMIC_ADDRESS_LOCK_FREE_must_be_a_macro" +#endif + +#ifndef ATOMIC_FLAG_INIT + #error "ATOMIC_FLAG_INIT_must_be_a_macro" +#endif + +#ifndef atomic_is_lock_free + #error "atomic_is_lock_free_must_be_a_macro" +#endif + +#ifndef atomic_load + #error "atomic_load_must_be_a_macro" +#endif + +#ifndef atomic_load_explicit + #error "atomic_load_explicit_must_be_a_macro" +#endif + +#ifndef atomic_store_explicit + #error "atomic_store_explicit_must_be_a_macro" +#endif + +#ifndef atomic_store + #error "atomic_store_must_be_a_macro" +#endif + +#ifndef atomic_swap_explicit + #error "atomic_swap_explicit_must_be_a_macro" +#endif + +#ifndef atomic_swap + #error "atomic_swap_must_be_a_macro" +#endif + +#ifndef atomic_compare_swap + #error "atomic_compare_swap_must_be_a_macro" +#endif + +#ifndef atomic_compare_swap_explicit + #error "atomic_compare_swap_explicit_must_be_a_macro" +#endif + +#ifndef atomic_fence + #error "atomic_fence_must_be_a_macro" +#endif + +#ifndef atomic_fetch_add_explicit + #error "atomic_fetch_add_explicit_must_be_a_macro" +#endif + +#ifndef atomic_fetch_add + #error "atomic_fetch_add_must_be_a_macro" +#endif + +#ifndef atomic_fetch_sub_explicit + #error "atomic_fetch_sub_explicit_must_be_a_macro" +#endif + +#ifndef atomic_fetch_sub + #error "atomic_fetch_sub_must_be_a_macro" +#endif + +#ifndef atomic_fetch_and_explicit + #error "atomic_fetch_and_explicit_must_be_a_macro" +#endif + +#ifndef atomic_fetch_and + #error "atomic_fetch_and_must_be_a_macro" +#endif + +#ifndef atomic_fetch_or_explicit + #error "atomic_fetch_or_explicit_must_be_a_macro" +#endif + +#ifndef atomic_fetch_or + #error "atomic_fetch_or_must_be_a_macro" +#endif + +#ifndef atomic_fetch_xor_explicit + #error "atomic_fetch_xor_explicit_must_be_a_macro" +#endif + +#ifndef atomic_fetch_xor + #error "atomic_fetch_xor_must_be_a_macro" +#endif + + return 0; +} diff --git a/libstdc++-v3/testsuite/29_atomics/headers/stdatomic.h/types.c b/libstdc++-v3/testsuite/29_atomics/headers/stdatomic.h/types.c new file mode 100644 index 00000000000..8e9cfd56e01 --- /dev/null +++ b/libstdc++-v3/testsuite/29_atomics/headers/stdatomic.h/types.c @@ -0,0 +1,80 @@ +// { dg-options "-x c" } +// { dg-do compile } + +// Copyright (C) 2008 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// 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 this library; see the file COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +#include <stdatomic.h> + +void test01() +{ + typedef memory_order t_01; + memory_order t_02 = memory_order_relaxed; + memory_order t_03 = memory_order_acquire; + memory_order t_04 = memory_order_release; + memory_order t_05 = memory_order_acq_rel; + memory_order t_06 = memory_order_seq_cst; + + typedef atomic_flag t_07; + + // atomics for builtins types + typedef atomic_bool t_08; + typedef atomic_char t_09; + typedef atomic_schar t_10; + typedef atomic_uchar t_11; + typedef atomic_short t_12; + typedef atomic_ushort t_13; + typedef atomic_int t_14; + typedef atomic_uint t_15; + typedef atomic_long t_16; + typedef atomic_ulong t_17; + typedef atomic_llong t_18; + typedef atomic_ullong t_19; + typedef atomic_wchar_t t_20; + typedef atomic_char16_t t_21; + typedef atomic_char32_t t_22; + + // atomics for standard typedefs + typedef atomic_int_least8_t t_23; + typedef atomic_uint_least8_t t_24; + typedef atomic_int_least16_t t_25; + typedef atomic_uint_least16_t t_26; + typedef atomic_int_least32_t t_27; + typedef atomic_uint_least32_t t_28; + typedef atomic_int_least64_t t_29; + typedef atomic_uint_least64_t t_30; + typedef atomic_int_fast8_t t_31; + typedef atomic_uint_fast8_t t_32; + typedef atomic_int_fast16_t t_33; + typedef atomic_uint_fast16_t t_34; + typedef atomic_int_fast32_t t_35; + typedef atomic_uint_fast32_t t_36; + typedef atomic_int_fast64_t t_37; + typedef atomic_uint_fast64_t t_38; + typedef atomic_intptr_t t_39; + typedef atomic_uintptr_t t_40; + typedef atomic_size_t t_41; + typedef atomic_ssize_t t_42; + typedef atomic_ptrdiff_t t_43; + typedef atomic_intmax_t t_44; + typedef atomic_uintmax_t t_45; + + typedef atomic_address t_46; + + &atomic_global_fence_compatibility; +} diff --git a/libstdc++-v3/testsuite/Makefile.in b/libstdc++-v3/testsuite/Makefile.in index 44749597aef..63d92370dcb 100644 --- a/libstdc++-v3/testsuite/Makefile.in +++ b/libstdc++-v3/testsuite/Makefile.in @@ -49,6 +49,7 @@ am__aclocal_m4_deps = $(top_srcdir)/../config/enable.m4 \ $(top_srcdir)/../config/lib-prefix.m4 \ $(top_srcdir)/../config/multi.m4 \ $(top_srcdir)/../config/no-executables.m4 \ + $(top_srcdir)/../config/proginstall.m4 \ $(top_srcdir)/../config/unwind_ipinfo.m4 \ $(top_srcdir)/../libtool.m4 $(top_srcdir)/../ltoptions.m4 \ $(top_srcdir)/../ltsugar.m4 $(top_srcdir)/../ltversion.m4 \ diff --git a/libstdc++-v3/testsuite/lib/libstdc++.exp b/libstdc++-v3/testsuite/lib/libstdc++.exp index b482bf58d20..5f68d789d6d 100644 --- a/libstdc++-v3/testsuite/lib/libstdc++.exp +++ b/libstdc++-v3/testsuite/lib/libstdc++.exp @@ -443,12 +443,13 @@ proc v3_target_compile_as_c { source dest type options } { set includestarget "${includesbase}/${machine}" set cc_final [concat $cc_final "-I$includesbase -I$includestarget"] - set libsup "${comp_base_dir}/lib" + set libdir "-L${comp_base_dir}/lib" } else { - set libsup "${blddir}/libsupc++/.libs" + set libdir "-L${blddir}/libsupc++/.libs" + set libdir [concat $libdir "-L${blddir}/src/.libs"] } - set cc_final [concat $cc_final "-L$libsup"] + set cc_final [concat $cc_final "$libdir"] lappend options "compiler=$cc_final" lappend options "timeout=600" diff --git a/libstdc++-v3/testsuite/util/testsuite_common_types.h b/libstdc++-v3/testsuite/util/testsuite_common_types.h index 78fe1fe7fca..bd9e76d4e2e 100644 --- a/libstdc++-v3/testsuite/util/testsuite_common_types.h +++ b/libstdc++-v3/testsuite/util/testsuite_common_types.h @@ -53,6 +53,10 @@ #include <tr1/unordered_map> #include <tr1/unordered_set> +#ifdef __GXX_EXPERIMENTAL_CXX0X__ +#include <cstdatomic> +#endif + namespace __gnu_test { using __gnu_cxx::typelist::node; @@ -260,6 +264,88 @@ namespace __gnu_test typedef typename append<a1, a2>::type type; }; + // A typelist of all integral types. + struct integral_types + { + typedef bool a1; + typedef char a2; + typedef signed char a3; + typedef unsigned char a4; + typedef short a5; + typedef unsigned short a6; + typedef int a7; + typedef unsigned int a8; + typedef long a9; + typedef unsigned long a10; + typedef long long a11; + typedef unsigned long long a12; + typedef wchar_t a13; + // typedef char16_t a14; + // typedef char16_t a15; + + typedef node<_GLIBCXX_TYPELIST_CHAIN13(a1, a2, a3, a4, a5, a6, a7, a8, a9, + a10, a11, a12, a13)> type; + }; + +#ifdef __GXX_EXPERIMENTAL_CXX0X__ + template<typename Tp> + struct atomics + { + typedef Tp value_type; + typedef std::atomic<value_type> type; + }; + + typedef transform<integral_types::type, atomics>::type atomics_tl; +#endif + + // Generator to test assignment operator. + struct assignable + { + template<typename _T> + void + operator()() + { + _T v1; + _T v2; + v1 = v2; + } + }; + + // Generator to test default constructor. + struct default_constructible + { + template<typename _T> + void + operator()() + { + _T v; + } + }; + + // Generator to test copy constructor. + struct copy_constructible + { + template<typename _T> + void + operator()() + { + _T v1; + _T v2(v1); + } + }; + + // Generator to test explicit value constructor. + struct explicit_value_constructible + { + template<typename _Ttype, typename _Tvalue> + void + operator()() + { + _Tvalue a; + _Ttype v(a); + } + }; + } // namespace __gnu_test |